* Update all dependencies to 1.7.3, fix issues
* Remove esm from mocha
* Fix missed token test
* Also update rust version
* token-swap: update tolerance on sim test
* Run `cargo clippy --fix` for needless_borrow errors
* Rerun cargo fmt
* Add rounding specification for deposit / withdraw
The fuzzing test was improved to make sure that the value of pool tokens
(minus fees) never changed, which revealed a calc bug with deposits and
withdrawals. If someone withdraws, they can take additional small
value out of the pool in the form of truncated value.
Before, deposit and withdrawal used the same calculation, rounding up the token
A and B amounts. Remember that deposit / withdrawal specify the pool
token amount, and calculate the amount of A / B required to get to that
many pool tokens. On withdrawal, we were giving back a little bit too
much. The concept is that everything would even out since a deposit is
required for a withdrawal, which makes everything a wash.
Fuzzing found this issue very quickly! The change is to introduce a
rounding parameter to avoid ever giving away too much value, either
during deposit or withdrawal.
* Cleanup
* Add withdraw test
* Cleanup
* Cargo fmt
* Remove curve tests from fuzzing cfg
* Update JS test
* Cleanup test
* Update honggfuzz again
* Fix fee on JS test
* Force correct version of honggfuzz for CI (remove later)
* Improve value tests using PreciseNumber everywhere
* Fix ceiling
* Add comment for 0 tokens
* Fix ceiling div, add in constant price calc
* Revert ceiling division as template and use trait, too much boilerplate
* Run cargo fmt
* Add user transfer authority to swap instruction
* Add user transfer authority to deposit all
* Add authority to withdraw all
* Add authority to deposit one
* Add authority to withdraw one
* Update fuzzer
* Add user transfer authority to JS
* Add extra check on instruction fuzz
* Refactor division
* Fix tests from fixed deposit math
* Fixup comments and cleanup fuzz
* Run fmt
* Address review feedback
* Fix JS test
* Add instructions to deposit / withdraw one token
* Run cargo fmt
* Fix clippy issues
* Add JS interface
* Add tests for new instructions
* Run prettier
* Rename deposit and withdraw
* Rename withdraw -> withdraw all in program
* Rename single token instructions
* Add price parameter for flat / constant price curve
This encompasses a lot of changes to properly support the constant price
curve, and fixes some old pain points to make the whole thing easier to
use, including:
* refactor fees out of the curve
* move all fee calculations into new Fees type
* modify constraints to only care about curve types and fee
* add price parameter into constant price curve (flat curve)
* Run cargo fmt and clippy
* Revert interface changes and math update
* Run cargo fmt
* Address review feedback
* Fix fraction validation for zeros
* token-swap: Add fuzzer for swap / withdraw / deposit
* Run cargo fmt
* Make end-to-end testing work
* Fix test failures
* Cleanup for review
* Remove Clone trait for Initialize
* Fix building fuzz targets
* Fix fuzz withdraw logic to avoid ZeroTradingTokens error
* Cargo fmt
* Clippy / fmt again
* Integrate fuzzer in main workspace to share clippy / fmt
* Fix clippy
* Switch to stable honggfuzz that could work with BPF
* Update to most recent honggfuzz
* Add build / run requirements
* Add fuzz CI and cleanup for honggfuzz
* Revert to using fuzz feature to integrate with workspace
* Make fuzz script executable
* Refactor and cleanup
* Add nightly run
* Fix workflow typo
* Add runtime for pull request fuzz workflow
* Fix unrelated new clippy errors