Skip to content

Commit

Permalink
revert code style for modify
Browse files Browse the repository at this point in the history
  • Loading branch information
welbon committed Mar 18, 2024
1 parent 4b72a56 commit eee7465
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compiled_package_info:
StarcoinAssociation: "0x0000000000000000000000000a550c18"
StarcoinFramework: "0x00000000000000000000000000000001"
VMReserved: "0x00000000000000000000000000000000"
source_digest: B92CA5625D9DE8DF70531D0180453DE29FF1E7218117822A15BB8D4E01BF8F01
source_digest: FF334A443259E7C9400053A6C2A1B2F0D3BEBCBD9D860F3B018C85763C1A5990
build_flags:
dev_mode: false
test_mode: false
Expand Down
25 changes: 9 additions & 16 deletions build/StarcoinFramework/docs/StdlibUpgradeScripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Module `0x1::StdlibUpgradeScripts`

The module for StdlibUpgrade init scripts


- [Function `upgrade_from_v2_to_v3`](#0x1_StdlibUpgradeScripts_upgrade_from_v2_to_v3)
Expand Down Expand Up @@ -62,24 +63,18 @@ Stdlib upgrade script from v2 to v3
<summary>Implementation</summary>


<pre><code><b>public</b> entry <b>fun</b> <a href="StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts_upgrade_from_v2_to_v3">upgrade_from_v2_to_v3</a>(account: signer, total_stc_amount: u128) {
<pre><code><b>public</b> entry <b>fun</b> <a href="StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts_upgrade_from_v2_to_v3">upgrade_from_v2_to_v3</a>(account: signer, total_stc_amount: u128 ) {
<a href="CoreAddresses.md#0x1_CoreAddresses_assert_genesis_address">CoreAddresses::assert_genesis_address</a>(&account);

<b>let</b> withdraw_cap = <a href="STC.md#0x1_STC_upgrade_from_v1_to_v2">STC::upgrade_from_v1_to_v2</a>(&account, total_stc_amount);

<b>let</b> mint_keys = <a href="Collection.md#0x1_Collection_borrow_collection">Collection::borrow_collection</a>&lt;LinearTimeMintKey&lt;<a href="STC.md#0x1_STC">STC</a>&gt;&gt;(
<a href="CoreAddresses.md#0x1_CoreAddresses_ASSOCIATION_ROOT_ADDRESS">CoreAddresses::ASSOCIATION_ROOT_ADDRESS</a>()
);
<b>let</b> mint_keys = <a href="Collection.md#0x1_Collection_borrow_collection">Collection::borrow_collection</a>&lt;LinearTimeMintKey&lt;<a href="STC.md#0x1_STC">STC</a>&gt;&gt;(<a href="CoreAddresses.md#0x1_CoreAddresses_ASSOCIATION_ROOT_ADDRESS">CoreAddresses::ASSOCIATION_ROOT_ADDRESS</a>());
<b>let</b> mint_key = <a href="Collection.md#0x1_Collection_borrow">Collection::borrow</a>(&mint_keys, 0);
<b>let</b> (total, minted, start_time, period) = <a href="Token.md#0x1_Token_read_linear_time_key">Token::read_linear_time_key</a>(mint_key);
<a href="Collection.md#0x1_Collection_return_collection">Collection::return_collection</a>(mint_keys);

<b>let</b> now = <a href="Timestamp.md#0x1_Timestamp_now_seconds">Timestamp::now_seconds</a>();
<b>let</b> linear_withdraw_cap = <a href="Treasury.md#0x1_Treasury_issue_linear_withdraw_capability">Treasury::issue_linear_withdraw_capability</a>(
&<b>mut</b> withdraw_cap,
total - minted,
period - (now - start_time)
);
<b>let</b> linear_withdraw_cap = <a href="Treasury.md#0x1_Treasury_issue_linear_withdraw_capability">Treasury::issue_linear_withdraw_capability</a>(&<b>mut</b> withdraw_cap, total-minted, period - (now - start_time));
// Lock the TreasuryWithdrawCapability <b>to</b> <a href="Dao.md#0x1_Dao">Dao</a>
<a href="TreasuryWithdrawDaoProposal.md#0x1_TreasuryWithdrawDaoProposal_plugin">TreasuryWithdrawDaoProposal::plugin</a>(&account, withdraw_cap);
// Give a LinearWithdrawCapability <a href="Offer.md#0x1_Offer">Offer</a> <b>to</b> association, association need <b>to</b> take the offer, and destroy <b>old</b> LinearTimeMintKey.
Expand Down Expand Up @@ -107,7 +102,7 @@ association account should call this script after upgrade from v2 to v3.
<summary>Implementation</summary>


<pre><code><b>public</b> entry <b>fun</b> <a href="StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts_take_linear_withdraw_capability">take_linear_withdraw_capability</a>(signer: signer) {
<pre><code><b>public</b> entry <b>fun</b> <a href="StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts_take_linear_withdraw_capability">take_linear_withdraw_capability</a>(signer: signer){
<b>let</b> offered = <a href="Offer.md#0x1_Offer_redeem">Offer::redeem</a>&lt;LinearWithdrawCapability&lt;<a href="STC.md#0x1_STC">STC</a>&gt;&gt;(&signer, <a href="CoreAddresses.md#0x1_CoreAddresses_GENESIS_ADDRESS">CoreAddresses::GENESIS_ADDRESS</a>());
<a href="Treasury.md#0x1_Treasury_add_linear_withdraw_capability">Treasury::add_linear_withdraw_capability</a>(&signer, offered);
<b>let</b> mint_key = <a href="Collection.md#0x1_Collection_take">Collection::take</a>&lt;LinearTimeMintKey&lt;<a href="STC.md#0x1_STC">STC</a>&gt;&gt;(&signer);
Expand Down Expand Up @@ -349,14 +344,12 @@ deprecated, use <code>do_upgrade_from_v6_to_v7_with_language_version</code>.

<pre><code><b>public</b> <b>fun</b> <a href="StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts_do_upgrade_from_v11_to_v12">do_upgrade_from_v11_to_v12</a>(sender: &signer) {
{
<a href="GasSchedule.md#0x1_GasSchedule_initialize">GasSchedule::initialize</a>(sender, <a href="GasSchedule.md#0x1_GasSchedule_new_gas_schedule">GasSchedule::new_gas_schedule</a>());
<a href="GasSchedule.md#0x1_GasSchedule_initialize">GasSchedule::initialize</a>(sender,<a href="GasSchedule.md#0x1_GasSchedule_new_gas_schedule">GasSchedule::new_gas_schedule</a>());
<b>let</b> <b>address</b> = @0x8c109349c6bd91411d6bc962e080c4a3;
<a href="EasyGas.md#0x1_EasyGas_initialize">EasyGas::initialize</a>(
sender,
<a href="EasyGas.md#0x1_EasyGas_initialize">EasyGas::initialize</a>(sender,
<b>address</b>,
b"STAR", b"STAR",
<b>address</b>
);
b"STAR",b"STAR",
<b>address</b>);
<a href="Block.md#0x1_Block_checkpoints_init">Block::checkpoints_init</a>(sender);
};
}
Expand Down
Binary file modified build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm
Binary file not shown.
6 changes: 3 additions & 3 deletions sources/StdlibUpgradeScripts.move
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ module StdlibUpgradeScripts {
};
}

public entry fun do_upgrade_from_v12_to_v13(sender: &signer) {
CoreAddresses::assert_genesis_address(sender);
public entry fun do_upgrade_from_v12_to_v13(sender: signer) {
CoreAddresses::assert_genesis_address(&sender);

// Burn all illegal tokens from frozen list
let frozen_acl = FrozenConfigStrategy::frozen_list_v1();
let acl_vec = ACL::get_vector(&frozen_acl);
let i = 0;
while (i < Vector::length(&acl_vec)) {
STC::burn(Account::withdraw_illige_token<STC>(sender, *Vector::borrow(&acl_vec, i)));
STC::burn(Account::withdraw_illige_token<STC>(&sender, *Vector::borrow(&acl_vec, i)));
i = i + 1;
}
}
Expand Down

0 comments on commit eee7465

Please sign in to comment.