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

Phat Contract 2.0 Compliance #35

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

GuiGou12358
Copy link
Contributor

@GuiGou12358 GuiGou12358 commented Nov 19, 2023

Add the function pop_raw to get the value without decoding. This way the decoding can be done in the js code.
Add the trait js_rollup_anchor to ease the implementation of ink! smart contract

phat/crates/rollup/src/clients/ink.rs Outdated Show resolved Hide resolved
}

#[openbrush::trait_definition]
pub trait JsRollupAnchor:
Copy link
Contributor

Choose a reason for hiding this comment

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

How does it simplify the use of the JS-based rollup anchor? Could you give some exapmle?

Copy link
Contributor Author

@GuiGou12358 GuiGou12358 Dec 18, 2023

Choose a reason for hiding this comment

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

You can find an example here: https://github.com/GuiGou12358/decentralized_oracle-graph-api-oracle/blob/main/ink/contracts/graph_api_consumer/lib.rs#L215

The JsRollupAnchor trait implements the communication logic between the JS Phat contract and the ink! contract consumer.
It alows to reduce the complexity of the contrat consumer. The developer:

  • doesn't have to test if the configured script/settings hashes match with the received ones. All is done in the JsRollupAnchor trait.
  • can use directly the business struct without care to the struct JsResponse

Copy link
Contributor

@h4x3rotab h4x3rotab left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants