Lossless can be integrated to your token code by using Lossless protected ERC20 token.
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:
- 1.totalSupply_ - amount of tokens to be minted
- 2.name_ - token title
- 3.symbol_ - symbol of a token
- 4.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.
- 5.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.
- 6.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.
- 7.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 .
- 2.Right-click on the “contracts” folder below “default_workspace”. Select “New file”, call it for example “LERC20.sol”.
- 4.Save it by using Ctrl+S on your keyboard.
- 5.Open the “Solidity compiler” by clicking onon the left of the screen . We suggest the following settings, select them, left-click “Compile LERC20.sol”.
- 6.Left-clickto 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”.
- 7.Select “LERC20 - contracts/LERC20.sol” as “CONTRACT”. Click thedownarrow 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.
- 8.Left-click “transact”, confirm the transaction on Metamask. The token will be deployed to the Environment that was selected in the Remix.