marinade-finance / bounties

Bounties will be published as issues in this repo
0 stars 1 forks source link

Onboarding bounty: Write a small simulation test for the backend program - add_liquidity #2

Closed luciotato closed 3 years ago

luciotato commented 3 years ago

Context: marinade.finance merged with SmartPool and we're merging codebases now under the marinade umbrella. The new marinade codebase is here: https://github.com/marinade-finance/marinade-anchor We're using Serum's Anchor framework to develop Solana backend programs

The SmartPool codebase is here: https://github.com/marinade-finance/SmartPoolProgram The SmartPool codebase is NOT using "Anchor". The SmartPool codebase is pure Rust/Solana in the same style as the SPL-Stake-Pool. The SmartPool codebase has simulation tests already coded.

Task: Take a simulation test, instruction "add_liquidity" from SmartPool codebase and migrate it to marinade-anchor. The simulation test is working in the old codebase and it is here: https://github.com/marinade-finance/SmartPoolProgram/blob/master/program/tests/liquidity.rs, it's 134 lines not including simluation-environment setup.

test description: call add_liquidity instruction in a simulated environment and check the result.

deposit instruction:

Expected result:

Bounty completion criteria: This test is migrated to marinade-anchor codebase. The test uses idiomatic Anchor to a reasonable degree. The test compiles, and you can explain the code.

vkomenda commented 3 years ago

@aankor Just to let you know I have created a common module for liquidity tests and moved your test_remove_liquidity template there. I had to tidy up some dependencies.

See the PR marinade-finance/marinade-anchor#10 for details.

vkomenda commented 3 years ago

@luciotato Did you mean SOL instead of wSOL in the description? The transfer_from argument of add_liquidity is constrained to have its owner be the system program. I guess this rules out SPL token accounts?

luciotato commented 3 years ago

That part changed after I wrote the bounty. You're correct, the new code receives SOL