feat: implement #771, #767, #766, #593 - #1
Open
NnamdiCyber wants to merge 1 commit into
Open
Conversation
…egacy#593 TTL-Legacy#771: Add get_check_in_history_page with cursor pagination - Cursor-based pagination for CheckInHistory entries (newest-first) - cursor=0 returns most recent; cap limit at 50 - Tests for pagination, boundary conditions, and empty history TTL-Legacy#767: Enforce maximum number of vaults per owner - Add MaxVaultsPerOwner to DataKey (default 50) - Add VaultLimitReached error variant (TTL-Legacy#82) - Enforce limit in create_vault; add admin set/get functions - Tests for limit enforcement and update TTL-Legacy#766: Add get_vault_age function - Returns seconds since vault creation; 0 if vault doesn't exist - Tests for newly-created, long-lived, and nonexistent vaults TTL-Legacy#593: Implement Token Fee Optimization - TokenFeeConfig struct with accumulation_enabled + accumulation_threshold - PendingWithdrawal batching for below-threshold amounts - Admin set_token_fee_config + execute_pending_withdrawals - Events: FEE_CONFIG_UPDATED_TOPIC, FEE_BATCH_EXECUTED_TOPIC - Tests for default config, set/get, and withdrawal batching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements four vault core enhancements across the Soroban contract.
Closes TTL-Legacy#771 —
get_check_in_history_pagewith Cursor PaginationNew function:
get_check_in_history_page(env, vault_id, cursor: u64, limit: u32) -> Vec<CheckInHistoryEntry>cursor = 0returns the most recent entry,cursor = 1the second-most-recent, etc.Closes#767 — Maximum Number of Vaults Per Owner
MaxVaultsPerOwnertoDataKey(default: 50)VaultLimitReachederror (code#82)set_max_vaults_per_owner/get_max_vaults_per_ownercreate_vaultnow rejects whenowneralready holdsmax_vaults_per_ownervaultsCloses TTL-Legacy#766 —
get_vault_ageFunctionNew function:
get_vault_age(env, vault_id) -> u64vault.created_atCloses TTL-Legacy#593 — Token Fee Optimization
TokenFeeConfigstruct:accumulation_enabled,accumulation_thresholdPendingWithdrawalstruct for deferred transfersdo_withdrawto batch below-threshold amounts into pending list instead of immediate transferset_token_fee_config,execute_pending_withdrawalsFEE_CONFIG_UPDATED_TOPIC,FEE_BATCH_EXECUTED_TOPICFiles Changed
contracts/ttl_vault/src/types.rscontracts/ttl_vault/src/lib.rscreate_vault&do_withdrawcontracts/ttl_vault/src/test.rs