Overview
You can interact directly with the smart contracts of the ooNodz app. On this page you will find all the information you need to access our services without going through our web interface.
Architecture
The implementation is built based on four Smart Contracts:
AccessControl.sol
: The purpose of this contract is to manage the various wallet roles used in the project's other contracts. It allows one or more admins to assign or revoke roles to other wallets. All Smart Contracts using this access role management model must inheritRoleBasedAccessControlled
.NodeIdNFT.sol
: This Smart Contract is an ERC721 "NFT" Contract representing the ownership of a NodeID. It uses 2 roles:- MINTER : wallets authorized to mint new tokens
- BURNER : wallets authorized to burn existing tokens (the owner of a token is also authorized to burn his own token).
Billing.sol
: This Smart Contract handles the billing part: supported currencies, exchange rates to USD (for the moment only USD-stable ERC20 tokens are supported), VAT rates, pricing rates, deposit rate, authorized countries of residence. This Smart Contract defines a role: BILLING. Each wallet with the BILLING role can add/remove a currency in the list of supported currency, manage the list of VAT rate per country of residence, the list of authorized countries and pricing data.Subscription.sol
: This is the main Smart Contract that receives subscriptions from customers. the overall subscription process is:- If customer is not yet registered, he must send a transaction to the
register
function with his country of residence. - Once customer is registered, he can send a transaction to the
newSubscription
function to create a new subscription.
Before calling
newSubscription
, customer has to allowSubscription
contract to transfer funds from his (ERC20) account, using theallowance
function of ERC20. Funds received by theSubscription
contract are immediately transfered to adestinationWallet
configured onSubscription
contract. Wallets with ADMIN role can change thedestinationWallet
.- If customer is not yet registered, he must send a transaction to the
Subscription Process
The user must be registered before starting the subscription process. He registers by calling the
Register
function from theSubscriptions
Smart Contract.The user must have a NodeID to validate. He can, through the
NodeIdNFT
Smart Contract:- Import a NodeID : he proceeds to the deposit required to mint the blank NFT that will carry the NodeID ownership by calling the
deposit
function. Once the deposit is made, the user calls themintBlank
function to mint the blank NFT. The user then makes aPOST
call to the ooNodz API to upload the NodeID files into the ooNodz network. Once imported, the NodeID is automatically inserted into the minted NFT. - Ask for a new NodeID : he proceeds to the deposit required to mint the NFT that will carry the NodeID ownership by calling the
deposit
function. Once the deposit is made, the user calls themint
function to mint the NFT. - Use a NodeID already created or imported inside the ooNodz App that is not already used for an ongoing validation.
- Import a NodeID : he proceeds to the deposit required to mint the blank NFT that will carry the NodeID ownership by calling the
The user calls the ERC20 contract
approve
function corresponding to the currency chosen for payment of his subscription, specifying the amount he wishes to be debited by the ooNodz contract. This step is bypassed if he has previously approved an amount equal to or greater than the amount of the current subscription plus any other subscriptions previously made since this last approval.The user calls the
newSubscription
function from theSubscriptions
Smart Contract. Once validated, it triggers the launch of the node server. All the user has to do is allocate the AVAX staking required to start validation.
Roles
ADMIN_ROLE
: allowed to manage grant / revoke roles for other wallets. Allowed to change thedestinationWallet
ofSubscription
Smart Contract.MINTER_ROLE
: allowed to mint new NodeIdNFT tokens.BURNER_ROLE
: allowed to burn existing NodeIdNFT tokens.BILLING_ROLE
: allowed to manage the list of supported currencies, VAT rates, authorized countries, pricing data.REFUNDER_ROLE
: allowed to refund users for unused periods.
Implementation Details
- Project is using Hardhat for compiling, testing and deploying Smart Contracts.
- Solhint is the linter.
- The OpenZeppelin library is used to define standard Smart Contracts (ERC20, ERC721, AccessControl).
- All these Smart Contracts are Upgradeable using OpenZeppelin Upgradeable patterns & plugins
hardhat-gas-reporter
plugin is used to compute gas fees for all operations
Deployment Addresses
ooNodz Contracts
Contract | Avalanche Mainnet Address | Fuji Testnet Address |
---|---|---|
Subscriptions | 0x59a90cD4fa3f6F9544fb26EEeE913a35d6E7772e | 0x2743A3c6B1618AF4335559165c6D992d02cf2846 |
Billing | 0xFF9a9cA3C1A49F74aB5D8233f11f7531f2Ef63c8 | 0xa05D8018B51A97b1b403A4630876317260e72B69 |
NodeIdNFT | 0x7C98CBd78b2180659484B91b06728BF8ABfde3BB | 0x85644e02E5eD82AA4ed37f231068Bc30E2C5C7a1 |
Subscriptions | 0x8BD06F20766E48Da514370056aA72070aE57882b | 0x89a89fE9B973E0474e983FD4baE5Ac09634fE598 |
Stable ERC20 Contracts
Contract | Avalanche Mainnet Address | Fuji Testnet Address |
---|---|---|
USDC (ERC20) | 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E | 0x08123E97291e1562eD2fC12C1f3325c6c4783a77 |
USDT (ERC20) | 0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7 | 0x7B8FDF47e587BaF614213f31A56E17B5C984C119 |
GitLab
You can access our GitLab repository to read the ooNodz contracts.
Audit
The ooNodz smart contracts have been audited by Deepy.lu, an independant auditor based in Luxembourg.
You can access the full audit report here.
In the meantime, you can now access our application and subscribe to our services via our web interface.