-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polyfungible-v2 time constraint #28
Comments
I like this proposal. I know other blockchains tend to use block height often, but here it seems good to use block-time. Especially since block time and time based operations are natively supported in Pact, |
I, too, am a fan. |
Hey, yeah, it caused much trouble during development. |
Current Problem
It's a bit hard to handle the UI/UX for NFT sales in
poly-fungible-v2
based contracts because it usesblock-height
as the time constraint for time dependant functions instead ofblock-time
.While listing an NFT for sale, the seller has to provide how long a token should be listed
(timeout)
.block-height
is used to check the timeout. To calculate theblock height
for the timeout,seconds = selected-time - current-time
blocks = (seconds / average block-time)
timeout = current-block-height + blocks
and send it to the contract.Now while displaying the
timeout
after the token listing has completed, we will have to convert theblock-height
back to user-understandable time format. To do this,seconds = (current-block-height - timeout) / average block-time
.This method has cons like,
Proposal
To use
block-time
as the constraint to validate time dependant functions because it will be a lot easier for marketplaces to display time, and it serves the same purpose as theblock-height
in validating the expiry of the token listing.Files to be changed:
block-time
inledger
contracttimeout
frominteger
totime
inpoly-fungible-v2
interfaceI will be happy to collaborate for implementing these changes.
References
I'm sharing some discussions in the eth community regarding block-time vs block-height.
The text was updated successfully, but these errors were encountered: