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

Add support for Lua smart contracts #157

Closed
garious opened this issue Apr 27, 2018 · 3 comments
Closed

Add support for Lua smart contracts #157

garious opened this issue Apr 27, 2018 · 3 comments

Comments

@garious
Copy link
Contributor

garious commented Apr 27, 2018

  • One Lua stack per contract
  • Use coroutines to move forward across multiple events

here's the AST for a smart contract that waits for either a timestamp or an abort signature:

Or((Timestamp(some_date), Payment(tokens, to)), (Signature(from), Payment(tokens, from)))

In Lua, that might look like this:

    while true do
       local event = bank:wait_for_event()
       if isinstance(event, Signature) and event.signature == from then
          bank:transfer(tokens, from)
       elseif isinstance(event, Timestamp) and event.date > some_date then
          bank:transfer(tokens, "0ddba11")
       end
    end
@garious garious added this to the v0.6.0 milestone Apr 27, 2018
@garious garious self-assigned this Apr 27, 2018
@garious
Copy link
Contributor Author

garious commented Apr 29, 2018

Depends on #159

@garious garious removed this from the v0.6.0 milestone May 1, 2018
@mvines mvines added this to the The Future! milestone Aug 9, 2018
@garious
Copy link
Contributor Author

garious commented Oct 9, 2018

Might end up more like this where accounts are passed in and state is passed through account userdata:

       local event = deserialize(data)
       if isinstance(event, Signature) then
          accounts[1].tokens = accounts[1].tokens + tokens
       elseif isinstance(event, Timestamp) and event.date > some_date then
          accounts[2].tokens = accounts[2].tokens + tokens
       end

@garious garious removed their assignment Jan 16, 2019
@garious garious removed this from the The Future! milestone Feb 4, 2019
@garious
Copy link
Contributor Author

garious commented Feb 4, 2019

Withdrawing this one. We'll focus on performance and concurrency.

@garious garious closed this as completed Feb 4, 2019
vkomenda pushed a commit to vkomenda/solana that referenced this issue Aug 29, 2021
steviez added a commit to steviez/solana that referenced this issue Mar 11, 2024
…#157)

These arguments are not read by anything, and they appear to correspond
to a proposed feature that is no longer in the codebase.
willhickey pushed a commit that referenced this issue Mar 16, 2024
These arguments are not read by anything, and they appear to correspond
to a proposed feature that is no longer in the codebase.
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

No branches or pull requests

2 participants