Fujicracy / fuji-v2

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

ForkingSetup refactor #200

Closed pedrovalido closed 1 year ago

pedrovalido commented 1 year ago

Added internal function to setup borrowing vault according to the collateral and debt asset provided. We can keep it that way for now to have a way to test other vaults other than weth-usdc. Also, after adding real oracle to the forking setup we can take another look at this changes. Let me know what you think @brozorec @DaigaroCota

pedrovalido commented 1 year ago

While changing the values, I discovered a problem with the flasherAaveV3 test on tests/forking/polygon: if the BORROW_AMOUNT is more than ~900 it starts failling. Im going to dig into it :)

pedrovalido commented 1 year ago

The problem I encountered before has been solved. The issue was related to the way the prices in the mock oracle were being defined for wmatic and usdc. Daigaro helped me solve this and the amounts (deposit and borrow) in the test make sense now. Some other changes are related to the issue with the inaccuracy of deposits. The asserts were changed to an approximate value (0.1% delta).

In another note, the tests for flasherAaveV3 on polygon were rebalancing between aaveV2 and aaveV3 providers which was giving a lot of issues. Changed it to rebalance between wepiggy and dforce and the issues disappeared. The borrow amount prior to this change had to be considerably lower than the deposit amount otherwise the rebalance would throw health factor errors. After changing to wepiggy/dforce, the amounts are more "real" and do not throw this error anymore :)

pedrovalido commented 1 year ago

@DaigaroCota we discussed we had a real oracle already implemented. Should we include its integration to this pr?

0xdcota commented 1 year ago

@DaigaroCota we discussed we had a real oracle already implemented. Should we include its integration into this pr?

Let's hold on implementing the real oracle as I think perhaps continuing to integrate other providers is a priority. I will create a separate Issue-ticket for implementing real oracles in forking tests.

pedrovalido commented 1 year ago

@DaigaroCota thanks for the review all changes above mentioned have been made :) Please check the discord thread on the balances of dforce and the way used to implement them. If everything is good, it is ready to merge.