plexus-money / contracts

Plexus Contracts aims to simplify defi, maintain security of user funds and aggregate other contracts functionality.
12 stars 12 forks source link

Implement Price Oracles for both `Uni V2` and `Sushi` #85

Closed terminator0x closed 3 years ago

terminator0x commented 3 years ago

Right now we're fetching token prices from the coingecko api .

This is fine but also a bit dangerous because when the crypto market experiences flash crashes or sudden pumps the coingecko servers tend to be overwhelmed and this would mean anyone using the wrapper at these times would get a less than stellar experience.

So for this reason we need to implement price oracle contracts for both Uni V2 and Sushi. The contracts should be called PriceOracleUni.sol and PriceOracleSushi.sol respectively and should be added in the /wrapper folder.

For further reading on this please checkout the official uni v2 docs.

Also implement the contracts using the sliding window mechanism as shown here for uni. Since sushi is basically just uni v2 contracts with different addresses, also do the same for sushi.

Acceptance Criteria

I should be able to call a function in either of the contracts called getTokenPrice(address tokenAddress) and easily get the price of the token.

ETA

4 days

softskillpro commented 3 years ago

I've got a question suddenly while implementing this. Should the oracle contract is a maintained oracle or non-maintained oracle? Non-maintained oracle implementation is here, https://github.com/Keydonix/uniswap-oracle

terminator0x commented 3 years ago

I've got a question suddenly while implementing this. Should the oracle contract is a maintained oracle or non-maintained oracle? Non-maintained oracle implementation is here, https://github.com/Keydonix/uniswap-oracle

Non-maintained please. Actually use the example you have shared, it's a good one :)

softskillpro commented 3 years ago

I've got a question suddenly while implementing this. Should the oracle contract is a maintained oracle or non-maintained oracle? Non-maintained oracle implementation is here, https://github.com/Keydonix/uniswap-oracle

Non-maintained please. Actually use the example you have shared, it's a good one :)

Okay, I got it.