ChainlinkCalculator
A helper contract for interactions with https://docs.chain.link
Functions
singlePrice
Calculates price of token relative to oracle unit (ETH or USD)
Parameters:
Name | Type | Description |
---|---|---|
| contract AggregatorV3Interface | concatenated inverse flag and spread. Lowest 254 bits specify spread amount. Spread is scaled by 1e9, i.e. 101% = 1.01e9, 99% = 0.99e9. Highest bit is set when oracle price should be inverted, e.g. for DAI-ETH oracle, inverse=false means that we request DAI price in ETH and inverse=true means that we request ETH price in DAI |
| uint256 | |
| uint256 |
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | spread oracle price |
doublePrice
Calculates price of token A relative to token B. Note that order is important
Parameters:
Name | Type | Description |
---|---|---|
| contract AggregatorV3Interface | |
| contract AggregatorV3Interface | |
| uint256 | |
| int256 | |
| uint256 |
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | Token A relative price times amount |
Last updated