Commit Graph

2599 Commits

Author SHA1 Message Date
Jon Cinque 688ee423ed
stake-pool-cli: Fix vote account address in details (#2585) 2021-11-16 21:30:10 +01:00
Michael Vines 4a9c91d594 Bump spl-name-service version to 0.2.0 2021-11-16 08:55:46 -08:00
DR497 fb949741fb name service: allow parent name owner to update records 2021-11-16 08:41:11 -08:00
Jon Cinque 02d2736797
token-js: Add test for disabling mint authority (#2582) 2021-11-15 18:56:23 +01:00
Dmitri Makarov c6758a697c
Increase compute max units for sqrt_u128_max test (#2574)
This increase is caused by upgrade of compiler builtins
2021-11-13 07:16:11 -08:00
Sebastian Bor bf7ad18f41
Governance: vote options (#2544)
* feat: use VoteChoice instead of VoteWeight

* chore: make clippy happy

* feat: use options for ye/no vote

* feat: use choices for CastVote instruction

* chore: move Vote enum to tests

* fix: iterate overall choices for withdrawal

* chore: split ProposalOption and ProposalOptionVote

* fix: calculate multi option proposal size

* chore: split weighted and fractional vote choices

* feat: add proposal type

* feat: add reject option flag

* feat: calculate final state for proposal using options results

* chore: make clippy happy

* fix: generalise max vote weight calculation for multiple options

* feat: gate vote tipping for yes/no proposals only

* chore: make clippy happy

* feat: add option_index to instruction

* feat: move instructions to options

* chore: advance clock

* chore: add await

* chore: add multi option proposal tests

* chore: move governing_mint to account list

* feat: assert valid proposal options

* feat: assert proposal is executable when instruction is added

* chore: make clippy happy

* chore: add tests to insert instructions into multi option proposal

* chore: make clippy happy

* feat: use explicit reject_option_vote_weight

* feat: use Vote struct for vote results

* feat: validate vote

* feat: reject empty proposal options

* chore: update comments

* fix: allow execute only successful options

* chore: add assertions for option statuses

* chore: add partial success test

* chore: add full success execution test

* chore: add test for instructions execution for fully denied proposal

* feat: finalise none executable proposals into completed state

* chore: fix chat

* feat: add vote_record v1 v2 roundtrip serialization

* eat: add proposal_instruction v1 v2 roundtrip serialisation

* chore: use VoteRecordV1

* chore: use legacy structs instead of legacy crate version

* chore: rename proposal to V2

* feat: translate Proposal v1 v2 versions

* chore: make clippy happy

* chore: make clippy happy

* chore: remove unnecessary clone for match

* chore: rename get_final_vote_state to resolve_final_vote_state

* fix proposal account name

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>

* chore: fix compilation

* chore: use borsh::maybestd::io::Write

* chore: consume self in serialise instructions to avoid cloning

* chore: update comments

* feat: add N limit placeholder to multi choice vote type

* feat: increase options size to u16

* fix: use checked math

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-11-11 19:34:00 +00:00
JulI0-concerto cd63580b79
Implement multiple output format for spl-stake-pool list-all (#2558)
* Implement json output formats for spl-stake-pool list-all

* Implement --output json or json-compact or display in list-all cmd

* cleanup: use destructuring instead of tuple

* Fix related to PR comments

* Add json and json-compact output for list command

* implement list command display with Display and VerboseDisplay

* make CliStakePool->details optional

* cleanup use

* Update stake-pool/cli/src/main.rs

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

* Update stake-pool/cli/src/main.rs

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

* clippished

* fix use

* fix fmt issue

Co-authored-by: Julien Piccaluga <julien.piccaluga@kudelskisecurity.com>
Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2021-11-10 13:06:14 -07:00
Ikko Ashimine 707382ee96
Fix typo in main.rs (#2569)
auxillary -> auxiliary
2021-11-10 11:18:07 -07:00
Jon Cinque 75ddd9bb22
stake-pool-docs: Rearrange docs, add quickstart guide (#2561)
* stake-pool-docs: Rearrange docs, add quickstart guide

* Rearrange doc sidebar
2021-11-06 12:48:11 +00:00
MarkSackerberg 81c90f5c73
Allow GC to close empty associated accounts (#2554)
* Allow GC to close empty associated accounts

Empty associated accounts will only be closed in case the new flag del_associated_accounts is set. Otherwise behaviour is as before.

Useage:
spl-token gc --del_associated_accounts

* use kebab-case

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>

* align coding style

Thank you jon!

* Add sanity check

* correcting amount check before closing

* formatting correcly

using cargo fmt

* changing sanity check to assert!

Co-authored-by: Sack <none>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
Co-authored-by: Mark Sackerberg <Contact@Discord>
2021-11-04 22:49:23 +01:00
Jon Cinque fcbc0d3501
token-swap: Add comment for stable curve A calculation (#2556) 2021-11-03 19:48:25 +01:00
Jon Cinque 8aef395901
stake-pool: Bump CLI and program version to 0.6.3 (#2555) 2021-11-02 22:15:33 +01:00
Jon Cinque 01765b9953
stake-pool: Reduce wait for active stake merges (#2553)
* stake-pool: Reduce wait to one epoch for active merges

* Remove stake_program references

* Remove credits observed point from docs
2021-11-01 15:14:49 +01:00
Alexander Ray 287c3bedaf
stake-pool-cli: Fix prepare_withdraw_accounts issues (#2548)
* - fix prepare_withdraw_accounts issues

* - use reverse fee as workaround for withdraw issue
2021-10-26 23:13:59 +02:00
Jon Cinque cd3f5ae9fe
stake-pool: Add test for withdrawing all, with fee (#2550) 2021-10-26 22:50:16 +02:00
Jon Cinque 8be3ba819c
stake-pool-docs: Add the published audits (#2546) 2021-10-26 22:30:16 +02:00
Jon Cinque 756696ee8e
stake-pool-cli: Add validator list argument to create (#2545)
People want to know more about the validator list, but there isn't too
much info provided.

* Include the validator list as an optional parameter to pool creation
* Print out the address during creation
* Always print out the address during `list`
* Add docs about it
2021-10-25 23:13:58 +02:00
Sebastian Bor d550f4f7e6
Governance: Flag payer account as writable on instructions creators (#2543) 2021-10-25 14:08:34 +01:00
Michael Vines fca9836a2c Avoid MemcmpEncodedBytes::Binary 2021-10-20 22:52:19 -07:00
Michael Vines e2a5785ad7 Revert "Revert once SPL updates to Solana 1.8.1"
This reverts commit f5767bb3e209b591c657ad5732ff854c635292a4.
2021-10-20 22:52:19 -07:00
Michael Vines 9acb082dc3 Upgrade to Solana v1.8.1 2021-10-20 22:52:19 -07:00
Jarry Xiao c8963e8348
Updating Stateless Offer to Optionally Include Fees (#2507)
* Updating Stateless Offer PDA seeds to only require main wallet and mint types

* Added optional payment of creator fees for NFTs

* Addressed formatting issues

* Fixed bugs in fee paying code, removed logs to lower compute limit

* Add in check to make sure the proper metadata is passed in

* Added workflow for taker posting NFT (maker pays fees)
2021-10-20 19:51:38 -05:00
Sebastian Bor ef72e56738
Governance: Use max_voting_time to determine proposal final state (#2529)
* feat: do not allow withdrawing votes before proposal is finalised

* feat: do not allow proposal cancellation before proposal is finalised

* chore: update comments and add test

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-10-20 20:48:02 +01:00
Jon Cinque 4ab60e6794
stake-pool: Also set the sol deposit authority on init (#2532) 2021-10-20 01:45:00 +02:00
Jon Cinque 675d65b965
stake-pool-cli: Add more docs around scripts (#2531) 2021-10-20 01:29:00 +02:00
Jon Cinque 203db7bc3f
stake-pool-cli: Improve deposit and withdraw UX (#2530) 2021-10-19 23:30:41 +02:00
Michael Vines c9a918f5cd Avoid `Hash`'s private parts, use `AsRef` instead 2021-10-19 09:11:56 -07:00
Jon Cinque c5e7ae736e
stake-pool: Add comment to validator stake info field (#2527) 2021-10-19 17:19:10 +02:00
Jon Cinque 1a48523a80
stake-pool: Remove copied stake program code (mostly) (#2526)
* stake-pool: Remove (mostly) the copied stake program

* Remove references to stake_program in CLI
2021-10-19 16:48:56 +02:00
Sebastian Bor d6d0b92ae7
Governance: Voter-weight-addin cleanup (#2512)
* chore: Ensure voter-weight-addin is built for tests

fix: build addin during test run

fix: build voter weight addin for tests using the addin only

chore: use mutex to build addin only once

chore: move build guard to separate file

chore: update governance version for chat

* chore: create tools crate for common utility functions in governance ecosystem

* chore: add test-sdk and tools readme

* chore: rename reserved addins to specific names

* chore: remove todo comment

* chore: remove unnecessary var drop

* chore: move all account tools to shared crate

* chore: fix chat compilation

* chore: move program_id to first position
2021-10-19 11:43:01 +01:00
Jon Cinque f95e390dd4
stake-pool: Clarify stake deposit fee (#2520) 2021-10-19 12:26:50 +02:00
Colin Ogoo 0a5e952485 fix: typo in comments
fix minimal typo in comment
2021-10-18 19:02:46 -06:00
Jon Cinque 3b48fa09d3
stake-pool: Cleanup documentation in code (#2525) 2021-10-19 01:50:35 +02:00
Jon Cinque 4658815e9f
stake-pool: Force pools to only use the SPL token program (#2521) 2021-10-19 01:39:57 +02:00
Jon Cinque 7f0278caa8
stake-pool: Add checked math to big vec calc (#2524) 2021-10-19 00:46:49 +02:00
Jon Cinque f97c61a9ed
stake-pool: Initialize all pool fields explicitly (#2523) 2021-10-19 00:46:39 +02:00
Jon Cinque 50b5597fcf
stake-pool: Improve error when overdrawing on decrease (#2522) 2021-10-19 00:45:46 +02:00
Alexander Ray 671590dd05
- reimplement prepare_withdraw_accounts according to the documentation (#2513)
* - reimplement prepare_withdraw_accounts according to the docu

* - add preferred withdraw validator

* - fix clippy issues

* - fix styling
2021-10-15 22:35:44 +02:00
Sebastian Bor e8b7009cc4
Governance: Add UI section to readme (#2511) 2021-10-13 21:38:04 +01:00
Michael Vines 647129c612 Revert once SPL updates to Solana 1.8.1 2021-10-13 12:45:21 -07:00
Michael Vines 18543cf352 Adapt to retyping of HEAP_START_ADDRESS from usize to u64 2021-10-13 12:45:21 -07:00
Sebastian Bor dc7f6be034
Governance: Add deposit amount (#2485)
* feat: add amount to Deposit instruction

* feat: use try_from_slice_unchecked to support forward compatibility

* chore: make clippy happy

* chore: update comments
2021-10-13 19:59:30 +01:00
fukaoi 5436ac239e
added transferChecked (#2481) 2021-10-13 16:55:19 +02:00
Krešimir Klas 889ccd6799
[token][js]: add missing checked instruction method declarations to module.d.ts (#2484)
The following methods:
- createApproveCheckedInstruction
- createMintToCheckedInstruction
- createBurnCheckedInstruction
- createSyncNativeInstruction

are missing from the `module.d.ts` file which means they won't be included in
the `lib/index.d.ts` module declaration file and therefore cannot be
referenced to when using the package with typescript.

Added the missing declarations.
2021-10-13 16:54:56 +02:00
Sebastian Bor c99f4195f1
Governance: Voters weights add-in (#2450)
* feat: setup and configure voter weight addin

feat: add use_voter_weight_add_in flag to realm config

chore: use spl-governance 1.1.1 version

chore: make clippy happy

chore: add test to deserialise v1 CreateRealm instruction from v2

feat: add voter-weight-addin skeleton project

chore: build voter-weight-addin before governance

fix: temp workaround to make spl_governance_voter_weight_addin available in CI

chore: add tests with voter-weight-addin

feat: implement deposit instruction for voter weight addin

feat: add voter_weight_expiry

fix: set voter_weight_expiry

chore: restore positive execute tests

chore: restore ignored tests

wip: pass voter weight accounts to create_account_governance2

wip: read voter weight account

chore: make clippy happy

wip: add realm and validation to voter_weight deposit

fix: update addin

chore: make clippy happy

chore: fix voter_weight_record names

feat: use voter weight provided by addin when governance created

chore: update addin

chore: remove governance stake pool program

feat: remove time offset from revise

chore: fix build

feat: create RealmAddins account when realm with addin is created

chore: make clippy happy

feat: set voter weight addin using SetRealmConfig instruction

chore: make clippy happy

chore: update comments

chore: reorder SetrealmConfig accounts

chore: infer use_community_voter_weight_addin

chore: infer use_community_voter_weight_addin

chore: update voter weight addin comments

feat: use voter weight addin id from RealmAddins account

* feat: use voter weight addin to create proposal

* feat: use voter weight addin to cast vote

* chore: make clippy happy

* feat: use voter weight addin to create token governance

* feat: use voter weight addin to create mint governance

* feat: use voter weight adding to create program governance

* chore: create assert_can_withdraw_governing_tokens() helper function

* chore: fix compilation

* fix: ensure governance authority signed transaction to create governance

* feat: implement CreateTokenOwnerRecord instruction

* chore: fix chat tests

* chore: update comments

* chore: rename RealmAddins account to RealmConfig account

* chore: add more reserved space to GovernanceConfig account

* chore: update instruction comments

* chore: update comments

* chore: fix compilation

* chore: remove ignore directive for tests

* feat: panic when depositing tokens into a realm with voter weight addin

* chore: rename community_voter_weight to community_voter_weight_addin

* feat: make payer account optional for SetRealmConfig
2021-10-13 13:15:22 +01:00
Michael Vines 1c417ffa4f Fork Token 2022 program 2021-10-12 10:43:58 -07:00
Michael Vines 12732f8d5a Upgrade to Solana 1.8.0 2021-10-12 09:40:06 -07:00
Jon Cinque f630d71fdc
stake-pool-cli: Bump version to 0.6.2 (#2501) 2021-10-12 00:29:38 -04:00
Jon Cinque b8cc6fa12c
stake-pool-cli: Fix funding authority flag name (#2500) 2021-10-12 00:04:35 -04:00
joeaba 3cf123312e
adding PR target 2021-10-11 15:27:03 +05:30