-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Conversation
ink/crates/phat_rollup_anchor_ink/src/traits/js_rollup_anchor.rs
Outdated
Show resolved
Hide resolved
} | ||
|
||
#[openbrush::trait_definition] | ||
pub trait JsRollupAnchor: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Co-authored-by: h4x3rotab <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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