Standard Token
Lossless can be integrated to your token code by using Lossless protected ERC20 token.
Last updated
Lossless can be integrated to your token code by using Lossless protected ERC20 token.
Last updated
Any token can be protected by Lossless just by using our ERC20 standard (LERC20) instead of the traditional ERC20. Code for the LERC20 can be found here:
LERC20 has the same interface and methods as the standard ERC20. The only difference is that before and after calling each of standard ERC20 method it does another call to the Lossless Controller.
Lossless Controller is a smart contract that has logic which allows it to check if the transfer or any other ERC20 method can go through. It has the ability to stop the ERC20 method from executing and also is the central contract for the whole Lossless ecosystem. Single Lossless Controller can be used by multiple tokens.
Lossless protected token can be deployed just like any other token, all needs is just a few additional properties.
Deploying it requires these parameters:
totalSupply_ - amount of tokens to be minted
name_ - token title
symbol_ - symbol of a token
admin_ - project owner’s administrative wallet address, this will be used in Lossless governance decision. Token creators should set a wallet that they are planning on using to interact with Lossless protocol.
recoveryAdmin_ - project owner’s wallet that is used to change admin_. Token creators should use multisig for this and keep it as secure as possible as this wallet allows changing the admin wallet.
timelockPeriod_ - timelock period in seconds dedicated for turning Lossless turn off. In case project decides to turn off Lossless they would have to wait for this period after initially proposing to turn the Lossless functionality off. Recommended timelockPeriod_ is 24 hours or 86400 seconds. Any lower timelockPeriod_ will be considered unsafe and will be marked as such in Lossless platform.
lossless_ - Lossless protocol controller address. Should be set to Lossless Controller address. Lossless Controller address is different on different chains. Any other address will not allow the token to function properly. You can find appropriate controller address here .
Go to https://remix.ethereum.org, an IDE will open.
Right-click on the “contracts” folder below “default_workspace”. Select “New file”, call it for example “LERC20.sol”.
Copy and paste the code from https://github.com/Lossless-Cash/lossless-v3/blob/master/contracts/utils/LERC20.sol
Save it by using Ctrl+S on your keyboard.
Left-click “transact”, confirm the transaction on Metamask. The token will be deployed to the Environment that was selected in the Remix.
Open the “Solidity compiler” by clicking on on the left of the screen . We suggest the following settings, select them, left-click “Compile LERC20.sol”.
Left-click to open the “DEPLOY & RUN TRANSACTIONS” prompt. Select “Injected Web3”. Use Metamask to connect the wallet that you would like to deploy the contract from with the Remix IDE. Make sure that the wallet address that you prefer shows up as the “ACCOUNT”.
Select “LERC20 - contracts/LERC20.sol” as “CONTRACT”. Click the downarrow next to “Deploy” in order to access the parameters of the token. Fill them out, see the section above for more details and the image below for an example.