Comment on page
⚖
AgToken - Stablecoin Contracts
Angle's Protocol Stablecoins
- Contract Name:
AgToken
- ABI:
AgToken.json
12KB
Code
AgToken ABI
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:
AgTokenSideChainMultiBridge.json
22KB
Code
AgTokenSideChainMultiBridge ABI
Implements
IAgToken
and ERC20PermitUpgradeable
. This contract is upgradeable.Depending on the implementation deployed, here are some of the usual parameters found in
AgToken
contractsstableMaster
: 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
.
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.
function burnStablecoin(uint256 amount) external;
Burns the amount of agToken on behalf of another account without redeeming collateral back anywhere
Parameters
amount
: Amount to burn
The following functions can only be called by approved minter contracts.
function mint(address account, uint256 amount) external;
Lets a
VaultManager
, if initialized the FlashLoan
contract or a whitelisted address mint agTokensParameters:
account
: Address to mint toamount
: Amount to mint
function burnSelf(uint256 amount, address burner) external;
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 addressParameters:
amount
: Amount of tokens to burnburner
: Address to burn from
function burnFrom(uint256 amount, address burner, address sender) external;
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
addressThe 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
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public;
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
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