Lossless Protocol
  • Lossless Whitepaper
  • FAQ
  • Technical reference
    • LERC20
      • Audits
    • Vault and Treasury Protection
      • LosslessControllerV2
      • LosslessGuardian
      • StrategyBase
      • TreasuryProtectionStrategy
      • LiquidityProtectionSingleLimitStrategy
      • Deployments
      • Audits
    • Hack Mitigation Protocol
      • Overview
      • How it works
      • Configuration
        • Current Configuration
      • Audits
      • Deployments
      • Smart Contracts
        • Lossless Controller V3
        • Lossless Governance
        • Lossless Reporting
        • Lossless Staking
    • Lossless Controller
      • Deployments
    • Wrapped Tokens
      • Lossless Wrapped Protection
        • Lossless Wrapped ERC20
        • Lossless Wrapped ERC20 Ownable
      • Extensible Wrapped Tokens
        • Lossless Wrapped ERC20 Extensible
        • Lossless Extensions Core
        • Extensions
          • Lossless Core Extension
      • UMA Protocol Integration
        • DAO Voting
      • Kleros Integration
      • Deployments
  • Guides
    • Wrapped Tokens
    • Committee Voting
    • Lossless Vault Protection User Guide
    • How To Use Vault Protection Smart Contracts
    • Lossless Integration Into The Token
      • Custom Token
      • Standard Token
Powered by GitBook
On this page

Was this helpful?

  1. Guides
  2. Lossless Integration Into The Token

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

PreviousLossless Integration Into The TokenNextStandard Token

Last updated 3 years ago

Was this helpful?

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

lossless controller
lossless-v4/LERC20.sol at master · Lossless-Cash/lossless-v4GitHub
LERC20
lossless-v4/LERC20Burnable.sol at master · Lossless-Cash/lossless-v4GitHub
LERC20Burnable
lossless-v4/LERC20Mintable.sol at master · Lossless-Cash/lossless-v4GitHub
LERC20Mintable
lossless-v4/LERC20MintableBurnable.sol at master · Lossless-Cash/lossless-v4GitHub
LERC20MintableBurnable
Logo
Logo
Logo
Logo