-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adding Context to the stdlib #369
Conversation
@sezna Still seeing errors.
If I switch it to use mcp it builds, but
In addition, trying to use the
in the Is this working for you on |
Have you pulled from the latest master and updated |
🤦🏼 I did not think to update forc. |
test/src/e2e_vm_tests/test_programs/context_testing_contract/src/main.sw
Show resolved
Hide resolved
1af11e8
to
fd89a87
Compare
What else do we want to add to |
Not |
This sounds good to me. So far I'm thinking of something like this (maybe exposing
Trying to get my head around the implications of the UTXO model...
|
ff2d6fe
to
fb42b64
Compare
To transclude some info from Slack: the equivalent of |
e9ac76b
to
e57b097
Compare
OK, I think this is getting close. It seems we can't define empty (unit) Structs in Sway, so I did this for now:
Just need some feedback on this before a final cleanup. |
Actually, what you've done is indeed a unit struct. It is zero-sized. It's just a bit more verbose than Rust's |
I guess the bigger question is, do we need the struct at all? |
IMO we don't need a struct at all. I don't actually see something like |
Replaced by #389. |
WIP.
A first crack at add a context Struct to the stdLib so that you can do stuff like
Context.id()
in a contract to get the current contract's id.It would be nice if:
context
struct manually before using itcontext.id
directly rather thancalling the method (minor detail)Note that this doesn't work yet.
Trying to build the contract gives the error: