UptownResearch / pyTokenSpike

intial work on pyTokens
0 stars 0 forks source link

Update to new oracle approach #12

Open aniemerg opened 4 years ago

aniemerg commented 4 years ago

The existing startBorrow, completeBorrow approach was designed to directly manage interaction with a Uniswap V2 Oracle. This approach didn't work for a variety of reasons and now needs to be replaced with an approach that abstracts away the Uniswap details into the pyOracle contract described in the Technical Document.

To close this issue, we need to replace startBorrow and completeBorrow with just "borrow" (essentially completeBorrow using pyOracle). Borrow should treat pyOracles "read" function as an oracle. If the read function returns validResult as false, borrow should fail to complete the borrow, should not revert (as the "read" function did valuable work), and should provide an error telling the user to try again later.

aniemerg commented 4 years ago

Additionally, startUnlock and completeUnlock should use this pattern.