osmosis-labs / isotonic

Smart Contracts for the Lendex Protocol
MIT License
1 stars 0 forks source link

Acceptance tests #71

Closed uint closed 2 years ago

uint commented 2 years ago

If there is risk of builds being green, but the numbers being wrong, maybe what we want to do is introduce a suite of tests that runs the whole system through more complex scenarios that are a little closer to how it's going to be used.

Something like (just to give you the idea):

We have:
* a CA with OSMO as the common token
* markets for 3 currencies, one of them using a different oracle than the rest.

Alice makes deposits in two currencies, borrows another one.
2 months pass.
Bob lends/borrows so that interest changes.
More time passes...

Are the credit line numbers what we expect now? Can Alice successfully repay her debt with the amount we expect?

Probably a separate package rather than something that lives with one of the contracts.

Yay or nay?

ueco-jb commented 2 years ago

You mean general scenarios for tests?

Alice makes deposits in two currencies, borrows another one. 2 months pass. Bob lends/borrows so that interest changes. More time passes...

https://github.com/confio/lendex/blob/main/contracts/lendex-credit-agency/src/multitest/total_credit_line.rs#L240-L257 https://github.com/confio/lendex/blob/main/contracts/lendex-credit-agency/src/multitest/liquidate.rs#L501-L522 https://github.com/confio/lendex/blob/main/contracts/lendex-market/src/multitest/interest.rs#L192-L236

We have couple tests with such scenarios already.

uint commented 2 years ago

Proposal: a new acceptance_tests crate in this repo. Use isotonic_osmosis_oracle rather than the mock one, include setting up the whole system with liquidity pool mocks from bindings-test, etc. Scope for this ticket: