⚖️AgToken - Stablecoin Contracts
Angle's Protocol Stablecoins
Contract Name:
AgToken
ABI:
1. Introduction
agTokens are Angle's protocol stablecoins. Depending on the stablecoin, different smart contracts may have minting rights on agTokens.
For some tokens, the FlashLoan
contract may have minting right on the token, just like some VaultManager
contracts associated to the Borrowing Module.
The implementation described here is specific to Ethereum mainnet. agToken implementations on sidechains have a different implementation, such that the ABI of their corresponding contract is the following:
2. Contract Details
Interfaces
Implements IAgToken
and ERC20PermitUpgradeable
. This contract is upgradeable.
Parameters and Mappings
Depending on the implementation deployed, here are some of the usual parameters found in AgToken
contracts
stableMaster
: Reference to theStableMaster
contract associated to this agToken. This is no longer used and was useful when the protocol's Core module was still being used.treasury
: Reference to theTreasury
contract associated to this agToken. This concerns AgTokens which can be minted from Angle Borrowing ModuleisMinter
: In the Borrowing Module, maps an address to whether it has the minting right on theAgToken
.
3. Key Mechanisms & Concepts
EIP20 Methods
All standard EIP20 methods are implemented, such as balanceOf()
, transfer()
, transferFrom()
, approve()
, totalSupply()
, etc.
The implementation of these methods is derived from OpenZeppelin's library.
User Available External Functions
burnStablecoin
Burns the amount of agToken on behalf of another account without redeeming collateral back anywhere
Parameters
amount
: Amount to burn
Minter only Functions
The following functions can only be called by approved minter contracts.
mint
Lets a VaultManager
, if initialized the FlashLoan
contract or a whitelisted address mint agTokens
Parameters:
account
: Address to mint toamount
: Amount to mint
burnSelf
Burns amount
tokens from a burner
address. This method is to be called by any contract with a minting right on the AgToken
after being requested to do so by an address willing to burn tokens from its address
Parameters:
amount
: Amount of tokens to burnburner
: Address to burn from
burnFrom
Burns amount
tokens from a burner
address after being asked to by sender
. This method is to be called by any contract with a minting right on the token after being requested to do so by a msg.sender
address willing to burn tokens from another sender
address
The method checks the allowance between the sender
and the burner
.
Parameters:
amount
: Amount of tokens to burnburner
: Address to burn fromsender
: Address which requested the burn fromburner
EIP2612 Methods
permit()
Allows a user to permit another account (or contract) to use their funds using a signed message. This enables gas-less transactions and single approval/transfer transactions.
Parameters:
owner
: The owner of the fundsspender
: The spender of the fundsvalue
: The amount thespender
is permitted to usedeadline
: The deadline timestamp that the permit is valid. Usetype(uint256).max
for no deadlinev
: Signature Parameterr
: Signature Parameters
: Signature Parameter
Governance Methods
There are some functions which are available to the Treasury
contract to perform some governance actions. Generally, the Treasury
will do so after being requested by governance.
addMinter
: to grant the minter right to an address.removeMinter
: to remove the minter right to an address. A minter can self-revoke itself.setTreasury
: to change the reference to the treasury contract
Last updated