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
  • Initiate stablecoin redemption
  • Finish stablecoin redemption
  • Check stablecoin redemption status

Was this helpful?

  1. Developers - Ethereum [Legacy]
  2. EthAnchor API

Redeeming Stablecoins

ERC20 aTerra tokens (e.g. aUST) can be redeemed to ERC20 stablecoins using the below endpoints:

Endpoint

Method

Description

POST

Initiates the redemption of ERC20 aTerra

POST

Claims redeemed ERC20 stablecoins

GET

Gets status of an ongoing stablecoin redemption request

Initiate stablecoin redemption

POST https://eth-api.anchorprotocol.com/api/v1/init_redeem_stable

POST /api/v1/init_redeem_stable allows you to fabricate an unsigned Ethereum Tx payload that initiates a stablecoin redemption request. The client can sign and broadcast the resulting Tx payload with their Ethereum account key, or use a custodian API that supports the signing of a raw Tx payload. Note that only one init_redeem_stable operation can take place at the same time; even if you successfully broadcast the resulting Tx to the network, the EthAnchor Account contract will block any subsequent operations until an ongoing stablecoin redemption is finished with finish_redeem_stable.

Headers

Name
Type
Description

Authentication

string

Anchor client key.

Request Body

Name
Type
Description

underlying_denom

string

Underlying stablecoin denomination of aTerra to redeem from Anchor. Example: "uusd"

a_terra_amount

string

(uint256) amount of aTerra to redeem from Anchor in 18 decimals. If empty, redeems all aTerra holdings.

{
    "success": true,
    "tx_hash": "0x......",
    "action": "anchor/init_redeem_stable",
    "underlying_denom": "uusd", 
    "a_terra_amount": "500000000"
}
{
    "success": false,
    "error": "unauthorized; client not registered"
}

Finish stablecoin redemption

POST https://eth-api.anchorprotocol.com/api/v1/finish_redeem_stable

POST /api/v1/finish_redeem_stable allows you to finish a previously requested redeem_stable operation. This endpoint returns an unsigned Ethereum transaction payload. You can sign this transaction yourself and send to the network, or broadcast using any custodian API that supports signing a raw Tx payload.

Headers

Name
Type
Description

Authentication

string

Anchor client key.

{
    "success": true,
    "tx_hash": "0x......",
    "action": "anchor/finish_redeem_stable"
}
{
    "success": false,
    "error": "unauthorized; client not registered"
}

Check stablecoin redemption status

GET https://eth-api.anchorprotocol.com/api/v1/redeem_stable_status

GET /api/v1/redeem_stable_status allows you to check the status of an ongoing redeem_stable operation. You may want to periodically check the progress of your redeem_stable request, since an operation may take up to minutes to finish due to congestion on either side of the networks. Note that status being "finished" does NOT mean you have run a full cycle of redeem_stable operation; you still need to send another transaction from POST /api/v1/finish_redeem_stable to finalize your operation.This endpoint responds with HTTP 204 when there is no ongoing operation.

Headers

Name
Type
Description

Authentication

string

Anchor client access key.

{
    // Phase
    // 0 - (Ethereum) wrapper contract has received aTerra tokens (e.g. aUST) and 
    //     dispatched through Shuttle
    // 1 - (Terra) terra-side client account has received aTerra tokens
    //     triggering RedeemStable soon
    // 2 - (Terra) RedeemStable action is processed and stablecoins (e.g. UST) have
    //     been received
    // 3 - (Terra) stablecoins are sent to the ether-side wrapper contract
    //     through Shuttle
    // 4 - (Ethereum) contract has received stablecoins; operation finished
    "phase": 0,

    // LastUpdated
    // Unix timestamp at which the last update to this response has been made
    "last_updated": 1608662606,

    // Status
    // Operation status
    // pending   - operation in flight
    // failed    - operation failed; last known tx has been recorded
    // finished  - operation finished; you can call /finish_redeem_stable
    "status": "pending",

    // UnderlyingDenom
    // Underlying denomination of aTerra tokens to be redeemed
    "underlying_denom": "uusd", 

    // aTerraAmount
    // amount of aTerra tokens to be redeemed
    "a_terra_amount": :20000000:,

    // TxHash
    // List of known tx hashes and the corresponding network name
    "tx_hash": [
        {
            "network": "ethereum",
            "tx_hash": "0x...."
        },
        {
            "network": "terra",
            "tx_hash": "00ABCD..."
        },
        ...
    ]
}
{
    "status": "idle"
}
PreviousDepositing StablecoinsNextFees

Last updated 4 years ago

Was this helpful?

init_redeem_stable
finish_redeem_stable
redeem_stable_status