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

Refactor moveos_stdlib::move_module and add example of issue coin without code #1107

Merged
merged 8 commits into from
Nov 4, 2023

Conversation

pause125
Copy link
Collaborator

@pause125 pause125 commented Nov 4, 2023

Summary

  1. Refactor moveos_stdlib::move_module and it's native functions, support replace_u8_constant, replace_u64_constant and replace_u256_constant. Related issues/prs: [MoveVM] Binding module address when module publishing #781 [MoveosStd] Bytecode module template #1002 Support replacing identifier, address and string constant in module bytecodes #1042
  2. Add an example examples/module_template/ to show how to replace identifiers and constants in modue byte codes and issue a new coin in just an entry function call.
  3. Add integration test for the example, check crates/testsuite/features/cmd.feature : Scenario: Issue a coin through entry function for detailed running commands.

Copy link

vercel bot commented Nov 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Nov 4, 2023 2:11pm

Copy link
Contributor

@jolestar jolestar left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +33 to +36
let template_bytes = x"a11ceb0b060000000b010012021220033250048201140596017e079402e50208f904800106f9057b0af4060e0c82077d0dff070200000101020202030204020503060307030800090c00000a0800030b0000040f0c0100010810080007110001080101170700000c000100000d020100051204050002130708010804140a08010808150c0d010806160e01010c0118101100071912010108051a01130100071b140d0108081c0215010c081616010108021d1701010803060409050b060b080b090b0a0b0b0b0c0b0d0602070802060c000107080202050b0501080001060c010501080102070802050107090001080401070b03010900010800020708040f010b0501090003070802050b05010900030b050108000b030108040c010a02010806040708020806080602010c020708020f010b03010804020708040b0501090003070802060c090022636f696e5f6d6f64756c655f6964656e7469666965725f706c616365686f6c64657206737472696e670f6163636f756e745f73746f7261676507636f6e74657874066f626a656374067369676e6572126163636f756e745f636f696e5f73746f726504636f696e0a636f696e5f73746f726522434f494e5f5354525543545f4944454e5449464945525f504c414345484f4c44455208547265617375727907436f6e746578740666617563657404696e69740b64756d6d795f6669656c64064f626a65637409436f696e53746f726504436f696e0a616464726573735f6f6611676c6f62616c5f626f72726f775f6d75740a626f72726f775f6d7574087769746864726177076465706f73697406537472696e6704757466380f72656769737465725f657874656e640d6d6f64756c655f7369676e65720b6d696e745f657874656e64116372656174655f636f696e5f73746f72650e676c6f62616c5f6d6f76655f746fdeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadead0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030201de0f20800283b61c0000000000000000000000000000000000000000000000000000000520deadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadeadead0a021615434f494e5f4e414d455f504c414345484f4c4445520a021817434f494e5f53594d424f4c5f504c414345484f4c4445520002010e01010201080b030108040001040003100b0111020c020a00070238000f0038014a102700000000000000000000000000000000000000000000000000000000000038020c030b000b020b03380302010000000f1a0a0007031107070411070700380438050c030a00070138060c010a0038070c020d0238010b0138080b000e030b021201380902010000";

let template_store = account_storage::global_borrow_mut<TemplateStore>(ctx, @rooch_examples);
table::add(&mut template_store.templates, name, template_bytes);
Copy link
Contributor

Choose a reason for hiding this comment

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

Put in the init()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As an example, I think it doesn't matter. My first thought is to make the name and temple_bytes as function parameters. But the template bytes is too long, which putted here maybe more clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

The example will auto-deploy to the devnet, and we can integrate it into the Dashboard.

#1109

@jolestar jolestar merged commit 9bca307 into rooch-network:main Nov 4, 2023
4 checks passed
@pause125 pause125 deleted the module_template branch November 8, 2023 00:37
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.

[Example] Issue a Coin without code
2 participants