mento-protocol / mento-core

Core smart contracts of the Mento protocol.
https://mento.org
GNU General Public License v3.0
24 stars 11 forks source link

Feat: Make ChainlinkRelayer support implicit pairs #487

Closed bowd closed 3 months ago

bowd commented 3 months ago

Description

Late last week it became apparent that Chainlink won't provide all derived rates that we need, and that we will need to compute implicit rates on-chain. This PR extends the relayer such that it can aggregate up to 4 chainlink date feeds into a single price. Each data feed can be inverted (1 / p) to make the dominos line up.

Other changes

Upgraded the tests to solidity 0.8 and fixed the issue with deploying SortedOracles via the factory by pre-deploying libraries as well because then factory links them automatically when calling vm.getCode.

Tested

Tests have been extended, and I've also used a slightly new pattern that I didn't use before which I like, and might not be evident from reading the code. Specifically for the relayer we have 4 scenarios depending on how many price feeds it aggregates, so I wrote test contracts that extend each other in such a way where test cases from N-1 price feeds get executed also in the test for N price feeds.

Related issues

N/A

Backwards compatibility

Not backwards compatible but not deployed yet.

Documentation

N/A

openzeppelin-code[bot] commented 3 months ago

Feat: Make ChainlinkRelayer support implicit pairs

Generated at commit: 0d2a445a1baaf997f2d0cea1650c11144aca499d

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
3
0
13
38
57
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector