Commit Graph

139 Commits

Author SHA1 Message Date
Justin Malčić d4bd86e162
Improve token error messages in token-swap (#3357)
* Move PrintProgramError impls

* Add wrapper function

* Add PrintProgramError to use declaration
2022-07-26 13:59:37 +02:00
Jon Cinque 042da2b687
token-swap: Allow for huge swaps that almost entirely drain one side (#3334) 2022-07-19 19:08:12 +02:00
Jon Cinque c1ee6a58be
Update Solana crates to 1.10.29 (#3303) 2022-07-01 16:51:01 -04:00
Jon Cinque 5b1b87ed48
token-swap: Prepare v3.0.0 release for testnet and devnet (#3227) 2022-06-07 16:31:18 +02:00
Dmitri Makarov f1c1d440e9
Bump solana to v1.10.15 (#3176) 2022-05-17 11:27:30 -07:00
Tyera Eulberg b3fe5b6d5d
Bump token-2022 (#3113)
* Bump token-2022

* Bump solana dependencies
2022-04-26 12:15:26 -06:00
Jon Cinque 1d1c2b178b
Upgrade crates to 1.10.8 (#3076) 2022-04-11 22:25:27 +02:00
kampung-tech 6487cde537
fix typo remove_liquidty to remove_liquidity (#3010) 2022-03-14 18:07:18 +01:00
Tyera Eulberg f4c5fdcfcf
Bump solana to v1.9.9 (#2902) 2022-02-23 16:20:55 -07:00
Jon Cinque d557474ff9
token-swap: Ceiling stable curve division (#2942) 2022-02-23 15:27:16 -05:00
Mykola Vasylchyshyn d6896a9715 Fix a typo in instruction.rs 2022-02-22 23:58:32 -07:00
Anurag Gupta 95cd64ce02
token-swap: Making Arc struct as Sync (#2896)
* box changed to arc

* Imported Arc in all files

* warnings removed

* Updated fuzz

* Removed useless Arc
2022-02-11 13:18:06 +01:00
Anurag Gupta 78e29e9238
token-swap: Changed Wrap SwapCurve's calculator field into Arc instead of Box (#2860)
* box changed to arc

* Imported Arc in all files

* warnings removed

* Updated fuzz
2022-02-03 20:22:51 +01:00
Tyera Eulberg 83c3ffad25
Bump solana crates to v1.9.5 (#2780)
* Bump solana crates to v1.9.5

* Update sol_set_return_data type signature and un-ignore test
2022-01-21 22:52:10 -07:00
Jon Cinque 81f50127f1
token: Bump version to 3.3.0 (#2765) 2022-01-21 01:47:02 +01:00
Peyton Randolph c5d73812cb
[token-swap] Upgrade PyO3 from 0.12.3 to 0.15.1 (#2673)
* Update PyO3 from 0.12.3 to 0.15.1

* run cargo fmt --all
2021-12-29 22:54:57 -05:00
Jon Cinque 6ee008d256
Update SDK to 1.9.2, fix warnings (#2674)
* Update SDK to 1.9.2, fix warnings

* Upgrade honggfuzz

* Use `get_latest_blockhash` correctly
2021-12-28 23:02:47 -05:00
Phạm Văn Dũng a6a1ce4290
fix account list in token_swap instructions docs (#2648) 2021-12-17 13:05:23 +01:00
Michael Vines 1a0155e34b Update to Rust 1.57.0 2021-12-09 23:56:47 -08:00
Jon Cinque f83240a868
token-swap: Prevent single deposits for curves that don't allow it (#2590) 2021-11-17 23:41:55 +01:00
Jon Cinque fcbc0d3501
token-swap: Add comment for stable curve A calculation (#2556) 2021-11-03 19:48:25 +01:00
Michael Vines 9acb082dc3 Upgrade to Solana v1.8.1 2021-10-20 22:52:19 -07:00
Michael Vines 12732f8d5a Upgrade to Solana 1.8.0 2021-10-12 09:40:06 -07:00
Jon Cinque 867417306a
token-swap: Use `find_program_address` on-chain during init (#2363) 2021-08-31 23:09:42 +02:00
Michael Vines 4406265d4a Upgrade to Solana 1.7.11 2021-08-30 12:41:08 -07:00
Tyera Eulberg 30fccebdc6
Bump solana crates (#2139) 2021-07-23 16:47:06 +00:00
Jon Cinque ddc029e14d
token: Bump to 3.2.0 everywhere (#2116) 2021-07-20 23:40:32 +02:00
Brian Anderson 8fbb54bf5f
Eliminate doc warnings (#2058)
* Add URL autolinks to docs in spl-math

* Autolink URLs in doc comments

* Surround 'account references' doc items with code spans to avoid warnings
2021-07-15 17:58:37 -05:00
dependabot[bot] 73e4e0c533
build(deps): bump enum_dispatch from 0.3.5 to 0.3.7 (#2017)
Bumps [enum_dispatch](https://gitlab.com/antonok/enum_dispatch) from 0.3.5 to 0.3.7.
- [Release notes](https://gitlab.com/antonok/enum_dispatch/tags)
- [Changelog](https://gitlab.com/antonok/enum_dispatch/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/antonok/enum_dispatch/commits/master)

---
updated-dependencies:
- dependency-name: enum_dispatch
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-02 17:52:01 +00:00
Tyera Eulberg 0acc8c8bad
Bump solana and borsh crates (#2015) 2021-07-02 16:53:41 +00:00
dependabot[bot] c98e05fe37
build(deps): bump roots from 0.0.6 to 0.0.7 (#2009)
Bumps [roots](https://github.com/vorot/roots) from 0.0.6 to 0.0.7.
- [Release notes](https://github.com/vorot/roots/releases)
- [Changelog](https://github.com/vorot/roots/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorot/roots/compare/v0.0.6...v0.0.7)

---
updated-dependencies:
- dependency-name: roots
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-01 12:11:43 +00:00
Jon Cinque 21f8af34e7
Update all solana dependencies to 1.7.3, fix issues (#1958)
* 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
2021-06-25 00:39:08 +02:00
Tyera Eulberg e28af24443 Bump solana version 2021-06-14 16:02:27 -06:00
Jon Cinque de8433e815
ci: Split out test-bpf into separate workflows for each program (#1893)
* ci: Split token, token-swap, and token-lending out

* Remove token lending js in main runner

* token-swap: Update proptest to trigger build

* Remove unused Cargo.lock file

* lending: Update proptest to trigger lending build

* Fix lending test

* Try re-using action

* binary-oracle-pair: Bump token version to trigger build

* Reference action differently

* Add checkout step before local action

* Move out cargo test bpf step

* Add more programs

* Update example file to trigger job

* Update library file to trigger build

* Update name-service file to trigger build

* Update record file to trigger build

* Update shared memory file to trigger build

* Add pull request runners for each probram / library

* Fix pull-request yml file referencing unknown step
2021-06-11 22:35:00 +02:00
Jon Cinque 929dd59e50
token-swap: Fuzz all curves (#1796) 2021-05-25 22:10:31 +00:00
Jon Cinque 5f692a0b61
token-swap: Make single token withdrawal fair with better calcs (#1794)
* Separate deposit and withdraw single side calcs

* token-swap: Make single token withdrawal fair with better calcs

* Fix JS test calcs
2021-05-25 22:05:06 +02:00
akamutsu 4915c0910a
Implementation of stable curve methods (#1488)
* WIP: Implementation of the remainder of stablecurve methods

* Edits based on PR feedback

* revert SwapVersion

* PR fixes

* checked add / sub

* reverted to using RoundDirection instead of LiquidityProviderOperaiton

* removed LiquidityProviderOperation enum

* Revert flipped parameters

* initial attempt at noramlized_value

* use d for noramlize value for stable curve

* TradeDirection instead of RoundDirection for trading_tokens_to_pool_tokens

* reimplemented the trading_tokens_to_pool tokens function for stable

* Typo

* fix rounding errors in pool_tokens_to_trading_tokens

* try different values of amplification factor in test for stable curve

* fixed broken tests, use constant_product normalized_value function

* use cubic solver

* fix noramlize_value function bad maths

* redid noramlized value for one last time

* added more proptests

* Get tests to work

* Fixup for prod usage

Co-authored-by: Yutaro Mori <me@yutaromori.com>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-05-19 02:44:01 +02:00
Elliott Benisty 58221fc9ae
Fix potential vulnerabilities in programs using spl-token CPIs by adding program id checks (#1714)
* Add spl-token program id check helper function. Add program id to instruction bindings.

* Run cargo fmt

* Fixup tests

* Skip ATA tests when custom token program-id

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-05-12 22:36:41 +00:00
Trent Nelson 1f36ca301b Bump solana crates to v1.6.7 2021-05-05 04:39:49 +00:00
Jon Cinque 0f4f2b8de9
token-swap: Fix slippage on withdraw tokens (#1637)
* token-swap: Fix withdrawal all tokens slippage

When withdrawing, the slippage check is done before `min`ing the token a
and b amounts, which makes it possible to ignore the desired slippage,
and lose out on a lot more than expected.

This has an additional knock-on effect. When burning all of the pool
tokens, it becomes impossible to ever use it again.

* Check for slippage after getting the actual amount that would be
  traded
* Re-initialize the pool token amount on the next deposit if all pool
  tokens were burned

Fixes #1629

* Fmt + clippy

* Deposit one side on 0 pool tokens just gives new supply back
2021-04-29 14:26:47 +02:00
Michael Vines 1e47030549 Update SPL to Solana v1.6.6 2021-04-23 13:39:51 -07:00
B 9281b6e828
feat: adjust fee constraints (#1596) 2021-04-14 13:33:34 -05:00
Jon Cinque e8f59e42ba
token-swap: Bump crate version to 2.1.0 for release (#1573) 2021-04-05 21:56:38 +02:00
Jon Cinque f309df4f35
token-swap: Update package version to match crates (#1561) 2021-04-01 20:53:59 +02:00
Michael Vines 448be67cfa Update to Solana 1.6.2 2021-03-30 09:38:04 -07:00
Jon Cinque d336b8b714
stake-pool: Use checked_ceil_div for withdraw calc (#1482)
* stake-pool: Use checked_ceil_div for withdraw calc

When a stake account is totally removed from a stake pool by the
manager, there's a chance that the operation would not take enough of
the manager's pool tokens by 1 due to truncation.

Do a ceiling division instead, and refactor ceiling division into the
math library.

* Use new function name on CLI

* Cargo fmt
2021-03-23 00:33:51 +01:00
Michael Vines 662f38f939 Bump Solana version to 1.6.1 2021-03-18 04:07:16 +00:00
Michael Vines 626376653d Clippy 2021-03-16 18:33:37 -07:00
Michael Vines 686444088b Bump Solana version to 1.5.15 2021-03-16 18:33:37 -07:00
Jon Cinque 9c12b50703
Update solana-program to 1.5.11 (#1362)
* Update solana-program to 1.5.11

* Update all programs
2021-03-02 19:19:50 +01:00