LogoLogo
  • ⚒️Introduction
  • Overview
    • 📖Public Repositories
    • ⛓️Smart Contracts Addresses
      • ⛓️Mainnet
      • 🟣Polygon
      • 🔴Optimism
      • 🔵Arbitrum
      • 🕸️Other Sidechains and L2s
  • Developer Guides
    • 💱Using Transmuter
    • 💸Integrating Savings Contracts
    • ⚡Flash Loans
    • 🍶Liquidations in the Borrowing Module
    • 🌻Auto-Leverage and Capital-Efficiency in the Borrowing Module
  • Tools
    • 🔌API - Accessing Angle Data
  • Governance and Cross-Module Contracts
    • ⚖️AgToken - Stablecoin Contracts
    • 🛣️Router - Combining Protocol Interactions
    • 💫FlashAngle - Instant AgToken liquidity
    • 💗CoreBorrow - Access Control Manager
    • 🗳️ANGLE and veANGLE - Governance Token
  • Borrowing Module Contracts
    • 🔜Architecture Overview
    • 📀Smart Contracts Docs
      • 🏦VaultManager - Borrowing AgTokens
      • 👮Treasury - Stablecoin Accounting
      • 🔱Oracles - Getting Price Feeds
      • 🗡️Settlement - Closing VaultManager contracts
      • 💱Swapper - Helper for Liquidations and Auto-Leverage
    • 🔬Implementation Details
Powered by GitBook
On this page
  • 1. Introduction
  • 2. Contract Details
  • Interfaces
  • Parameters and Mappings
  • 3. Key Mechanisms & Concepts
  • EIP20 Methods
  • User Available External Functions
  • Minter only Functions
  • EIP2612 Methods
  • Governance Methods

Was this helpful?

  1. Governance and Cross-Module Contracts

AgToken - Stablecoin Contracts

Angle's Protocol Stablecoins

PreviousAPI - Accessing Angle DataNextRouter - Combining Protocol Interactions

Last updated 1 year ago

Was this helpful?

  • Contract Name: AgToken

  • Contract Source:

  • 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 the StableMaster 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 the Treasury contract associated to this agToken. This concerns AgTokens which can be minted from Angle Borrowing Module

  • isMinter: In the Borrowing Module, maps an address to whether it has the minting right on the AgToken.

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

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

Minter only Functions

The following functions can only be called by approved minter contracts.

mint

function mint(address account, uint256 amount) external;

Lets a VaultManager, if initialized the FlashLoan contract or a whitelisted address mint agTokens

Parameters:

  • account: Address to mint to

  • amount: Amount to mint

burnSelf

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 address

Parameters:

  • amount: Amount of tokens to burn

  • burner: Address to burn from

burnFrom

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 address

The method checks the allowance between the sender and the burner.

Parameters:

  • amount: Amount of tokens to burn

  • burner: Address to burn from

  • sender: Address which requested the burn from burner

EIP2612 Methods

permit()

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 funds

  • spender: The spender of the funds

  • value: The amount the spender is permitted to use

  • deadline: The deadline timestamp that the permit is valid. Use type(uint256).max for no deadline

  • v: Signature Parameter

  • r: Signature Parameter

  • s: 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

⚖️
https://github.com/AngleProtocol/angle-core/blob/main/contracts/agToken
12KB
AgToken.json
AgToken ABI
22KB
AgTokenSideChainMultiBridge.json
AgTokenSideChainMultiBridge ABI