Anchor Protocol
  • Home
  • Security
  • Protocol
    • Overview
    • Bonded Assets (bAssets)
      • Bonded Luna (bLuna)
      • Bonded ETH (bETH)
    • Money Market
      • Deposit Rate Subsidization
    • Loan Liquidation
    • Anchor Token (ANC)
    • Anchor Governance
      • Modify Collateral Attributes
      • Modify Market Parameters
      • Modify Liquidation Parameters
      • Modify ANC Parameters
      • Modify Governance Parameters
      • Modify Borrow Interest
      • Modify ANC Distribution
      • Community Grants
      • Text Proposal
  • User Guide
    • Interchain Transfers
    • WebApp
      • EARN
      • BORROW
      • bASSET [bLUNA]
      • bASSET [bETH]
      • GOVERN
        • ANC - UST LP Staking
        • Anchor Governance Staking
        • Claiming ANC Rewards
        • Creating and voting on proposals
  • EthAnchor
    • EthAnchor
    • EthAnchor Contracts
      • Deployed Contracts
      • Router
      • ConversionPool
      • ExchangeRateFeeder
    • Fees
  • Developers - Earn
    • Anchor Earn SDK
    • Example Usage
    • Appendix
  • xAnchor
    • xAnchor
    • xAnchor Contracts
    • xAnchor Bridge (EVM Chains)
    • xAnchor Terra-side Contracts
      • xAnchor Core
      • xAnchor Wormhole Bridge
      • Address Proxy
  • Developers - Terra
    • Anchor.js
    • AnchorCLI
  • Smart Contracts
    • Deployed Contracts
    • bLuna
      • Hub
      • Reward
      • Rewards Dispatcher
      • Validators Registry
      • Airdrop Registry
      • Tokens: bLuna and stLuna
    • bETH
      • Reward
      • Token
      • Converter
    • Money Market
      • Overseer
      • Market
      • Custody [bLUNA]
      • Custody [bETH]
      • Interest Model
      • Distribution Model
      • Oracle
    • Liquidation
      • Liquidation Contract
      • Liquidation Queue Contract
    • Anchor Token (ANC)
      • Gov
      • Staking
      • Community
      • Collector
      • Distributor
  • Developers - Ethereum [Legacy]
    • EthAnchor
    • EthAnchor Account Contract
    • EthAnchor API
      • Getting Market Information
      • Depositing Stablecoins
      • Redeeming Stablecoins
    • Fees
  • External Resources
    • Anchor WebApp
    • Anchor Protocol GitHub
    • Terra Blockchain
Powered by GitBook
On this page
  • Events
  • InitDeposit
  • FinishDeposit
  • InitRedemption
  • FinishRedemption
  • FailureReported
  • EmergencyWithdrawActivated
  • Functions
  • initDepositStable
  • finishDepositStable
  • initRedeemStable
  • finishRedeemStable
  • reportFailure
  • emergencyWithdraw

Was this helpful?

  1. Developers - Ethereum [Legacy]

EthAnchor Account Contract

PreviousEthAnchorNextEthAnchor API

Last updated 4 years ago

Was this helpful?

EthAnchor Account contracts are user-specifically generated Ethereum smart contracts for interacting with Anchor Protocol from the Ethereum blockchain.

EthAnchor Account contracts only allow a single operation at a time, tracked by the ActionFlag state.

Events

InitDeposit

Emitted when wrapped UST is requested for deposit to Anchor via .

event InitDeposit(address indexed sender, uint256 amount, bytes32 to);

FinishDeposit

Emitted when wrapped aUST is claimed from Anchor via .

event FinishDeposit(address indexed sender);

InitRedemption

Emitted when wrapped aUST is requested for redemption to Anchor via .

event InitRedemption(address indexed sender, uint256 amount, bytes32 to);

FinishRedemption

event FinishRedemption(address indexed sender);

FailureReported

Emitted when aUST redemption fails due to a lack of stablecoin liquidity in the money market.

event FailureReported(); 

EmergencyWithdrawActivated

event EmergencyWithdrawActivated(address tokenAddress, uint256 amount);

Functions

initDepositStable

Accepts new wrapped UST deposits.

function initDepositStable(uint256 amount) public onlyAuthSender checkInit terraAddressSet 

Prerequisite: must have called approve() for an allowance of at least amount for the wrapped UST contract, ActionFlag is set to false Accepts: amount - how much UST to deposit Updates: ActionFlag to true Emits: InitDeposit

finishDepositStable

Claims resulting wrapped aUST after a successful deposit.

function finishDepositStable() function initDepositStable(uint256 amount) public onlyAuthSender checkInit terraAddressSet 

Prerequisite: aUST balance of account-specific endpoint contract must be greater than 0, ActionFlag is set to true Updates: sets ActionFlag to false, transfers all aUST balances from contract address to tx.origin Emits: FinishDeposit

initRedeemStable

Accepts wrapped aUST for redemption back to wrapped UST.

function initRedeemStable(uint256 amount) public onlyAuthSender checkInit terraAddressSet 

Prerequisite: must have called approve() for an allowance of at least amount for the wrapped aUST contract, ActionFlag is set to false Accepts: amount - how much aUST to redeem back to UST Updates: ActionFlag to trueIMPORTANT: aUST redemptions may fail if UST liquidity is low in the Terra side Anchor money market → be sure to check account contract balances & initRedeemStable() success parameters. Emits: InitRedemption

finishRedeemStable

Claims resulting wrapped UST after withdrawal.

function finishRedeemStable() public onlyAuthSender checkFinish terraAddressSet 

Prerequisite: UST balance of account-specific endpoint contract must be greater than 0, ActionFlag is set to true Updates: sets ActionFlag to false, transfers all UST balances from contract address to tx.origin Emits: FinishRedemption

reportFailure

Reports any failures in-between init operations to allow the EthAnchor operator to return any funds, and reset ActionFlag back to false. Only callable by contract owner.

function reportFailure() public onlyController checkFinish 

Prerequisite: UST balance of account-specific endpoint contract must be 0, ActionFlag is set to true Updates: sets ActionFlag to false

emergencyWithdraw

Withdraws all balances of any ERC20 token from the contract. Only callable by contract owner.

function emergencyWithdraw(address _tokenAddress) public onlyController 

Prerequisite: ERC20 token balances of token contract _tokenAddress at contract address must be greater than 0 Updates: transfers all ERC20 token balances of token contract _tokenAddress back to msg.sender

Emitted when wrapped UST is claimed from Anchor via .

Emitted when is activated for withdrawing ERC20 tokens from the contract.

initDepositStable
finishDepositStable
initRedeemStable
finishRedeemStable
emergencyWithdraw