Price Oracle

The Price Oracle contract retrieves the exchange rate between Basis Cash and DAI.

Code

A modified version of ExampleOracleSimple.sol from the uniswap-v2-periphery repository has been used.

Oracle.sol

Deployed at [0xcontract_address] on the Ethereum mainnet, [other_testnets] testnets.

This contract is yet to be deployed.

Events

Updated

event Updated(uint256 price0CumulativeLast, uint256 price1CumulativeLast);

Emitted when the price of Basis Cash is updated via update.

Functions

update

function update() external

If 24 hours has passed since update was last successfully executed, updates the time-weighted average price (TWAP) of Basis Cash. Emits Updated.

consult

function consult(address token, uint amountIn) external view returns (uint amountOut)

Returns the amount of output tokens given in exchange for amountIn number oftoken tokens ((Price of token token denominated in output tokens) * amountIn).

pairFor

function pairFor(address factory, address tokenA, address tokenB) external pure returns (address lpt)

Returns the calculated address for a pair without making any external calls.