Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

Implementing real oracle in forking setup #279

Closed pedrovalido closed 1 year ago

pedrovalido commented 1 year ago

As discussed in the issue, a ChainlinkFeeds.sol was added and ForkingSetup inherits from it. In this added contract, there is info about both the erc20 tokens and the chainlink feeds addresses, correlating to each domain. Side note: the option 1 was taken( domain->assets[] and domain->priceFeeds). This way, setting the FujiOracle is easier in the ForkingSetup.

pedrovalido commented 1 year ago

@DaigaroCota @brozorec please verify the failing tests are not due to the the oracle

pedrovalido commented 1 year ago

FYI @DaigaroCota I noticed the oracle wasnt a public var and I need it in the liquidation manager tests. So, had to do one more change.

0xdcota commented 1 year ago

@pedrovalido the following tests should not be failing. This is lower priority than any issue related to audits.

ConnextRouter.t.sol

In the ConnextRouter.t.sol tests (both on Goerli and OptimismGoerli) I believe this is because the test tDAI address is not the same as the address set up in the oracle. Please check. This is the returned error "FujiOracle__noPriceFeed()"

Encountered 4 failing tests in test/forking/goerli/ConnextRouter.t.sol:ConnextRouterForkingTest [FAIL. Reason: Log != expected log] test_bridgeInbound() (gas: 1201057) [FAIL. Reason: Log != expected log] test_bridgeSlippageInbound() (gas: 1210521) [FAIL. Reason: Log != expected log] test_depositAndBorrowaAndTransfer() (gas: 585251) [FAIL. Reason: Assertion failed.] test_retryFailedInboundXReceive() (gas: 1386747)

Encountered 3 failing tests in test/forking/optimism-goerli/ConnextRouter.t.sol:ConnextRouterForkingTest [FAIL. Reason: Log != expected log] test_bridgeInbound() (gas: 1177240) [FAIL. Reason: Log != expected log] test_bridgeSlippageInbound() (gas: 1201656) [FAIL. Reason: Log != expected log] test_depositAndBorrowaAndTransfer() (gas: 584880)

SimpleRouter.sol

The setup was not updated, see: https://github.com/Fujicracy/fuji-v2/blob/9ba9889d4f707ea094f4a72df05100a8a5eca00f/packages/protocol/test/forking/polygon/SimpleRouter.t.sol#L56 https://github.com/Fujicracy/fuji-v2/blob/9ba9889d4f707ea094f4a72df05100a8a5eca00f/packages/protocol/test/forking/polygon/SimpleRouter.t.sol#L64

Also ensure the test passes after updates.

Encountered 1 failing test in test/forking/polygon/SimpleRouter.t.sol:SimpleRouterForkingTest [FAIL. Reason: Setup failed: EvmError: Revert] setUp() (gas: 0)

pedrovalido commented 1 year ago

@DaigaroCota The issue has been fixed and the same tests that are passing on main are now passing on this branch. Let me know if I should change anything else