Skip to content

feat: implement get_pool_remaining_time function#173

Merged
Akshola00 merged 3 commits intoWeb3Novalabs:mainfrom
mayasimi:feat/get-pool-remaining-time
Feb 25, 2026
Merged

feat: implement get_pool_remaining_time function#173
Akshola00 merged 3 commits intoWeb3Novalabs:mainfrom
mayasimi:feat/get-pool-remaining-time

Conversation

@mayasimi
Copy link
Contributor

resolves #90
What was done:

Added get_pool_remaining_time function to the CrowdfundingTrait interface
Implemented the function in crowdfunding.rs — returns seconds remaining until the pool deadline, or 0 if the deadline has already passed
Used saturating_sub to safely handle expired pools without underflow
Added 3 tests in pool_remaining_time_test.rs covering: time remaining, expired pool returning zero, and pool not found error

How it works:
The deadline is calculated as created_at + duration, which is consistent with how the rest of the contract (e.g. refund) handles pool deadlines. The ledger timestamp is used for the current time via env.ledger().timestamp().

@Akshola00
Copy link
Contributor

@mayasimi thanks for your contribution
lgtm

@Akshola00 Akshola00 merged commit 183ff2d into Web3Novalabs:main Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FUNCTION] implement get_pool_remaining_time

2 participants