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 a very simple account contract example. #227

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

dmkozh
Copy link
Contributor

@dmkozh dmkozh commented Apr 11, 2023

What

Add a very simple account contract example.

This is close to minimal possible valid account contract that is aimed at demonstrating the most basic concepts.

Why

This is in response to request for a simpler account contract example(#226) - the only existing example is quite involved and aims at demonstrating all the account contract features.

Known limitations

N/A

dmkozh added 2 commits April 11, 2023 15:23
This is close to minimal possible valid account contract that is aimed at demonstrating the most basic concepts.
Copy link
Contributor

@tomerweller tomerweller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dmkozh dmkozh merged commit 04a4a6a into stellar:main Apr 11, 2023
@leighmcculloch
Copy link
Member

Love how simple this is. 👏🏻

Comment on lines +44 to +49
env.invoke_account_contract_check_auth::<Status>(
&account_contract.contract_id,
&payload,
&vec![&env, sign(&env, &signer, &payload)],
&vec![&env],
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to use invoke_account_contract_check_auth? Can we test the account contract by simply calling the contract like it would be called in deployment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually emulates the call from host - __check_auth function is reserved and can't be called directly (we've also recently reserved all the contract functions starting with __ as well). The comment above tries to explain that.

chadoh added a commit to AhaLabs/soroban-examples that referenced this pull request Apr 13, 2023
* main:
  Add a very simple account contract example. (stellar#227)
chadoh added a commit to AhaLabs/soroban-examples that referenced this pull request Apr 13, 2023
* main:
  Add a very simple account contract example. (stellar#227)
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.

3 participants