SanityRates

circle-exclamation

contract SanityRates

is SanityRatesInterfacearrow-up-right, Withdrawablearrow-up-right, Utils\ imports ERC20Interface, Withdrawablearrow-up-right, Utils, SanityRatesInterfacearrow-up-right

Source: SanityRates.solarrow-up-right

The SanityRates contract's role is provide a safeguard for reserves whereby trades are disabled in the event exchange rates fall below the lower limit or rise above the upper limit of the sanity rates.


<AUTOGENERATED_TABLE_OF_CONTENTS>

Contract constructor. Note that constructor methods are called exactly once during contract instantiation and cannot be called again.


function SanityRates(address _admin) public | Parameter | Type | Description | | ----------|:-------:|:--------------------:| | _admin | address | address of the admin |\

getSanityRatearrow-up-right

Gets the sanity rate for a pair of tokens.


function getSanityRate(ERC20 src, ERC20 dest) public view returns (uint) | Parameter | Type | Description | | --------- |:-----:|:----------------------------------------:| | src | ERC20 | source ERC20 token contract address | | dest | ERC20 | destination ERC20 token contract address | Returns:\ The sanity rate for the pair of tokens


Web3 Example:

\

setReasonableDiffarrow-up-right

Set reasonable conversion rate difference in percentage (any conversion rate outside of this range is considered unreasonable).


function setReasonableDiff(ERC20[] srcs, uint[] diff) public | Parameter | Type | Description | | --------- |:-----:|:-----------------------------------------------:| | srcs | ERC20[] | list of source ERC20 token contract addresses | | diff | uint[] | list of reasonableDiffs in basis points (bps) 1 bps = 0.01% Modifiers: onlyAdminarrow-up-right |


Web3 Example:

\

setSanityRatesarrow-up-right

Sets the sanity rate for a list of tokens.


function setSanityRates(ERC20[] srcs, uint[] rates) public | Parameter | Type | Description | | --------- |:-------:|:---------------------------------------------:| | srcs | ERC20[] | list of source ERC20 token contract addresses | | rates | uint[] | list of rates in ETH wei | Modifiers: onlyOperatorarrow-up-right


Web3 Example:

Last updated

Was this helpful?