stellar / soroban-example-dapp

End-to-End Example Soroban Dapp
Apache License 2.0
1.1k stars 889 forks source link

Cleanup and test crowdfund contract #10

Closed sisuresh closed 2 years ago

sisuresh commented 2 years ago

Resolves #9.

Important points about this PR-

  1. I don't see why the user would want to partially withdraw a balance from an expired crowdfund, so I removed the amount from withdraw.
  2. The owner can currently call deposit, so should the owner be allowed to withdraw a deposit? If not, the owner shouldn't be able to call deposit.
  3. I updated deadline from i64 to u64. I64 may have been used intentionally, but I'm not sure why so let me know if that should be reverted.
  4. There are two TODO's in the test advance_ledger function. This shouldn't affect the tests, but it should still be cleaned up.
paulbellamy commented 2 years ago

If you're updating the cargo dependency git hashes you'll also need to update the token contract (and maybe soroban-cli?), otherwise when you try to run ./initialize.sh, you'll just get 0: "unexpected environment interface version"

Basically, you should be able to run rm -rf .soroban ; make && ./initialize.sh and not see any errors output. (This would be a great integration test as well)

paulbellamy commented 2 years ago

I initially used i64, because of this bug: https://github.com/stellar/soroban-cli/pull/118, so yeah let's use u64 now. :+1:

sisuresh commented 2 years ago

@paulbellamy I updated the token contract and tested with rm -rf .soroban ; make && ./initialize.sh using the latest version of the cli from soroban-cli/main.