Anchor Protocol
Search…
ExchangeRateFeeder
The ExchangeRateFeeder contract is responsible for calculating and determining the exchange rate between an Ethereum stablecoin and their aTerra counterpart.

Events

RateUpdated

Emitted when exchange rate is updated.
1
event RateUpdated(
2
address indexed _operator,
3
address indexed _token,
4
uint256 _before,
5
uint256 _after,
6
uint256 _updateCount
7
);
Copied!
Key
Type
Description
_operator
address
Address that updated the exchange rate
_token
address
Address of token that had its exchange rate updated
_before
uint256
Exchange rate value pre-update
_after
uint256
Exchange rate value post-update
_updateCount
uint256
Number of times that interest was compounded during the update

State

Status

Represents the exchange rate updatability for a stablecoin.
1
enum Status {NEUTRAL, RUNNING, STOPPED}
Copied!
Key
Description
NEUTRAL
Set when a stablecoin was first added
RUNNING
Exchange rate of stablecoin available for updates
STOPPED
Set when exchange rate updates for this stablecoin is stopped

Token

Represents information for an aTerra token.
1
struct Token {
2
Status status;
3
uint256 exchangeRate;
4
uint256 period;
5
uint256 weight;
6
uint256 lastUpdatedAt;
7
}
Copied!
Key
Type
Description
status
Status
Exchange rate updatability status
exchangeRate
uint256
Exchange rate when the exchange rate was last updated.
period
uint256
Minimum time period required between exchange rate updates
weight
uint256
Interest rate per period of time
lastUpdated
uint256
Block timestamp when exchange rate was last updated

Functions

exchangeRateOf

Gets the exchange rate for the specified aTerra token. Returns a simulated value (reflects yield accrued since last exchange rate update) if _simulate is set as true. Returns the last updated exchange rate value is _simulate is set as false.
1
function exchangeRateOf(
2
address _token,
3
bool _simulate
4
) external view returns (uint256);
Copied!
Key
Type
Description
_token
address
Address of aTerra token to retrieve exchange rate
_simulate
bool
Indicator on whether to return a interest-accrued value

update

Updates the exchange rate for specified aTerra token.
1
function update(address _token) external;
Copied!
Key
Type
Description
_token
address
Address of aTerra token to update exchange rate
Last modified 4mo ago