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

feat: POC of contracts pallet #990

Closed
wants to merge 1 commit into from
Closed

feat: POC of contracts pallet #990

wants to merge 1 commit into from

Conversation

sander2
Copy link
Member

@sander2 sander2 commented Mar 30, 2023

This adds pallet_contracts to the standalone runtime. I added a contract in contracts/hello_world that has a function that interacts with the runtime, and a test in standalone/runtime/tests/test_contracts.rs to show that it's working. The test is simple: the contract calls a function in the runtime that returns some value (in this case, it returns Alice's balance), followed by another call that sets some value. This way, we test that (1) passing arguments to runtime functions work, (2) those functions can return values, and (3) that these functions can have side effects (storage changes). The implementation of the runtime side of these functions can be found in standalone/runtime/src/lib.rs

To test for yourself:

  • run cargo install cargo-contract
  • cd to the contracts/hello_world folder and run cargo contract build
  • open standalone/runtime/tests/test_contracts.rs
    • Modify the path in test_contract
    • run test_contract
    • Observe that the test passes

ps don't mind the dex changes - they are unrelated

Closes #983

@sander2 sander2 marked this pull request as draft March 30, 2023 12:14
@sander2 sander2 mentioned this pull request Apr 5, 2023
3 tasks
@gregdhill
Copy link
Member

Succeeded by #1114

@gregdhill gregdhill closed this Jul 4, 2023
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.

Contracts (ink!) support
2 participants