Customize

Consensus List

Set specific addresses to be added to the consensus list, when token TRANSFER from the consensus list address will generate a consensus period. For example, LP contract address, treasury address and so on.

How to Add Consensus List?

It’s recommended to add consensus list during setup and deployment when possible.

The following is an example of how to add consensus list initially.

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ERC7660} from "erc7660/ERC7660.sol";

contract ExampleERC7660 is Ownable, ERC7660 {
  constructor(
    string memory name_,
    string memory symbol_,
    uint256 totalSupply_
  ) ERC7660(name_, symbol_, totalSupply_) {

      
  }

   function addPair(address _pair,bool flag) public onlyOwner {
       _addPair(_pair,flat);
    }
   //_routers
    function addRouter(address _router,bool flag) public onlyOwner {
       _addRouter(_router,flag);
    }

    function setDuration(uint256 _duration) public onlyOwner {
        _setDuration(_duration);
    }
}

The owner of the smart contract in this example will receive all tokens upon completion of the deployment.

In addition to this, if you want to add additional consensus lists after the deployment, you can do so by using the following forge script example.

contract Whitelist is Script {
    modifier broadcast(address deployer) {
        vm.startBroadcast(deployer);
        _;
        vm.stopBroadcast();
    }

    function run() external override {
        deploy(address(this));
    }

    function deploy(address deployer) public broadcast(deployer) {
        ExampleERC7660 exampleERC7660 = ExampleERC7660(contractAddress);
        exampleERC7660.addPair(targetAddress, true);
    }
}

The address added in the example will be added to the consensus lists. It represents all tokens transferred from this list of addresses (or smart contracts), and the recipient will receive the transferred amount linearly over a specific period of time.

Last updated