SanityRates
Last updated
Was this helpful?
Last updated
Was this helpful?
You are referring to the Legacy
version of KyberSwap docs.
For the most updated information, please refer to:
is , , Utils\ imports ERC20Interface, , Utils,
Source:
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 |\
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:
\
Set reasonable conversion rate difference in percentage (any conversion rate outside of this range is considered unreasonable).
Web3 Example:
\
Sets the sanity rate for a list of tokens.
Web3 Example:
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: |
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: