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

migrate script to entry function #142

Merged
merged 5 commits into from
Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: ChainId
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: CheckpointScript
: StarcoinFramework
? address: "0x00000000000000000000000000000001"
name: Collection
: StarcoinFramework
Expand Down Expand Up @@ -321,7 +318,7 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: YieldFarmingV2
: StarcoinFramework
source_digest: 9171A59A0F735B5531F80C357F850D2E91F7C8887F6DDE36390713DBDCD4C41E
source_digest: F80E466423D53185036DF2CE624112C6CC3F22A7A3DBC3010A1B5556F5FAA544
build_flags:
dev_mode: false
test_mode: false
Expand Down
Binary file removed build/StarcoinFramework/abis/Block/checkpoint.abi
Binary file not shown.
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/Account.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/AccountScripts.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/Block.mv
Binary file not shown.
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/GenesisNFT.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/GenesisNFTScripts.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/IdentifierNFT.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/IdentifierNFTScripts.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/NFTGallery.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/NFTGalleryScripts.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/PriceOracle.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/PriceOracleScripts.mv
Binary file not shown.
191 changes: 171 additions & 20 deletions build/StarcoinFramework/docs/Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The module for the account resource that governs every account
- [Function `create_signer`](#0x1_Account_create_signer)
- [Function `create_account_with_initial_amount`](#0x1_Account_create_account_with_initial_amount)
- [Function `create_account_with_initial_amount_v2`](#0x1_Account_create_account_with_initial_amount_v2)
- [Function `create_account_with_initial_amount_entry`](#0x1_Account_create_account_with_initial_amount_entry)
- [Function `create_delegate_account`](#0x1_Account_create_delegate_account)
- [Function `generate_fresh_address`](#0x1_Account_generate_fresh_address)
- [Function `deposit_to_self`](#0x1_Account_deposit_to_self)
Expand All @@ -58,13 +59,17 @@ The module for the account resource that governs every account
- [Function `restore_key_rotation_capability`](#0x1_Account_restore_key_rotation_capability)
- [Function `destroy_key_rotation_capability`](#0x1_Account_destroy_key_rotation_capability)
- [Function `rotate_authentication_key`](#0x1_Account_rotate_authentication_key)
- [Function `rotate_authentication_key_entry`](#0x1_Account_rotate_authentication_key_entry)
- [Function `do_rotate_authentication_key`](#0x1_Account_do_rotate_authentication_key)
- [Function `balance_for`](#0x1_Account_balance_for)
- [Function `balance`](#0x1_Account_balance)
- [Function `do_accept_token`](#0x1_Account_do_accept_token)
- [Function `accept_token`](#0x1_Account_accept_token)
- [Function `accept_token_entry`](#0x1_Account_accept_token_entry)
- [Function `is_accepts_token`](#0x1_Account_is_accepts_token)
- [Function `is_accept_token`](#0x1_Account_is_accept_token)
- [Function `can_auto_accept_token`](#0x1_Account_can_auto_accept_token)
- [Function `set_auto_accept_token_entry`](#0x1_Account_set_auto_accept_token_entry)
- [Function `set_auto_accept_token`](#0x1_Account_set_auto_accept_token)
- [Function `try_accept_token`](#0x1_Account_try_accept_token)
- [Function `sequence_number_for_account`](#0x1_Account_sequence_number_for_account)
Expand All @@ -79,6 +84,7 @@ The module for the account resource that governs every account
- [Function `txn_prologue`](#0x1_Account_txn_prologue)
- [Function `txn_epilogue`](#0x1_Account_txn_epilogue)
- [Function `txn_epilogue_v2`](#0x1_Account_txn_epilogue_v2)
- [Function `remove_zero_balance_entry`](#0x1_Account_remove_zero_balance_entry)
- [Function `remove_zero_balance`](#0x1_Account_remove_zero_balance)
- [Function `make_event_store_if_not_exist`](#0x1_Account_make_event_store_if_not_exist)
- [Module Specification](#@Module_Specification_1)
Expand Down Expand Up @@ -1226,7 +1232,7 @@ reserved address for the MoveVM.

<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_create_account_with_initial_amount">create_account_with_initial_amount</a>&lt;TokenType: store&gt;(account: signer, fresh_address: <b>address</b>, _auth_key: vector&lt;u8&gt;, initial_amount: u128)
<b>acquires</b> <a href="Account.md#0x1_Account">Account</a>, <a href="Account.md#0x1_Account_Balance">Balance</a>, <a href="Account.md#0x1_Account_AutoAcceptToken">AutoAcceptToken</a> {
<a href="Account.md#0x1_Account_create_account_with_initial_amount_v2">create_account_with_initial_amount_v2</a>&lt;TokenType&gt;(account, fresh_address, initial_amount)
<a href="Account.md#0x1_Account_create_account_with_initial_amount_entry">create_account_with_initial_amount_entry</a>&lt;TokenType&gt;(account, fresh_address, initial_amount);
}
</code></pre>

Expand Down Expand Up @@ -1263,10 +1269,7 @@ reserved address for the MoveVM.

<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_create_account_with_initial_amount_v2">create_account_with_initial_amount_v2</a>&lt;TokenType: store&gt;(account: signer, fresh_address: <b>address</b>, initial_amount: u128)
<b>acquires</b> <a href="Account.md#0x1_Account">Account</a>, <a href="Account.md#0x1_Account_Balance">Balance</a>, <a href="Account.md#0x1_Account_AutoAcceptToken">AutoAcceptToken</a> {
<a href="Account.md#0x1_Account_create_account_with_address">create_account_with_address</a>&lt;TokenType&gt;(fresh_address);
<b>if</b> (initial_amount &gt; 0) {
<a href="Account.md#0x1_Account_pay_from">pay_from</a>&lt;TokenType&gt;(&account, fresh_address, initial_amount);
};
<a href="Account.md#0x1_Account_create_account_with_initial_amount_entry">create_account_with_initial_amount_entry</a>&lt;TokenType&gt;(account, fresh_address, initial_amount);
}
</code></pre>

Expand All @@ -1284,6 +1287,34 @@ reserved address for the MoveVM.



</details>

<a name="0x1_Account_create_account_with_initial_amount_entry"></a>

## Function `create_account_with_initial_amount_entry`



<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_create_account_with_initial_amount_entry">create_account_with_initial_amount_entry</a>&lt;TokenType: store&gt;(account: signer, fresh_address: <b>address</b>, initial_amount: u128)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_create_account_with_initial_amount_entry">create_account_with_initial_amount_entry</a>&lt;TokenType: store&gt;(account: signer, fresh_address: <b>address</b>, initial_amount: u128)
<b>acquires</b> <a href="Account.md#0x1_Account">Account</a>, <a href="Account.md#0x1_Account_Balance">Balance</a>, <a href="Account.md#0x1_Account_AutoAcceptToken">AutoAcceptToken</a> {
<a href="Account.md#0x1_Account_create_account_with_address">create_account_with_address</a>&lt;TokenType&gt;(fresh_address);
<b>if</b> (initial_amount &gt; 0) {
<a href="Account.md#0x1_Account_pay_from">pay_from</a>&lt;TokenType&gt;(&account, fresh_address, initial_amount);
};
}
</code></pre>



</details>

<a name="0x1_Account_create_delegate_account"></a>
Expand Down Expand Up @@ -2341,20 +2372,7 @@ Return the key rotation capability to the account it originally came from


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_rotate_authentication_key">rotate_authentication_key</a>(account: signer, new_key: vector&lt;u8&gt;) <b>acquires</b> <a href="Account.md#0x1_Account">Account</a>, <a href="Account.md#0x1_Account_EventStore">EventStore</a> {
<b>let</b> key_rotation_capability = <a href="Account.md#0x1_Account_extract_key_rotation_capability">extract_key_rotation_capability</a>(&account);
<a href="Account.md#0x1_Account_rotate_authentication_key_with_capability">rotate_authentication_key_with_capability</a>(&key_rotation_capability, <b>copy</b> new_key);
<a href="Account.md#0x1_Account_restore_key_rotation_capability">restore_key_rotation_capability</a>(key_rotation_capability);

<a href="Account.md#0x1_Account_make_event_store_if_not_exist">make_event_store_if_not_exist</a>(&account);
<b>let</b> signer_addr = <a href="Signer.md#0x1_Signer_address_of">Signer::address_of</a>(&account);
<b>let</b> event_store = <b>borrow_global_mut</b>&lt;<a href="Account.md#0x1_Account_EventStore">EventStore</a>&gt;(signer_addr);
<a href="Event.md#0x1_Event_emit_event">Event::emit_event</a>&lt;<a href="Account.md#0x1_Account_RotateAuthKeyEvent">RotateAuthKeyEvent</a>&gt;(
&<b>mut</b> event_store.rotate_auth_key_events,
<a href="Account.md#0x1_Account_RotateAuthKeyEvent">RotateAuthKeyEvent</a> {
account_address: signer_addr,
new_auth_key: new_key,
}
);
<a href="Account.md#0x1_Account_rotate_authentication_key_entry">rotate_authentication_key_entry</a>(account, new_key);
}
</code></pre>

Expand All @@ -2372,6 +2390,67 @@ Return the key rotation capability to the account it originally came from



</details>

<a name="0x1_Account_rotate_authentication_key_entry"></a>

## Function `rotate_authentication_key_entry`



<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_rotate_authentication_key_entry">rotate_authentication_key_entry</a>(account: signer, new_key: vector&lt;u8&gt;)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_rotate_authentication_key_entry">rotate_authentication_key_entry</a>(account: signer, new_key: vector&lt;u8&gt;) <b>acquires</b> <a href="Account.md#0x1_Account">Account</a>, <a href="Account.md#0x1_Account_EventStore">EventStore</a> {
<a href="Account.md#0x1_Account_do_rotate_authentication_key">do_rotate_authentication_key</a>(&account, new_key);
}
</code></pre>



</details>

<a name="0x1_Account_do_rotate_authentication_key"></a>

## Function `do_rotate_authentication_key`



<pre><code><b>public</b> <b>fun</b> <a href="Account.md#0x1_Account_do_rotate_authentication_key">do_rotate_authentication_key</a>(account: &signer, new_key: vector&lt;u8&gt;)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Account.md#0x1_Account_do_rotate_authentication_key">do_rotate_authentication_key</a>(account: &signer, new_key: vector&lt;u8&gt;) <b>acquires</b> <a href="Account.md#0x1_Account">Account</a>, <a href="Account.md#0x1_Account_EventStore">EventStore</a> {
<b>let</b> key_rotation_capability = <a href="Account.md#0x1_Account_extract_key_rotation_capability">extract_key_rotation_capability</a>(account);
<a href="Account.md#0x1_Account_rotate_authentication_key_with_capability">rotate_authentication_key_with_capability</a>(&key_rotation_capability, <b>copy</b> new_key);
<a href="Account.md#0x1_Account_restore_key_rotation_capability">restore_key_rotation_capability</a>(key_rotation_capability);

<a href="Account.md#0x1_Account_make_event_store_if_not_exist">make_event_store_if_not_exist</a>(account);
<b>let</b> signer_addr = <a href="Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>let</b> event_store = <b>borrow_global_mut</b>&lt;<a href="Account.md#0x1_Account_EventStore">EventStore</a>&gt;(signer_addr);
<a href="Event.md#0x1_Event_emit_event">Event::emit_event</a>&lt;<a href="Account.md#0x1_Account_RotateAuthKeyEvent">RotateAuthKeyEvent</a>&gt;(
&<b>mut</b> event_store.rotate_auth_key_events,
<a href="Account.md#0x1_Account_RotateAuthKeyEvent">RotateAuthKeyEvent</a> {
account_address: signer_addr,
new_auth_key: new_key,
}
);
}
</code></pre>



</details>

<a name="0x1_Account_balance_for"></a>
Expand Down Expand Up @@ -2504,7 +2583,7 @@ Add a balance of <code><a href="Token.md#0x1_Token">Token</a></code> type to the


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_accept_token">accept_token</a>&lt;TokenType: store&gt;(account: signer) <b>acquires</b> <a href="Account.md#0x1_Account">Account</a> {
<a href="Account.md#0x1_Account_do_accept_token">do_accept_token</a>&lt;TokenType&gt;(&account);
<a href="Account.md#0x1_Account_accept_token_entry">accept_token_entry</a>&lt;TokenType&gt;(account);
}
</code></pre>

Expand All @@ -2522,6 +2601,30 @@ Add a balance of <code><a href="Token.md#0x1_Token">Token</a></code> type to the



</details>

<a name="0x1_Account_accept_token_entry"></a>

## Function `accept_token_entry`



<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_accept_token_entry">accept_token_entry</a>&lt;TokenType: store&gt;(account: signer)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_accept_token_entry">accept_token_entry</a>&lt;TokenType: store&gt;(account: signer) <b>acquires</b> <a href="Account.md#0x1_Account">Account</a> {
<a href="Account.md#0x1_Account_do_accept_token">do_accept_token</a>&lt;TokenType&gt;(&account);
}
</code></pre>



</details>

<a name="0x1_Account_is_accepts_token"></a>
Expand Down Expand Up @@ -2635,6 +2738,30 @@ Check whether the address can auto accept token.



</details>

<a name="0x1_Account_set_auto_accept_token_entry"></a>

## Function `set_auto_accept_token_entry`



<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_set_auto_accept_token_entry">set_auto_accept_token_entry</a>(account: signer, enable: bool)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_set_auto_accept_token_entry">set_auto_accept_token_entry</a>(account: signer, enable: bool) <b>acquires</b> <a href="Account.md#0x1_Account_AutoAcceptToken">AutoAcceptToken</a> {
<a href="Account.md#0x1_Account_set_auto_accept_token">set_auto_accept_token</a>(&account, enable);
}
</code></pre>



</details>

<a name="0x1_Account_set_auto_accept_token"></a>
Expand Down Expand Up @@ -3267,6 +3394,30 @@ It collects gas and bumps the sequence number



</details>

<a name="0x1_Account_remove_zero_balance_entry"></a>

## Function `remove_zero_balance_entry`



<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_remove_zero_balance_entry">remove_zero_balance_entry</a>&lt;TokenType: store&gt;(account: signer)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="Account.md#0x1_Account_remove_zero_balance_entry">remove_zero_balance_entry</a>&lt;TokenType: store&gt;(account: signer) <b>acquires</b> <a href="Account.md#0x1_Account_Balance">Balance</a> {
<a href="Account.md#0x1_Account_remove_zero_balance">remove_zero_balance</a>&lt;TokenType&gt;(&account);
}
</code></pre>



</details>

<a name="0x1_Account_remove_zero_balance"></a>
Expand Down
6 changes: 3 additions & 3 deletions build/StarcoinFramework/docs/AccountScripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The script function is reenterable.


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="AccountScripts.md#0x1_AccountScripts_enable_auto_accept_token">enable_auto_accept_token</a>(account: signer) {
<a href="Account.md#0x1_Account_set_auto_accept_token">Account::set_auto_accept_token</a>(&account, <b>true</b>);
<a href="Account.md#0x1_Account_set_auto_accept_token_entry">Account::set_auto_accept_token_entry</a>(account, <b>true</b>);
}
</code></pre>

Expand All @@ -59,7 +59,7 @@ The script function is reenterable.


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="AccountScripts.md#0x1_AccountScripts_disable_auto_accept_token">disable_auto_accept_token</a>(account: signer) {
<a href="Account.md#0x1_Account_set_auto_accept_token">Account::set_auto_accept_token</a>(&account, <b>false</b>);
<a href="Account.md#0x1_Account_set_auto_accept_token_entry">Account::set_auto_accept_token_entry</a>(account, <b>false</b>);
}
</code></pre>

Expand All @@ -84,7 +84,7 @@ Remove zero Balance


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="AccountScripts.md#0x1_AccountScripts_remove_zero_balance">remove_zero_balance</a>&lt;TokenType: store&gt;(account: signer) {
<a href="Account.md#0x1_Account_remove_zero_balance">Account::remove_zero_balance</a>&lt;TokenType&gt;(&account);
<a href="Account.md#0x1_Account_remove_zero_balance_entry">Account::remove_zero_balance_entry</a>&lt;TokenType&gt;(account);
}
</code></pre>

Expand Down
Loading