From 556858a65d7508cbeef8f099a6d294415d7667ae Mon Sep 17 00:00:00 2001 From: ququzone Date: Wed, 21 Aug 2024 13:09:26 +0800 Subject: [PATCH] add whitelist token --- contracts/AdhocVoter.sol | 12 ++++++++++++ contracts/interfaces/IAdhocVoter.sol | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/contracts/AdhocVoter.sol b/contracts/AdhocVoter.sol index ef2f634..9bfa37a 100644 --- a/contracts/AdhocVoter.sol +++ b/contracts/AdhocVoter.sol @@ -29,6 +29,8 @@ contract AdhocVoter is IAdhocVoter, Initializable { mapping(address => uint256) public weights; uint256 public totalWeight; + mapping(address => bool) public isWhitelistedToken; + function initialize() public initializer { governor = msg.sender; weekly = 100_000 * 1e18; @@ -97,6 +99,16 @@ contract AdhocVoter is IAdhocVoter, Initializable { } } + function whitelistToken(address _token, bool _bool) external { + require(msg.sender == governor, "Not Governor"); + _whitelistToken(_token, _bool); + } + + function _whitelistToken(address _token, bool _bool) internal { + isWhitelistedToken[_token] = _bool; + emit WhitelistToken(msg.sender, _token, _bool); + } + function changeWeight(address _gauge, uint256 _weight) external { require(_weight >= 10 && _weight <= 100, "invalid weight"); require(msg.sender == governor, "Not Governor"); diff --git a/contracts/interfaces/IAdhocVoter.sol b/contracts/interfaces/IAdhocVoter.sol index d7c268e..e22926e 100644 --- a/contracts/interfaces/IAdhocVoter.sol +++ b/contracts/interfaces/IAdhocVoter.sol @@ -4,13 +4,13 @@ pragma solidity ^0.8.0; import {IVoter} from "./IVoter.sol"; interface IAdhocVoter { - event Emission(address indexed sender, uint256 weekly); event WeeklyChanged(uint256 weekly); event WeightChanged(address gauge, uint256 weight); event GovernorChanged(address indexed governor); event Donation(address indexed donor, address indexed token, uint256 amount); event Withdraw(address indexed operator, address indexed token, address indexed recipcient, uint256 amount); + event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool); /// @notice Standard OZ IGovernor using ve for vote weights. function governor() external view returns (address);