Commit Graph

28 Commits

Author SHA1 Message Date
Jon Cinque 5e1c2bb34d
token-swap: Use sdk version of Pack (#554)
* token-swap: Use sdk version of Pack

* Update to get_packed_len per review
2020-10-01 11:02:31 +02:00
Jon Cinque 13de66817d
token-swap: Improve pool token supply on initialization, deposit, and withdrawal (#508)
* token-swap: Add token supply in invariant calculation

* Refactor state classes into curve components for future use
* Align pool initialization with Uniswap using geometric mean of token
  amounts
* Fix deposit and withdraw instruction to work as a proportion of pool
  tokens
* Add math utilities to calculate the geometric mean with u64

* Improve variable names

* Use a fixed starting pool size

* Run cargo fmt

* Update js tests with new pool numbers

* Run linting

* Remove math

* Fix BN type issues found by flow
2020-09-23 23:08:44 +02:00
Tyera Eulberg 90b5ce6d65
Standardize failure case ordering (#509)
* Standardize processor failure-case ordering

* Fix token-swap test
2020-09-21 20:28:24 -06:00
Jack May 759fe1487e Switch to solana_sdk Pack and COption 2020-09-21 17:08:37 -07:00
Jack May 08fe8307f0
Bump solana-sdk to v1.3.12 (#484) 2020-09-21 08:38:29 -07:00
Jon Cinque 84cf55e9ae
Token-swap: add tests for all instructions (#455)
* token-swap: Add initialize tests

* Cleanup initialize test using helper struct

* Add deposit tests

* Run cargo fmt

* Add withdraw tests, refactor swap in test

* Add swap tests

* Integrate review feedback
2020-09-17 12:11:24 +02:00
dependabot[bot] 9d9545c98d
Bump solana-sdk from 1.3.9 to 1.3.11 (#454)
Bumps [solana-sdk](https://github.com/solana-labs/solana) from 1.3.9 to 1.3.11.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.3.9...v1.3.11)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-16 09:22:53 +00:00
Jon Cinque 759cbb3866
Pack instructions and state more efficiently (#420)
* Pack instructions and state more efficiently

* SwapInfo and SwapInstruction are more memory-efficient, following the
  example from SPL Token
* Remove unnecessary helper structs to make instructions clearer
* Error -> SwapError
* Update JS tests to reflect the change

* Integrate review feedback
2020-09-11 18:19:06 +02:00
Jon Cinque f5e0d793a9
token-swap: Swap instruction fix and update libs for CI (#408)
* token-swap: Fix swap instruction

* Update SDK libs and fix outstanding issues

* Run lint in token/js

* Disable CI token-swap js tests

* Update code for web3.js 0.75.0

* Update output -> destination verbiage for clarity / consistency
2020-09-10 20:16:50 +02:00
Justin Starry 708bb430ab
Bump dependencies from 1.3.8 to 1.3.9 (#415) 2020-09-10 17:25:43 +08:00
Jon Cinque f6fc53c311
token-swap: Fix withdraw instruction (#405)
* Include pool mint in instruction, required for burning
* Add simple Rust test
* Fix js withdraw test
2020-09-09 18:00:03 +02:00
Jon Cinque db729af089
Fix deposit instruction (#399)
* Fix deposit instruction

* Refactor tests for easier composibility
* Add deposit instruction and test
* Deposit JS test works again

* Fix js lint
2020-09-09 10:59:27 +02:00
Jon Cinque ac73bd2e73
Fix token-swap tests (#388)
* Fix local token-swap tests

* Change generation of program address to use a nonce
* Accept nonce properly in initialization
* Include nonce in TokenSwap structure
* Fixup serialization with new parameter (padding used for now)
* Update dependencies

Update toml / lock files

Fix token swap initialization end-to-end

Cleanup unit test to use `find_program_address`

Add / refactor tests

Most importantly, added a special test to make sure that
token_program_id is provided at the end of CPI instructions, since
unit testing did not pick up that problem, and it was tough to debug
during end-to-end testing

* Revert some testing changes for PR

* Update token-swap/program/src/processor.rs

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

* Integrate review comments

* Fmt and clippy

* Refactor for clippy

* Fmt again

* Fix npm lint error

* Clarify signers line as requested

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2020-09-06 00:09:05 +02:00
Trent Nelson 9eb10d9144 Unrelated clippy... 2020-09-04 01:18:44 -06:00
Trent Nelson b15eb09cfb Bump solana crates to 1.3.8 2020-09-04 01:18:44 -06:00
Trent Nelson ddc47a6d86 Fix TokenSwap initialization test 2020-09-04 01:18:44 -06:00
Michael Vines 9e23bc94cb Update to Solana 1.3.6 2020-08-29 22:12:00 +00:00
Jack May 815cca3cb8
Don't repack if not needed (#355) 2020-08-28 12:03:10 -07:00
Michael Vines 0a47a3127c Move c header generation out of build.rs 2020-08-27 23:32:07 -07:00
Jack May 2a5acff2d8
Safer pack/unpack (#349)
* Safer pack/unpack

* fix cli

* clippy

* fix swap

* nit

* clippy

Co-authored-by: Michael Vines <mvines@gmail.com>
2020-08-27 21:19:15 -07:00
Tyera Eulberg 49e6e4a589
Reinstate Mint supply (#342)
* Reinstate Mint supply, and adjust with Minto & Burn

* C headers

* Patch token-cli

* Patch token-swap
2020-08-27 13:06:23 -06:00
Michael Vines c671fdcd3a Update token-swap for token2 2020-08-26 23:10:18 -07:00
dependabot[bot] 036cca36b6 Bump solana-sdk from 1.3.2 to 1.3.4
Bumps [solana-sdk](https://github.com/solana-labs/solana) from 1.3.2 to 1.3.4.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.3.2...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-25 09:05:29 -07:00
Michael Vines 77e43016f1 clippy 2020-08-14 01:22:11 +00:00
Michael Vines b9bb2f2c48 Adapt to create_program_address changes 2020-08-14 01:22:11 +00:00
Michael Vines d37626e360 Move program READMEs back 2020-08-08 23:04:16 +00:00
Michael Vines a22908bbd9 Relocate js 2020-08-08 15:25:47 -07:00
Michael Vines 26ab9bb26a Reorganize crates based on program 2020-08-08 15:25:47 -07:00