Lossless
Search…
Custom Token
The best way for integrating lossless protection into your token contract that has custom functions is to inherit from LERC20.
1
import ./LERC20.sol
2
3
contract YourCustomToken is LERC20 {
4
constructor(
5
uint256 totalSupply_,
6
string memory name_,
7
string memory symbol_
8
address admin_,
9
address recoveryAdmin_,
10
uint256 timelockPeriod_,
11
address lossless_
12
) LERC20(
13
totalSupply_,
14
name_,
15
symbol_,
16
admin_,
17
recoveryAdmin_,
18
timelockPeriod_,
19
lossless_) {}
20
21
// Your custom function goes here...
22
}
23
Copied!
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:
lossless-v4/LERC20.sol at master · Lossless-Cash/lossless-v4
GitHub
LERC20
lossless-v4/LERC20Burnable.sol at master · Lossless-Cash/lossless-v4
GitHub
LERC20Burnable
lossless-v4/LERC20Mintable.sol at master · Lossless-Cash/lossless-v4
GitHub
LERC20Mintable
lossless-v4/LERC20MintableBurnable.sol at master · Lossless-Cash/lossless-v4
GitHub
LERC20MintableBurnable
Copy link