EthAnchor Account Contract
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 initDepositStable.
1
event InitDeposit(address indexed sender, uint256 amount, bytes32 to);
Copied!

FinishDeposit

Emitted when wrapped aUST is claimed from Anchor via finishDepositStable.
1
event FinishDeposit(address indexed sender);
Copied!

InitRedemption

Emitted when wrapped aUST is requested for redemption to Anchor via initRedeemStable.
1
event InitRedemption(address indexed sender, uint256 amount, bytes32 to);
Copied!

FinishRedemption

Emitted when wrapped UST is claimed from Anchor via finishRedeemStable.
1
event FinishRedemption(address indexed sender);
Copied!

FailureReported

Emitted when aUST redemption fails due to a lack of stablecoin liquidity in the money market.
1
event FailureReported();
Copied!

EmergencyWithdrawActivated

Emitted when emergencyWithdraw is activated for withdrawing ERC20 tokens from the contract.
1
event EmergencyWithdrawActivated(address tokenAddress, uint256 amount);
Copied!

Functions

initDepositStable

Accepts new wrapped UST deposits.
1
function initDepositStable(uint256 amount) public onlyAuthSender checkInit terraAddressSet
Copied!
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.
1
function finishDepositStable() function initDepositStable(uint256 amount) public onlyAuthSender checkInit terraAddressSet
Copied!
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.
1
function initRedeemStable(uint256 amount) public onlyAuthSender checkInit terraAddressSet
Copied!
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.
1
function finishRedeemStable() public onlyAuthSender checkFinish terraAddressSet
Copied!
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.
1
function reportFailure() public onlyController checkFinish
Copied!
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.
1
function emergencyWithdraw(address _tokenAddress) public onlyController
Copied!
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
Last modified 8mo ago