ERC20TokenRegistry
Last updated
Was this helpful?
Last updated
Was this helpful?
The ERC20TokenRegistry
contract manages a whitelist of ERC20 tokens that can be used for fulfillment services in the Bando Protocol. It ensures that only approved tokens can be used for ERC20 fulfillment requests and manages swap fee basis points for each token.
The ERC20TokenRegistry
is responsible for:
Maintaining a whitelist of approved ERC20 tokens
Managing swap fee basis points for each whitelisted token
Providing validation functions to check if a token is whitelisted
The contract uses the UUPS (Universal Upgradeable Proxy Standard) pattern for upgradeability and inherits from OpenZeppelin's OwnableUpgradeable for access control.
The ERC20TokenRegistry
responsibilities can be broken down into the following concepts:
The ERC20TokenRegistry
contract manages a whitelist of ERC20 tokens that can be used for fulfillment services in the Bando Protocol. It ensures that only approved tokens can be used for ERC20 fulfillment requests and manages swap fee basis points for each token.
The ERC20TokenRegistry
is responsible for:
Maintaining a whitelist of approved ERC20 tokens
Managing swap fee basis points for each whitelisted token
Providing validation functions to check if a token is whitelisted
The contract uses the UUPS (Universal Upgradeable Proxy Standard) pattern for upgradeability and inherits from OpenZeppelin's OwnableUpgradeable for access control.
The ERC20TokenRegistry
responsibilities can be broken down into the following concepts:
The following methods are used to manage the whitelist of ERC20 tokens:
addToken
Adds a token to the whitelist with the specified swap fee basis points. Only the contract owner can add tokens.
Effects:
Checks if the token is already whitelisted
Adds the token to the whitelist
Sets the swap fee basis points for the token
Emits TokenAdded(token, swapFeeBasisPoints)
event
Requirements:
Caller MUST be the contract owner
Token MUST NOT already be whitelisted
removeToken
Removes a token from the whitelist. Only the contract owner can remove tokens.
Effects:
Checks if the token is whitelisted
Removes the token from the whitelist
Emits TokenRemoved(token)
event
Requirements:
Caller MUST be the contract owner
Token MUST be whitelisted
The following method is used to manage swap fee basis points for whitelisted tokens:
updateSwapFeeBasisPoints
Updates the swap fee basis points for a token. Only the contract owner can update swap fee basis points.
Effects:
Validates the swap fee basis points
Updates the swap fee basis points for the token
Emits SwapFeeBasisPointsUpdated(token, swapFeeBasisPoints)
event
Requirements:
Caller MUST be the contract owner
swapFeeBasisPoints
MUST be between 0 and 10000
The following method is used to check if a token is whitelisted:
isTokenWhitelisted
Checks if a token is whitelisted. Returns true if the token is whitelisted, false otherwise.
Emitted when a token is added to the whitelist.
Emitted when a token is removed from the whitelist.
Emitted when the swap fee basis points for a token are updated.
Emitted when attempting to perform an operation on a token that is not whitelisted.
Emitted when attempting to add a token that is already whitelisted.
Emitted when attempting to set invalid swap fee basis points.
whitelist
: Mapping of token addresses to their whitelist status
_swapFeeBasisPoints
: Mapping of token addresses to their swap fee basis points