Skip to content
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

Contract constraints should allow access to BLOCKNUMBER #779

Closed
anton-trunov opened this issue Feb 13, 2020 · 1 comment
Closed

Contract constraints should allow access to BLOCKNUMBER #779

anton-trunov opened this issue Feb 13, 2020 · 1 comment
Labels
enhancement New feature or request usability

Comments

@anton-trunov
Copy link
Contributor

anton-trunov commented Feb 13, 2020

Some contracts depend on the notion of time which we model using BLOCKNUMBER variable. E.g. if a contract defines some kind of end-of-life of the contract in its parameters, then it would be unfortunate to deploy a newborn contract which is effectively dead. Contract constraints in this case would looks look something like this

contract Mortal (end_of_life : BNum)
with
  let current_time = BLOCKNUMBER in  (* this is not the right syntax for this, just an illustration *)
  builtin lt current_time end_of_life
=>

Somewhat related to issue #384.

@anton-trunov anton-trunov added enhancement New feature or request usability labels Feb 13, 2020
@anton-trunov
Copy link
Contributor Author

Turns out this was a documentation issue because Scilla already has support for this, see Zilliqa/scilla-docs#119.

It can be done like so

scilla_version 0

library Constraint

contract Mortal (end_of_life : BNum)
with
  builtin blt _creation_block end_of_life
=>

(* the rest of the contract *)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request usability
Projects
None yet
Development

No branches or pull requests

1 participant