Smart Contracts for Etherland - ELAND ERC20 Token
Contracts Structure
CLONED SOURCE
-
We cloned OpenZeppelin Contracts v3 code for
SafeMath,ERC20andERC20Burnablelogic.SafeMathprovides arithmetic functions that throw exceptions when integer overflows occur.ERC20provides a basic implementation of the ERC20 standardERC20Burnableprovides a burning function that decrement the balance of the burner and the total supplyMintableTokenprovides the token a mintable ability in order to generate the supply
UPGRADED CLONED SOURCE
-
We cloned OpenZeppelin Contracts v3 code for
Ownableand added some logic.Ownablekeeps track of a contract owner and permits the transfer of ownership by the current owner- This part of the logic originally propose a straight method named
renounceOwnership. - We've enhanced this part of the contract's logic by adding a new layer of security materialized by a new method allowing the current owner to definitively relinquish control of the contract in a safe way.
- This safe check mechanism has been implemented to absolutely avoid situations where a method is unwantely called which could potentially lock the all ecosystem permanently.
- To make sure this will never happens, we've defined the standalone release process in 2 steps :
- First, the owner calls
preRenounceOwnershipmethod to generate, store and retrieve an hexadecimal random key namedrelinquishmentToken. - In a second time, the owner calls
renounceOwnershipmethod withrelinquishmentTokento renounce to his ownership and set the standalone state to true.
- First, the owner calls
- This part of the logic originally propose a straight method named
ERC20Cappedprovides a way to add a cap to the supply of tokens ensuring overflow will never happen- Constructor has been replaced by a method called
setImmutableCapthat is called during contract migration (see Flow section of Etherland.sol definition down below) - Internal calls to
_beforeTokenTransferare made toERC20.sol
- Constructor has been replaced by a method called
INTERNAL SOURCE
-
LandRegistry.solEtherland Decentralized Land Registration Protocol- Uses
iLANDID.solinterface to get the ability to call thehasAdminRightsfunction of Etherland LANDID Non-Fungible-Token smart-contract at address retrievable with thelandidNftAddressgetter function. - On the Etherland Metaverse, any token holder has the ability to register a new land, to do so, they must exchange ELAND Ethereum or any other Token displayed on the offer of Opensea marketplace.
- Land Record Rights offers and prices are in ELAND or ETH or other Tokens.
- Those rights are detailed on our website at https://etherland.io/dashboard/?ua=newitem
REGISTER A NEW LANDrequest the mint of an Etherland LANDID Non-Fungible-Token use-case- Making a new record in the Land Registry is doable in a few simple steps :
- Select a
Record Rightamong the offers at https://etherland.world/register-a-place/ - Fill the form and validate all record steps
- Validate purchase: A transaction calling the function
registerLandis prompted and must be accepted/successfull - Corresponding
Record Rightis attributed to the caller and safely stored on-chain - Etherland administrator validates the record and mints the corresponding LANDID NFT which caller becomes the owner
- Etherland administrator consumes the corresponding
Record Rightby calling the functionconsumeRecordRightgiving a tokenId - Operation is successfull : a new unique LANDID NFT has been minted which caller is the owner
- Uses
-
Etherland.solcontract assembling the code for Etherland logicGENERAL CHARASTERISTICS:
-
IDENTIFICATION
- Name : Etherland
- Symbol : ELAND
- Decimals : 18
-
CAP The maximum amount of ELAND tokens the contract will ever mint
- 1 000 000 000 (1 Billion) units
-
TOTAL SUPPLY A total available supply of ELAND (will never be higher than the Maximum Supply)
- starting at capped value of 1 000 000 000 (1 Billion) units
- may be lower than the Cap along with the burn operations
-
CIRCULATING SUPPLY The number of circulating ELAND : = totalSupply - team and advisors - reserve - Etherland wallet - Credit carbon reward
-
MINTING FINISHED In concern for transaprency, we've made available a getter returning a boolean that must be positive with value "true", indicating that its programmatically impossible to mint more tokens than the cap
-
BURN
- Any token holder has the ability to burn its own tokens,
- Burn operations remove the tokens from the total supply
-
APPROVE
- Any token holder has the ability to allow a tiers to spend/burn its own tokens
-
LAND REGISTRY see LandRegistry definition above
FLOW UPON CONTRACT CONSTRUCTION:
- Maximum supply is pre-minted
- Address of the contract owner is initialized
- Supply is partionnalized and distributed to 3 different wallets :
- Team wallet : 10% of the maximum supply is allocated to the team
- Reserve : 20% of the maximum supply is allocated to the reserve
- Owner : 70% of the maximum supply is transfered to the contract owner
- Minting is definitvely closed assuring that no more tokens than the maximum supply will be minted
-
LOCAL TEST FLOW
after having installed dependencies :
- install yarn running commant
yarn install - run command
yarn test
DEPLOYMENT FLOW
- If its not done yet, install truffle globally on your system, run
npm install -g trufflein a terminal - Create or update the
.envfile at the root of the project with the following environnement variables :OWNER_LIVE: the public address of the contract owner to use on mainnetOWNER_TEST: the public address of the contract owner to use on testnet (rinkeby only)RESERVE_WALLET: the address to use as the reserve wallet for partionningTEAM_WALLET: the address to use as the team wallet for partionningDEPLOY_ETHERLAND_ERC20: a boolean to allow the deployment flow, set totrueif you allow deployment orfalseotherwiseMNEMONIC: seed words separated with a spaceINFURA_KEY: goto https://infura.io to get an access key
- Open a terminal at root and run :
- for Rinkeby : truffle deploy --network rinkeby
- for Mainnet : truffle deploy --network live
if you have the
up to datemessage when deploying, maybe you've already deployed the contract before. In that case, if your contract doesnt deploy, simply add the--resettag as follow :truffle deploy --network rinkeby --reset
/!\ IMPORTANT /!\
DO NOT FORGET NOT TO SHARE YOUR .env MNEMONIC and INFURA_KEY PUBLICLY
PACKAGES VERSION
If any error occurs due to node or npm version, try to update version to :
- npm : 6.14.8
run
npm install -g npm@6.14.8 - node : 14.15.0
run
nvm use 14.15.0
contact: info@etherland.world