Custom Token

The best way for integrating lossless protection into your token contract that has custom functions is to inherit from LERC20.

import ./LERC20.sol

contract YourCustomToken is LERC20 {
    constructor(
         uint256 totalSupply_,
         string memory name_, 
         string memory symbol_
         address admin_,
         address recoveryAdmin_,
         uint256 timelockPeriod_,
         address lossless_
         ) LERC20(
               totalSupply_,
               name_,
               symbol_,
               admin_,
               recoveryAdmin_,
               timelockPeriod_,
               lossless_) {}
               
   // Your custom function goes here...
}

However in cases where you want to modify one of the public functions like:

  • transfer

  • transferFrom

  • approve

  • increaseAllowance

  • decreaseAllowance

You must add before modifier to these functions. This modifier must call lossless controller hook function and forward all of the initial function call parameters. An example of how these modifiers can be found here:

Last updated