Token Controller
Token Controller is a contract used to redeem USC for AGC and vice versa
Last updated
Token Controller is a contract used to redeem USC for AGC and vice versa
Last updated
Contract:
TokenController is an Upgradeable
smart contract that acts as a bridge for exchanging USC for AGC and vice versa.
UUPSUpgradeable: Openzeppelin's smart contract that makes a smart contract upgradeable.
Pausable: Allows for pausing/unpausing in case of emergencies.
AccessControl: Allows for multiple permission roles to exist in the same contract.
The TokenController will have perform the following redeeming actions:
Redeem USC: TokenController will burn user's approved and mint a certain amount of to the user.
Redeem AGC: TokenController will burn user's AGC tokens and mint a certain amount of USC to the user.
Only Admin and backend service with Redeemer role can call the redeemUSC
and redeemAGC
functions.
Admin (DEFAULT_ADMIN_ROLE): Admin role is able to pause/unpause the smart contract and can perform redeeming actions. Admin role will be held be a gnosis safe address to ensure security.
Redeemer (REDEEMER_ROLE): Redeemer role is able to perform redeemUSC
and redeemAGC
actions. Redeemer role will be held by the backend service to perform the redeem actions.
Pauser (PAUSER_ROLE): Pauser role is able to pause/unpause the contract in case of emergencies. Initially no specific address is the holder of the Pauser role other than the Admin.
Upgrader (UPGRADER_ROLE): Upgrader role is able to upgrade the smart contract for future phases. Initially no specific address is the holder of the Upgrader role other than the Admin.
Gnosis-safe address as Admin: This ensures important roles are secure and doesn't have single-point-of-failure. Also for future extension, Admin can grant roles to other addresses if needed.
Backend service as Redeemer: This allows the backend service to perform redeem by interacting with the contract directly.
User: Not allowed to interact with the TokenController due to insufficient permission.