diff --git a/.gitattributes b/.gitattributes index 8b137891..3e86637f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ - +# Best-effort syntax highlighting for Move: just use Rust highlighter +*.move linguist-language=Rust diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 0dd9e67d..d3cb8f47 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -3,7 +3,6 @@ on: pull_request: branches: - main - - genesis_dao jobs: build-and-test: @@ -21,7 +20,7 @@ jobs: profile: minimal - name: setup environment run: | - bash scripts/dev_setup.sh -b -t -y -p + bash scripts/dev_setup.sh -b -t -y -p - name: test run: | source "$HOME/.profile" @@ -29,7 +28,7 @@ jobs: - name: integration test run: | source "$HOME/.profile" - mpm integration-test --current-as-stdlib + mpm integration-test - name: move-prover-test run: | source "$HOME/.profile" @@ -40,4 +39,4 @@ jobs: source "$HOME/.profile" bash ./scripts/build.sh - name: check changed files - run: bash ./scripts/changed_files.sh + run: bash ./scripts/changed_files.sh \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7716a27e..aa6aa3ab 100644 --- a/.gitignore +++ b/.gitignore @@ -42,7 +42,6 @@ packages-microsoft-prod.deb # Move Build Output sources build/StarcoinFramework/sources/*.move -StarcoinFramework build/UnitTest # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries diff --git a/.starcoin-ide/config b/.starcoin-ide/config deleted file mode 100644 index 82c22df2..00000000 --- a/.starcoin-ide/config +++ /dev/null @@ -1,5 +0,0 @@ -[mpm.package.build] -OPTIONS=["--doc", "--abi", "--force"] - -[mpm.integration-test] -OPTIONS=["--current-as-stdlib"] \ No newline at end of file diff --git a/README.md b/README.md index ad544359..c2501b63 100644 --- a/README.md +++ b/README.md @@ -12,20 +12,6 @@ - [latest](./build/StarcoinFramework/docs) - [v11](./release/v11/docs) -## Usage - -Add `address` and `dependency` to the project's Move.toml - -``` -[addresses] -StarcoinFramework = "0x1" - -[dependencies] -StarcoinFramework = {git = "https://github.com/starcoinorg/starcoin-framework.git", rev="cf1deda180af40a8b3e26c0c7b548c4c290cd7e7"} -``` - -* v11 git version: cf1deda180af40a8b3e26c0c7b548c4c290cd7e7 - ## Build and Test Setup dev environment: @@ -72,11 +58,11 @@ Contributions in the following are welcome: 1. Add New Move module to `sources` dir, such as `MyModule.move`. 2. Write Move code and add unit test in the module file. -3. Add an integration test to [integration-tests](./integration-tests) dir, such as: `test_my_module.move`. +3. Add an integration test to [integration-tests](../integration-tests) dir, such as: `test_my_module.move`. 4. Run the integration test `mpm integration-test test_my_module.move `. 5. Run script `./script/build.sh` for build and generate documents. 6. Commit the changes and create a pull request. -If you are not sure that the module belongs to starcoin-framework, please submit it to [move-funs](https://github.com/movefuns/movefuns) first. +If you are not sure that the module belongs to starcoin-framework, please submit it to [starcoin-framework-commons](https://github.com/starcoinorg/starcoin-framework-commons) first. You can view our [Code of Conduct](./CODE_OF_CONDUCT.md). diff --git a/release/v12/BuildInfo.yaml b/build/StarcoinFramework/BuildInfo.yaml similarity index 75% rename from release/v12/BuildInfo.yaml rename to build/StarcoinFramework/BuildInfo.yaml index 6c1f4789..78e85dbd 100644 --- a/release/v12/BuildInfo.yaml +++ b/build/StarcoinFramework/BuildInfo.yaml @@ -6,18 +6,12 @@ compiled_package_info: StarcoinFramework: "0x00000000000000000000000000000001" VMReserved: "0x00000000000000000000000000000000" module_resolution_metadata: - ? address: "0x00000000000000000000000000000001" - name: ASCII - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Account : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: AccountScripts : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: AnyMemberPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Arith : StarcoinFramework @@ -51,9 +45,6 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: Config : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: ConfigProposalPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: ConsensusConfig : StarcoinFramework @@ -63,21 +54,6 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: CoreAddresses : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: DAOAccount - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: DAOExtensionPoint - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: DAOPluginMarketplace - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: DAORegistry - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: DAOSpace - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Dao : StarcoinFramework @@ -108,18 +84,9 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: Event : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: EventUtil - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: FixedPoint32 : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: GasOracle - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: GasOracleProposalPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Genesis : StarcoinFramework @@ -132,9 +99,6 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: GenesisSignerCapability : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: GrantProposalPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Hash : StarcoinFramework @@ -144,18 +108,12 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: IdentifierNFTScripts : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: InstallPluginProposalPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: LanguageVersion : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Math : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: MemberProposalPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: MerkleNFTDistributor : StarcoinFramework @@ -165,9 +123,6 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: MintDaoProposal : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: MintProposalPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: MintScripts : StarcoinFramework @@ -195,9 +150,6 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: OnChainConfigScripts : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: OnChainStarcoinDAOConfig - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Option : StarcoinFramework @@ -219,12 +171,6 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: RewardConfig : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: Ring - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: SBTVoteStrategy - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: SIP_2 : StarcoinFramework @@ -249,27 +195,9 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: Signer : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: SimpleMap - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: SnapshotUtil - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: StakeToSBTPlugin - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: StarcoinDAO - : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: StarcoinVerifier - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: StdlibUpgradeScripts : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: StructuredHash - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: Timestamp : StarcoinFramework @@ -297,27 +225,18 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: Treasury : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: TreasuryPlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: TreasuryScripts : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: TreasuryWithdrawDaoProposal : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: TypeInfo - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: U256 : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: UpgradeModuleDaoProposal : StarcoinFramework - ? address: "0x00000000000000000000000000000001" - name: UpgradeModulePlugin - : StarcoinFramework ? address: "0x00000000000000000000000000000001" name: VMConfig : StarcoinFramework @@ -333,7 +252,7 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: YieldFarmingV2 : StarcoinFramework - source_digest: E90F2F8FC8A933897A28C415C88680705ED69370B7BE7AE1025E9CE037CE07FC + source_digest: DC688BF938B40FD9B3D5BE2F97C93640AC08F67382227622875406514244667D build_flags: dev_mode: false test_mode: false diff --git a/build/StarcoinFramework/abis/Genesis/initialize.abi b/build/StarcoinFramework/abis/Genesis/initialize.abi index 6ec0ef0c..a2f881ae 100644 Binary files a/build/StarcoinFramework/abis/Genesis/initialize.abi and b/build/StarcoinFramework/abis/Genesis/initialize.abi differ diff --git a/build/StarcoinFramework/abis/Offer/take_offer.abi b/build/StarcoinFramework/abis/Offer/take_offer.abi index d601d280..a9ad0fa8 100644 Binary files a/build/StarcoinFramework/abis/Offer/take_offer.abi and b/build/StarcoinFramework/abis/Offer/take_offer.abi differ diff --git a/build/StarcoinFramework/abis/StdlibUpgradeScripts/upgrade_from_v11_to_v12.abi b/build/StarcoinFramework/abis/StdlibUpgradeScripts/upgrade_from_v11_to_v12.abi deleted file mode 100644 index 4e6f60b3..00000000 Binary files a/build/StarcoinFramework/abis/StdlibUpgradeScripts/upgrade_from_v11_to_v12.abi and /dev/null differ diff --git a/build/StarcoinFramework/bytecode_modules/Account.mv b/build/StarcoinFramework/bytecode_modules/Account.mv index 4e1d4368..35c1be98 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Account.mv and b/build/StarcoinFramework/bytecode_modules/Account.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/AccountScripts.mv b/build/StarcoinFramework/bytecode_modules/AccountScripts.mv index 4f709474..f2f9121c 100644 Binary files a/build/StarcoinFramework/bytecode_modules/AccountScripts.mv and b/build/StarcoinFramework/bytecode_modules/AccountScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Authenticator.mv b/build/StarcoinFramework/bytecode_modules/Authenticator.mv index 9626d9c1..2c4afcf2 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Authenticator.mv and b/build/StarcoinFramework/bytecode_modules/Authenticator.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/BCS.mv b/build/StarcoinFramework/bytecode_modules/BCS.mv index 83ccc945..262389f2 100644 Binary files a/build/StarcoinFramework/bytecode_modules/BCS.mv and b/build/StarcoinFramework/bytecode_modules/BCS.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Block.mv b/build/StarcoinFramework/bytecode_modules/Block.mv index a7fdecd2..c6049e5e 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Block.mv and b/build/StarcoinFramework/bytecode_modules/Block.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/BlockReward.mv b/build/StarcoinFramework/bytecode_modules/BlockReward.mv index e7027b75..eb9ba50f 100644 Binary files a/build/StarcoinFramework/bytecode_modules/BlockReward.mv and b/build/StarcoinFramework/bytecode_modules/BlockReward.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Compare.mv b/build/StarcoinFramework/bytecode_modules/Compare.mv index 9fc383b4..670997b1 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Compare.mv and b/build/StarcoinFramework/bytecode_modules/Compare.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/EVMAddress.mv b/build/StarcoinFramework/bytecode_modules/EVMAddress.mv index 5d447d73..b1f33ef7 100644 Binary files a/build/StarcoinFramework/bytecode_modules/EVMAddress.mv and b/build/StarcoinFramework/bytecode_modules/EVMAddress.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Event.mv b/build/StarcoinFramework/bytecode_modules/Event.mv index cfcb7069..95c907ad 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Event.mv and b/build/StarcoinFramework/bytecode_modules/Event.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Genesis.mv b/build/StarcoinFramework/bytecode_modules/Genesis.mv index 67dd4287..ac1c22e9 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Genesis.mv and b/build/StarcoinFramework/bytecode_modules/Genesis.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/GenesisNFT.mv b/build/StarcoinFramework/bytecode_modules/GenesisNFT.mv index 48c1bbde..76dd0b7a 100644 Binary files a/build/StarcoinFramework/bytecode_modules/GenesisNFT.mv and b/build/StarcoinFramework/bytecode_modules/GenesisNFT.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/GenesisNFTScripts.mv b/build/StarcoinFramework/bytecode_modules/GenesisNFTScripts.mv index 3aa46b0b..7ee755dd 100644 Binary files a/build/StarcoinFramework/bytecode_modules/GenesisNFTScripts.mv and b/build/StarcoinFramework/bytecode_modules/GenesisNFTScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/GenesisSignerCapability.mv b/build/StarcoinFramework/bytecode_modules/GenesisSignerCapability.mv index 8f2da435..d2321ed4 100644 Binary files a/build/StarcoinFramework/bytecode_modules/GenesisSignerCapability.mv and b/build/StarcoinFramework/bytecode_modules/GenesisSignerCapability.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/IdentifierNFT.mv b/build/StarcoinFramework/bytecode_modules/IdentifierNFT.mv index 816454d7..4965211c 100644 Binary files a/build/StarcoinFramework/bytecode_modules/IdentifierNFT.mv and b/build/StarcoinFramework/bytecode_modules/IdentifierNFT.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/IdentifierNFTScripts.mv b/build/StarcoinFramework/bytecode_modules/IdentifierNFTScripts.mv index 23ca97d3..5a4879c7 100644 Binary files a/build/StarcoinFramework/bytecode_modules/IdentifierNFTScripts.mv and b/build/StarcoinFramework/bytecode_modules/IdentifierNFTScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv deleted file mode 100644 index 511e0a87..00000000 Binary files a/build/StarcoinFramework/bytecode_modules/InstallPluginProposalPlugin.mv and /dev/null differ diff --git a/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv b/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv deleted file mode 100644 index 3e83c189..00000000 Binary files a/build/StarcoinFramework/bytecode_modules/MemberProposalPlugin.mv and /dev/null differ diff --git a/build/StarcoinFramework/bytecode_modules/MerkleNFTDistributor.mv b/build/StarcoinFramework/bytecode_modules/MerkleNFTDistributor.mv index c37a0416..c384493f 100644 Binary files a/build/StarcoinFramework/bytecode_modules/MerkleNFTDistributor.mv and b/build/StarcoinFramework/bytecode_modules/MerkleNFTDistributor.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/ModifyDaoConfigProposal.mv b/build/StarcoinFramework/bytecode_modules/ModifyDaoConfigProposal.mv index 5c00c614..5f2ff88a 100644 Binary files a/build/StarcoinFramework/bytecode_modules/ModifyDaoConfigProposal.mv and b/build/StarcoinFramework/bytecode_modules/ModifyDaoConfigProposal.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/ModuleUpgradeScripts.mv b/build/StarcoinFramework/bytecode_modules/ModuleUpgradeScripts.mv index 1bfea8bd..58cd57f1 100644 Binary files a/build/StarcoinFramework/bytecode_modules/ModuleUpgradeScripts.mv and b/build/StarcoinFramework/bytecode_modules/ModuleUpgradeScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/NFTGallery.mv b/build/StarcoinFramework/bytecode_modules/NFTGallery.mv index 9f3fb03e..14374d03 100644 Binary files a/build/StarcoinFramework/bytecode_modules/NFTGallery.mv and b/build/StarcoinFramework/bytecode_modules/NFTGallery.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/NFTGalleryScripts.mv b/build/StarcoinFramework/bytecode_modules/NFTGalleryScripts.mv index d7954ee6..8b82da2e 100644 Binary files a/build/StarcoinFramework/bytecode_modules/NFTGalleryScripts.mv and b/build/StarcoinFramework/bytecode_modules/NFTGalleryScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Offer.mv b/build/StarcoinFramework/bytecode_modules/Offer.mv index c8216dd6..69425dab 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Offer.mv and b/build/StarcoinFramework/bytecode_modules/Offer.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/OnChainConfigDao.mv b/build/StarcoinFramework/bytecode_modules/OnChainConfigDao.mv index 5e578fd1..61110fcf 100644 Binary files a/build/StarcoinFramework/bytecode_modules/OnChainConfigDao.mv and b/build/StarcoinFramework/bytecode_modules/OnChainConfigDao.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Oracle.mv b/build/StarcoinFramework/bytecode_modules/Oracle.mv index b2ef22b9..fac74536 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Oracle.mv and b/build/StarcoinFramework/bytecode_modules/Oracle.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv b/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv index de91a6bd..1c27d3b9 100644 Binary files a/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv and b/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/PriceOracle.mv b/build/StarcoinFramework/bytecode_modules/PriceOracle.mv index 3fca8abf..ce5b5f7b 100644 Binary files a/build/StarcoinFramework/bytecode_modules/PriceOracle.mv and b/build/StarcoinFramework/bytecode_modules/PriceOracle.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/PriceOracleScripts.mv b/build/StarcoinFramework/bytecode_modules/PriceOracleScripts.mv index c433d2c0..ead679c0 100644 Binary files a/build/StarcoinFramework/bytecode_modules/PriceOracleScripts.mv and b/build/StarcoinFramework/bytecode_modules/PriceOracleScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Ring.mv b/build/StarcoinFramework/bytecode_modules/Ring.mv deleted file mode 100644 index d14fabef..00000000 Binary files a/build/StarcoinFramework/bytecode_modules/Ring.mv and /dev/null differ diff --git a/build/StarcoinFramework/bytecode_modules/STC.mv b/build/StarcoinFramework/bytecode_modules/STC.mv index 83f51548..281eb50f 100644 Binary files a/build/StarcoinFramework/bytecode_modules/STC.mv and b/build/StarcoinFramework/bytecode_modules/STC.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Signature.mv b/build/StarcoinFramework/bytecode_modules/Signature.mv index a5743312..b28c15e4 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Signature.mv and b/build/StarcoinFramework/bytecode_modules/Signature.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/SignedInteger64.mv b/build/StarcoinFramework/bytecode_modules/SignedInteger64.mv index 366352d8..d11b7f7a 100644 Binary files a/build/StarcoinFramework/bytecode_modules/SignedInteger64.mv and b/build/StarcoinFramework/bytecode_modules/SignedInteger64.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/StarcoinVerifier.mv b/build/StarcoinFramework/bytecode_modules/StarcoinVerifier.mv deleted file mode 100644 index 2151161e..00000000 Binary files a/build/StarcoinFramework/bytecode_modules/StarcoinVerifier.mv and /dev/null differ diff --git a/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv b/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv index 9d3125c8..55b53b9d 100644 Binary files a/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv and b/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/StructuredHash.mv b/build/StarcoinFramework/bytecode_modules/StructuredHash.mv deleted file mode 100644 index 5ff2d183..00000000 Binary files a/build/StarcoinFramework/bytecode_modules/StructuredHash.mv and /dev/null differ diff --git a/build/StarcoinFramework/bytecode_modules/Token.mv b/build/StarcoinFramework/bytecode_modules/Token.mv index 57123b45..09f0518f 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Token.mv and b/build/StarcoinFramework/bytecode_modules/Token.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/TransactionManager.mv b/build/StarcoinFramework/bytecode_modules/TransactionManager.mv index 7ba1dba8..6c44b85e 100644 Binary files a/build/StarcoinFramework/bytecode_modules/TransactionManager.mv and b/build/StarcoinFramework/bytecode_modules/TransactionManager.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/TreasuryWithdrawDaoProposal.mv b/build/StarcoinFramework/bytecode_modules/TreasuryWithdrawDaoProposal.mv index d5e8e732..d6257ff4 100644 Binary files a/build/StarcoinFramework/bytecode_modules/TreasuryWithdrawDaoProposal.mv and b/build/StarcoinFramework/bytecode_modules/TreasuryWithdrawDaoProposal.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/U256.mv b/build/StarcoinFramework/bytecode_modules/U256.mv index f93df531..0d9c2da9 100644 Binary files a/build/StarcoinFramework/bytecode_modules/U256.mv and b/build/StarcoinFramework/bytecode_modules/U256.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/UpgradeModuleDaoProposal.mv b/build/StarcoinFramework/bytecode_modules/UpgradeModuleDaoProposal.mv index a09eefb5..e93b0392 100644 Binary files a/build/StarcoinFramework/bytecode_modules/UpgradeModuleDaoProposal.mv and b/build/StarcoinFramework/bytecode_modules/UpgradeModuleDaoProposal.mv differ diff --git a/build/StarcoinFramework/docs/Account.md b/build/StarcoinFramework/docs/Account.md index 50885860..5aa8ee74 100644 --- a/build/StarcoinFramework/docs/Account.md +++ b/build/StarcoinFramework/docs/Account.md @@ -22,7 +22,6 @@ The module for the account resource that governs every account - [Resource `EventStore`](#0x1_Account_EventStore) - [Constants](#@Constants_0) - [Function `remove_signer_capability`](#0x1_Account_remove_signer_capability) -- [Function `get_genesis_capability`](#0x1_Account_get_genesis_capability) - [Function `create_signer_with_cap`](#0x1_Account_create_signer_with_cap) - [Function `destroy_signer_cap`](#0x1_Account_destroy_signer_cap) - [Function `signer_address`](#0x1_Account_signer_address) @@ -35,9 +34,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) - [Function `deposit`](#0x1_Account_deposit) - [Function `deposit_with_metadata`](#0x1_Account_deposit_with_metadata) @@ -59,17 +56,13 @@ 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) @@ -82,12 +75,8 @@ The module for the account resource that governs every account - [Function `exists_at`](#0x1_Account_exists_at) - [Function `is_dummy_auth_key`](#0x1_Account_is_dummy_auth_key) - [Function `txn_prologue`](#0x1_Account_txn_prologue) -- [Function `txn_prologue_v2`](#0x1_Account_txn_prologue_v2) - [Function `txn_epilogue`](#0x1_Account_txn_epilogue) -- [Function `transaction_fee_simulate`](#0x1_Account_transaction_fee_simulate) - [Function `txn_epilogue_v2`](#0x1_Account_txn_epilogue_v2) -- [Function `txn_epilogue_v3`](#0x1_Account_txn_epilogue_v3) -- [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) @@ -99,7 +88,6 @@ The module for the account resource that governs every account use 0x1::Errors; use 0x1::Event; use 0x1::Hash; -use 0x1::Math; use 0x1::Option; use 0x1::STC; use 0x1::Signer; @@ -615,6 +603,15 @@ Message for SignerDelegate events + + + + +
const EPROLOGUE_ACCOUNT_DOES_NOT_EXIST: u64 = 0;
+
+
+
+
The address bytes length
@@ -706,15 +703,6 @@ The address bytes length
-
-
-
-
-const EPROLOGUE_ACCOUNT_DOES_NOT_EXIST: u64 = 0;
-
-
-
-
@@ -842,31 +830,6 @@ This function can only called once by signer.
-
-
-
-
-## Function `get_genesis_capability`
-
-
-
-public(friend) fun get_genesis_capability(): Account::SignerCapability
-
-
-
-
-public (friend) fun get_genesis_capability():SignerCapability{
- let signer_cap = SignerCapability {addr: Token::token_address<STC>() };
- signer_cap
-}
-
-
-
-
public(script) fun create_account_with_initial_amount<TokenType: store>(account: signer, fresh_address: address, _auth_key: vector<u8>, initial_amount: u128)
acquires Account, Balance, AutoAcceptToken {
- create_account_with_initial_amount_entry<TokenType>(account, fresh_address, initial_amount);
+ create_account_with_initial_amount_v2<TokenType>(account, fresh_address, initial_amount)
}
@@ -1273,7 +1236,10 @@ reserved address for the MoveVM.
public(script) fun create_account_with_initial_amount_v2<TokenType: store>(account: signer, fresh_address: address, initial_amount: u128)
acquires Account, Balance, AutoAcceptToken {
- create_account_with_initial_amount_entry<TokenType>(account, fresh_address, initial_amount);
+ create_account_with_address<TokenType>(fresh_address);
+ if (initial_amount > 0) {
+ pay_from<TokenType>(&account, fresh_address, initial_amount);
+ };
}
@@ -1291,34 +1257,6 @@ reserved address for the MoveVM.
-
-
-
-
-## Function `create_account_with_initial_amount_entry`
-
-
-
-public(script) fun create_account_with_initial_amount_entry<TokenType: store>(account: signer, fresh_address: address, initial_amount: u128)
-
-
-
-
-public(script) fun create_account_with_initial_amount_entry<TokenType: store>(account: signer, fresh_address: address, initial_amount: u128)
-acquires Account, Balance, AutoAcceptToken {
- create_account_with_address<TokenType>(fresh_address);
- if (initial_amount > 0) {
- pay_from<TokenType>(&account, fresh_address, initial_amount);
- };
-}
-
-
-
-
public fun create_delegate_account(sender: &signer) : (address, SignerCapability) acquires Balance, Account, EventStore {
- let new_address = generate_fresh_address(sender);
+ let sender_address = Signer::address_of(sender);
+ let sequence_number = Self::sequence_number(sender_address);
+ // use stc balance as part of seed, just for new address more random.
+ let stc_balance = Self::balance<STC>(sender_address);
+
+ let seed_bytes = BCS::to_bytes(&sender_address);
+ Vector::append(&mut seed_bytes, BCS::to_bytes(&sequence_number));
+ Vector::append(&mut seed_bytes, BCS::to_bytes(&stc_balance));
+
+ let seed_hash = Hash::sha3_256(seed_bytes);
+ let i = 0;
+ let address_bytes = Vector::empty();
+ while (i < ADDRESS_LENGTH) {
+ Vector::push_back(&mut address_bytes, *Vector::borrow(&seed_hash,i));
+ i = i + 1;
+ };
+ let new_address = BCS::to_address(address_bytes);
Self::create_account_with_address<STC>(new_address);
let new_signer = Self::create_signer(new_address);
(new_address, Self::remove_signer_capability(&new_signer))
@@ -1359,60 +1313,6 @@ Generate an new address and create a new account, then delegate the account and
-
-
-
-
-## Function `generate_fresh_address`
-
-Generate a fresh address from the sender address and the sender's sequence number, and ensure the generated address is not exists onchain.
-
-
-public fun generate_fresh_address(sender: &signer): address
-
-
-
-
-
-Implementation
-
-
-public fun generate_fresh_address(sender: &signer) : address acquires Balance, Account {
- let try_times = 0u64;
- while(true){
- let sender_address = Signer::address_of(sender);
- let sequence_number = Self::sequence_number(sender_address);
- // use stc balance as part of seed, just for new address more random.
- let stc_balance = Self::balance<STC>(sender_address);
-
- let seed_bytes = BCS::to_bytes(&sender_address);
- Vector::append(&mut seed_bytes, BCS::to_bytes(&sequence_number));
- Vector::append(&mut seed_bytes, BCS::to_bytes(&stc_balance));
- Vector::append(&mut seed_bytes, BCS::to_bytes(&try_times));
-
- let seed_hash = Hash::sha3_256(seed_bytes);
-
- let i = 0;
- let address_bytes = Vector::empty();
- while (i < ADDRESS_LENGTH) {
- Vector::push_back(&mut address_bytes, *Vector::borrow(&seed_hash,i));
- i = i + 1;
- };
- let new_address = BCS::to_address(address_bytes);
- if (Self::exists_at(new_address)){
- try_times = try_times + 1;
- continue
- }else{
- return new_address
- }
- };
- //unreachable
- abort 0
-}
-
-
-
-
@@ -2376,7 +2276,20 @@ Return the key rotation capability to the account it originally came from
public(script) fun rotate_authentication_key(account: signer, new_key: vector<u8>) acquires Account, EventStore {
- rotate_authentication_key_entry(account, new_key);
+ let key_rotation_capability = extract_key_rotation_capability(&account);
+ rotate_authentication_key_with_capability(&key_rotation_capability, copy new_key);
+ restore_key_rotation_capability(key_rotation_capability);
+
+ make_event_store_if_not_exist(&account);
+ let signer_addr = Signer::address_of(&account);
+ let event_store = borrow_global_mut<EventStore>(signer_addr);
+ Event::emit_event<RotateAuthKeyEvent>(
+ &mut event_store.rotate_auth_key_events,
+ RotateAuthKeyEvent {
+ account_address: signer_addr,
+ new_auth_key: new_key,
+ }
+ );
}
@@ -2394,67 +2307,6 @@ Return the key rotation capability to the account it originally came from
-
-
-
-
-## Function `rotate_authentication_key_entry`
-
-
-
-public(script) fun rotate_authentication_key_entry(account: signer, new_key: vector<u8>)
-
-
-
-
-
-Implementation
-
-
-public(script) fun rotate_authentication_key_entry(account: signer, new_key: vector<u8>) acquires Account, EventStore {
- do_rotate_authentication_key(&account, new_key);
-}
-
-
-
-
-
-
-
-
-## Function `do_rotate_authentication_key`
-
-
-
-public fun do_rotate_authentication_key(account: &signer, new_key: vector<u8>)
-
-
-
-
-
-Implementation
-
-
-public fun do_rotate_authentication_key(account: &signer, new_key: vector<u8>) acquires Account, EventStore {
- let key_rotation_capability = extract_key_rotation_capability(account);
- rotate_authentication_key_with_capability(&key_rotation_capability, copy new_key);
- restore_key_rotation_capability(key_rotation_capability);
-
- make_event_store_if_not_exist(account);
- let signer_addr = Signer::address_of(account);
- let event_store = borrow_global_mut<EventStore>(signer_addr);
- Event::emit_event<RotateAuthKeyEvent>(
- &mut event_store.rotate_auth_key_events,
- RotateAuthKeyEvent {
- account_address: signer_addr,
- new_auth_key: new_key,
- }
- );
-}
-
-
-
-
@@ -2587,7 +2439,7 @@ Add a balance of Token
type to the
public(script) fun accept_token<TokenType: store>(account: signer) acquires Account {
- accept_token_entry<TokenType>(account);
+ do_accept_token<TokenType>(&account);
}
@@ -2605,30 +2457,6 @@ Add a balance of Token
type to the
-
-
-
-
-## Function `accept_token_entry`
-
-
-
-public(script) fun accept_token_entry<TokenType: store>(account: signer)
-
-
-
-
-
-Implementation
-
-
-public(script) fun accept_token_entry<TokenType: store>(account: signer) acquires Account {
- do_accept_token<TokenType>(&account);
-}
-
-
-
-
@@ -2742,30 +2570,6 @@ Check whether the address can auto accept token.
-
-
-
-
-## Function `set_auto_accept_token_entry`
-
-
-
-public(script) fun set_auto_accept_token_entry(account: signer, enable: bool)
-
-
-
-
-
-Implementation
-
-
-public(script) fun set_auto_accept_token_entry(account: signer, enable: bool) acquires AutoAcceptToken {
- set_auto_accept_token(&account, enable);
-}
-
-
-
-
@@ -3192,64 +2996,6 @@ It verifies:
txn_authentication_key_preimage: vector<u8>,
txn_gas_price: u64,
txn_max_gas_units: u64,
-) acquires Account, Balance {
- txn_prologue_v2<TokenType>(
- account,
- txn_sender,
- txn_sequence_number,
- txn_authentication_key_preimage,
- txn_gas_price,
- txn_max_gas_units,
- 1,
- 1,
- )
-}
-
-
-
-
-
-
-aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
-aborts_if !exists<Account>(txn_sender);
-aborts_if global<Account>(txn_sender).authentication_key == DUMMY_AUTH_KEY && Authenticator::spec_derived_address(Hash::sha3_256(txn_authentication_key_preimage)) != txn_sender;
-aborts_if global<Account>(txn_sender).authentication_key != DUMMY_AUTH_KEY && Hash::sha3_256(txn_authentication_key_preimage) != global<Account>(txn_sender).authentication_key;
-aborts_if txn_sequence_number < global<Account>(txn_sender).sequence_number;
-
-
-
-
-public fun txn_prologue_v2<TokenType: store>(account: &signer, txn_sender: address, txn_sequence_number: u64, txn_authentication_key_preimage: vector<u8>, txn_gas_price: u64, txn_max_gas_units: u64, stc_price: u128, stc_price_scaling: u128)
-
-
-
-
-public fun txn_prologue_v2<TokenType: store>(
- account: &signer,
- txn_sender: address,
- txn_sequence_number: u64,
- txn_authentication_key_preimage: vector<u8>,
- txn_gas_price: u64,
- txn_max_gas_units: u64,
- stc_price: u128,
- stc_price_scaling: u128
) acquires Account, Balance {
CoreAddresses::assert_genesis_address(account);
@@ -3274,61 +3020,31 @@ It verifies:
Errors::invalid_argument(EPROLOGUE_INVALID_ACCOUNT_AUTH_KEY)
);
};
+
// Check that the account has enough balance for all of the gas
- let (max_transaction_fee_stc,max_transaction_fee_token) = transaction_fee_simulate(txn_gas_price,txn_max_gas_units,0, stc_price, stc_price_scaling);
assert!(
- max_transaction_fee_stc <= MAX_U64,
+ (txn_gas_price as u128) * (txn_max_gas_units as u128) <= MAX_U64,
Errors::invalid_argument(EPROLOGUE_CANT_PAY_GAS_DEPOSIT),
);
- if (max_transaction_fee_stc > 0) {
+ let max_transaction_fee = txn_gas_price * txn_max_gas_units;
+ if (max_transaction_fee > 0) {
+ assert!(
+ STC::is_stc<TokenType>(),
+ Errors::invalid_argument(EBAD_TRANSACTION_FEE_TOKEN)
+ );
+
+ let balance_amount = balance<TokenType>(txn_sender);
+ assert!(balance_amount >= (max_transaction_fee as u128), Errors::invalid_argument(EPROLOGUE_CANT_PAY_GAS_DEPOSIT));
+
assert!(
(txn_sequence_number as u128) < MAX_U64,
Errors::limit_exceeded(EPROLOGUE_SEQUENCE_NUMBER_TOO_BIG)
);
- let balance_amount_token = balance<TokenType>(txn_sender);
- assert!(balance_amount_token >= max_transaction_fee_token, Errors::invalid_argument(EPROLOGUE_CANT_PAY_GAS_DEPOSIT));
- if (!is_stc<TokenType>()){
- let balance_amount_stc= balance<STC>(CoreAddresses::GENESIS_ADDRESS());
- assert!(balance_amount_stc >= max_transaction_fee_stc, Errors::invalid_argument(EPROLOGUE_CANT_PAY_GAS_DEPOSIT));
- }
};
+
// Check that the transaction sequence number matches the sequence number of the account
assert!(txn_sequence_number >= sender_account.sequence_number, Errors::invalid_argument(EPROLOGUE_SEQUENCE_NUMBER_TOO_OLD));
assert!(txn_sequence_number == sender_account.sequence_number, Errors::invalid_argument(EPROLOGUE_SEQUENCE_NUMBER_TOO_NEW));
-
-}
-
-
-
-
-public fun txn_epilogue<TokenType: store>(account: &signer, txn_sender: address, txn_sequence_number: u64, txn_gas_price: u64, txn_max_gas_units: u64, gas_units_remaining: u64)
-
-
-
-
-public fun txn_epilogue<TokenType: store>(
- account: &signer,
- txn_sender: address,
- txn_sequence_number: u64,
- txn_gas_price: u64,
- txn_max_gas_units: u64,
- gas_units_remaining: u64,
-) acquires Account, Balance {
- txn_epilogue_v3<TokenType>(account, txn_sender, txn_sequence_number, Vector::empty(), txn_gas_price, txn_max_gas_units, gas_units_remaining,1,1)
}
@@ -3341,55 +3057,32 @@ It collects gas and bumps the sequence number
-pragma verify = false;
-
-
-
-
-public fun transaction_fee_simulate(txn_gas_price: u64, txn_max_gas_units: u64, gas_units_remaining: u64, stc_price: u128, stc_price_scaling: u128): (u128, u128)
-
-
-
-
-public fun transaction_fee_simulate(
- txn_gas_price:u64,
- txn_max_gas_units: u64,
- gas_units_remaining:u64,
- stc_price: u128,
- stc_price_scaling: u128,
-): (u128, u128){
- let transaction_fee_stc =(txn_gas_price * (txn_max_gas_units - gas_units_remaining) as u128);
- let transaction_fee_token= Math::mul_div((transaction_fee_stc as u128), stc_price, stc_price_scaling);
- transaction_fee_token = if (transaction_fee_token == 0 && transaction_fee_stc > 0 ) { 1 } else { transaction_fee_token};
- (transaction_fee_stc, transaction_fee_token)
-}
+aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
+aborts_if !exists<Account>(txn_sender);
+aborts_if global<Account>(txn_sender).authentication_key == DUMMY_AUTH_KEY && Authenticator::spec_derived_address(Hash::sha3_256(txn_authentication_key_preimage)) != txn_sender;
+aborts_if global<Account>(txn_sender).authentication_key != DUMMY_AUTH_KEY && Hash::sha3_256(txn_authentication_key_preimage) != global<Account>(txn_sender).authentication_key;
+aborts_if txn_gas_price * txn_max_gas_units > max_u64();
+aborts_if txn_gas_price * txn_max_gas_units > 0 && !exists<Balance<TokenType>>(txn_sender);
+aborts_if txn_gas_price * txn_max_gas_units > 0 && Token::spec_token_code<TokenType>() != Token::spec_token_code<STC>();
+aborts_if txn_gas_price * txn_max_gas_units > 0 && global<Balance<TokenType>>(txn_sender).token.value < txn_gas_price * txn_max_gas_units;
+aborts_if txn_gas_price * txn_max_gas_units > 0 && txn_sequence_number >= max_u64();
+aborts_if txn_sequence_number < global<Account>(txn_sender).sequence_number;
+aborts_if txn_sequence_number != global<Account>(txn_sender).sequence_number;
public fun txn_epilogue_v2<TokenType: store>(account: &signer, txn_sender: address, txn_sequence_number: u64, txn_authentication_key_preimage: vector<u8>, txn_gas_price: u64, txn_max_gas_units: u64, gas_units_remaining: u64)
+public fun txn_epilogue<TokenType: store>(account: &signer, txn_sender: address, txn_sequence_number: u64, txn_gas_price: u64, txn_max_gas_units: u64, gas_units_remaining: u64)
@@ -3398,23 +3091,15 @@ It collects gas and bumps the sequence number
Implementation
-public fun txn_epilogue_v2<TokenType: store>(
+public fun txn_epilogue<TokenType: store>(
account: &signer,
txn_sender: address,
txn_sequence_number: u64,
- txn_authentication_key_preimage: vector<u8>,
txn_gas_price: u64,
txn_max_gas_units: u64,
gas_units_remaining: u64,
) acquires Account, Balance {
- txn_epilogue_v3<TokenType>(
- account,
- txn_sender,
- txn_sequence_number,
- txn_authentication_key_preimage,
- txn_gas_price,
- txn_max_gas_units,
- gas_units_remaining,1,1)
+ txn_epilogue_v2<TokenType>(account, txn_sender, txn_sequence_number, Vector::empty(), txn_gas_price, txn_max_gas_units, gas_units_remaining)
}
@@ -3428,47 +3113,21 @@ It collects gas and bumps the sequence number
pragma verify = false;
-aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
-aborts_if !exists<Account>(txn_sender);
-aborts_if !exists<Balance<TokenType>>(txn_sender);
-aborts_if txn_max_gas_units < gas_units_remaining;
-let transaction_fee_amount = txn_gas_price * (txn_max_gas_units - gas_units_remaining);
-aborts_if transaction_fee_amount > max_u128();
-aborts_if global<Balance<TokenType>>(txn_sender).token.value < transaction_fee_amount;
-aborts_if txn_sequence_number + 1 > max_u64();
-aborts_if txn_gas_price * (txn_max_gas_units - gas_units_remaining) > 0 &&
- global<Balance<TokenType>>(txn_sender).token.value < txn_gas_price * (txn_max_gas_units - gas_units_remaining);
-aborts_if txn_gas_price * (txn_max_gas_units - gas_units_remaining) > 0 &&
- !exists<TransactionFee::TransactionFee<TokenType>>(CoreAddresses::GENESIS_ADDRESS());
-aborts_if txn_gas_price * (txn_max_gas_units - gas_units_remaining) > 0 &&
- global<TransactionFee::TransactionFee<TokenType>>(CoreAddresses::GENESIS_ADDRESS()).fee.value + txn_gas_price * (txn_max_gas_units - gas_units_remaining) > max_u128();
-
-
-
-
-
-pragma verify = false;
-aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
-aborts_if !exists<Account>(txn_sender);
-aborts_if !exists<Balance<TokenType>>(txn_sender);
-aborts_if txn_sequence_number + 1 > max_u64();
-aborts_if !exists<Balance<TokenType>>(txn_sender);
-aborts_if txn_max_gas_units < gas_units_remaining;
-
+
-## Function `txn_epilogue_v3`
+## Function `txn_epilogue_v2`
The epilogue is invoked at the end of transactions.
It collects gas and bumps the sequence number
-public fun txn_epilogue_v3<TokenType: store>(account: &signer, txn_sender: address, txn_sequence_number: u64, txn_authentication_key_preimage: vector<u8>, txn_gas_price: u64, txn_max_gas_units: u64, gas_units_remaining: u64, stc_price: u128, stc_price_scaling: u128)
+public fun txn_epilogue_v2<TokenType: store>(account: &signer, txn_sender: address, txn_sequence_number: u64, txn_authentication_key_preimage: vector<u8>, txn_gas_price: u64, txn_max_gas_units: u64, gas_units_remaining: u64)
@@ -3477,7 +3136,7 @@ It collects gas and bumps the sequence number
Implementation
-public fun txn_epilogue_v3<TokenType: store>(
+public fun txn_epilogue_v2<TokenType: store>(
account: &signer,
txn_sender: address,
txn_sequence_number: u64,
@@ -3485,43 +3144,32 @@ It collects gas and bumps the sequence number
txn_gas_price: u64,
txn_max_gas_units: u64,
gas_units_remaining: u64,
- stc_price: u128,
- stc_price_scaling: u128,
) acquires Account, Balance {
CoreAddresses::assert_genesis_address(account);
+
+ // Load the transaction sender's account and balance resources
+ let sender_account = borrow_global_mut<Account>(txn_sender);
+ let sender_balance = borrow_global_mut<Balance<TokenType>>(txn_sender);
+
// Charge for gas
- let (transaction_fee_amount_stc,transaction_fee_amount_token) = transaction_fee_simulate(
- txn_gas_price,
- txn_max_gas_units,
- gas_units_remaining,
- stc_price,
- stc_price_scaling);
+ let transaction_fee_amount =(txn_gas_price * (txn_max_gas_units - gas_units_remaining) as u128);
assert!(
- balance<TokenType>(txn_sender) >= transaction_fee_amount_token,
+ balance_for(sender_balance) >= transaction_fee_amount,
Errors::limit_exceeded(EINSUFFICIENT_BALANCE)
);
- if (!is_stc<TokenType>()){
- let genesis_balance_amount_stc=balance<STC>(CoreAddresses::GENESIS_ADDRESS());
- assert!(genesis_balance_amount_stc >= transaction_fee_amount_stc,
- Errors::invalid_argument(EPROLOGUE_CANT_PAY_GAS_DEPOSIT)
- );
- };
- // Load the transaction sender's account and balance resources
- let sender_account = borrow_global_mut<Account>(txn_sender);
+
// Bump the sequence number
sender_account.sequence_number = txn_sequence_number + 1;
// Set auth key when user send transaction first.
if (is_dummy_auth_key(sender_account) && !Vector::is_empty(&txn_authentication_key_preimage)){
sender_account.authentication_key = Hash::sha3_256(txn_authentication_key_preimage);
};
- if (transaction_fee_amount_stc > 0) {
- let transaction_fee_token = withdraw_from_balance(
- borrow_global_mut<Balance<TokenType>>(txn_sender),
- transaction_fee_amount_token
+ if (transaction_fee_amount > 0) {
+ let transaction_fee = withdraw_from_balance(
+ sender_balance,
+ transaction_fee_amount
);
- deposit_to_balance(borrow_global_mut<Balance<TokenType>>(CoreAddresses::GENESIS_ADDRESS()), transaction_fee_token);
- let stc_fee_token = withdraw_from_balance(borrow_global_mut<Balance<STC>>(CoreAddresses::GENESIS_ADDRESS()), transaction_fee_amount_stc);
- TransactionFee::pay_fee(stc_fee_token);
+ TransactionFee::pay_fee(transaction_fee);
};
}
@@ -3530,24 +3178,26 @@ It collects gas and bumps the sequence number
-
-
-## Function `remove_zero_balance_entry`
-
-
-
-public(script) fun remove_zero_balance_entry<TokenType: store>(account: signer)
-
-
-
-
-Implementation
+Specification
-public(script) fun remove_zero_balance_entry<TokenType: store>(account: signer) acquires Balance {
- remove_zero_balance<TokenType>(&account);
-}
+
+pragma verify = false;
+aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
+aborts_if !exists<Account>(txn_sender);
+aborts_if !exists<Balance<TokenType>>(txn_sender);
+aborts_if txn_max_gas_units < gas_units_remaining;
+let transaction_fee_amount = txn_gas_price * (txn_max_gas_units - gas_units_remaining);
+aborts_if transaction_fee_amount > max_u128();
+aborts_if global<Balance<TokenType>>(txn_sender).token.value < transaction_fee_amount;
+aborts_if txn_sequence_number + 1 > max_u64();
+aborts_if txn_gas_price * (txn_max_gas_units - gas_units_remaining) > 0 &&
+ global<Balance<TokenType>>(txn_sender).token.value < txn_gas_price * (txn_max_gas_units - gas_units_remaining);
+aborts_if txn_gas_price * (txn_max_gas_units - gas_units_remaining) > 0 &&
+ !exists<TransactionFee::TransactionFee<TokenType>>(CoreAddresses::GENESIS_ADDRESS());
+aborts_if txn_gas_price * (txn_max_gas_units - gas_units_remaining) > 0 &&
+ global<TransactionFee::TransactionFee<TokenType>>(CoreAddresses::GENESIS_ADDRESS()).fee.value + txn_gas_price * (txn_max_gas_units - gas_units_remaining) > max_u128();
diff --git a/build/StarcoinFramework/docs/AccountScripts.md b/build/StarcoinFramework/docs/AccountScripts.md
index 0a0a0d74..07c1a5e1 100644
--- a/build/StarcoinFramework/docs/AccountScripts.md
+++ b/build/StarcoinFramework/docs/AccountScripts.md
@@ -33,7 +33,7 @@ The script function is reenterable.
public(script) fun enable_auto_accept_token(account: signer) {
- Account::set_auto_accept_token_entry(account, true);
+ Account::set_auto_accept_token(&account, true);
}
@@ -59,7 +59,7 @@ The script function is reenterable.
public(script) fun disable_auto_accept_token(account: signer) {
- Account::set_auto_accept_token_entry(account, false);
+ Account::set_auto_accept_token(&account, false);
}
@@ -84,7 +84,7 @@ Remove zero Balance
public(script) fun remove_zero_balance<TokenType: store>(account: signer) {
- Account::remove_zero_balance_entry<TokenType>(account);
+ Account::remove_zero_balance<TokenType>(&account);
}
diff --git a/build/StarcoinFramework/docs/BCS.md b/build/StarcoinFramework/docs/BCS.md
index 9af233ec..ad28b902 100644
--- a/build/StarcoinFramework/docs/BCS.md
+++ b/build/StarcoinFramework/docs/BCS.md
@@ -8,104 +8,12 @@ Serialization). BCS is the binary encoding for Move resources and other non-modu
published on-chain.
-- [Constants](#@Constants_0)
- [Function `to_bytes`](#0x1_BCS_to_bytes)
- [Function `to_address`](#0x1_BCS_to_address)
-- [Function `deserialize_option_bytes_vector`](#0x1_BCS_deserialize_option_bytes_vector)
-- [Function `deserialize_option_tuple`](#0x1_BCS_deserialize_option_tuple)
-- [Function `deserialize_bytes_vector`](#0x1_BCS_deserialize_bytes_vector)
-- [Function `deserialize_u64_vector`](#0x1_BCS_deserialize_u64_vector)
-- [Function `deserialize_u128_vector`](#0x1_BCS_deserialize_u128_vector)
-- [Function `deserialize_option_bytes`](#0x1_BCS_deserialize_option_bytes)
-- [Function `deserialize_address`](#0x1_BCS_deserialize_address)
-- [Function `deserialize_16_bytes`](#0x1_BCS_deserialize_16_bytes)
-- [Function `deserialize_bytes`](#0x1_BCS_deserialize_bytes)
-- [Function `deserialize_u128`](#0x1_BCS_deserialize_u128)
-- [Function `deserialize_u64`](#0x1_BCS_deserialize_u64)
-- [Function `deserialize_u32`](#0x1_BCS_deserialize_u32)
-- [Function `deserialize_u16`](#0x1_BCS_deserialize_u16)
-- [Function `deserialize_u8`](#0x1_BCS_deserialize_u8)
-- [Function `deserialize_option_tag`](#0x1_BCS_deserialize_option_tag)
-- [Function `deserialize_len`](#0x1_BCS_deserialize_len)
-- [Function `deserialize_bool`](#0x1_BCS_deserialize_bool)
-- [Function `get_byte`](#0x1_BCS_get_byte)
-- [Function `get_n_bytes`](#0x1_BCS_get_n_bytes)
-- [Function `get_n_bytes_as_u128`](#0x1_BCS_get_n_bytes_as_u128)
-- [Function `deserialize_uleb128_as_u32`](#0x1_BCS_deserialize_uleb128_as_u32)
-- [Function `serialize_u32_as_uleb128`](#0x1_BCS_serialize_u32_as_uleb128)
-- [Function `skip_option_bytes_vector`](#0x1_BCS_skip_option_bytes_vector)
-- [Function `skip_option_bytes`](#0x1_BCS_skip_option_bytes)
-- [Function `skip_bytes_vector`](#0x1_BCS_skip_bytes_vector)
-- [Function `skip_bytes`](#0x1_BCS_skip_bytes)
-- [Function `skip_n_bytes`](#0x1_BCS_skip_n_bytes)
-- [Function `skip_u64_vector`](#0x1_BCS_skip_u64_vector)
-- [Function `skip_u128_vector`](#0x1_BCS_skip_u128_vector)
-- [Function `skip_u256`](#0x1_BCS_skip_u256)
-- [Function `skip_u128`](#0x1_BCS_skip_u128)
-- [Function `skip_u64`](#0x1_BCS_skip_u64)
-- [Function `skip_u32`](#0x1_BCS_skip_u32)
-- [Function `skip_u16`](#0x1_BCS_skip_u16)
-- [Function `skip_u8`](#0x1_BCS_skip_u8)
-- [Function `skip_address`](#0x1_BCS_skip_address)
-- [Function `skip_bool`](#0x1_BCS_skip_bool)
-- [Function `can_skip`](#0x1_BCS_can_skip)
-- [Module Specification](#@Module_Specification_1)
+- [Module Specification](#@Module_Specification_0)
-use 0x1::Errors;
-use 0x1::Option;
-use 0x1::Vector;
-
-
-
-
-
-
-## Constants
-
-
-
-
-
-
-const ERR_INPUT_NOT_LARGE_ENOUGH: u64 = 201;
-
-
-
-
-
-
-
-
-const ERR_INVALID_ULEB128_NUMBER_UNEXPECTED_ZERO_DIGIT: u64 = 207;
-
-
-
-
-
-
-
-
-const ERR_OVERFLOW_PARSING_ULEB128_ENCODED_UINT32: u64 = 206;
-
-
-
-
-
-
-
-
-const ERR_UNEXPECTED_BOOL_VALUE: u64 = 205;
-
-
-
-
-
-
-
-
-const INTEGER32_MAX_VALUE: u64 = 2147483647;
-
+
@@ -116,7 +24,7 @@ published on-chain.
Return the binary representation of v
in BCS (Starcoin Canonical Serialization) format
-public fun to_bytes<MoveValue>(v: &MoveValue): vector<u8>
+public fun to_bytes<MoveValue: store>(v: &MoveValue): vector<u8>
@@ -125,7 +33,7 @@ Return the binary representation of v
in BCS (Starcoin Canonical Se
Implementation
-native public fun to_bytes<MoveValue>(v: &MoveValue): vector<u8>;
+native public fun to_bytes<MoveValue: store>(v: &MoveValue): vector<u8>;
@@ -155,1514 +63,7 @@ Return the address of key bytes
-
-
-## Function `deserialize_option_bytes_vector`
-
-
-
-public fun deserialize_option_bytes_vector(input: &vector<u8>, offset: u64): (vector<Option::Option<vector<u8>>>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_option_bytes_vector(input: &vector<u8>, offset: u64): (vector<Option::Option<vector<u8>>>, u64) {
- let (len, new_offset) = deserialize_len(input, offset);
- let i = 0;
- let vec = Vector::empty<Option::Option<vector<u8>>>();
- while (i < len) {
- let (opt_bs, o) = deserialize_option_bytes(input, new_offset);
- Vector::push_back(&mut vec, opt_bs);
- new_offset = o;
- i = i + 1;
- };
- (vec, new_offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_option_tuple`
-
-
-
-public fun deserialize_option_tuple(input: &vector<u8>, offset: u64): (Option::Option<vector<u8>>, Option::Option<vector<u8>>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_option_tuple(input: &vector<u8>, offset: u64): (Option::Option<vector<u8>>, Option::Option<vector<u8>>, u64) {
- let (tag, new_offset) = deserialize_option_tag(input, offset);
- if (!tag) {
- return (Option::none<vector<u8>>(), Option::none<vector<u8>>(), new_offset)
- } else {
- let (bs1, new_offset) = deserialize_bytes(input, new_offset);
- let (bs2, new_offset) = deserialize_bytes(input, new_offset);
-
- (Option::some<vector<u8>>(bs1), Option::some<vector<u8>>(bs2), new_offset)
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_bytes_vector`
-
-
-
-public fun deserialize_bytes_vector(input: &vector<u8>, offset: u64): (vector<vector<u8>>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_bytes_vector(input: &vector<u8>, offset: u64): (vector<vector<u8>>, u64) {
- let (len, new_offset) = deserialize_len(input, offset);
- let i = 0;
- let vec = Vector::empty<vector<u8>>();
- while (i < len) {
- let (opt_bs, o) = deserialize_bytes(input, new_offset);
- Vector::push_back(&mut vec, opt_bs);
- new_offset = o;
- i = i + 1;
- };
- (vec, new_offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_u64_vector`
-
-
-
-public fun deserialize_u64_vector(input: &vector<u8>, offset: u64): (vector<u64>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_u64_vector(input: &vector<u8>, offset: u64): (vector<u64>, u64) {
- let (len, new_offset) = deserialize_len(input, offset);
- let i = 0;
- let vec = Vector::empty<u64>();
- while (i < len) {
- let (opt_bs, o) = deserialize_u64(input, new_offset);
- Vector::push_back(&mut vec, opt_bs);
- new_offset = o;
- i = i + 1;
- };
- (vec, new_offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_u128_vector`
-
-
-
-public fun deserialize_u128_vector(input: &vector<u8>, offset: u64): (vector<u128>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_u128_vector(input: &vector<u8>, offset: u64): (vector<u128>, u64) {
- let (len, new_offset) = deserialize_len(input, offset);
- let i = 0;
- let vec = Vector::empty<u128>();
- while (i < len) {
- let (opt_bs, o) = deserialize_u128(input, new_offset);
- Vector::push_back(&mut vec, opt_bs);
- new_offset = o;
- i = i + 1;
- };
- (vec, new_offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_option_bytes`
-
-
-
-public fun deserialize_option_bytes(input: &vector<u8>, offset: u64): (Option::Option<vector<u8>>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_option_bytes(input: &vector<u8>, offset: u64): (Option::Option<vector<u8>>, u64) {
- let (tag, new_offset) = deserialize_option_tag(input, offset);
- if (!tag) {
- return (Option::none<vector<u8>>(), new_offset)
- } else {
- let (bs, new_offset) = deserialize_bytes(input, new_offset);
- return (Option::some<vector<u8>>(bs), new_offset)
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_address`
-
-
-
-public fun deserialize_address(input: &vector<u8>, offset: u64): (address, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_address(input: &vector<u8>, offset: u64): (address, u64) {
- let (content, new_offset) = deserialize_16_bytes(input, offset);
- (BCS::to_address(content), new_offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_16_bytes`
-
-
-
-public fun deserialize_16_bytes(input: &vector<u8>, offset: u64): (vector<u8>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_16_bytes(input: &vector<u8>, offset: u64): (vector<u8>, u64) {
- let content = get_n_bytes(input, offset, 16);
- (content, offset + 16)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_bytes`
-
-
-
-public fun deserialize_bytes(input: &vector<u8>, offset: u64): (vector<u8>, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_bytes(input: &vector<u8>, offset: u64): (vector<u8>, u64) {
- let (len, new_offset) = deserialize_len(input, offset);
- let content = get_n_bytes(input, new_offset, len);
- (content, new_offset + len)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_u128`
-
-
-
-public fun deserialize_u128(input: &vector<u8>, offset: u64): (u128, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_u128(input: &vector<u8>, offset: u64): (u128, u64) {
- let u = get_n_bytes_as_u128(input, offset, 16);
- (u, offset + 16)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_u64`
-
-
-
-public fun deserialize_u64(input: &vector<u8>, offset: u64): (u64, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_u64(input: &vector<u8>, offset: u64): (u64, u64) {
- let u = get_n_bytes_as_u128(input, offset, 8);
- ((u as u64), offset + 8)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_u32`
-
-
-
-public fun deserialize_u32(input: &vector<u8>, offset: u64): (u64, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_u32(input: &vector<u8>, offset: u64): (u64, u64) {
- let u = get_n_bytes_as_u128(input, offset, 4);
- ((u as u64), offset + 4)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_u16`
-
-
-
-public fun deserialize_u16(input: &vector<u8>, offset: u64): (u64, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_u16(input: &vector<u8>, offset: u64): (u64, u64) {
- let u = get_n_bytes_as_u128(input, offset, 2);
- ((u as u64), offset + 2)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_u8`
-
-
-
-public fun deserialize_u8(input: &vector<u8>, offset: u64): (u8, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_u8(input: &vector<u8>, offset: u64): (u8, u64) {
- let u = get_byte(input, offset);
- (u, offset + 1)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_option_tag`
-
-
-
-public fun deserialize_option_tag(input: &vector<u8>, offset: u64): (bool, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_option_tag(input: &vector<u8>, offset: u64): (bool, u64) {
- deserialize_bool(input, offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_len`
-
-
-
-public fun deserialize_len(input: &vector<u8>, offset: u64): (u64, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_len(input: &vector<u8>, offset: u64): (u64, u64) {
- deserialize_uleb128_as_u32(input, offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_bool`
-
-
-
-public fun deserialize_bool(input: &vector<u8>, offset: u64): (bool, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_bool(input: &vector<u8>, offset: u64): (bool, u64) {
- let b = get_byte(input, offset);
- if (b == 1) {
- return (true, offset + 1)
- } else if (b == 0) {
- return (false, offset + 1)
- } else {
- abort ERR_UNEXPECTED_BOOL_VALUE
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `get_byte`
-
-
-
-fun get_byte(input: &vector<u8>, offset: u64): u8
-
-
-
-
-
-Implementation
-
-
-fun get_byte(input: &vector<u8>, offset: u64): u8 {
- assert!(((offset + 1) <= Vector::length(input)) && (offset < offset + 1), Errors::invalid_state(ERR_INPUT_NOT_LARGE_ENOUGH));
- *Vector::borrow(input, offset)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `get_n_bytes`
-
-
-
-fun get_n_bytes(input: &vector<u8>, offset: u64, n: u64): vector<u8>
-
-
-
-
-
-Implementation
-
-
-fun get_n_bytes(input: &vector<u8>, offset: u64, n: u64): vector<u8> {
- assert!(((offset + n) <= Vector::length(input)) && (offset <= offset + n), Errors::invalid_state(ERR_INPUT_NOT_LARGE_ENOUGH));
- let i = 0;
- let content = Vector::empty<u8>();
- while (i < n) {
- let b = *Vector::borrow(input, offset + i);
- Vector::push_back(&mut content, b);
- i = i + 1;
- };
- content
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `get_n_bytes_as_u128`
-
-
-
-fun get_n_bytes_as_u128(input: &vector<u8>, offset: u64, n: u64): u128
-
-
-
-
-
-Implementation
-
-
-fun get_n_bytes_as_u128(input: &vector<u8>, offset: u64, n: u64): u128 {
- assert!(((offset + n) <= Vector::length(input)) && (offset < offset + n), Errors::invalid_state(ERR_INPUT_NOT_LARGE_ENOUGH));
- let number: u128 = 0;
- let i = 0;
- while (i < n) {
- let byte = *Vector::borrow(input, offset + i);
- let s = (i as u8) * 8;
- number = number + ((byte as u128) << s);
- i = i + 1;
- };
- number
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `deserialize_uleb128_as_u32`
-
-
-
-public fun deserialize_uleb128_as_u32(input: &vector<u8>, offset: u64): (u64, u64)
-
-
-
-
-
-Implementation
-
-
-public fun deserialize_uleb128_as_u32(input: &vector<u8>, offset: u64): (u64, u64) {
- let value: u64 = 0;
- let shift = 0;
- let new_offset = offset;
- while (shift < 32) {
- let x = get_byte(input, new_offset);
- new_offset = new_offset + 1;
- let digit: u8 = x & 0x7F;
- value = value | (digit as u64) << shift;
- if ((value < 0) || (value > INTEGER32_MAX_VALUE)) {
- abort ERR_OVERFLOW_PARSING_ULEB128_ENCODED_UINT32
- };
- if (digit == x) {
- if (shift > 0 && digit == 0) {
- abort ERR_INVALID_ULEB128_NUMBER_UNEXPECTED_ZERO_DIGIT
- };
- return (value, new_offset)
- };
- shift = shift + 7
- };
- abort ERR_OVERFLOW_PARSING_ULEB128_ENCODED_UINT32
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `serialize_u32_as_uleb128`
-
-
-
-fun serialize_u32_as_uleb128(value: u64): vector<u8>
-
-
-
-
-
-Implementation
-
-
-fun serialize_u32_as_uleb128(value: u64): vector<u8> {
- let output = Vector::empty<u8>();
- while ((value >> 7) != 0) {
- Vector::push_back(&mut output, (((value & 0x7f) | 0x80) as u8));
- value = value >> 7;
- };
- Vector::push_back(&mut output, (value as u8));
- output
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_option_bytes_vector`
-
-
-
-public fun skip_option_bytes_vector(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_option_bytes_vector(input: &vector<u8>, offset: u64): u64 {
- let (len, new_offset) = deserialize_len(input, offset);
- let i = 0;
- while (i < len) {
- new_offset = skip_option_bytes(input, new_offset);
- i = i + 1;
- };
- new_offset
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_option_bytes`
-
-
-
-public fun skip_option_bytes(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_option_bytes(input: &vector<u8>, offset: u64): u64 {
- let (tag, new_offset) = deserialize_option_tag(input, offset);
- if (!tag) {
- new_offset
- } else {
- skip_bytes(input, new_offset)
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_bytes_vector`
-
-
-
-public fun skip_bytes_vector(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_bytes_vector(input: &vector<u8>, offset: u64): u64 {
- let (len, new_offset) = deserialize_len(input, offset);
- let i = 0;
- while (i < len) {
- new_offset = skip_bytes(input, new_offset);
- i = i + 1;
- };
- new_offset
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_bytes`
-
-
-
-public fun skip_bytes(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_bytes(input: &vector<u8>, offset: u64): u64 {
- let (len, new_offset) = deserialize_len(input, offset);
- new_offset + len
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_n_bytes`
-
-
-
-public fun skip_n_bytes(input: &vector<u8>, offset: u64, n: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_n_bytes(input: &vector<u8>, offset: u64, n:u64): u64 {
- can_skip(input, offset, n );
- offset + n
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u64_vector`
-
-
-
-public fun skip_u64_vector(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u64_vector(input: &vector<u8>, offset: u64): u64 {
- let (len, new_offset) = deserialize_len(input, offset);
- can_skip(input, new_offset, len * 8);
- new_offset + len * 8
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u128_vector`
-
-
-
-public fun skip_u128_vector(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u128_vector(input: &vector<u8>, offset: u64): u64 {
- let (len, new_offset) = deserialize_len(input, offset);
- can_skip(input, new_offset, len * 16);
- new_offset + len * 16
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u256`
-
-
-
-public fun skip_u256(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u256(input: &vector<u8>, offset: u64): u64 {
- can_skip(input, offset, 32 );
- offset + 32
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u128`
-
-
-
-public fun skip_u128(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u128(input: &vector<u8>, offset: u64): u64 {
- can_skip(input, offset, 16 );
- offset + 16
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u64`
-
-
-
-public fun skip_u64(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u64(input: &vector<u8>, offset: u64): u64 {
- can_skip(input, offset, 8 );
- offset + 8
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u32`
-
-
-
-public fun skip_u32(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u32(input: &vector<u8>, offset: u64): u64 {
- can_skip(input, offset, 4 );
- offset + 4
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u16`
-
-
-
-public fun skip_u16(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u16(input: &vector<u8>, offset: u64): u64 {
- can_skip(input, offset, 2 );
- offset + 2
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_u8`
-
-
-
-public fun skip_u8(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_u8(input: &vector<u8>, offset: u64): u64 {
- can_skip(input, offset, 1 );
- offset + 1
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_address`
-
-
-
-public fun skip_address(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_address(input: &vector<u8>, offset: u64): u64 {
- skip_n_bytes(input, offset, 16)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `skip_bool`
-
-
-
-public fun skip_bool(input: &vector<u8>, offset: u64): u64
-
-
-
-
-
-Implementation
-
-
-public fun skip_bool(input: &vector<u8>, offset: u64): u64{
- can_skip(input, offset, 1);
- offset + 1
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `can_skip`
-
-
-
-fun can_skip(input: &vector<u8>, offset: u64, n: u64)
-
-
-
-
-
-Implementation
-
-
-fun can_skip(input: &vector<u8>, offset: u64, n: u64){
- assert!(((offset + n) <= Vector::length(input)) && (offset < offset + n), Errors::invalid_state(ERR_INPUT_NOT_LARGE_ENOUGH));
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
+
## Module Specification
diff --git a/build/StarcoinFramework/docs/Block.md b/build/StarcoinFramework/docs/Block.md
index 7a24f46d..7368a1bc 100644
--- a/build/StarcoinFramework/docs/Block.md
+++ b/build/StarcoinFramework/docs/Block.md
@@ -8,36 +8,19 @@ Block module provide metadata for generated blocks.
- [Resource `BlockMetadata`](#0x1_Block_BlockMetadata)
- [Struct `NewBlockEvent`](#0x1_Block_NewBlockEvent)
-- [Struct `Checkpoint`](#0x1_Block_Checkpoint)
-- [Resource `Checkpoints`](#0x1_Block_Checkpoints)
- [Constants](#@Constants_0)
- [Function `initialize`](#0x1_Block_initialize)
- [Function `get_current_block_number`](#0x1_Block_get_current_block_number)
- [Function `get_parent_hash`](#0x1_Block_get_parent_hash)
- [Function `get_current_author`](#0x1_Block_get_current_author)
- [Function `process_block_metadata`](#0x1_Block_process_block_metadata)
-- [Function `checkpoints_init`](#0x1_Block_checkpoints_init)
-- [Function `checkpoint_entry`](#0x1_Block_checkpoint_entry)
-- [Function `checkpoint`](#0x1_Block_checkpoint)
-- [Function `base_checkpoint`](#0x1_Block_base_checkpoint)
-- [Function `latest_state_root`](#0x1_Block_latest_state_root)
-- [Function `base_latest_state_root`](#0x1_Block_base_latest_state_root)
-- [Function `update_state_root_entry`](#0x1_Block_update_state_root_entry)
-- [Function `update_state_root`](#0x1_Block_update_state_root)
-- [Function `base_update_state_root`](#0x1_Block_base_update_state_root)
- [Module Specification](#@Module_Specification_1)
-use 0x1::BCS;
-use 0x1::CoreAddresses;
+use 0x1::CoreAddresses;
use 0x1::Errors;
use 0x1::Event;
-use 0x1::GenesisSignerCapability;
-use 0x1::Hash;
-use 0x1::Option;
-use 0x1::Ring;
use 0x1::Timestamp;
-use 0x1::Vector;
@@ -138,84 +121,6 @@ Events emitted when new block generated.
-
-
-
-
-## Struct `Checkpoint`
-
-
-
-struct Checkpoint has copy, drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
block_number: u64
-
--
-
-
--
-
block_hash: vector<u8>
-
--
-
-
--
-
state_root: Option::Option<vector<u8>>
-
--
-
-
-
-
-
-
-
-
-
-## Resource `Checkpoints`
-
-
-
-struct Checkpoints has store, key
-
-
-
-
-
-Fields
-
-
-
--
-
checkpoints: Ring::Ring<Block::Checkpoint>
-
--
-
-
--
-
index: u64
-
--
-
-
--
-
last_number: u64
-
--
-
-
-
-
-
@@ -223,42 +128,6 @@ Events emitted when new block generated.
## Constants
-
-
-
-
-const ERR_ALREADY_INITIALIZED: u64 = 21;
-
-
-
-
-
-
-
-
-const BLOCK_HEADER_LENGTH: u64 = 247;
-
-
-
-
-
-
-
-
-const BLOCK_INTERVAL_NUMBER: u64 = 5;
-
-
-
-
-
-
-
-
-const CHECKPOINT_LENGTH: u64 = 60;
-
-
-
-
@@ -268,33 +137,6 @@ Events emitted when new block generated.
-
-
-
-
-const ERROR_INTERVAL_TOO_LITTLE: u64 = 20;
-
-
-
-
-
-
-
-
-const ERROR_NOT_BLOCK_HEADER: u64 = 19;
-
-
-
-
-
-
-
-
-const ERROR_NO_HAVE_CHECKPOINT: u64 = 18;
-
-
-
-
## Function `initialize`
@@ -521,425 +363,6 @@ Call at block prologue
-
-
-
-
-## Function `checkpoints_init`
-
-
-
-public fun checkpoints_init()
-
-
-
-
-
-Implementation
-
-
-public fun checkpoints_init(){
-
- assert!(!exists<Checkpoints>(CoreAddresses::GENESIS_ADDRESS()), Errors::already_published(ERR_ALREADY_INITIALIZED));
- let signer = GenesisSignerCapability::get_genesis_signer();
-
- let checkpoints = Ring::create_with_capacity<Checkpoint>(CHECKPOINT_LENGTH);
- move_to<Checkpoints>(
- &signer,
- Checkpoints {
- checkpoints : checkpoints,
- index : 0,
- last_number : 0,
- });
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `checkpoint_entry`
-
-
-
-public(script) fun checkpoint_entry(_account: signer)
-
-
-
-
-
-Implementation
-
-
-public (script) fun checkpoint_entry(_account: signer) acquires BlockMetadata, Checkpoints {
- checkpoint();
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `checkpoint`
-
-
-
-public fun checkpoint()
-
-
-
-
-
-Implementation
-
-
-public fun checkpoint() acquires BlockMetadata, Checkpoints{
- let parent_block_number = get_current_block_number() - 1;
- let parent_block_hash = get_parent_hash();
-
- let checkpoints = borrow_global_mut<Checkpoints>(CoreAddresses::GENESIS_ADDRESS());
- base_checkpoint(checkpoints, parent_block_number, parent_block_hash);
-
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `base_checkpoint`
-
-
-
-fun base_checkpoint(checkpoints: &mut Block::Checkpoints, parent_block_number: u64, parent_block_hash: vector<u8>)
-
-
-
-
-
-Implementation
-
-
-fun base_checkpoint(checkpoints: &mut Checkpoints, parent_block_number: u64, parent_block_hash:vector<u8>){
- assert!(checkpoints.last_number + BLOCK_INTERVAL_NUMBER <= parent_block_number || checkpoints.last_number == 0, Errors::invalid_argument(ERROR_INTERVAL_TOO_LITTLE));
-
- checkpoints.index = checkpoints.index + 1;
- checkpoints.last_number = parent_block_number;
- let op_checkpoint = Ring::push<Checkpoint>(&mut checkpoints.checkpoints, Checkpoint {
- block_number: parent_block_number,
- block_hash: parent_block_hash,
- state_root: Option::none<vector<u8>>(),
- } );
- if(Option::is_some(&op_checkpoint)){
- Option::destroy_some(op_checkpoint);
- }else{
- Option::destroy_none(op_checkpoint);
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `latest_state_root`
-
-
-
-public fun latest_state_root(): (u64, vector<u8>)
-
-
-
-
-
-Implementation
-
-
-public fun latest_state_root():(u64,vector<u8>) acquires Checkpoints{
- let checkpoints = borrow_global<Checkpoints>(CoreAddresses::GENESIS_ADDRESS());
- base_latest_state_root(checkpoints)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `base_latest_state_root`
-
-
-
-fun base_latest_state_root(checkpoints: &Block::Checkpoints): (u64, vector<u8>)
-
-
-
-
-
-Implementation
-
-
-fun base_latest_state_root(checkpoints: &Checkpoints):(u64,vector<u8>){
- let len = Ring::capacity<Checkpoint>(&checkpoints.checkpoints);
- let j = if(checkpoints.index < len - 1){
- checkpoints.index
- }else{
- len
- };
- let i = checkpoints.index;
- while( j > 0){
- let op_checkpoint = Ring::borrow(&checkpoints.checkpoints, i - 1 );
- if( Option::is_some(op_checkpoint) && Option::is_some(&Option::borrow(op_checkpoint).state_root) ) {
- let state_root = Option::borrow(&Option::borrow(op_checkpoint).state_root);
- return (Option::borrow(op_checkpoint).block_number, *state_root)
- };
- j = j - 1;
- i = i - 1;
- };
-
- abort Errors::invalid_state(ERROR_NO_HAVE_CHECKPOINT)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `update_state_root_entry`
-
-
-
-public(script) fun update_state_root_entry(_account: signer, header: vector<u8>)
-
-
-
-
-
-Implementation
-
-
-public (script) fun update_state_root_entry(_account: signer , header: vector<u8>)
-acquires Checkpoints {
- update_state_root(header);
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `update_state_root`
-
-
-
-public fun update_state_root(header: vector<u8>)
-
-
-
-
-
-Implementation
-
-
-public fun update_state_root(header: vector<u8>) acquires Checkpoints {
- let checkpoints = borrow_global_mut<Checkpoints>(CoreAddresses::GENESIS_ADDRESS());
- base_update_state_root(checkpoints, header);
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `base_update_state_root`
-
-
-
-fun base_update_state_root(checkpoints: &mut Block::Checkpoints, header: vector<u8>)
-
-
-
-
-
-Implementation
-
-
-fun base_update_state_root(checkpoints: &mut Checkpoints, header: vector<u8>){
- let prefix = Hash::sha3_256(b"STARCOIN::BlockHeader");
-
- //parent_hash
- let new_offset = BCS::skip_bytes(&header,0);
- //timestamp
- let new_offset = BCS::skip_u64(&header,new_offset);
- //number
- let (number,new_offset) = BCS::deserialize_u64(&header,new_offset);
- //author
- new_offset = BCS::skip_address(&header,new_offset);
- //author_auth_key
- new_offset = BCS::skip_option_bytes(&header,new_offset);
- //txn_accumulator_root
- new_offset = BCS::skip_bytes(&header,new_offset);
- //block_accumulator_root
- new_offset = BCS::skip_bytes(&header,new_offset);
- //state_root
- let (state_root,_new_offset) = BCS::deserialize_bytes(&header,new_offset);
-
- Vector::append(&mut prefix,header);
- let block_hash = Hash::sha3_256(prefix);
-
- let len = Ring::capacity<Checkpoint>(&checkpoints.checkpoints);
- let j = if(checkpoints.index < len - 1){
- checkpoints.index
- }else{
- len
- };
- let i = checkpoints.index;
- while( j > 0){
- let op_checkpoint = Ring::borrow_mut(&mut checkpoints.checkpoints, i - 1);
-
- if( Option::is_some(op_checkpoint) && &Option::borrow(op_checkpoint).block_hash == &block_hash && Option::borrow<Checkpoint>(op_checkpoint).block_number == number) {
-
- let op_state_root = &mut Option::borrow_mut<Checkpoint>(op_checkpoint).state_root;
- if(Option::is_some(op_state_root)){
- Option::swap(op_state_root, state_root);
- }else{
- Option::fill(op_state_root, state_root);
- };
- return
- };
- j = j - 1;
- i = i - 1;
- };
-
- abort Errors::invalid_state(ERROR_NO_HAVE_CHECKPOINT)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
diff --git a/build/StarcoinFramework/docs/BlockReward.md b/build/StarcoinFramework/docs/BlockReward.md
index 4499e64e..213d255d 100644
--- a/build/StarcoinFramework/docs/BlockReward.md
+++ b/build/StarcoinFramework/docs/BlockReward.md
@@ -24,7 +24,7 @@ The module provide block rewarding calculation logic.
use 0x1::Timestamp;
use 0x1::Token;
use 0x1::Treasury;
-use 0x1::TreasuryPlugin;
+use 0x1::TreasuryWithdrawDaoProposal;
use 0x1::Vector;
@@ -317,7 +317,7 @@ Process the given block rewards.
block_reward = treasury_balance;
};
if (block_reward > 0) {
- let reward = TreasuryPlugin::withdraw_for_block_reward<STC>(account, block_reward);
+ let reward = TreasuryWithdrawDaoProposal::withdraw_for_block_reward<STC>(account, block_reward);
Token::deposit(&mut total_reward, reward);
};
};
diff --git a/build/StarcoinFramework/docs/Compare.md b/build/StarcoinFramework/docs/Compare.md
index cd7ba32c..006370d0 100644
--- a/build/StarcoinFramework/docs/Compare.md
+++ b/build/StarcoinFramework/docs/Compare.md
@@ -8,10 +8,8 @@
- [Constants](#@Constants_0)
- [Function `cmp_bcs_bytes`](#0x1_Compare_cmp_bcs_bytes)
- [Function `cmp_bytes`](#0x1_Compare_cmp_bytes)
+- [Function `cmp_u8`](#0x1_Compare_cmp_u8)
- [Function `cmp_u64`](#0x1_Compare_cmp_u64)
-- [Function `is_equal`](#0x1_Compare_is_equal)
-- [Function `is_less_than`](#0x1_Compare_is_less_than)
-- [Function `is_greater_than`](#0x1_Compare_is_greater_than)
- [Module Specification](#@Module_Specification_1)
@@ -102,11 +100,7 @@ Keep this in mind when using this function to compare addresses.
while (i1 > 0 && i2 > 0) {
i1 = i1 - 1;
i2 = i2 - 1;
- let v1 = *Vector::borrow(v1, i1);
- let v2 = *Vector::borrow(v2, i2);
- let elem_cmp = if (v1 == v2) EQUAL
- else if (v1 < v2) LESS_THAN
- else GREATER_THAN;
+ let elem_cmp = cmp_u8(*Vector::borrow(v1, i1), *Vector::borrow(v2, i2));
if (elem_cmp != 0) return elem_cmp
// else, compare next element
};
@@ -150,18 +144,16 @@ Keep this in mind when using this function to compare addresses.
let l1 = Vector::length(v1);
let l2 = Vector::length(v2);
let len_cmp = cmp_u64(l1, l2);
- let i = 0;
- while (i < l1 && i < l2) {
- let v1 = *Vector::borrow(v1, i);
- let v2 = *Vector::borrow(v2, i);
- let elem_cmp = if (v1 == v2) EQUAL
- else if (v1 < v2) LESS_THAN
- else GREATER_THAN;
+ let i1 = 0;
+ let i2 = 0;
+ while (i1 < l1 && i2 < l2) {
+ let elem_cmp = cmp_u8(*Vector::borrow(v1, i1), *Vector::borrow(v2, i2));
if (elem_cmp != 0) {
return elem_cmp
};
// else, compare next element
- i = i + 1;
+ i1 = i1 + 1;
+ i2 = i2 + 1;
};
// all compared elements equal; use length comparison to break the tie
len_cmp
@@ -184,13 +176,13 @@ Keep this in mind when using this function to compare addresses.
-
+
-## Function `cmp_u64`
+## Function `cmp_u8`
-fun cmp_u64(i1: u64, i2: u64): u8
+fun cmp_u8(i1: u8, i2: u8): u8
@@ -199,7 +191,7 @@ Keep this in mind when using this function to compare addresses.
Implementation
-fun cmp_u64(i1: u64, i2: u64): u8 {
+fun cmp_u8(i1: u8, i2: u8): u8 {
if (i1 == i2) EQUAL
else if (i1 < i2) LESS_THAN
else GREATER_THAN
@@ -222,85 +214,13 @@ Keep this in mind when using this function to compare addresses.
-
-
-## Function `is_equal`
-
-
-
-public fun is_equal(result: u8): bool
-
-
-
-
-
-Implementation
-
-
-public fun is_equal(result: u8): bool {
- result == EQUAL
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-aborts_if false;
-
-
-
-
-
-
-
-
-## Function `is_less_than`
-
-
-
-public fun is_less_than(result: u8): bool
-
-
-
-
-
-Implementation
-
-
-public fun is_less_than(result: u8): bool {
- result == LESS_THAN
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-aborts_if false;
-
-
-
-
-
-
-
+
-## Function `is_greater_than`
+## Function `cmp_u64`
-public fun is_greater_than(result: u8): bool
+fun cmp_u64(i1: u64, i2: u64): u8
@@ -309,8 +229,10 @@ Keep this in mind when using this function to compare addresses.
Implementation
-public fun is_greater_than(result: u8): bool {
- result == GREATER_THAN
+fun cmp_u64(i1: u64, i2: u64): u8 {
+ if (i1 == i2) EQUAL
+ else if (i1 < i2) LESS_THAN
+ else GREATER_THAN
}
diff --git a/build/StarcoinFramework/docs/Genesis.md b/build/StarcoinFramework/docs/Genesis.md
index 1bebd584..9a994b7a 100644
--- a/build/StarcoinFramework/docs/Genesis.md
+++ b/build/StarcoinFramework/docs/Genesis.md
@@ -14,49 +14,34 @@ The module for init Genesis
use 0x1::Account;
-use 0x1::AnyMemberPlugin;
use 0x1::Block;
use 0x1::BlockReward;
use 0x1::ChainId;
+use 0x1::Collection;
use 0x1::Config;
-use 0x1::ConfigProposalPlugin;
use 0x1::ConsensusConfig;
use 0x1::ConsensusStrategy;
use 0x1::CoreAddresses;
-use 0x1::DAOExtensionPoint;
-use 0x1::DAOPluginMarketplace;
-use 0x1::DAORegistry;
use 0x1::DummyToken;
use 0x1::Epoch;
-use 0x1::Errors;
-use 0x1::GasOracleProposalPlugin;
use 0x1::GenesisNFT;
use 0x1::GenesisSignerCapability;
-use 0x1::GrantProposalPlugin;
-use 0x1::InstallPluginProposalPlugin;
-use 0x1::LanguageVersion;
-use 0x1::MemberProposalPlugin;
-use 0x1::MintProposalPlugin;
use 0x1::Option;
use 0x1::PackageTxnManager;
-use 0x1::RewardConfig;
use 0x1::STC;
use 0x1::STCUSDOracle;
use 0x1::Signer;
-use 0x1::StakeToSBTPlugin;
-use 0x1::StarcoinDAO;
+use 0x1::StdlibUpgradeScripts;
use 0x1::Timestamp;
use 0x1::Token;
use 0x1::TransactionFee;
use 0x1::TransactionPublishOption;
use 0x1::TransactionTimeoutConfig;
use 0x1::Treasury;
-use 0x1::TreasuryPlugin;
-use 0x1::UpgradeModulePlugin;
+use 0x1::TreasuryWithdrawDaoProposal;
use 0x1::VMConfig;
use 0x1::Vector;
use 0x1::Version;
-use 0x1::WithdrawPlugin;
@@ -67,7 +52,7 @@ The module for init Genesis
-public(script) fun initialize(_stdlib_version: u64, _reward_delay: u64, _pre_mine_stc_amount: u128, _time_mint_stc_amount: u128, _time_mint_stc_period: u64, _parent_hash: vector<u8>, _association_auth_key: vector<u8>, _genesis_auth_key: vector<u8>, _chain_id: u8, _genesis_timestamp: u64, _uncle_rate_target: u64, _epoch_block_count: u64, _base_block_time_target: u64, _base_block_difficulty_window: u64, _base_reward_per_block: u128, _base_reward_per_uncle_percent: u64, _min_block_time_target: u64, _max_block_time_target: u64, _base_max_uncles_per_block: u64, _base_block_gas_limit: u64, _strategy: u8, _script_allowed: bool, _module_publishing_allowed: bool, _instruction_schedule: vector<u8>, _native_schedule: vector<u8>, _global_memory_per_byte_cost: u64, _global_memory_per_byte_write_cost: u64, _min_transaction_gas_units: u64, _large_transaction_cutoff: u64, _instrinsic_gas_per_byte: u64, _maximum_number_of_gas_units: u64, _min_price_per_gas_unit: u64, _max_price_per_gas_unit: u64, _max_transaction_size_in_bytes: u64, _gas_unit_scaling_factor: u64, _default_account_size: u64, _voting_delay: u64, _voting_period: u64, _voting_quorum_rate: u8, _min_action_delay: u64, _transaction_timeout: u64)
+public(script) fun initialize(stdlib_version: u64, reward_delay: u64, pre_mine_stc_amount: u128, time_mint_stc_amount: u128, time_mint_stc_period: u64, parent_hash: vector<u8>, association_auth_key: vector<u8>, genesis_auth_key: vector<u8>, chain_id: u8, genesis_timestamp: u64, uncle_rate_target: u64, epoch_block_count: u64, base_block_time_target: u64, base_block_difficulty_window: u64, base_reward_per_block: u128, base_reward_per_uncle_percent: u64, min_block_time_target: u64, max_block_time_target: u64, base_max_uncles_per_block: u64, base_block_gas_limit: u64, strategy: u8, script_allowed: bool, module_publishing_allowed: bool, instruction_schedule: vector<u8>, native_schedule: vector<u8>, global_memory_per_byte_cost: u64, global_memory_per_byte_write_cost: u64, min_transaction_gas_units: u64, large_transaction_cutoff: u64, instrinsic_gas_per_byte: u64, maximum_number_of_gas_units: u64, min_price_per_gas_unit: u64, max_price_per_gas_unit: u64, max_transaction_size_in_bytes: u64, gas_unit_scaling_factor: u64, default_account_size: u64, voting_delay: u64, voting_period: u64, voting_quorum_rate: u8, min_action_delay: u64, transaction_timeout: u64)
@@ -77,55 +62,149 @@ The module for init Genesis
public(script) fun initialize(
- _stdlib_version: u64,
+ stdlib_version: u64,
+
// block reward config
- _reward_delay: u64,
- _pre_mine_stc_amount: u128,
- _time_mint_stc_amount: u128,
- _time_mint_stc_period: u64,
- _parent_hash: vector<u8>,
- _association_auth_key: vector<u8>,
- _genesis_auth_key: vector<u8>,
- _chain_id: u8,
- _genesis_timestamp: u64,
+ reward_delay: u64,
+
+ pre_mine_stc_amount: u128,
+ time_mint_stc_amount: u128,
+ time_mint_stc_period: u64,
+ parent_hash: vector<u8>,
+ association_auth_key: vector<u8>,
+ genesis_auth_key: vector<u8>,
+ chain_id: u8,
+ genesis_timestamp: u64,
+
//consensus config
- _uncle_rate_target: u64,
- _epoch_block_count: u64,
- _base_block_time_target: u64,
- _base_block_difficulty_window: u64,
- _base_reward_per_block: u128,
- _base_reward_per_uncle_percent: u64,
- _min_block_time_target: u64,
- _max_block_time_target: u64,
- _base_max_uncles_per_block: u64,
- _base_block_gas_limit: u64,
- _strategy: u8,
+ uncle_rate_target: u64,
+ epoch_block_count: u64,
+ base_block_time_target: u64,
+ base_block_difficulty_window: u64,
+ base_reward_per_block: u128,
+ base_reward_per_uncle_percent: u64,
+ min_block_time_target: u64,
+ max_block_time_target: u64,
+ base_max_uncles_per_block: u64,
+ base_block_gas_limit: u64,
+ strategy: u8,
+
//vm config
- _script_allowed: bool,
- _module_publishing_allowed: bool,
- _instruction_schedule: vector<u8>,
- _native_schedule: vector<u8>,
+ script_allowed: bool,
+ module_publishing_allowed: bool,
+ instruction_schedule: vector<u8>,
+ native_schedule: vector<u8>,
+
//gas constants
- _global_memory_per_byte_cost: u64,
- _global_memory_per_byte_write_cost: u64,
- _min_transaction_gas_units: u64,
- _large_transaction_cutoff: u64,
- _instrinsic_gas_per_byte: u64,
- _maximum_number_of_gas_units: u64,
- _min_price_per_gas_unit: u64,
- _max_price_per_gas_unit: u64,
- _max_transaction_size_in_bytes: u64,
- _gas_unit_scaling_factor: u64,
- _default_account_size: u64,
+ global_memory_per_byte_cost: u64,
+ global_memory_per_byte_write_cost: u64,
+ min_transaction_gas_units: u64,
+ large_transaction_cutoff: u64,
+ instrinsic_gas_per_byte: u64,
+ maximum_number_of_gas_units: u64,
+ min_price_per_gas_unit: u64,
+ max_price_per_gas_unit: u64,
+ max_transaction_size_in_bytes: u64,
+ gas_unit_scaling_factor: u64,
+ default_account_size: u64,
+
// dao config
- _voting_delay: u64,
- _voting_period: u64,
- _voting_quorum_rate: u8,
- _min_action_delay: u64,
+ voting_delay: u64,
+ voting_period: u64,
+ voting_quorum_rate: u8,
+ min_action_delay: u64,
+
// transaction timeout config
- _transaction_timeout: u64,
+ transaction_timeout: u64,
) {
- abort Errors::deprecated(1)
+ assert!(Timestamp::is_genesis(), 1);
+ // create genesis account
+ let genesis_account = Account::create_genesis_account(CoreAddresses::GENESIS_ADDRESS());
+ //Init global time
+ Timestamp::initialize(&genesis_account, genesis_timestamp);
+ ChainId::initialize(&genesis_account, chain_id);
+ ConsensusStrategy::initialize(&genesis_account, strategy);
+ Block::initialize(&genesis_account, parent_hash);
+ TransactionPublishOption::initialize(
+ &genesis_account,
+ script_allowed,
+ module_publishing_allowed,
+ );
+ // init config
+ VMConfig::initialize(
+ &genesis_account,
+ instruction_schedule,
+ native_schedule,
+ global_memory_per_byte_cost,
+ global_memory_per_byte_write_cost,
+ min_transaction_gas_units,
+ large_transaction_cutoff,
+ instrinsic_gas_per_byte,
+ maximum_number_of_gas_units,
+ min_price_per_gas_unit,
+ max_price_per_gas_unit,
+ max_transaction_size_in_bytes,
+ gas_unit_scaling_factor,
+ default_account_size,
+ );
+ TransactionTimeoutConfig::initialize(&genesis_account, transaction_timeout);
+ ConsensusConfig::initialize(
+ &genesis_account,
+ uncle_rate_target,
+ epoch_block_count,
+ base_block_time_target,
+ base_block_difficulty_window,
+ base_reward_per_block,
+ base_reward_per_uncle_percent,
+ min_block_time_target,
+ max_block_time_target,
+ base_max_uncles_per_block,
+ base_block_gas_limit,
+ strategy,
+ );
+ Epoch::initialize(&genesis_account);
+ BlockReward::initialize(&genesis_account, reward_delay);
+ TransactionFee::initialize(&genesis_account);
+ let association = Account::create_genesis_account(
+ CoreAddresses::ASSOCIATION_ROOT_ADDRESS(),
+ );
+ Config::publish_new_config<Version::Version>(&genesis_account, Version::new_version(stdlib_version));
+ // stdlib use two phase upgrade strategy.
+ PackageTxnManager::update_module_upgrade_strategy(
+ &genesis_account,
+ PackageTxnManager::get_strategy_two_phase(),
+ Option::some(0u64),
+ );
+ // stc should be initialized after genesis_account's module upgrade strategy set.
+ {
+ STC::initialize(&genesis_account, voting_delay, voting_period, voting_quorum_rate, min_action_delay);
+ Account::do_accept_token<STC>(&genesis_account);
+ DummyToken::initialize(&genesis_account);
+ Account::do_accept_token<STC>(&association);
+ };
+ if (pre_mine_stc_amount > 0) {
+ let stc = Token::mint<STC>(&genesis_account, pre_mine_stc_amount);
+ Account::deposit(Signer::address_of(&association), stc);
+ };
+ if (time_mint_stc_amount > 0) {
+ let cap = Token::remove_mint_capability<STC>(&genesis_account);
+ let key = Token::issue_linear_mint_key<STC>(&cap, time_mint_stc_amount, time_mint_stc_period);
+ Token::add_mint_capability(&genesis_account, cap);
+ Collection::put(&association, key);
+ };
+ // only dev network set genesis auth key.
+ if (!Vector::is_empty(&genesis_auth_key)) {
+ let genesis_rotate_key_cap = Account::extract_key_rotation_capability(&genesis_account);
+ Account::rotate_authentication_key_with_capability(&genesis_rotate_key_cap, genesis_auth_key);
+ Account::restore_key_rotation_capability(genesis_rotate_key_cap);
+ };
+ let assoc_rotate_key_cap = Account::extract_key_rotation_capability(&association);
+ Account::rotate_authentication_key_with_capability(&assoc_rotate_key_cap, association_auth_key);
+ Account::restore_key_rotation_capability(assoc_rotate_key_cap);
+ //Start time, Timestamp::is_genesis() will return false. this call should at the end of genesis init.
+ Timestamp::set_time_has_started(&genesis_account);
+ Account::release_genesis_signer(genesis_account);
+ Account::release_genesis_signer(association);
}
@@ -150,17 +229,20 @@ The module for init Genesis
public(script) fun initialize_v2(
stdlib_version: u64,
+
// block reward and stc config
reward_delay: u64,
total_stc_amount: u128,
pre_mine_stc_amount: u128,
time_mint_stc_amount: u128,
time_mint_stc_period: u64,
+
parent_hash: vector<u8>,
association_auth_key: vector<u8>,
genesis_auth_key: vector<u8>,
chain_id: u8,
genesis_timestamp: u64,
+
//consensus config
uncle_rate_target: u64,
epoch_block_count: u64,
@@ -173,11 +255,13 @@ The module for init Genesis
base_max_uncles_per_block: u64,
base_block_gas_limit: u64,
strategy: u8,
+
//vm config
script_allowed: bool,
module_publishing_allowed: bool,
instruction_schedule: vector<u8>,
native_schedule: vector<u8>,
+
//gas constants
global_memory_per_byte_cost: u64,
global_memory_per_byte_write_cost: u64,
@@ -190,57 +274,59 @@ The module for init Genesis
max_transaction_size_in_bytes: u64,
gas_unit_scaling_factor: u64,
default_account_size: u64,
+
// dao config
voting_delay: u64,
voting_period: u64,
voting_quorum_rate: u8,
min_action_delay: u64,
+
// transaction timeout config
transaction_timeout: u64,
) {
Self::do_initialize(
- stdlib_version,
- reward_delay,
- total_stc_amount,
- pre_mine_stc_amount,
- time_mint_stc_amount,
- time_mint_stc_period,
- parent_hash,
- association_auth_key,
- genesis_auth_key,
- chain_id,
- genesis_timestamp,
- uncle_rate_target,
- epoch_block_count,
- base_block_time_target,
- base_block_difficulty_window,
- base_reward_per_block,
- base_reward_per_uncle_percent,
- min_block_time_target,
- max_block_time_target,
- base_max_uncles_per_block,
- base_block_gas_limit,
- strategy,
- script_allowed,
- module_publishing_allowed,
- instruction_schedule,
- native_schedule,
- global_memory_per_byte_cost,
- global_memory_per_byte_write_cost,
- min_transaction_gas_units,
- large_transaction_cutoff,
- instrinsic_gas_per_byte,
- maximum_number_of_gas_units,
- min_price_per_gas_unit,
- max_price_per_gas_unit,
- max_transaction_size_in_bytes,
- gas_unit_scaling_factor,
- default_account_size,
- voting_delay,
- voting_period,
- voting_quorum_rate,
- min_action_delay,
- transaction_timeout,
+ stdlib_version,
+ reward_delay,
+ total_stc_amount,
+ pre_mine_stc_amount,
+ time_mint_stc_amount,
+ time_mint_stc_period,
+ parent_hash,
+ association_auth_key,
+ genesis_auth_key,
+ chain_id,
+ genesis_timestamp,
+ uncle_rate_target,
+ epoch_block_count,
+ base_block_time_target,
+ base_block_difficulty_window,
+ base_reward_per_block,
+ base_reward_per_uncle_percent,
+ min_block_time_target,
+ max_block_time_target,
+ base_max_uncles_per_block,
+ base_block_gas_limit,
+ strategy,
+ script_allowed,
+ module_publishing_allowed,
+ instruction_schedule,
+ native_schedule,
+ global_memory_per_byte_cost,
+ global_memory_per_byte_write_cost,
+ min_transaction_gas_units,
+ large_transaction_cutoff,
+ instrinsic_gas_per_byte,
+ maximum_number_of_gas_units,
+ min_price_per_gas_unit,
+ max_price_per_gas_unit,
+ max_transaction_size_in_bytes,
+ gas_unit_scaling_factor,
+ default_account_size,
+ voting_delay,
+ voting_period,
+ voting_quorum_rate,
+ min_action_delay,
+ transaction_timeout,
);
}
@@ -266,17 +352,20 @@ The module for init Genesis
fun do_initialize(
stdlib_version: u64,
+
// block reward and stc config
reward_delay: u64,
total_stc_amount: u128,
pre_mine_stc_amount: u128,
time_mint_stc_amount: u128,
time_mint_stc_period: u64,
+
parent_hash: vector<u8>,
association_auth_key: vector<u8>,
genesis_auth_key: vector<u8>,
chain_id: u8,
genesis_timestamp: u64,
+
//consensus config
uncle_rate_target: u64,
epoch_block_count: u64,
@@ -289,11 +378,13 @@ The module for init Genesis
base_max_uncles_per_block: u64,
base_block_gas_limit: u64,
strategy: u8,
+
//vm config
script_allowed: bool,
module_publishing_allowed: bool,
instruction_schedule: vector<u8>,
native_schedule: vector<u8>,
+
//gas constants
global_memory_per_byte_cost: u64,
global_memory_per_byte_write_cost: u64,
@@ -306,14 +397,16 @@ The module for init Genesis
max_transaction_size_in_bytes: u64,
gas_unit_scaling_factor: u64,
default_account_size: u64,
+
// dao config
voting_delay: u64,
voting_period: u64,
voting_quorum_rate: u8,
min_action_delay: u64,
+
// transaction timeout config
transaction_timeout: u64,
-) {
+){
Timestamp::assert_genesis();
// create genesis account
let genesis_account = Account::create_genesis_account(CoreAddresses::GENESIS_ADDRESS());
@@ -373,7 +466,7 @@ The module for init Genesis
BlockReward::initialize(&genesis_account, reward_delay);
// stc should be initialized after genesis_account's module upgrade strategy set and all on chain config init.
- let withdraw_cap = STC::initialize_v3(&genesis_account, total_stc_amount);
+ let withdraw_cap = STC::initialize_v2(&genesis_account, total_stc_amount, voting_delay, voting_period, voting_quorum_rate, min_action_delay);
Account::do_accept_token<STC>(&genesis_account);
Account::do_accept_token<STC>(&association);
@@ -389,7 +482,7 @@ The module for init Genesis
};
// Lock the TreasuryWithdrawCapability to Dao
- TreasuryPlugin::delegate_capability<STC>(&genesis_account, withdraw_cap);
+ TreasuryWithdrawDaoProposal::plugin(&genesis_account, withdraw_cap);
TransactionFee::initialize(&genesis_account);
@@ -414,48 +507,7 @@ The module for init Genesis
let image = b"ipfs://QmSPcvcXgdtHHiVTAAarzTeubk5X3iWymPAoKBfiRFjPMY";
GenesisNFT::initialize(&genesis_account, merkle_root, 1639u64, image);
};
- Config::publish_new_config(&genesis_account, LanguageVersion::new(4));
-
- //v11 -> v12
- Block::checkpoints_init();
- DAORegistry::initialize();
-
- DAOExtensionPoint::initialize();
- DAOPluginMarketplace::initialize();
-
- AnyMemberPlugin::initialize(&genesis_account);
- ConfigProposalPlugin::initialize(&genesis_account);
- GrantProposalPlugin::initialize(&genesis_account);
- InstallPluginProposalPlugin::initialize(&genesis_account);
- MemberProposalPlugin::initialize(&genesis_account);
- MintProposalPlugin::initialize(&genesis_account);
- StakeToSBTPlugin::initialize(&genesis_account);
- UpgradeModulePlugin::initialize(&genesis_account);
- GasOracleProposalPlugin::initialize(&genesis_account);
- TreasuryPlugin::initialize(&genesis_account);
-
- let signer_cap = Account::get_genesis_capability();
- let upgrade_plan_cap = PackageTxnManager::extract_submit_upgrade_plan_cap(&genesis_account);
- StarcoinDAO::create_dao(signer_cap, upgrade_plan_cap, voting_delay, voting_period, voting_quorum_rate, min_action_delay, 1000 * 1000 * 1000 * 1000);
-
- StarcoinDAO::delegate_config_capability<STC, TransactionPublishOption::TransactionPublishOption>(
- Config::extract_modify_config_capability<TransactionPublishOption::TransactionPublishOption>(&genesis_account));
- StarcoinDAO::delegate_config_capability<STC, VMConfig::VMConfig>(
- Config::extract_modify_config_capability<VMConfig::VMConfig>(&genesis_account));
- StarcoinDAO::delegate_config_capability<STC, ConsensusConfig::ConsensusConfig>(
- Config::extract_modify_config_capability<ConsensusConfig::ConsensusConfig>(&genesis_account));
- StarcoinDAO::delegate_config_capability<STC, RewardConfig::RewardConfig>(
- Config::extract_modify_config_capability<RewardConfig::RewardConfig>(&genesis_account));
- StarcoinDAO::delegate_config_capability<STC, TransactionTimeoutConfig::TransactionTimeoutConfig>(
- Config::extract_modify_config_capability<TransactionTimeoutConfig::TransactionTimeoutConfig>(&genesis_account));
- StarcoinDAO::delegate_config_capability<STC, LanguageVersion::LanguageVersion>(
- Config::extract_modify_config_capability<LanguageVersion::LanguageVersion>(&genesis_account));
- StarcoinDAO::set_treasury_withdraw_proposal_scale(100);
-
- // v12 -> v13
- WithdrawPlugin::initialize(&genesis_account);
- StarcoinDAO::upgrade_dao();
-
+ StdlibUpgradeScripts::do_upgrade_from_v6_to_v7_with_language_version(&genesis_account, 4);
//Start time, Timestamp::is_genesis() will return false. this call should at the end of genesis init.
Timestamp::set_time_has_started(&genesis_account);
Account::release_genesis_signer(genesis_account);
@@ -483,19 +535,19 @@ Init the genesis for unit tests
Implementation
-public fun initialize_for_unit_tests() {
+public fun initialize_for_unit_tests(){
let stdlib_version: u64 = 6;
let reward_delay: u64 = 7;
let total_stc_amount: u128 = 3185136000000000000u128;
let pre_mine_stc_amount: u128 = 159256800000000000u128;
- let time_mint_stc_amount: u128 = (85043130u128 * 3u128 + 74213670u128 * 3u128) * 1000000000u128;
+ let time_mint_stc_amount: u128 = (85043130u128 * 3u128 + 74213670u128 * 3u128)*1000000000u128;
let time_mint_stc_period: u64 = 1000000000;
let parent_hash: vector<u8> = x"0000000000000000000000000000000000000000000000000000000000000000";
let association_auth_key: vector<u8> = x"0000000000000000000000000000000000000000000000000000000000000000";
let genesis_auth_key: vector<u8> = x"0000000000000000000000000000000000000000000000000000000000000000";
let chain_id: u8 = 255;
- let genesis_timestamp: u64 = 0;
+ let genesis_timestamp: u64 =0;
//consensus config
let uncle_rate_target: u64 = 80;
@@ -526,13 +578,13 @@ Init the genesis for unit tests
let maximum_number_of_gas_units: u64 = 1;
let min_price_per_gas_unit: u64 = 1;
let max_price_per_gas_unit: u64 = 10000;
- let max_transaction_size_in_bytes: u64 = 1024 * 1024;
+ let max_transaction_size_in_bytes: u64 = 1024*1024;
let gas_unit_scaling_factor: u64 = 1;
let default_account_size: u64 = 600;
// dao config
let voting_delay: u64 = 1000;
- let voting_period: u64 = 6000;
+ let voting_period: u64 = 6000;
let voting_quorum_rate: u8 = 4;
let min_action_delay: u64 = 1000;
diff --git a/build/StarcoinFramework/docs/GenesisNFT.md b/build/StarcoinFramework/docs/GenesisNFT.md
index b25f6504..8dfc03e3 100644
--- a/build/StarcoinFramework/docs/GenesisNFT.md
+++ b/build/StarcoinFramework/docs/GenesisNFT.md
@@ -31,7 +31,7 @@ Mint a GenesisNFT
public(script) fun mint(sender: signer, index: u64, merkle_proof:vector<vector<u8>>) {
- GenesisNFT::mint_entry(sender, index, merkle_proof);
+ GenesisNFT::mint(&sender, index, merkle_proof);
}
diff --git a/build/StarcoinFramework/docs/InstallPluginProposalPlugin.md b/build/StarcoinFramework/docs/InstallPluginProposalPlugin.md
deleted file mode 100644
index 908486f8..00000000
--- a/build/StarcoinFramework/docs/InstallPluginProposalPlugin.md
+++ /dev/null
@@ -1,233 +0,0 @@
-
-
-
-# Module `0x1::InstallPluginProposalPlugin`
-
-
-
-- [Struct `InstallPluginProposalPlugin`](#0x1_InstallPluginProposalPlugin_InstallPluginProposalPlugin)
-- [Struct `InstallPluginAction`](#0x1_InstallPluginProposalPlugin_InstallPluginAction)
-- [Function `initialize`](#0x1_InstallPluginProposalPlugin_initialize)
-- [Function `required_caps`](#0x1_InstallPluginProposalPlugin_required_caps)
-- [Function `create_proposal`](#0x1_InstallPluginProposalPlugin_create_proposal)
-- [Function `execute_proposal`](#0x1_InstallPluginProposalPlugin_execute_proposal)
-- [Function `execute_proposal_entry`](#0x1_InstallPluginProposalPlugin_execute_proposal_entry)
-
-
-use 0x1::DAOPluginMarketplace;
-use 0x1::DAOSpace;
-use 0x1::Option;
-use 0x1::Vector;
-
-
-
-
-
-
-## Struct `InstallPluginProposalPlugin`
-
-
-
-struct InstallPluginProposalPlugin has drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
dummy_field: bool
-
--
-
-
-
-
-
-
-
-
-
-## Struct `InstallPluginAction`
-
-
-
-struct InstallPluginAction<ToInstallPluginT> has drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
required_caps: vector<DAOSpace::CapType>
-
--
-
-
-
-
-
-
-
-
-
-## Function `initialize`
-
-
-
-public fun initialize(_sender: &signer)
-
-
-
-
-
-Implementation
-
-
-public fun initialize(_sender: &signer) {
- let witness = InstallPluginProposalPlugin{};
-
- DAOPluginMarketplace::register_plugin<InstallPluginProposalPlugin>(
- &witness,
- b"0x1::InstallPluginProposalPlugin",
- b"The plugin for install plugin proposal",
- Option::none(),
- );
-
- let implement_extpoints = Vector::empty<vector<u8>>();
- let depend_extpoints = Vector::empty<vector<u8>>();
-
- DAOPluginMarketplace::publish_plugin_version<InstallPluginProposalPlugin>(
- &witness,
- b"v0.1.0",
- *&implement_extpoints,
- *&depend_extpoints,
- b"inner-plugin://install-plugin-proposal-plugin",
- );
-}
-
-
-
-
-
-
-
-
-## Function `required_caps`
-
-
-
-public fun required_caps(): vector<DAOSpace::CapType>
-
-
-
-
-
-Implementation
-
-
-public fun required_caps():vector<CapType>{
- let caps = Vector::singleton(DAOSpace::proposal_cap_type());
- Vector::push_back(&mut caps, DAOSpace::install_plugin_cap_type());
- caps
-}
-
-
-
-
-
-
-
-
-## Function `create_proposal`
-
-Create a proposal to install a plugin.
-We do not provide a entry function for create_proposal, because we can not use CapType as an entry function parameter,
-every plugin should provide a entry function to create proposal to install self.
-
-
-public fun create_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, required_caps: vector<DAOSpace::CapType>, title: vector<u8>, introduction: vector<u8>, extend: vector<u8>, action_delay: u64)
-
-
-
-
-
-Implementation
-
-
-public fun create_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, required_caps: vector<CapType>, title:vector<u8>, introduction:vector<u8>, extend: vector<u8>, action_delay: u64){
- let witness = InstallPluginProposalPlugin{};
-
- let cap = DAOSpace::acquire_proposal_cap<DAOT, InstallPluginProposalPlugin>(&witness);
- let action = InstallPluginAction<ToInstallPluginT>{
- required_caps,
- };
-
- DAOSpace::create_proposal(&cap, sender, action, title, introduction, extend, action_delay, Option::none<u8>());
-}
-
-
-
-
-
-
-
-
-## Function `execute_proposal`
-
-
-
-public fun execute_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, proposal_id: u64)
-
-
-
-
-
-Implementation
-
-
-public fun execute_proposal<DAOT: store, ToInstallPluginT: store>(sender: &signer, proposal_id: u64){
- let witness = InstallPluginProposalPlugin{};
-
- let proposal_cap = DAOSpace::acquire_proposal_cap<DAOT, InstallPluginProposalPlugin>(&witness);
- let InstallPluginAction{required_caps} = DAOSpace::execute_proposal<DAOT, InstallPluginProposalPlugin, InstallPluginAction<ToInstallPluginT>>(&proposal_cap, sender, proposal_id);
-
- let install_plugin_cap = DAOSpace::acquire_install_plugin_cap<DAOT, InstallPluginProposalPlugin>(&witness);
- DAOSpace::install_plugin<DAOT, InstallPluginProposalPlugin, ToInstallPluginT>(&install_plugin_cap, required_caps);
-}
-
-
-
-
-
-
-
-
-## Function `execute_proposal_entry`
-
-
-
-public(script) fun execute_proposal_entry<DAOT: store, ToInstallPluginT: store>(sender: signer, proposal_id: u64)
-
-
-
-
-
-Implementation
-
-
-public (script) fun execute_proposal_entry<DAOT: store, ToInstallPluginT: store>(sender: signer, proposal_id: u64) {
- execute_proposal<DAOT, ToInstallPluginT>(&sender, proposal_id);
-}
-
-
-
-
-
diff --git a/build/StarcoinFramework/docs/MemberProposalPlugin.md b/build/StarcoinFramework/docs/MemberProposalPlugin.md
deleted file mode 100644
index 818e6e9c..00000000
--- a/build/StarcoinFramework/docs/MemberProposalPlugin.md
+++ /dev/null
@@ -1,360 +0,0 @@
-
-
-
-# Module `0x1::MemberProposalPlugin`
-
-
-
-- [Struct `MemberProposalPlugin`](#0x1_MemberProposalPlugin_MemberProposalPlugin)
-- [Struct `MemberJoinAction`](#0x1_MemberProposalPlugin_MemberJoinAction)
-- [Constants](#@Constants_0)
-- [Function `initialize`](#0x1_MemberProposalPlugin_initialize)
-- [Function `required_caps`](#0x1_MemberProposalPlugin_required_caps)
-- [Function `create_proposal`](#0x1_MemberProposalPlugin_create_proposal)
-- [Function `create_proposal_entry`](#0x1_MemberProposalPlugin_create_proposal_entry)
-- [Function `execute_proposal`](#0x1_MemberProposalPlugin_execute_proposal)
-- [Function `execute_proposal_entry`](#0x1_MemberProposalPlugin_execute_proposal_entry)
-- [Function `install_plugin_proposal`](#0x1_MemberProposalPlugin_install_plugin_proposal)
-- [Function `install_plugin_proposal_entry`](#0x1_MemberProposalPlugin_install_plugin_proposal_entry)
-
-
-use 0x1::DAOPluginMarketplace;
-use 0x1::DAOSpace;
-use 0x1::Errors;
-use 0x1::InstallPluginProposalPlugin;
-use 0x1::Option;
-use 0x1::Vector;
-
-
-
-
-
-
-## Struct `MemberProposalPlugin`
-
-
-
-struct MemberProposalPlugin has drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
dummy_field: bool
-
--
-
-
-
-
-
-
-
-
-
-## Struct `MemberJoinAction`
-
-
-
-struct MemberJoinAction has drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
member: address
-
--
-
-
--
-
init_sbt: u128
-
--
-
-
--
-
image_url: vector<u8>
-
--
-
-
--
-
image_data: vector<u8>
-
--
-
-
-
-
-
-
-
-
-
-## Constants
-
-
-
-
-
-
-const ERR_MEMBER_EXIST: u64 = 101;
-
-
-
-
-
-
-
-
-const ERR_MEMBER_OFFER_EXIST: u64 = 102;
-
-
-
-
-
-
-## Function `initialize`
-
-
-
-public fun initialize(_sender: &signer)
-
-
-
-
-
-Implementation
-
-
-public fun initialize(_sender: &signer) {
- let witness = MemberProposalPlugin{};
-
- DAOPluginMarketplace::register_plugin<MemberProposalPlugin>(
- &witness,
- b"0x1::MemberProposalPlugin",
- b"The plugin for member proposal",
- Option::none(),
- );
-
- let implement_extpoints = Vector::empty<vector<u8>>();
- let depend_extpoints = Vector::empty<vector<u8>>();
-
- DAOPluginMarketplace::publish_plugin_version<MemberProposalPlugin>(
- &witness,
- b"v0.1.0",
- *&implement_extpoints,
- *&depend_extpoints,
- b"inner-plugin://member-proposal-plugin",
- );
-}
-
-
-
-
-
-
-
-
-## Function `required_caps`
-
-
-
-public fun required_caps(): vector<DAOSpace::CapType>
-
-
-
-
-
-Implementation
-
-
-public fun required_caps():vector<CapType>{
- let caps = Vector::singleton(DAOSpace::member_cap_type());
- Vector::push_back(&mut caps, DAOSpace::proposal_cap_type());
- caps
-}
-
-
-
-
-
-
-
-
-## Function `create_proposal`
-
-
-
-public fun create_proposal<DAOT: store>(sender: &signer, title: vector<u8>, introduction: vector<u8>, extend: vector<u8>, member: address, image_data: vector<u8>, image_url: vector<u8>, init_sbt: u128, action_delay: u64)
-
-
-
-
-
-Implementation
-
-
-public fun create_proposal<DAOT: store>(sender: &signer, title:vector<u8>, introduction:vector<u8>, extend: vector<u8>, member: address, image_data:vector<u8>, image_url:vector<u8>, init_sbt: u128, action_delay: u64){
- let witness = MemberProposalPlugin{};
- let cap = DAOSpace::acquire_proposal_cap<DAOT, MemberProposalPlugin>(&witness);
- let action = MemberJoinAction{
- member,
- init_sbt,
- image_data,
- image_url
- };
- assert!(!DAOSpace::is_exist_member_offer<DAOT>(member), Errors::already_published(ERR_MEMBER_OFFER_EXIST));
- assert!(!DAOSpace::is_member<DAOT>(member), Errors::already_published(ERR_MEMBER_EXIST));
- DAOSpace::create_proposal(&cap, sender, action, title, introduction, extend, action_delay, Option::none<u8>());
-}
-
-
-
-
-
-
-
-
-## Function `create_proposal_entry`
-
-
-
-public(script) fun create_proposal_entry<DAOT: store>(sender: signer, title: vector<u8>, introduction: vector<u8>, extend: vector<u8>, member: address, image_data: vector<u8>, image_url: vector<u8>, init_sbt: u128, action_delay: u64)
-
-
-
-
-
-Implementation
-
-
-public (script) fun create_proposal_entry<DAOT: store>(sender: signer, title:vector<u8>, introduction:vector<u8>, extend: vector<u8>, member: address, image_data:vector<u8>, image_url:vector<u8>, init_sbt: u128, action_delay: u64){
- create_proposal<DAOT>(&sender, title, introduction, extend, member, image_data, image_url, init_sbt, action_delay);
-}
-
-
-
-
-
-
-
-
-## Function `execute_proposal`
-
-
-
-public fun execute_proposal<DAOT: store>(sender: &signer, proposal_id: u64)
-
-
-
-
-
-Implementation
-
-
-public fun execute_proposal<DAOT: store>(sender: &signer, proposal_id: u64){
- let witness = MemberProposalPlugin{};
- let proposal_cap = DAOSpace::acquire_proposal_cap<DAOT, MemberProposalPlugin>(&witness);
- let MemberJoinAction{member, init_sbt, image_data, image_url} = DAOSpace::execute_proposal<DAOT, MemberProposalPlugin, MemberJoinAction>(&proposal_cap, sender, proposal_id);
- let member_cap = DAOSpace::acquire_member_cap<DAOT, MemberProposalPlugin>(&witness);
- let op_image_data = if(Vector::length(&image_data) == 0){
- Option::none<vector<u8>>()
- }else{
- Option::some(image_data)
- };
- let op_image_url = if(Vector::length(&image_url) == 0){
- Option::none<vector<u8>>()
- }else{
- Option::some(image_url)
- };
- DAOSpace::issue_member_offer(&member_cap, member,op_image_data , op_image_url , init_sbt);
-}
-
-
-
-
-
-
-
-
-## Function `execute_proposal_entry`
-
-
-
-public(script) fun execute_proposal_entry<DAOT: store>(sender: signer, proposal_id: u64)
-
-
-
-
-
-Implementation
-
-
-public (script) fun execute_proposal_entry<DAOT: store>(sender: signer, proposal_id: u64){
- execute_proposal<DAOT>(&sender, proposal_id);
-}
-
-
-
-
-
-
-
-
-## Function `install_plugin_proposal`
-
-
-
-public fun install_plugin_proposal<DAOT: store>(sender: &signer, title: vector<u8>, introduction: vector<u8>, extend: vector<u8>, action_delay: u64)
-
-
-
-
-
-Implementation
-
-
-public fun install_plugin_proposal<DAOT:store>(sender:&signer, title:vector<u8>, introduction:vector<u8>, extend: vector<u8>,action_delay:u64){
- InstallPluginProposalPlugin::create_proposal<DAOT, MemberProposalPlugin>(sender, required_caps(), title, introduction, extend, action_delay);
-}
-
-
-
-
-
-
-
-
-## Function `install_plugin_proposal_entry`
-
-
-
-public(script) fun install_plugin_proposal_entry<DAOT: store>(sender: signer, title: vector<u8>, introduction: vector<u8>, extend: vector<u8>, action_delay: u64)
-
-
-
-
-
-Implementation
-
-
-public (script) fun install_plugin_proposal_entry<DAOT:store>(sender:signer, title:vector<u8>, introduction:vector<u8>, extend: vector<u8>, action_delay:u64){
- install_plugin_proposal<DAOT>(&sender, title, introduction, extend, action_delay);
-}
-
-
-
-
-
diff --git a/build/StarcoinFramework/docs/MerkleNFT.md b/build/StarcoinFramework/docs/MerkleNFT.md
index 93a2088b..abb38d9d 100644
--- a/build/StarcoinFramework/docs/MerkleNFT.md
+++ b/build/StarcoinFramework/docs/MerkleNFT.md
@@ -8,7 +8,6 @@
- [Resource `MerkleNFTDistribution`](#0x1_MerkleNFTDistributor_MerkleNFTDistribution)
- [Constants](#@Constants_0)
- [Function `register`](#0x1_MerkleNFTDistributor_register)
-- [Function `register_v2`](#0x1_MerkleNFTDistributor_register_v2)
- [Function `mint_with_cap`](#0x1_MerkleNFTDistributor_mint_with_cap)
- [Function `encode_leaf`](#0x1_MerkleNFTDistributor_encode_leaf)
- [Function `set_minted_`](#0x1_MerkleNFTDistributor_set_minted_)
@@ -97,7 +96,6 @@
## Function `register`
-Deprecated, use register_v2
instead.
public fun register<NFTMeta: copy, drop, store, Info: copy, drop, store>(signer: &signer, merkle_root: vector<u8>, leafs: u64, info: Info, meta: NFT::Metadata): NFT::MintCapability<NFTMeta>
@@ -109,13 +107,7 @@ Deprecated, use register_v2
instead.
Implementation
-public fun register<NFTMeta: copy + store + drop, Info: copy + store + drop>(
- signer: &signer,
- merkle_root: vector<u8>,
- leafs: u64,
- info: Info,
- meta: Metadata
-): MintCapability<NFTMeta> {
+public fun register<NFTMeta: copy + store + drop, Info: copy + store + drop>(signer: &signer, merkle_root: vector<u8>, leafs: u64, info: Info, meta: Metadata): MintCapability<NFTMeta> {
let bitmap_count = leafs / 128;
if (bitmap_count * 128 < leafs) {
bitmap_count = bitmap_count + 1;
@@ -138,46 +130,6 @@ Deprecated, use register_v2
instead.
-
-
-
-
-## Function `register_v2`
-
-
-
-public fun register_v2<NFTMeta: copy, drop, store>(signer: &signer, merkle_root: vector<u8>, leafs: u64, meta: NFT::Metadata): NFT::MintCapability<NFTMeta>
-
-
-
-
-
-Implementation
-
-
-public fun register_v2<NFTMeta: copy + store + drop>(signer: &signer, merkle_root: vector<u8>, leafs: u64, meta: Metadata): MintCapability<NFTMeta> {
- let bitmap_count = leafs / 128;
- if (bitmap_count * 128 < leafs) {
- bitmap_count = bitmap_count + 1;
- };
- let claimed_bitmap = Vector::empty();
- let j = 0;
- while (j < bitmap_count) {
- Vector::push_back( &mut claimed_bitmap, 0u128);
- j = j + 1;
- };
- let distribution = MerkleNFTDistribution<NFTMeta>{
- merkle_root,
- claimed_bitmap
- };
- NFT::register_v2<NFTMeta>(signer, meta);
- move_to(signer, distribution);
- NFT::remove_mint_capability<NFTMeta>(signer)
-}
-
-
-
-
diff --git a/build/StarcoinFramework/docs/ModifyDaoConfigProposal.md b/build/StarcoinFramework/docs/ModifyDaoConfigProposal.md
index c602b98d..8efd0995 100644
--- a/build/StarcoinFramework/docs/ModifyDaoConfigProposal.md
+++ b/build/StarcoinFramework/docs/ModifyDaoConfigProposal.md
@@ -10,7 +10,6 @@ A proposal module which is used to modify Token's DAO configuration.
- [Struct `DaoConfigUpdate`](#0x1_ModifyDaoConfigProposal_DaoConfigUpdate)
- [Constants](#@Constants_0)
- [Function `plugin`](#0x1_ModifyDaoConfigProposal_plugin)
-- [Function `destroy_modify_config_capability`](#0x1_ModifyDaoConfigProposal_destroy_modify_config_capability)
- [Function `propose`](#0x1_ModifyDaoConfigProposal_propose)
- [Function `execute`](#0x1_ModifyDaoConfigProposal_execute)
- [Module Specification](#@Module_Specification_1)
@@ -174,48 +173,6 @@ Should be called by token issuer.
-
-
-
-
-## Function `destroy_modify_config_capability`
-
-Destroy ModifyConfigCapability
-
-
-public fun destroy_modify_config_capability<TokenT: copy, drop, store>(sender: &signer)
-
-
-
-
-
-Implementation
-
-
-public fun destroy_modify_config_capability<TokenT: copy + drop + store>(sender: &signer)
-acquires DaoConfigModifyCapability {
- let token_issuer = Token::token_address<TokenT>();
- assert!(Signer::address_of(sender) == token_issuer, Errors::requires_address(ERR_NOT_AUTHORIZED));
-
- let DaoConfigModifyCapability {cap} = move_from<DaoConfigModifyCapability<TokenT>>(token_issuer);
- Config::destroy_modify_config_capability<DaoConfig<TokenT>>(cap);
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
diff --git a/build/StarcoinFramework/docs/ModuleUpgradeScripts.md b/build/StarcoinFramework/docs/ModuleUpgradeScripts.md
index cbca2aef..75885ab7 100644
--- a/build/StarcoinFramework/docs/ModuleUpgradeScripts.md
+++ b/build/StarcoinFramework/docs/ModuleUpgradeScripts.md
@@ -5,19 +5,16 @@
-- [Constants](#@Constants_0)
- [Function `propose_module_upgrade_v2`](#0x1_ModuleUpgradeScripts_propose_module_upgrade_v2)
- [Function `update_module_upgrade_strategy`](#0x1_ModuleUpgradeScripts_update_module_upgrade_strategy)
-- [Function `update_module_upgrade_strategy_with_min_time`](#0x1_ModuleUpgradeScripts_update_module_upgrade_strategy_with_min_time)
- [Function `submit_module_upgrade_plan`](#0x1_ModuleUpgradeScripts_submit_module_upgrade_plan)
- [Function `execute_module_upgrade_plan_propose`](#0x1_ModuleUpgradeScripts_execute_module_upgrade_plan_propose)
- [Function `submit_upgrade_plan`](#0x1_ModuleUpgradeScripts_submit_upgrade_plan)
- [Function `cancel_upgrade_plan`](#0x1_ModuleUpgradeScripts_cancel_upgrade_plan)
-- [Module Specification](#@Module_Specification_1)
+- [Module Specification](#@Module_Specification_0)
use 0x1::Config;
-use 0x1::Errors;
use 0x1::Option;
use 0x1::PackageTxnManager;
use 0x1::Signer;
@@ -27,20 +24,6 @@
-
-
-## Constants
-
-
-
-
-
-
-const ERR_WRONG_UPGRADE_STRATEGY: u64 = 100;
-
-
-
-
## Function `propose_module_upgrade_v2`
@@ -117,43 +100,6 @@ Update sender
's module upgrade strategy to strategy
-
-
-
-
-## Function `update_module_upgrade_strategy_with_min_time`
-
-Update sender
's module upgrade strategy to strategy
with min_time_limit.
-This can only be invoked when strategy is STRATEGY_TWO_PHASE.
-
-
-public(script) fun update_module_upgrade_strategy_with_min_time(sender: signer, strategy: u8, min_time_limit: u64)
-
-
-
-
-
-Implementation
-
-
-public(script) fun update_module_upgrade_strategy_with_min_time(
- sender: signer,
- strategy: u8,
- min_time_limit: u64,
-){
- // 1. check version
- assert!(strategy == PackageTxnManager::get_strategy_two_phase(), Errors::invalid_argument(ERR_WRONG_UPGRADE_STRATEGY));
- // 2. update strategy
- PackageTxnManager::update_module_upgrade_strategy(
- &sender,
- strategy,
- Option::some<u64>(min_time_limit),
- );
-}
-
-
-
-
@@ -302,7 +248,7 @@ Cancel current upgrade plan, the sender
must have UpgradePlan
-
+
## Module Specification
diff --git a/build/StarcoinFramework/docs/NFT.md b/build/StarcoinFramework/docs/NFT.md
index 3cca6422..c43e4d72 100644
--- a/build/StarcoinFramework/docs/NFT.md
+++ b/build/StarcoinFramework/docs/NFT.md
@@ -33,7 +33,7 @@ Init a NFTGallery for accept NFT
public(script) fun accept<NFTMeta: copy + store + drop, NFTBody: store>(sender: signer) {
- NFTGallery::accept_entry<NFTMeta, NFTBody>(sender);
+ NFTGallery::accept<NFTMeta, NFTBody>(&sender);
}
@@ -61,7 +61,7 @@ Transfer NFT with id
from sender
to
sender: signer,
id: u64, receiver: address
) {
- NFTGallery::transfer_entry<NFTMeta, NFTBody>(sender, id, receiver);
+ NFTGallery::transfer<NFTMeta, NFTBody>(&sender, id, receiver);
}
@@ -86,7 +86,7 @@ Remove empty NFTGallery.
public(script) fun remove_empty_gallery<NFTMeta: copy + store + drop, NFTBody: store>(sender: signer) {
- NFTGallery::remove_empty_gallery_entry<NFTMeta, NFTBody>(sender);
+ NFTGallery::remove_empty_gallery<NFTMeta, NFTBody>(&sender);
}
diff --git a/build/StarcoinFramework/docs/Offer.md b/build/StarcoinFramework/docs/Offer.md
index 4540012a..37508102 100644
--- a/build/StarcoinFramework/docs/Offer.md
+++ b/build/StarcoinFramework/docs/Offer.md
@@ -6,35 +6,19 @@
- [Resource `Offer`](#0x1_Offer_Offer)
-- [Resource `Offers`](#0x1_Offer_Offers)
-- [Struct `OfferInfo`](#0x1_Offer_OfferInfo)
- [Constants](#@Constants_0)
- [Function `create`](#0x1_Offer_create)
-- [Function `create_v2`](#0x1_Offer_create_v2)
-- [Function `create_offers`](#0x1_Offer_create_offers)
-- [Function `push`](#0x1_Offer_push)
- [Function `redeem`](#0x1_Offer_redeem)
-- [Function `redeem_v2`](#0x1_Offer_redeem_v2)
- [Function `exists_at`](#0x1_Offer_exists_at)
-- [Function `exists_at_v2`](#0x1_Offer_exists_at_v2)
- [Function `address_of`](#0x1_Offer_address_of)
-- [Function `address_of_v2`](#0x1_Offer_address_of_v2)
-- [Function `retake`](#0x1_Offer_retake)
-- [Function `get_offers_infos`](#0x1_Offer_get_offers_infos)
-- [Function `get_offers_info`](#0x1_Offer_get_offers_info)
-- [Function `unpack_offer_info`](#0x1_Offer_unpack_offer_info)
-- [Function `get_offers_length`](#0x1_Offer_get_offers_length)
-- [Function `is_offers_empty`](#0x1_Offer_is_offers_empty)
- [Function `take_offer`](#0x1_Offer_take_offer)
-- [Function `find_offer`](#0x1_Offer_find_offer)
- [Module Specification](#@Module_Specification_1)
-use 0x1::Errors;
-use 0x1::Option;
+use 0x1::Collection2;
+use 0x1::Errors;
use 0x1::Signer;
use 0x1::Timestamp;
-use 0x1::Vector;
@@ -46,7 +30,7 @@
A wrapper around value offered
that can be claimed by the address stored in for
when after lock time.
-struct Offer<Offered> has store, key
+struct Offer<Offered> has key
@@ -77,66 +61,6 @@ A wrapper around value offered
that can be claimed by the address s
-
-
-
-
-## Resource `Offers`
-
-
-
-struct Offers<Offered: store> has key
-
-
-
-
-
-Fields
-
-
-
--
-
offers: vector<Offer::Offer<Offered>>
-
--
-
-
-
-
-
-
-
-
-
-## Struct `OfferInfo`
-
-
-
-struct OfferInfo has copy, drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
for: address
-
--
-
-
--
-
time_lock: u64
-
--
-
-
-
-
-
@@ -154,24 +78,6 @@ An offer of the specified type for the account does not match
-
-
-
-
-const EOFFER_HAVE_OFFER: u64 = 106;
-
-
-
-
-
-
-
-
-const EOFFER_NOT_HAVE_OFFER: u64 = 105;
-
-
-
-
Offer is not unlocked yet.
@@ -182,42 +88,6 @@ Offer is not unlocked yet.
-
-
-
-
-const EOFFER_OFFERS_ARG_LEN_NOT_SAME: u64 = 104;
-
-
-
-
-
-
-
-
-const EOFFER_OFFERS_EMPTY: u64 = 107;
-
-
-
-
-
-
-
-
-const EOFFER_OFFERS_ZERO: u64 = 103;
-
-
-
-
-
-
-
-
-const ERR_DEPRECATED: u64 = 1;
-
-
-
-
## Function `create`
@@ -235,20 +105,10 @@ either the for
address or the transaction sender.
Implementation
-public fun create<Offered: store>(account: &signer, offered: Offered, for: address, lock_period: u64) acquires Offer, Offers{
+public fun create<Offered: store>(account: &signer, offered: Offered, for: address, lock_period: u64) {
let time_lock = Timestamp::now_seconds() + lock_period;
- let account_address = Signer::address_of(account);
- if(exists<Offers<Offered>>(account_address)){
- let offers = &mut borrow_global_mut<Offers<Offered>>(account_address).offers;
- Vector::push_back(offers, Offer<Offered> { offered, for, time_lock });
- }else {
- let offers = Vector::empty<Offer<Offered>>();
- if(exists<Offer<Offered>>(account_address)){
- Vector::push_back(&mut offers, move_from<Offer<Offered>>(account_address));
- };
- Vector::push_back(&mut offers, Offer<Offered> { offered, for, time_lock });
- move_to(account, Offers<Offered> { offers });
- }
+ //TODO should support multi Offer?
+ move_to(account, Offer<Offered> { offered, for, time_lock });
}
@@ -268,159 +128,6 @@ either the for
address or the transaction sender.
-
-
-
-
-## Function `create_v2`
-
-
-
-public fun create_v2<Offered: store>(account: &signer, offered: Offered, for: address, lock_period: u64)
-
-
-
-
-
-Implementation
-
-
-public fun create_v2<Offered: store>(account: &signer, offered: Offered, for: address, lock_period: u64) acquires Offers, Offer{
- let account_address = Signer::address_of(account);
- let time_lock = Timestamp::now_seconds() + lock_period;
-
- if(exists<Offers<Offered>>(account_address)){
- let offers = &mut borrow_global_mut<Offers<Offered>>(account_address).offers;
- Vector::push_back(offers, Offer<Offered> { offered, for, time_lock });
- }else {
- let offers = Vector::empty<Offer<Offered>>();
- if(exists<Offer<Offered>>(account_address)){
- Vector::push_back(&mut offers, move_from<Offer<Offered>>(account_address));
- };
- Vector::push_back(&mut offers, Offer<Offered> { offered, for, time_lock });
- move_to(account, Offers<Offered> { offers });
- };
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `create_offers`
-
-
-
-public fun create_offers<Offered: store>(account: &signer, offereds: vector<Offered>, for: vector<address>, lock_periods: vector<u64>)
-
-
-
-
-
-Implementation
-
-
-public fun create_offers<Offered: store>(account: &signer, offereds: vector<Offered>, for: vector<address>, lock_periods: vector<u64>) acquires Offers, Offer {
- let offer_length = Vector::length(&offereds);
- assert!(offer_length > 0, Errors::invalid_argument(EOFFER_OFFERS_ZERO));
- assert!(offer_length == Vector::length(&for) && offer_length == Vector::length(&lock_periods), Errors::invalid_argument(EOFFER_OFFERS_ARG_LEN_NOT_SAME));
- let account_address = Signer::address_of(account);
-
- if(exists<Offers<Offered>>(account_address)){
- let offers = &mut borrow_global_mut<Offers<Offered>>(account_address).offers;
- push(offers, offereds, for, lock_periods);
- }else {
- let offers = Vector::empty<Offer<Offered>>();
- if(exists<Offer<Offered>>(account_address)){
- Vector::push_back(&mut offers, move_from<Offer<Offered>>(account_address));
- };
- push(&mut offers, offereds, for, lock_periods);
- move_to(account, Offers<Offered> { offers });
- };
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `push`
-
-
-
-fun push<Offered: store>(offers: &mut vector<Offer::Offer<Offered>>, offereds: vector<Offered>, for: vector<address>, lock_periods: vector<u64>)
-
-
-
-
-
-Implementation
-
-
-fun push<Offered: store>(offers: &mut vector<Offer<Offered>>, offereds: vector<Offered>, for: vector<address>, lock_periods: vector<u64>){
- let now = Timestamp::now_seconds();
- let offer_length = Vector::length(&offereds);
-
- let i = offer_length - 1;
- loop{
- Vector::push_back(offers, Offer<Offered> {
- offered: Vector::remove(&mut offereds, i),
- for: Vector::remove(&mut for, i),
- time_lock: now + Vector::remove(&mut lock_periods, i)
- });
- if(i == 0){
- break
- };
- i = i - 1;
- };
- Vector::destroy_empty(offereds);
- Vector::destroy_empty(for);
- Vector::destroy_empty(lock_periods);
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
@@ -442,27 +149,11 @@ Also fails if no such value exists.
Implementation
-public fun redeem<Offered: store>(account: &signer, offer_address: address): Offered acquires Offer, Offers {
- let account_address = Signer::address_of(account);
- let Offer<Offered> { offered, for, time_lock } = if(exists<Offers<Offered>>(offer_address)){
- let op_index = find_offer<Offered>(offer_address, account_address);
- assert!(Option::is_some(&op_index),Errors::invalid_argument(EOFFER_DNE_FOR_ACCOUNT));
- let offers = &mut borrow_global_mut<Offers<Offered>>(offer_address).offers;
- let index = Option::destroy_some(op_index);
- let offer = Vector::remove(offers , index);
- if(Vector::length(offers) == 0){
- let Offers { offers } = move_from<Offers<Offered>>(offer_address);
- Vector::destroy_empty(offers);
- };
- offer
- }else if(exists<Offer<Offered>>(offer_address)){
- move_from<Offer<Offered>>(offer_address)
- }else{
- abort Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER)
- };
-
+public fun redeem<Offered: store>(account: &signer, offer_address: address): Offered acquires Offer {
+ let Offer<Offered> { offered, for, time_lock } = move_from<Offer<Offered>>(offer_address);
+ let sender = Signer::address_of(account);
let now = Timestamp::now_seconds();
- assert!(account_address == for || account_address == offer_address, Errors::invalid_argument(EOFFER_DNE_FOR_ACCOUNT));
+ assert!(sender == for || sender == offer_address, Errors::invalid_argument(EOFFER_DNE_FOR_ACCOUNT));
assert!(now >= time_lock, Errors::not_published(EOFFER_NOT_UNLOCKED));
offered
}
@@ -485,61 +176,6 @@ Also fails if no such value exists.
-
-
-
-
-## Function `redeem_v2`
-
-
-
-public fun redeem_v2<Offered: store>(account: &signer, offer_address: address, idx: u64): Offered
-
-
-
-
-
-Implementation
-
-
-public fun redeem_v2<Offered: store>(account: &signer, offer_address: address, idx: u64): Offered acquires Offer, Offers {
- let account_address = Signer::address_of(account);
- let Offer<Offered> { offered, for, time_lock } = if(exists<Offers<Offered>>(offer_address)){
- let offers = &mut borrow_global_mut<Offers<Offered>>(offer_address).offers;
- assert!(Vector::length(offers) - 1 >= idx, Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER));
- let offer = Vector::remove(offers, idx);
- if(Vector::length(offers) == 0){
- let Offers { offers } = move_from<Offers<Offered>>(offer_address);
- Vector::destroy_empty(offers);
- };
- offer
- }else if(exists<Offer<Offered>>(offer_address)){
- move_from<Offer<Offered>>(offer_address)
- }else{
- abort Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER)
- };
-
- let now = Timestamp::now_seconds();
- assert!(account_address == for || account_address == offer_address, Errors::invalid_argument(EOFFER_DNE_FOR_ACCOUNT));
- assert!(now >= time_lock, Errors::not_published(EOFFER_NOT_UNLOCKED));
- offered
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
@@ -559,7 +195,7 @@ Returns true if an offer of type Offered
exists at offer_addr
public fun exists_at<Offered: store>(offer_address: address): bool {
- exists<Offer<Offered>>(offer_address) || exists<Offers<Offered>>(offer_address)
+ exists<Offer<Offered>>(offer_address)
}
@@ -572,43 +208,7 @@ Returns true if an offer of type Offered
exists at offer_addr
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `exists_at_v2`
-
-
-
-public fun exists_at_v2<Offered: store>(offer_address: address): bool
-
-
-
-
-
-Implementation
-
-
-public fun exists_at_v2<Offered: store>(offer_address: address): bool{
- exists<Offers<Offered>>(offer_address)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
+aborts_if false;
@@ -632,14 +232,8 @@ Fails if no such Offer
exists.
Implementation
-public fun address_of<Offered: store>(offer_address: address): address acquires Offer, Offers {
- if(exists<Offer<Offered>>(offer_address)){
- borrow_global<Offer<Offered>>(offer_address).for
- }else{
- assert!(!is_offers_empty<Offered>(offer_address), Errors::invalid_argument(EOFFER_OFFERS_EMPTY));
- address_of_v2<Offered>(offer_address, get_offers_length<Offered>(offer_address) - 1)
- }
-
+public fun address_of<Offered: store>(offer_address: address): address acquires Offer {
+ borrow_global<Offer<Offered>>(offer_address).for
}
@@ -653,302 +247,6 @@ Fails if no such Offer
exists.
aborts_if !exists<Offer<Offered>>(offer_address);
-aborts_if !exists<Offers<Offered>>(offer_address);
-
-
-
-
-
-
-
-
-## Function `address_of_v2`
-
-
-
-public fun address_of_v2<Offered: store>(offer_address: address, idx: u64): address
-
-
-
-
-
-Implementation
-
-
-public fun address_of_v2<Offered: store>(offer_address: address, idx: u64): address acquires Offers {
- assert!(exists<Offers<Offered>>(offer_address), Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER));
- let offers = & borrow_global<Offers<Offered>>(offer_address).offers;
- assert!(Vector::length(offers) - 1 >= idx, Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER));
- Vector::borrow(offers, idx).for
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `retake`
-
-
-
-public fun retake<Offered: store>(account: &signer, idx: u64): Offered
-
-
-
-
-
-Implementation
-
-
-public fun retake<Offered: store>(account: &signer, idx: u64): Offered acquires Offer, Offers {
- let account_address = Signer::address_of(account);
- let Offer<Offered> { offered: offered, for: _, time_lock: time_lock } = if(exists<Offers<Offered>>(account_address)){
- let offers = &mut borrow_global_mut<Offers<Offered>>(account_address).offers;
- assert!(Vector::length(offers) - 1 >= idx, Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER));
- let offer = Vector::remove(offers, idx);
- if(Vector::length(offers) == 0){
- let Offers { offers } = move_from<Offers<Offered>>(account_address);
- Vector::destroy_empty(offers);
- };
- offer
- }else if(exists<Offer<Offered>>(account_address)){
- move_from<Offer<Offered>>(account_address)
- }else{
- abort Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER)
- };
- let now = Timestamp::now_seconds();
- assert!(now >= time_lock + ( 3600 * 24 * 30 * 3 ), Errors::not_published(EOFFER_NOT_UNLOCKED));
- offered
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `get_offers_infos`
-
-
-
-public fun get_offers_infos<Offered: store>(offer_address: address): Option::Option<vector<Offer::OfferInfo>>
-
-
-
-
-
-Implementation
-
-
-public fun get_offers_infos<Offered: store>(offer_address: address): Option::Option<vector<OfferInfo>> acquires Offers{
- if(!exists_at_v2<Offered>(offer_address)){
- return Option::none<vector<OfferInfo>>()
- };
- let offers = & borrow_global<Offers<Offered>>(offer_address).offers;
- let offer_infos = Vector::empty<OfferInfo>();
- let i = 0;
- let length = Vector::length(offers);
- while(i < length){
- Vector::push_back(&mut offer_infos, OfferInfo { for: Vector::borrow(offers, i).for, time_lock: Vector::borrow(offers, i).time_lock });
- i = i + 1;
- };
- Option::some(offer_infos)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `get_offers_info`
-
-
-
-public fun get_offers_info<Offered: store>(offer_address: address, idx: u64): Option::Option<Offer::OfferInfo>
-
-
-
-
-
-Implementation
-
-
-public fun get_offers_info<Offered: store>(offer_address: address, idx: u64): Option::Option<OfferInfo> acquires Offers{
- if(!exists_at_v2<Offered>(offer_address)){
- return Option::none<OfferInfo>()
- };
- let offers = & borrow_global<Offers<Offered>>(offer_address).offers;
- assert!(Vector::length(offers) >= idx, Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER));
- Option::some(OfferInfo { for: Vector::borrow(offers, idx).for, time_lock: Vector::borrow(offers, idx).time_lock })
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `unpack_offer_info`
-
-
-
-public fun unpack_offer_info(offer_info: Offer::OfferInfo): (address, u64)
-
-
-
-
-
-Implementation
-
-
-public fun unpack_offer_info(offer_info: OfferInfo):(address, u64){
- let OfferInfo{ for, time_lock } = offer_info;
- ( for, time_lock )
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `get_offers_length`
-
-
-
-public fun get_offers_length<Offered: store>(offer_address: address): u64
-
-
-
-
-
-Implementation
-
-
-public fun get_offers_length<Offered: store>(offer_address: address): u64 acquires Offers{
- assert!(exists_at_v2<Offered>(offer_address), Errors::invalid_argument(EOFFER_NOT_HAVE_OFFER));
- let offers = & borrow_global<Offers<Offered>>(offer_address).offers;
- Vector::length(offers)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `is_offers_empty`
-
-
-
-public fun is_offers_empty<Offered: store>(offer_address: address): bool
-
-
-
-
-
-Implementation
-
-
-public fun is_offers_empty<Offered: store>(offer_address: address): bool acquires Offers{
- if( get_offers_length<Offered>(offer_address) == 0){
- true
- }else{
- false
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
@@ -962,7 +260,7 @@ Fails if no such Offer
exists.
Take Offer and put to signer's Collection.
-public(script) fun take_offer<Offered: store>(_signer: signer, _offer_address: address)
+public(script) fun take_offer<Offered: store>(signer: signer, offer_address: address)
@@ -971,57 +269,12 @@ Take Offer and put to signer's Collection.
Implementation
-public(script) fun take_offer<Offered: store>(_signer: signer, _offer_address: address){
- abort Errors::invalid_state(ERR_DEPRECATED)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `find_offer`
-
-
-
-public fun find_offer<Offered: store>(offer_address: address, for: address): Option::Option<u64>
-
-
-
-
-
-Implementation
-
-
-public fun find_offer<Offered: store>(offer_address: address, for: address):Option::Option<u64> acquires Offers {
- if(!exists_at_v2<Offered>(offer_address)){
- return Option::none<u64>()
- };
- let offers = & borrow_global<Offers<Offered>>(offer_address).offers;
- let length = Vector::length(offers);
- let i = 0;
- while(i < length){
- let offer = Vector::borrow(offers, i);
- if( offer.for == for ){
- return Option::some(i)
- };
- i = i + 1;
- };
- Option::none<u64>()
+public(script) fun take_offer<Offered: store>(
+ signer: signer,
+ offer_address: address,
+) acquires Offer {
+ let offered = redeem<Offered>(&signer, offer_address);
+ Collection2::put(&signer, Signer::address_of(&signer), offered);
}
@@ -1047,6 +300,6 @@ Take Offer and put to signer's Collection.
-pragma verify = false;
+pragma verify = true;
pragma aborts_if_is_strict = true;
diff --git a/build/StarcoinFramework/docs/OnChainConfigDao.md b/build/StarcoinFramework/docs/OnChainConfigDao.md
index 90a98f79..1fc075ec 100644
--- a/build/StarcoinFramework/docs/OnChainConfigDao.md
+++ b/build/StarcoinFramework/docs/OnChainConfigDao.md
@@ -12,12 +12,10 @@ OnChainConfigDao is a DAO proposal for modify onchain configuration.
- [Function `plugin`](#0x1_OnChainConfigDao_plugin)
- [Function `propose_update`](#0x1_OnChainConfigDao_propose_update)
- [Function `execute`](#0x1_OnChainConfigDao_execute)
-- [Function `config_cap`](#0x1_OnChainConfigDao_config_cap)
- [Module Specification](#@Module_Specification_1)
use 0x1::Config;
-use 0x1::CoreAddresses;
use 0x1::Dao;
use 0x1::Errors;
use 0x1::Signer;
@@ -245,31 +243,6 @@ the kind of this proposal module.
-
-
-
-
-## Function `config_cap`
-
-
-
-public(friend) fun config_cap<TokenT: store, ConfigT: copy, drop, store>(): Config::ModifyConfigCapability<ConfigT>
-
-
-
-
-
-Implementation
-
-
-public (friend) fun config_cap<TokenT: store, ConfigT: copy + drop + store>():Config::ModifyConfigCapability<ConfigT>acquires WrappedConfigModifyCapability{
- let WrappedConfigModifyCapability <TokenT, ConfigT>{cap} = move_from<WrappedConfigModifyCapability<TokenT, ConfigT>>(CoreAddresses::GENESIS_ADDRESS());
- cap
-}
-
-
-
-
diff --git a/build/StarcoinFramework/docs/Oracle.md b/build/StarcoinFramework/docs/Oracle.md
index f0066760..e2f92fa4 100644
--- a/build/StarcoinFramework/docs/Oracle.md
+++ b/build/StarcoinFramework/docs/Oracle.md
@@ -31,7 +31,7 @@
public(script) fun register_oracle<OracleT: copy+store+drop>(sender: signer, precision: u8){
- PriceOracle::register_oracle_entry<OracleT>(sender, precision);
+ PriceOracle::register_oracle<OracleT>(&sender, precision)
}
@@ -55,7 +55,7 @@
public(script) fun init_data_source<OracleT: copy+store+drop>(sender: signer, init_value: u128){
- PriceOracle::init_data_source_entry<OracleT>(sender, init_value);
+ PriceOracle::init_data_source<OracleT>(&sender, init_value);
}
@@ -79,7 +79,7 @@
public(script) fun update<OracleT: copy+store+drop>(sender: signer, value: u128){
- PriceOracle::update_entry<OracleT>(sender, value);
+ PriceOracle::update<OracleT>(&sender, value);
}
diff --git a/build/StarcoinFramework/docs/PackageTxnManager.md b/build/StarcoinFramework/docs/PackageTxnManager.md
index 2e9bafae..9c9cbc20 100644
--- a/build/StarcoinFramework/docs/PackageTxnManager.md
+++ b/build/StarcoinFramework/docs/PackageTxnManager.md
@@ -14,8 +14,6 @@ The module provides strategies for module upgrading.
- [Struct `TwoPhaseUpgradeConfig`](#0x1_PackageTxnManager_TwoPhaseUpgradeConfig)
- [Resource `TwoPhaseUpgradeV2`](#0x1_PackageTxnManager_TwoPhaseUpgradeV2)
- [Struct `UpgradeEvent`](#0x1_PackageTxnManager_UpgradeEvent)
-- [Resource `UpgradePlanEventHolder`](#0x1_PackageTxnManager_UpgradePlanEventHolder)
-- [Struct `UpgradePlanEvent`](#0x1_PackageTxnManager_UpgradePlanEvent)
- [Constants](#@Constants_0)
- [Function `get_strategy_arbitrary`](#0x1_PackageTxnManager_get_strategy_arbitrary)
- [Function `get_strategy_two_phase`](#0x1_PackageTxnManager_get_strategy_two_phase)
@@ -40,7 +38,6 @@ The module provides strategies for module upgrading.
- [Function `package_txn_prologue`](#0x1_PackageTxnManager_package_txn_prologue)
- [Function `package_txn_prologue_v2`](#0x1_PackageTxnManager_package_txn_prologue_v2)
- [Function `package_txn_epilogue`](#0x1_PackageTxnManager_package_txn_epilogue)
-- [Function `exists_upgrade_plan_cap`](#0x1_PackageTxnManager_exists_upgrade_plan_cap)
- [Module Specification](#@Module_Specification_1)
@@ -358,67 +355,6 @@ module upgrade event.
-
-
-
-
-## Resource `UpgradePlanEventHolder`
-
-
-
-struct UpgradePlanEventHolder has key
-
-
-
-
-
-Fields
-
-
-
--
-
upgrade_plan_event: Event::EventHandle<PackageTxnManager::UpgradePlanEvent>
-
--
-
-
-
-
-
-
-
-
-
-## Struct `UpgradePlanEvent`
-
-module upgrade plan event when submitting a module upgrade plan
-
-
-struct UpgradePlanEvent has drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
package_address: address
-
--
-
-
--
-
plan: PackageTxnManager::UpgradePlanV2
-
--
-
-
-
-
-
@@ -674,8 +610,7 @@ Update account's ModuleUpgradeStrategy
Implementation
-public fun update_module_upgrade_strategy(account: &signer, strategy: u8, min_time: Option<u64>)
-acquires ModuleUpgradeStrategy, TwoPhaseUpgrade, TwoPhaseUpgradeV2, UpgradePlanCapability, UpgradePlanEventHolder{
+public fun update_module_upgrade_strategy(account: &signer, strategy: u8, min_time: Option<u64>) acquires ModuleUpgradeStrategy, TwoPhaseUpgrade, TwoPhaseUpgradeV2, UpgradePlanCapability{
assert!(strategy == STRATEGY_ARBITRARY || strategy == STRATEGY_TWO_PHASE || strategy == STRATEGY_NEW_MODULE || strategy == STRATEGY_FREEZE, Errors::invalid_argument(EUNKNOWN_STRATEGY));
let account_address = Signer::address_of(account);
let previous_strategy = get_module_upgrade_strategy(account_address);
@@ -688,16 +623,13 @@ Update account's ModuleUpgradeStrategy
if (strategy == STRATEGY_TWO_PHASE){
let version_cap = Config::extract_modify_config_capability<Version::Version>(account);
let min_time_limit = Option::get_with_default(&min_time, DEFAULT_MIN_TIME_LIMIT);
- move_to(account, UpgradePlanCapability{ account_address});
- move_to(account, TwoPhaseUpgradeV2 {
- config: TwoPhaseUpgradeConfig { min_time_limit },
+ move_to(account, UpgradePlanCapability{ account_address: account_address});
+ move_to(account, TwoPhaseUpgradeV2{
+ config: TwoPhaseUpgradeConfig{min_time_limit: min_time_limit},
plan: Option::none<UpgradePlanV2>(),
- version_cap,
- upgrade_event: Event::new_event_handle<UpgradeEvent>(account)
- });
- move_to(account, UpgradePlanEventHolder {
- upgrade_plan_event: Event::new_event_handle<UpgradePlanEvent>(account)
- });
+ version_cap: version_cap,
+ upgrade_event: Event::new_event_handle<Self::UpgradeEvent>(account)}
+ );
};
//clean two phase upgrade resource
if (previous_strategy == STRATEGY_TWO_PHASE){
@@ -709,12 +641,8 @@ Update account's ModuleUpgradeStrategy
};
if (exists<TwoPhaseUpgradeV2>(account_address)) {
let tpu = move_from<TwoPhaseUpgradeV2>(account_address);
- let TwoPhaseUpgradeV2{config: _, plan: _, version_cap, upgrade_event } = tpu;
- Event::destroy_handle<UpgradeEvent>(upgrade_event);
- if (exists<UpgradePlanEventHolder>(account_address)) {
- let UpgradePlanEventHolder{ upgrade_plan_event } = move_from<UpgradePlanEventHolder>(account_address);
- Event::destroy_handle<UpgradePlanEvent>(upgrade_plan_event);
- };
+ let TwoPhaseUpgradeV2{plan:_, version_cap, upgrade_event, config: _} = tpu;
+ Event::destroy_handle<Self::UpgradeEvent>(upgrade_event);
Config::destroy_modify_config_capability<Version::Version>(version_cap);
};
// UpgradePlanCapability may be extracted
@@ -879,27 +807,21 @@ extract out UpgradePlanCapability from signer
.
if (Option::is_some(&plan)) {
let old_plan = Option::borrow(&plan);
move_to(&account, TwoPhaseUpgradeV2{
- config,
+ config: config,
plan: Option::some(UpgradePlanV2 {
package_hash: *&old_plan.package_hash,
active_after_time: old_plan.active_after_time,
version: old_plan.version,
enforced: false }),
- version_cap,
- upgrade_event
- });
- move_to(&account, UpgradePlanEventHolder {
- upgrade_plan_event: Event::new_event_handle<UpgradePlanEvent>(&account)
+ version_cap: version_cap,
+ upgrade_event: upgrade_event
});
} else {
- move_to(&account, TwoPhaseUpgradeV2 {
- config,
+ move_to(&account, TwoPhaseUpgradeV2{
+ config: config,
plan: Option::none<UpgradePlanV2>(),
- version_cap,
- upgrade_event
- });
- move_to(&account, UpgradePlanEventHolder {
- upgrade_plan_event: Event::new_event_handle<UpgradePlanEvent>(&account)
+ version_cap: version_cap,
+ upgrade_event: upgrade_event
});
};
}
@@ -936,16 +858,9 @@ extract out UpgradePlanCapability from signer
.
Implementation
-public fun submit_upgrade_plan_v2(account: &signer, package_hash: vector<u8>, version:u64, enforced: bool)
-acquires TwoPhaseUpgradeV2,UpgradePlanCapability,ModuleUpgradeStrategy,UpgradePlanEventHolder{
+public fun submit_upgrade_plan_v2(account: &signer, package_hash: vector<u8>, version:u64, enforced: bool) acquires TwoPhaseUpgradeV2,UpgradePlanCapability,ModuleUpgradeStrategy{
let account_address = Signer::address_of(account);
let cap = borrow_global<UpgradePlanCapability>(account_address);
- assert!(get_module_upgrade_strategy(cap.account_address) == STRATEGY_TWO_PHASE, Errors::invalid_argument(ESTRATEGY_NOT_TWO_PHASE));
- if (!exists<UpgradePlanEventHolder>(account_address)) {
- move_to(account, UpgradePlanEventHolder {
- upgrade_plan_event: Event::new_event_handle<UpgradePlanEvent>(account)
- })
- };
submit_upgrade_plan_with_cap_v2(cap, package_hash, version, enforced);
}
@@ -984,27 +899,12 @@ extract out UpgradePlanCapability from signer
.
Implementation
-public fun submit_upgrade_plan_with_cap_v2(cap: &UpgradePlanCapability, package_hash: vector<u8>, version: u64, enforced: bool)
-acquires TwoPhaseUpgradeV2, ModuleUpgradeStrategy, UpgradePlanEventHolder{
+public fun submit_upgrade_plan_with_cap_v2(cap: &UpgradePlanCapability, package_hash: vector<u8>, version: u64, enforced: bool) acquires TwoPhaseUpgradeV2,ModuleUpgradeStrategy{
let package_address = cap.account_address;
assert!(get_module_upgrade_strategy(package_address) == STRATEGY_TWO_PHASE, Errors::invalid_argument(ESTRATEGY_NOT_TWO_PHASE));
-
let tpu = borrow_global_mut<TwoPhaseUpgradeV2>(package_address);
let active_after_time = Timestamp::now_milliseconds() + tpu.config.min_time_limit;
- let plan = UpgradePlanV2 { package_hash, active_after_time, version, enforced };
- tpu.plan = Option::some(copy plan);
-
- // TODO
- // if UpgradePlanCapability was delegated to DAO or contract,
- // it's hard to upgrade the address to claim an UpgradePlanEventHolder.
- // Try to fix this!
- if (exists<UpgradePlanEventHolder>(package_address)) {
- let event_holder = borrow_global_mut<UpgradePlanEventHolder>(package_address);
- Event::emit_event<UpgradePlanEvent>(&mut event_holder.upgrade_plan_event, UpgradePlanEvent {
- package_address,
- plan
- });
- }
+ tpu.plan = Option::some(UpgradePlanV2 { package_hash, active_after_time, version, enforced });
}
@@ -1401,7 +1301,7 @@ Check againest on the given package data.
let plan = Option::borrow(&tpu.plan);
Config::set_with_capability<Version::Version>(&mut tpu.version_cap, Version::new_version(plan.version));
Event::emit_event<Self::UpgradeEvent>(&mut tpu.upgrade_event, UpgradeEvent {
- package_address,
+ package_address: package_address,
package_hash: *&plan.package_hash,
version: plan.version});
};
@@ -1541,42 +1441,6 @@ Package txn finished, and clean UpgradePlan
-
-
-
-
-## Function `exists_upgrade_plan_cap`
-
-
-
-public fun exists_upgrade_plan_cap(addr: address): bool
-
-
-
-
-
-Implementation
-
-
-public fun exists_upgrade_plan_cap(addr :address):bool{
- exists<UpgradePlanCapability>(addr)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-aborts_if false;
-
-
-
-
diff --git a/build/StarcoinFramework/docs/README.md b/build/StarcoinFramework/docs/README.md
index 4552316e..c4593a86 100644
--- a/build/StarcoinFramework/docs/README.md
+++ b/build/StarcoinFramework/docs/README.md
@@ -12,10 +12,8 @@ This is the root document for the Move StarcoinFramework module documentation. T
## Index
-- [`0x1::ASCII`](ASCII.md#0x1_ASCII)
- [`0x1::Account`](Account.md#0x1_Account)
- [`0x1::AccountScripts`](AccountScripts.md#0x1_AccountScripts)
-- [`0x1::AnyMemberPlugin`](AnyMemberPlugin.md#0x1_AnyMemberPlugin)
- [`0x1::Arith`](U256.md#0x1_Arith)
- [`0x1::Authenticator`](Authenticator.md#0x1_Authenticator)
- [`0x1::BCS`](BCS.md#0x1_BCS)
@@ -27,15 +25,9 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::Collection2`](Collection2.md#0x1_Collection2)
- [`0x1::Compare`](Compare.md#0x1_Compare)
- [`0x1::Config`](Config.md#0x1_Config)
-- [`0x1::ConfigProposalPlugin`](ConfigProposalPlugin.md#0x1_ConfigProposalPlugin)
- [`0x1::ConsensusConfig`](ConsensusConfig.md#0x1_ConsensusConfig)
- [`0x1::ConsensusStrategy`](ConsensusStrategy.md#0x1_ConsensusStrategy)
- [`0x1::CoreAddresses`](CoreAddresses.md#0x1_CoreAddresses)
-- [`0x1::DAOAccount`](DAOAccount.md#0x1_DAOAccount)
-- [`0x1::DAOExtensionPoint`](DAOExtensionPoint.md#0x1_DAOExtensionPoint)
-- [`0x1::DAOPluginMarketplace`](DAOPluginMarketplace.md#0x1_DAOPluginMarketplace)
-- [`0x1::DAORegistry`](DAORegistry.md#0x1_DAORegistry)
-- [`0x1::DAOSpace`](DAOSpace.md#0x1_DAOSpace)
- [`0x1::Dao`](Dao.md#0x1_Dao)
- [`0x1::DaoVoteScripts`](DaoVoteScripts.md#0x1_DaoVoteScripts)
- [`0x1::Debug`](Debug.md#0x1_Debug)
@@ -46,26 +38,19 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::Epoch`](Epoch.md#0x1_Epoch)
- [`0x1::Errors`](Errors.md#0x1_Errors)
- [`0x1::Event`](Event.md#0x1_Event)
-- [`0x1::EventUtil`](EventUtil.md#0x1_EventUtil)
- [`0x1::FixedPoint32`](FixedPoint32.md#0x1_FixedPoint32)
-- [`0x1::GasOracle`](Oracle.md#0x1_GasOracle)
-- [`0x1::GasOracleProposalPlugin`](GasOracleProposalPlugin.md#0x1_GasOracleProposalPlugin)
- [`0x1::Genesis`](Genesis.md#0x1_Genesis)
- [`0x1::GenesisNFT`](GenesisNFT.md#0x1_GenesisNFT)
- [`0x1::GenesisNFTScripts`](GenesisNFT.md#0x1_GenesisNFTScripts)
- [`0x1::GenesisSignerCapability`](GenesisSignerCapability.md#0x1_GenesisSignerCapability)
-- [`0x1::GrantProposalPlugin`](GrantProposalPlugin.md#0x1_GrantProposalPlugin)
- [`0x1::Hash`](Hash.md#0x1_Hash)
- [`0x1::IdentifierNFT`](NFT.md#0x1_IdentifierNFT)
- [`0x1::IdentifierNFTScripts`](NFT.md#0x1_IdentifierNFTScripts)
-- [`0x1::InstallPluginProposalPlugin`](InstallPluginProposalPlugin.md#0x1_InstallPluginProposalPlugin)
- [`0x1::LanguageVersion`](LanguageVersion.md#0x1_LanguageVersion)
- [`0x1::Math`](Math.md#0x1_Math)
-- [`0x1::MemberProposalPlugin`](MemberProposalPlugin.md#0x1_MemberProposalPlugin)
- [`0x1::MerkleNFTDistributor`](MerkleNFT.md#0x1_MerkleNFTDistributor)
- [`0x1::MerkleProof`](MerkleNFT.md#0x1_MerkleProof)
- [`0x1::MintDaoProposal`](MintDaoProposal.md#0x1_MintDaoProposal)
-- [`0x1::MintProposalPlugin`](MintProposalPlugin.md#0x1_MintProposalPlugin)
- [`0x1::MintScripts`](MintScripts.md#0x1_MintScripts)
- [`0x1::ModifyDaoConfigProposal`](ModifyDaoConfigProposal.md#0x1_ModifyDaoConfigProposal)
- [`0x1::ModuleUpgradeScripts`](ModuleUpgradeScripts.md#0x1_ModuleUpgradeScripts)
@@ -75,7 +60,6 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::Offer`](Offer.md#0x1_Offer)
- [`0x1::OnChainConfigDao`](OnChainConfigDao.md#0x1_OnChainConfigDao)
- [`0x1::OnChainConfigScripts`](OnChainConfigScripts.md#0x1_OnChainConfigScripts)
-- [`0x1::OnChainStarcoinDAOConfig`](OnChainStarcoinDAOConfig.md#0x1_OnChainStarcoinDAOConfig)
- [`0x1::Option`](Option.md#0x1_Option)
- [`0x1::Oracle`](Oracle.md#0x1_Oracle)
- [`0x1::PackageTxnManager`](PackageTxnManager.md#0x1_PackageTxnManager)
@@ -83,8 +67,6 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::PriceOracleAggregator`](Oracle.md#0x1_PriceOracleAggregator)
- [`0x1::PriceOracleScripts`](Oracle.md#0x1_PriceOracleScripts)
- [`0x1::RewardConfig`](RewardConfig.md#0x1_RewardConfig)
-- [`0x1::Ring`](Ring.md#0x1_Ring)
-- [`0x1::SBTVoteStrategy`](SBTVoteStrategy.md#0x1_SBTVoteStrategy)
- [`0x1::SIP_2`](SIPs.md#0x1_SIP_2)
- [`0x1::SIP_3`](SIPs.md#0x1_SIP_3)
- [`0x1::STC`](STC.md#0x1_STC)
@@ -93,13 +75,7 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::Signature`](Signature.md#0x1_Signature)
- [`0x1::SignedInteger64`](SignedInteger64.md#0x1_SignedInteger64)
- [`0x1::Signer`](Signer.md#0x1_Signer)
-- [`0x1::SimpleMap`](SimpleMap.md#0x1_SimpleMap)
-- [`0x1::SnapshotUtil`](SnapshotUtil.md#0x1_SnapshotUtil)
-- [`0x1::StakeToSBTPlugin`](StakeToSBTPlugin.md#0x1_StakeToSBTPlugin)
-- [`0x1::StarcoinDAO`](StarcoinDAO.md#0x1_StarcoinDAO)
-- [`0x1::StarcoinVerifier`](StarcoinVerifier.md#0x1_StarcoinVerifier)
- [`0x1::StdlibUpgradeScripts`](StdlibUpgradeScripts.md#0x1_StdlibUpgradeScripts)
-- [`0x1::StructuredHash`](StarcoinVerifier.md#0x1_StructuredHash)
- [`0x1::Timestamp`](Timestamp.md#0x1_Timestamp)
- [`0x1::Token`](Token.md#0x1_Token)
- [`0x1::TransactionFee`](TransactionFee.md#0x1_TransactionFee)
@@ -109,16 +85,12 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::TransactionTimeoutConfig`](TransactionTimeoutConfig.md#0x1_TransactionTimeoutConfig)
- [`0x1::TransferScripts`](TransferScripts.md#0x1_TransferScripts)
- [`0x1::Treasury`](Treasury.md#0x1_Treasury)
-- [`0x1::TreasuryPlugin`](TreasuryPlugin.md#0x1_TreasuryPlugin)
- [`0x1::TreasuryScripts`](TreasuryScripts.md#0x1_TreasuryScripts)
- [`0x1::TreasuryWithdrawDaoProposal`](TreasuryWithdrawDaoProposal.md#0x1_TreasuryWithdrawDaoProposal)
-- [`0x1::TypeInfo`](TypeInfo.md#0x1_TypeInfo)
- [`0x1::U256`](U256.md#0x1_U256)
- [`0x1::UpgradeModuleDaoProposal`](UpgradeModuleDaoProposal.md#0x1_UpgradeModuleDaoProposal)
-- [`0x1::UpgradeModulePlugin`](UpgradeModulePlugin.md#0x1_UpgradeModulePlugin)
- [`0x1::VMConfig`](VMConfig.md#0x1_VMConfig)
- [`0x1::Vector`](Vector.md#0x1_Vector)
- [`0x1::Version`](Version.md#0x1_Version)
-- [`0x1::WithdrawPlugin`](WithdrawPlugin.md#0x1_WithdrawPlugin)
- [`0x1::YieldFarming`](YieldFarming.md#0x1_YieldFarming)
- [`0x1::YieldFarmingV2`](YieldFarmingV2.md#0x1_YieldFarmingV2)
diff --git a/build/StarcoinFramework/docs/Ring.md b/build/StarcoinFramework/docs/Ring.md
deleted file mode 100644
index 9fa1f7ef..00000000
--- a/build/StarcoinFramework/docs/Ring.md
+++ /dev/null
@@ -1,437 +0,0 @@
-
-
-
-# Module `0x1::Ring`
-
-A ring-shaped container that can hold any type, indexed from 0
-The capacity is fixed at creation time, and the accessible index is constantly growing
-
-
-- [Struct `Ring`](#0x1_Ring_Ring)
-- [Constants](#@Constants_0)
-- [Function `create_with_capacity`](#0x1_Ring_create_with_capacity)
-- [Function `is_full`](#0x1_Ring_is_full)
-- [Function `capacity`](#0x1_Ring_capacity)
-- [Function `push`](#0x1_Ring_push)
-- [Function `borrow`](#0x1_Ring_borrow)
-- [Function `borrow_mut`](#0x1_Ring_borrow_mut)
-- [Function `index_of`](#0x1_Ring_index_of)
-- [Function `destroy`](#0x1_Ring_destroy)
-
-
-use 0x1::Errors;
-use 0x1::Option;
-use 0x1::Vector;
-
-
-
-
-
-
-## Struct `Ring`
-
-
-
-struct Ring<Element> has store
-
-
-
-
-
-Fields
-
-
-
--
-
data: vector<Option::Option<Element>>
-
--
-
-
--
-
insertion_index: u64
-
--
-
-
--
-
external_index: u64
-
--
-
-
-
-
-
-
-
-
-
-## Constants
-
-
-
-
-The index into the vector is out of bounds
-
-
-const ERROR_RING_INDEX_OUT_OF_BOUNDS: u64 = 101;
-
-
-
-
-
-
-## Function `create_with_capacity`
-
-Create a Ring with capacity.
-
-
-public fun create_with_capacity<Element>(len: u64): Ring::Ring<Element>
-
-
-
-
-
-Implementation
-
-
-public fun create_with_capacity<Element>( len: u64 ):Ring<Element>{
- let data = Vector::empty<Option::Option<Element>>();
- let i = 0;
- while(i < len){
- Vector::push_back(&mut data , Option::none<Element>());
- i = i + 1;
- };
- Ring {
- data : data,
- insertion_index : 0,
- external_index : 0,
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `is_full`
-
-is Ring full
-
-
-public fun is_full<Element>(r: &Ring::Ring<Element>): bool
-
-
-
-
-
-Implementation
-
-
-public fun is_full<Element>(r: &Ring<Element>):bool{
- Option::is_some(Vector::borrow(&r.data, r.insertion_index))
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `capacity`
-
-Return the capacity of the Ring.
-
-
-public fun capacity<Element>(r: &Ring::Ring<Element>): u64
-
-
-
-
-
-Implementation
-
-
-public fun capacity<Element>(r: &Ring<Element>): u64{
- Vector::length( &r.data )
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `push`
-
-Add element e
to the insertion_index of the Ring r
.
-
-
-public fun push<Element>(r: &mut Ring::Ring<Element>, e: Element): Option::Option<Element>
-
-
-
-
-
-Implementation
-
-
-public fun push<Element> (r: &mut Ring<Element> , e: Element):Option::Option<Element>{
- let op_e = Vector::borrow_mut<Option::Option<Element>>(&mut r.data, r.insertion_index);
- let res = if( Option::is_none<Element>(op_e) ){
- Option::fill( op_e, e);
- Option::none<Element>()
- }else{
- Option::some<Element>( Option::swap( op_e, e) )
- };
- r.insertion_index = ( r.insertion_index + 1 ) % Vector::length(&r.data);
- r.external_index = r.external_index + 1;
- res
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `borrow`
-
-Return a reference to the i
th element in the Ring r
.
-
-
-public fun borrow<Element>(r: &Ring::Ring<Element>, i: u64): &Option::Option<Element>
-
-
-
-
-
-Implementation
-
-
-public fun borrow<Element>(r:& Ring<Element>, i: u64):&Option::Option<Element>{
- let len = capacity<Element>(r);
- if( r.external_index > len - 1) {
- assert!( i >= r.external_index - len && i < r.external_index , Errors::invalid_argument(ERROR_RING_INDEX_OUT_OF_BOUNDS));
- Vector::borrow(&r.data, i % len)
- }else {
- assert!( i < len , Errors::invalid_argument(ERROR_RING_INDEX_OUT_OF_BOUNDS));
- Vector::borrow(&r.data, i )
- }
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `borrow_mut`
-
-Return a mutable reference to the i
th element in the Ring r
.
-
-
-public fun borrow_mut<Element>(r: &mut Ring::Ring<Element>, i: u64): &mut Option::Option<Element>
-
-
-
-
-
-Implementation
-
-
-public fun borrow_mut<Element>(r: &mut Ring<Element>, i: u64):&mut Option::Option<Element>{
- let len = capacity<Element>(r);
- if( r.external_index > len - 1) {
- assert!( i >= r.external_index - len && i < r.external_index , Errors::invalid_argument(ERROR_RING_INDEX_OUT_OF_BOUNDS));
- Vector::borrow_mut(&mut r.data, i % len)
- }else {
- assert!( i < len , Errors::invalid_argument(ERROR_RING_INDEX_OUT_OF_BOUNDS));
- Vector::borrow_mut(&mut r.data, i )
- }
-
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `index_of`
-
-Return Option::Option<u64>
if e
is in the Ring r
at index i
.
-Otherwise, returns Option::none<u64>
.
-
-
-public fun index_of<Element>(r: &Ring::Ring<Element>, e: &Element): Option::Option<u64>
-
-
-
-
-
-Implementation
-
-
-public fun index_of<Element>(r: &Ring<Element>, e: &Element):Option::Option<u64>{
- let i = 0;
- let len = capacity<Element>(r);
- while ( i < len ) {
- if ( Option::borrow(Vector::borrow( &r.data, i )) == e) return Option::some(i + r.external_index - len);
- i = i + 1;
- };
- Option::none<u64>()
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `destroy`
-
-Destroy the Ring r
.
-Returns the vector saved by ring
-
-
-public fun destroy<Element>(r: Ring::Ring<Element>): vector<Element>
-
-
-
-
-
-Implementation
-
-
-public fun destroy<Element>(r: Ring<Element>):vector<Element>{
- let Ring {
- data : data ,
- insertion_index : _,
- external_index : _,
- } = r ;
- let len = Vector::length(&data);
- let i = 0;
- let vec = Vector::empty<Element>();
- while ( i < len ) {
- let op_e = Vector::pop_back( &mut data );
- if ( Option::is_some(&op_e) ) {
- Vector::push_back(&mut vec, Option::destroy_some(op_e))
- }else {
- Option::destroy_none(op_e)
- };
- i = i + 1;
- };
- Vector::destroy_empty(data);
- vec
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
diff --git a/build/StarcoinFramework/docs/STC.md b/build/StarcoinFramework/docs/STC.md
index 74bed864..b22272d5 100644
--- a/build/StarcoinFramework/docs/STC.md
+++ b/build/StarcoinFramework/docs/STC.md
@@ -13,17 +13,25 @@ It uses apis defined in the Token
- [Function `initialize`](#0x1_STC_initialize)
- [Function `upgrade_from_v1_to_v2`](#0x1_STC_upgrade_from_v1_to_v2)
- [Function `initialize_v2`](#0x1_STC_initialize_v2)
-- [Function `initialize_v3`](#0x1_STC_initialize_v3)
- [Function `is_stc`](#0x1_STC_is_stc)
- [Function `burn`](#0x1_STC_burn)
- [Function `token_address`](#0x1_STC_token_address)
- [Module Specification](#@Module_Specification_1)
-use 0x1::CoreAddresses;
-use 0x1::Errors;
+use 0x1::ConsensusConfig;
+use 0x1::CoreAddresses;
+use 0x1::Dao;
+use 0x1::ModifyDaoConfigProposal;
+use 0x1::OnChainConfigDao;
+use 0x1::PackageTxnManager;
+use 0x1::RewardConfig;
use 0x1::Token;
+use 0x1::TransactionPublishOption;
+use 0x1::TransactionTimeoutConfig;
use 0x1::Treasury;
+use 0x1::UpgradeModuleDaoProposal;
+use 0x1::VMConfig;
@@ -106,7 +114,7 @@ precision of STC token.
STC initialization.
-public fun initialize(_account: &signer, _voting_delay: u64, _voting_period: u64, _voting_quorum_rate: u8, _min_action_delay: u64)
+public fun initialize(account: &signer, voting_delay: u64, voting_period: u64, voting_quorum_rate: u8, min_action_delay: u64)
@@ -116,13 +124,34 @@ STC initialization.
public fun initialize(
- _account: &signer,
- _voting_delay: u64,
- _voting_period: u64,
- _voting_quorum_rate: u8,
- _min_action_delay: u64,
+ account: &signer,
+ voting_delay: u64,
+ voting_period: u64,
+ voting_quorum_rate: u8,
+ min_action_delay: u64,
) {
- abort Errors::deprecated(1)
+ Token::register_token<STC>(account, PRECISION);
+ let burn_cap = Token::remove_burn_capability<STC>(account);
+ move_to(account, SharedBurnCapability { cap: burn_cap });
+ Dao::plugin<STC>(
+ account,
+ voting_delay,
+ voting_period,
+ voting_quorum_rate,
+ min_action_delay,
+ );
+ ModifyDaoConfigProposal::plugin<STC>(account);
+ let upgrade_plan_cap = PackageTxnManager::extract_submit_upgrade_plan_cap(account);
+ UpgradeModuleDaoProposal::plugin<STC>(
+ account,
+ upgrade_plan_cap,
+ );
+ // the following configurations are gov-ed by Dao.
+ OnChainConfigDao::plugin<STC, TransactionPublishOption::TransactionPublishOption>(account);
+ OnChainConfigDao::plugin<STC, VMConfig::VMConfig>(account);
+ OnChainConfigDao::plugin<STC, ConsensusConfig::ConsensusConfig>(account);
+ OnChainConfigDao::plugin<STC, RewardConfig::RewardConfig>(account);
+ OnChainConfigDao::plugin<STC, TransactionTimeoutConfig::TransactionTimeoutConfig>(account);
}
@@ -135,7 +164,7 @@ STC initialization.
-pragma verify = false;
+include Token::RegisterTokenAbortsIf<STC>{precision: PRECISION};
@@ -157,11 +186,11 @@ STC initialization.
Implementation
-public fun upgrade_from_v1_to_v2(account: &signer, total_amount: u128, ): Treasury::WithdrawCapability<STC> {
+public fun upgrade_from_v1_to_v2(account: &signer,total_amount: u128,): Treasury::WithdrawCapability<STC> {
CoreAddresses::assert_genesis_address(account);
// Mint all stc, and destroy mint capability
- let total_stc = Token::mint<STC>(account, total_amount - Token::market_cap<STC>());
+ let total_stc = Token::mint<STC>(account, total_amount-Token::market_cap<STC>());
let withdraw_cap = Treasury::initialize(account, total_stc);
let mint_cap = Token::remove_mint_capability<STC>(account);
Token::destroy_mint_capability(mint_cap);
@@ -192,7 +221,7 @@ STC initialization.
STC initialization.
-public fun initialize_v2(_account: &signer, _total_amount: u128, _voting_delay: u64, _voting_period: u64, _voting_quorum_rate: u8, _min_action_delay: u64): Treasury::WithdrawCapability<STC::STC>
+public fun initialize_v2(account: &signer, total_amount: u128, voting_delay: u64, voting_period: u64, voting_quorum_rate: u8, min_action_delay: u64): Treasury::WithdrawCapability<STC::STC>
@@ -202,52 +231,12 @@ STC initialization.
public fun initialize_v2(
- _account: &signer,
- _total_amount: u128,
- _voting_delay: u64,
- _voting_period: u64,
- _voting_quorum_rate: u8,
- _min_action_delay: u64,
-): Treasury::WithdrawCapability<STC> {
- abort Errors::deprecated(1)
-}
-
-
-
-
-
-
-
-Specification
-
-
-
-pragma verify = false;
-
-
-
-
-
-
-
-
-## Function `initialize_v3`
-
-STC initialization.
-
-
-public fun initialize_v3(account: &signer, total_amount: u128): Treasury::WithdrawCapability<STC::STC>
-
-
-
-
-
-Implementation
-
-
-public fun initialize_v3(
account: &signer,
total_amount: u128,
+ voting_delay: u64,
+ voting_period: u64,
+ voting_quorum_rate: u8,
+ min_action_delay: u64,
): Treasury::WithdrawCapability<STC> {
Token::register_token<STC>(account, PRECISION);
@@ -260,6 +249,25 @@ STC initialization.
let burn_cap = Token::remove_burn_capability<STC>(account);
move_to(account, SharedBurnCapability { cap: burn_cap });
+ Dao::plugin<STC>(
+ account,
+ voting_delay,
+ voting_period,
+ voting_quorum_rate,
+ min_action_delay,
+ );
+ ModifyDaoConfigProposal::plugin<STC>(account);
+ let upgrade_plan_cap = PackageTxnManager::extract_submit_upgrade_plan_cap(account);
+ UpgradeModuleDaoProposal::plugin<STC>(
+ account,
+ upgrade_plan_cap,
+ );
+ // the following configurations are gov-ed by Dao.
+ OnChainConfigDao::plugin<STC, TransactionPublishOption::TransactionPublishOption>(account);
+ OnChainConfigDao::plugin<STC, VMConfig::VMConfig>(account);
+ OnChainConfigDao::plugin<STC, ConsensusConfig::ConsensusConfig>(account);
+ OnChainConfigDao::plugin<STC, RewardConfig::RewardConfig>(account);
+ OnChainConfigDao::plugin<STC, TransactionTimeoutConfig::TransactionTimeoutConfig>(account);
withdraw_cap
}
@@ -273,7 +281,7 @@ STC initialization.
-include Token::RegisterTokenAbortsIf<STC> { precision: PRECISION };
+include Token::RegisterTokenAbortsIf<STC>{precision: PRECISION};
diff --git a/build/StarcoinFramework/docs/Signature.md b/build/StarcoinFramework/docs/Signature.md
index e819d8cf..ea42a890 100644
--- a/build/StarcoinFramework/docs/Signature.md
+++ b/build/StarcoinFramework/docs/Signature.md
@@ -10,7 +10,6 @@ Contains functions for [ed25519](https://en.wikipedia.org/wiki/EdDSA) digital si
- [Function `ed25519_verify`](#0x1_Signature_ed25519_verify)
- [Function `native_ecrecover`](#0x1_Signature_native_ecrecover)
- [Function `ecrecover`](#0x1_Signature_ecrecover)
-- [Function `secp256k1_verify`](#0x1_Signature_secp256k1_verify)
- [Module Specification](#@Module_Specification_0)
@@ -116,32 +115,6 @@ recover address from ECDSA signature, if recover fail, return None
-
-
-
-
-## Function `secp256k1_verify`
-
-
-
-public fun secp256k1_verify(signature: vector<u8>, addr: vector<u8>, message: vector<u8>): bool
-
-
-
-
-
-Implementation
-
-
-public fun secp256k1_verify(signature: vector<u8>, addr: vector<u8>, message: vector<u8>) : bool{
- let receover_address_opt:Option<EVMAddress> = ecrecover(message, signature);
- let expect_address = EVMAddress::new(addr);
- &Option::destroy_some<EVMAddress>(receover_address_opt) == &expect_address
-}
-
-
-
-
diff --git a/build/StarcoinFramework/docs/SignedInteger64.md b/build/StarcoinFramework/docs/SignedInteger64.md
index 5d4c8fc2..81d8dbda 100644
--- a/build/StarcoinFramework/docs/SignedInteger64.md
+++ b/build/StarcoinFramework/docs/SignedInteger64.md
@@ -73,7 +73,7 @@ Multiply a u64 integer by a signed integer number.
public fun multiply_u64(num: u64, multiplier: SignedInteger64): SignedInteger64 {
let product = multiplier.value * num;
- SignedInteger64 { value: product, is_negative: multiplier.is_negative }
+ SignedInteger64 { value: (product as u64), is_negative: multiplier.is_negative }
}
@@ -111,7 +111,7 @@ Divide a u64 integer by a signed integer number.
public fun divide_u64(num: u64, divisor: SignedInteger64): SignedInteger64 {
let quotient = num / divisor.value;
- SignedInteger64 { value: quotient, is_negative: divisor.is_negative }
+ SignedInteger64 { value: (quotient as u64), is_negative: divisor.is_negative }
}
@@ -150,14 +150,14 @@ Sub: num - minus
public fun sub_u64(num: u64, minus: SignedInteger64): SignedInteger64 {
if (minus.is_negative) {
let result = num + minus.value;
- SignedInteger64 { value: result, is_negative: false }
+ SignedInteger64 { value: (result as u64), is_negative: false }
} else {
- if (num >= minus.value) {
+ if (num > minus.value) {
let result = num - minus.value;
- SignedInteger64 { value: result, is_negative: false }
+ SignedInteger64 { value: (result as u64), is_negative: false }
}else {
let result = minus.value - num;
- SignedInteger64 { value: result, is_negative: true }
+ SignedInteger64 { value: (result as u64), is_negative: true }
}
}
}
@@ -197,16 +197,16 @@ Add: num + addend
public fun add_u64(num: u64, addend: SignedInteger64): SignedInteger64 {
if (addend.is_negative) {
- if (num >= addend.value) {
- let result = num - addend.value;
- SignedInteger64 { value: result, is_negative: false }
- }else {
- let result = addend.value - num;
- SignedInteger64 { value: result, is_negative: true }
- }
+ if (num > addend.value) {
+ let result = num - addend.value;
+ SignedInteger64 { value: (result as u64), is_negative: false }
+ }else {
+ let result = addend.value - num;
+ SignedInteger64 { value: (result as u64), is_negative: true }
+ }
} else {
- let result = num + addend.value;
- SignedInteger64 { value: result, is_negative: false }
+ let result = num + addend.value;
+ SignedInteger64 { value: (result as u64), is_negative: false }
}
}
diff --git a/build/StarcoinFramework/docs/StarcoinVerifier.md b/build/StarcoinFramework/docs/StarcoinVerifier.md
deleted file mode 100644
index 21650547..00000000
--- a/build/StarcoinFramework/docs/StarcoinVerifier.md
+++ /dev/null
@@ -1,703 +0,0 @@
-
-
-
-# Module `0x1::StarcoinVerifier`
-
-
-
-- [Struct `AccountState`](#0x1_StarcoinVerifier_AccountState)
-- [Struct `StateProof`](#0x1_StarcoinVerifier_StateProof)
-- [Struct `SparseMerkleProof`](#0x1_StarcoinVerifier_SparseMerkleProof)
-- [Struct `SMTNode`](#0x1_StarcoinVerifier_SMTNode)
-- [Constants](#@Constants_0)
-- [Function `bcs_deserialize_account_state`](#0x1_StarcoinVerifier_bcs_deserialize_account_state)
-- [Function `new_state_proof`](#0x1_StarcoinVerifier_new_state_proof)
-- [Function `new_sparse_merkle_proof`](#0x1_StarcoinVerifier_new_sparse_merkle_proof)
-- [Function `new_smt_node`](#0x1_StarcoinVerifier_new_smt_node)
-- [Function `empty_smt_node`](#0x1_StarcoinVerifier_empty_smt_node)
-- [Function `verify_state_proof`](#0x1_StarcoinVerifier_verify_state_proof)
-- [Function `verify_smp`](#0x1_StarcoinVerifier_verify_smp)
-- [Function `compute_smp_root_by_path_and_node_hash`](#0x1_StarcoinVerifier_compute_smp_root_by_path_and_node_hash)
-- [Function `placeholder`](#0x1_StarcoinVerifier_placeholder)
-- [Function `create_literal_hash`](#0x1_StarcoinVerifier_create_literal_hash)
-- [Function `hash_key`](#0x1_StarcoinVerifier_hash_key)
-- [Function `hash_value`](#0x1_StarcoinVerifier_hash_value)
-- [Function `count_common_prefix`](#0x1_StarcoinVerifier_count_common_prefix)
-- [Function `get_bit_at_from_msb`](#0x1_StarcoinVerifier_get_bit_at_from_msb)
-
-
-use 0x1::BCS;
-use 0x1::Hash;
-use 0x1::Option;
-use 0x1::StructuredHash;
-use 0x1::Vector;
-
-
-
-
-
-
-## Struct `AccountState`
-
-
-
-struct AccountState has copy, drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
storage_roots: vector<Option::Option<vector<u8>>>
-
--
-
-
-
-
-
-
-
-
-
-## Struct `StateProof`
-
-
-
-struct StateProof has copy, drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
account_proof: StarcoinVerifier::SparseMerkleProof
-
--
-
- * Account state's proof for global state root.
-
-
--
-
account_state: vector<u8>
-
--
-
- * Account state including storage roots.
-
-
--
-
proof: StarcoinVerifier::SparseMerkleProof
-
--
-
- * State's proof for account storage root.
-
-
-
-
-
-
-
-
-
-## Struct `SparseMerkleProof`
-
-
-
-struct SparseMerkleProof has copy, drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
siblings: vector<vector<u8>>
-
--
-
-
--
-
leaf: StarcoinVerifier::SMTNode
-
--
-
-
-
-
-
-
-
-
-
-## Struct `SMTNode`
-
-
-
-struct SMTNode has copy, drop, store
-
-
-
-
-
-Fields
-
-
-
--
-
hash1: vector<u8>
-
--
-
-
--
-
hash2: vector<u8>
-
--
-
-
-
-
-
-
-
-
-
-## Constants
-
-
-
-
-
-
-const ACCOUNT_STORAGE_INDEX_RESOURCE: u64 = 1;
-
-
-
-
-
-
-
-
-const BLOB_HASH_PREFIX: vector<u8> = [66, 108, 111, 98];
-
-
-
-
-
-
-
-
-const DEFAULT_VALUE: vector<u8> = [];
-
-
-
-
-
-
-
-
-const ERROR_ACCOUNT_STORAGE_ROOTS: u64 = 101;
-
-
-
-
-
-
-
-
-const ERROR_LITERAL_HASH_WRONG_LENGTH: u64 = 102;
-
-
-
-
-
-
-
-
-const HASH_LEN_IN_BITS: u64 = 256;
-
-
-
-
-
-
-
-
-const SPARSE_MERKLE_INTERNAL_NODE: vector<u8> = [83, 112, 97, 114, 115, 101, 77, 101, 114, 107, 108, 101, 73, 110, 116, 101, 114, 110, 97, 108, 78, 111, 100, 101];
-
-
-
-
-
-
-
-
-const SPARSE_MERKLE_LEAF_NODE: vector<u8> = [83, 112, 97, 114, 115, 101, 77, 101, 114, 107, 108, 101, 76, 101, 97, 102, 78, 111, 100, 101];
-
-
-
-
-
-
-
-
-const SPARSE_MERKLE_PLACEHOLDER_HASH_LITERAL: vector<u8> = [83, 80, 65, 82, 83, 69, 95, 77, 69, 82, 75, 76, 69, 95, 80, 76, 65, 67, 69, 72, 79, 76, 68, 69, 82, 95, 72, 65, 83, 72];
-
-
-
-
-
-
-## Function `bcs_deserialize_account_state`
-
-
-
-public fun bcs_deserialize_account_state(data: &vector<u8>): StarcoinVerifier::AccountState
-
-
-
-
-
-Implementation
-
-
-public fun bcs_deserialize_account_state(data: &vector<u8>): AccountState {
- let (vec, _) = BCS::deserialize_option_bytes_vector(data, 0);
- AccountState{
- storage_roots: vec
- }
-}
-
-
-
-
-
-
-
-
-## Function `new_state_proof`
-
-
-
-public fun new_state_proof(account_proof: StarcoinVerifier::SparseMerkleProof, account_state: vector<u8>, proof: StarcoinVerifier::SparseMerkleProof): StarcoinVerifier::StateProof
-
-
-
-
-
-Implementation
-
-
-public fun new_state_proof(account_proof: SparseMerkleProof, account_state: vector<u8>, proof: SparseMerkleProof): StateProof {
- StateProof{
- account_proof,
- account_state,
- proof,
- }
-}
-
-
-
-
-
-
-
-
-## Function `new_sparse_merkle_proof`
-
-
-
-public fun new_sparse_merkle_proof(siblings: vector<vector<u8>>, leaf: StarcoinVerifier::SMTNode): StarcoinVerifier::SparseMerkleProof
-
-
-
-
-
-Implementation
-
-
-public fun new_sparse_merkle_proof(siblings: vector<vector<u8>>, leaf: SMTNode): SparseMerkleProof {
- SparseMerkleProof{
- siblings,
- leaf,
- }
-}
-
-
-
-
-
-
-
-
-## Function `new_smt_node`
-
-
-
-public fun new_smt_node(hash1: vector<u8>, hash2: vector<u8>): StarcoinVerifier::SMTNode
-
-
-
-
-
-Implementation
-
-
-public fun new_smt_node(hash1: vector<u8>, hash2: vector<u8>): SMTNode {
- SMTNode{
- hash1,
- hash2,
- }
-}
-
-
-
-
-
-
-
-
-## Function `empty_smt_node`
-
-
-
-public fun empty_smt_node(): StarcoinVerifier::SMTNode
-
-
-
-
-
-Implementation
-
-
-public fun empty_smt_node(): SMTNode {
- SMTNode{
- hash1: Vector::empty(),
- hash2: Vector::empty(),
- }
-}
-
-
-
-
-
-
-
-
-## Function `verify_state_proof`
-
-
-
-public fun verify_state_proof(state_proof: &StarcoinVerifier::StateProof, state_root: &vector<u8>, account_address: address, resource_struct_tag: &vector<u8>, state: &vector<u8>): bool
-
-
-
-
-
-Implementation
-
-
-public fun verify_state_proof(state_proof: &StateProof, state_root: &vector<u8>,
- account_address: address, resource_struct_tag: &vector<u8>,
- state: &vector<u8>): bool {
- let accountState: AccountState = bcs_deserialize_account_state(&state_proof.account_state);
- assert!(Vector::length(&accountState.storage_roots) > ACCOUNT_STORAGE_INDEX_RESOURCE, ERROR_ACCOUNT_STORAGE_ROOTS);
-
- // First, verify state for storage root.
- let storageRoot = Option::borrow(Vector::borrow(&accountState.storage_roots, ACCOUNT_STORAGE_INDEX_RESOURCE));
- let ok: bool = verify_smp(&state_proof.proof.siblings,
- &state_proof.proof.leaf,
- storageRoot,
- resource_struct_tag, // resource struct tag BCS serialized as key
- state);
- if (!ok) {
- return false
- };
-
- // Then, verify account state for global state root.
- ok = verify_smp(&state_proof.account_proof.siblings,
- &state_proof.account_proof.leaf,
- state_root,
- &BCS::to_bytes<address>(&account_address), // account address as key
- &state_proof.account_state,
- );
- ok
-}
-
-
-
-
-
-
-
-
-## Function `verify_smp`
-
-Verify sparse merkle proof by key and value.
-
-
-public fun verify_smp(sibling_nodes: &vector<vector<u8>>, leaf_data: &StarcoinVerifier::SMTNode, expected_root: &vector<u8>, key: &vector<u8>, value: &vector<u8>): bool
-
-
-
-
-
-Implementation
-
-
-public fun verify_smp(sibling_nodes: &vector<vector<u8>>, leaf_data: &SMTNode, expected_root: &vector<u8>, key: &vector<u8>, value: &vector<u8>): bool {
- let path = hash_key(key);
- let current_hash: vector<u8>;
- if (*value == DEFAULT_VALUE) {
- // Non-membership proof.
- if (empty_smt_node() == *leaf_data) {
- current_hash = placeholder();
- } else {
- if (*&leaf_data.hash1 == *&path) {
- return false
- };
- if (!(count_common_prefix(&leaf_data.hash1, &path) >= Vector::length(sibling_nodes))) {
- return false
- };
- current_hash = StructuredHash::hash(SPARSE_MERKLE_LEAF_NODE, leaf_data);
- };
- } else {
- // Membership proof.
- if (empty_smt_node() == *leaf_data) {
- return false
- };
- if (*&leaf_data.hash1 != *&path) {
- return false
- };
- let value_hash = hash_value(value);
- if (*&leaf_data.hash2 != value_hash) {
- return false
- };
- current_hash = StructuredHash::hash(SPARSE_MERKLE_LEAF_NODE, leaf_data);
- };
-
- current_hash = compute_smp_root_by_path_and_node_hash(sibling_nodes, &path, ¤t_hash);
- current_hash == *expected_root
-}
-
-
-
-
-
-
-
-
-## Function `compute_smp_root_by_path_and_node_hash`
-
-
-
-public fun compute_smp_root_by_path_and_node_hash(sibling_nodes: &vector<vector<u8>>, path: &vector<u8>, node_hash: &vector<u8>): vector<u8>
-
-
-
-
-
-Implementation
-
-
-public fun compute_smp_root_by_path_and_node_hash(sibling_nodes: &vector<vector<u8>>, path: &vector<u8>, node_hash: &vector<u8>): vector<u8> {
- let current_hash = *node_hash;
- let i = 0;
- let proof_length = Vector::length(sibling_nodes);
- while (i < proof_length) {
- let sibling = *Vector::borrow(sibling_nodes, i);
- let bit = get_bit_at_from_msb(path, proof_length - i - 1);
- let internal_node = if (bit) {
- SMTNode{ hash1: sibling, hash2: current_hash }
- } else {
- SMTNode{ hash1: current_hash, hash2: sibling }
- };
- current_hash = StructuredHash::hash(SPARSE_MERKLE_INTERNAL_NODE, &internal_node);
- i = i + 1;
- };
- current_hash
-}
-
-
-
-
-
-
-
-
-## Function `placeholder`
-
-
-
-public fun placeholder(): vector<u8>
-
-
-
-
-
-Implementation
-
-
-public fun placeholder(): vector<u8> {
- create_literal_hash(&SPARSE_MERKLE_PLACEHOLDER_HASH_LITERAL)
-}
-
-
-
-
-
-
-
-
-## Function `create_literal_hash`
-
-
-
-public fun create_literal_hash(word: &vector<u8>): vector<u8>
-
-
-
-
-
-Implementation
-
-
-public fun create_literal_hash(word: &vector<u8>): vector<u8> {
- if (Vector::length(word) <= 32) {
- let lenZero = 32 - Vector::length(word);
- let i = 0;
- let r = *word;
- while (i < lenZero) {
- Vector::push_back(&mut r, 0);
- i = i + 1;
- };
- return r
- };
- abort ERROR_LITERAL_HASH_WRONG_LENGTH
-}
-
-
-
-
-
-
-
-
-## Function `hash_key`
-
-
-
-fun hash_key(key: &vector<u8>): vector<u8>
-
-
-
-
-
-Implementation
-
-
-fun hash_key(key: &vector<u8>): vector<u8> {
- Hash::sha3_256(*key)
-}
-
-
-
-
-
-
-
-
-## Function `hash_value`
-
-
-
-fun hash_value(value: &vector<u8>): vector<u8>
-
-
-
-
-
-Implementation
-
-
-fun hash_value(value: &vector<u8>): vector<u8> {
- StructuredHash::hash(BLOB_HASH_PREFIX, value)
-}
-
-
-
-
-
-
-
-
-## Function `count_common_prefix`
-
-
-
-fun count_common_prefix(data1: &vector<u8>, data2: &vector<u8>): u64
-
-
-
-
-
-Implementation
-
-
-fun count_common_prefix(data1: &vector<u8>, data2: &vector<u8>): u64 {
- let count = 0;
- let i = 0;
- while ( i < Vector::length(data1) * 8) {
- if (get_bit_at_from_msb(data1, i) == get_bit_at_from_msb(data2, i)) {
- count = count + 1;
- } else {
- break
- };
- i = i + 1;
- };
- count
-}
-
-
-
-
-
-
-
-
-## Function `get_bit_at_from_msb`
-
-
-
-fun get_bit_at_from_msb(data: &vector<u8>, index: u64): bool
-
-
-
-
-
-Implementation
-
-
-fun get_bit_at_from_msb(data: &vector<u8>, index: u64): bool {
- let pos = index / 8;
- let bit = (7 - index % 8);
- (*Vector::borrow(data, pos) >> (bit as u8)) & 1u8 != 0
-}
-
-
-
-
-
diff --git a/build/StarcoinFramework/docs/StdlibUpgradeScripts.md b/build/StarcoinFramework/docs/StdlibUpgradeScripts.md
index 05209e21..6bf98043 100644
--- a/build/StarcoinFramework/docs/StdlibUpgradeScripts.md
+++ b/build/StarcoinFramework/docs/StdlibUpgradeScripts.md
@@ -15,55 +15,26 @@ The module for StdlibUpgrade init scripts
- [Function `do_upgrade_from_v6_to_v7_with_language_version`](#0x1_StdlibUpgradeScripts_do_upgrade_from_v6_to_v7_with_language_version)
- [Function `upgrade_from_v7_to_v8`](#0x1_StdlibUpgradeScripts_upgrade_from_v7_to_v8)
- [Function `do_upgrade_from_v7_to_v8`](#0x1_StdlibUpgradeScripts_do_upgrade_from_v7_to_v8)
-- [Function `upgrade_from_v11_to_v12`](#0x1_StdlibUpgradeScripts_upgrade_from_v11_to_v12)
-- [Function `do_upgrade_from_v11_to_v12`](#0x1_StdlibUpgradeScripts_do_upgrade_from_v11_to_v12)
-- [Function `upgrade_from_v12_to_v13`](#0x1_StdlibUpgradeScripts_upgrade_from_v12_to_v13)
-- [Function `do_upgrade_from_v12_to_v13`](#0x1_StdlibUpgradeScripts_do_upgrade_from_v12_to_v13)
- [Module Specification](#@Module_Specification_0)
use 0x1::Account;
-use 0x1::AnyMemberPlugin;
-use 0x1::Block;
use 0x1::Collection;
use 0x1::Config;
-use 0x1::ConfigProposalPlugin;
-use 0x1::ConsensusConfig;
use 0x1::CoreAddresses;
-use 0x1::DAOExtensionPoint;
-use 0x1::DAOPluginMarketplace;
-use 0x1::DAORegistry;
-use 0x1::Dao;
-use 0x1::GasOracleProposalPlugin;
use 0x1::GenesisNFT;
use 0x1::GenesisSignerCapability;
-use 0x1::GrantProposalPlugin;
-use 0x1::InstallPluginProposalPlugin;
use 0x1::LanguageVersion;
-use 0x1::MemberProposalPlugin;
-use 0x1::MintProposalPlugin;
-use 0x1::ModifyDaoConfigProposal;
use 0x1::NFT;
use 0x1::Offer;
use 0x1::OnChainConfigDao;
use 0x1::Oracle;
-use 0x1::PackageTxnManager;
-use 0x1::RewardConfig;
use 0x1::STC;
use 0x1::STCUSDOracle;
-use 0x1::StakeToSBTPlugin;
-use 0x1::StarcoinDAO;
use 0x1::Timestamp;
use 0x1::Token;
-use 0x1::TransactionPublishOption;
-use 0x1::TransactionTimeoutConfig;
use 0x1::Treasury;
-use 0x1::TreasuryPlugin;
use 0x1::TreasuryWithdrawDaoProposal;
-use 0x1::UpgradeModuleDaoProposal;
-use 0x1::UpgradeModulePlugin;
-use 0x1::VMConfig;
-use 0x1::WithdrawPlugin;
@@ -84,7 +55,7 @@ Stdlib upgrade script from v2 to v3
Implementation
-public(script) fun upgrade_from_v2_to_v3(account: signer, total_stc_amount: u128) {
+public(script) fun upgrade_from_v2_to_v3(account: signer, total_stc_amount: u128 ) {
CoreAddresses::assert_genesis_address(&account);
let withdraw_cap = STC::upgrade_from_v1_to_v2(&account, total_stc_amount);
@@ -95,7 +66,7 @@ Stdlib upgrade script from v2 to v3
Collection::return_collection(mint_keys);
let now = Timestamp::now_seconds();
- let linear_withdraw_cap = Treasury::issue_linear_withdraw_capability(&mut withdraw_cap, total - minted, period - (now - start_time));
+ let linear_withdraw_cap = Treasury::issue_linear_withdraw_capability(&mut withdraw_cap, total-minted, period - (now - start_time));
// Lock the TreasuryWithdrawCapability to Dao
TreasuryWithdrawDaoProposal::plugin(&account, withdraw_cap);
// Give a LinearWithdrawCapability Offer to association, association need to take the offer, and destroy old LinearTimeMintKey.
@@ -123,7 +94,7 @@ association account should call this script after upgrade from v2 to v3.
Implementation
-public(script) fun take_linear_withdraw_capability(signer: signer) {
+public(script) fun take_linear_withdraw_capability(signer: signer){
let offered = Offer::redeem<LinearWithdrawCapability<STC>>(&signer, CoreAddresses::GENESIS_ADDRESS());
Treasury::add_linear_withdraw_capability(&signer, offered);
let mint_key = Collection::take<LinearTimeMintKey<STC>>(&signer);
@@ -182,7 +153,7 @@ association account should call this script after upgrade from v2 to v3.
public(script) fun upgrade_from_v5_to_v6(sender: signer) {
- Self::do_upgrade_from_v5_to_v6(&sender)
+ Self::do_upgrade_from_v5_to_v6(&sender)
}
@@ -231,7 +202,7 @@ deprecated, use do_upgrade_from_v6_to_v7_with_language_version
.
public fun do_upgrade_from_v6_to_v7(sender: &signer) {
- do_upgrade_from_v6_to_v7_with_language_version(sender, 2);
+ do_upgrade_from_v6_to_v7_with_language_version(sender, 2);
}
@@ -322,150 +293,6 @@ deprecated, use do_upgrade_from_v6_to_v7_with_language_version
.
-
-
-
-
-## Function `upgrade_from_v11_to_v12`
-
-
-
-public(script) fun upgrade_from_v11_to_v12()
-
-
-
-
-
-Implementation
-
-
-public(script) fun upgrade_from_v11_to_v12() {
- do_upgrade_from_v11_to_v12();
-}
-
-
-
-
-
-
-
-
-## Function `do_upgrade_from_v11_to_v12`
-
-
-
-public fun do_upgrade_from_v11_to_v12()
-
-
-
-
-
-Implementation
-
-
-public fun do_upgrade_from_v11_to_v12() {
- let genessis_signer = GenesisSignerCapability::get_genesis_signer();
- Block::checkpoints_init();
- DAORegistry::initialize();
-
- DAOExtensionPoint::initialize();
- DAOPluginMarketplace::initialize();
-
- AnyMemberPlugin::initialize(&genessis_signer);
- ConfigProposalPlugin::initialize(&genessis_signer);
- GrantProposalPlugin::initialize(&genessis_signer);
- InstallPluginProposalPlugin::initialize(&genessis_signer);
- MemberProposalPlugin::initialize(&genessis_signer);
- MintProposalPlugin::initialize(&genessis_signer);
- StakeToSBTPlugin::initialize(&genessis_signer);
- UpgradeModulePlugin::initialize(&genessis_signer);
- GasOracleProposalPlugin::initialize(&genessis_signer);
- TreasuryPlugin::initialize(&genessis_signer);
-
- //TODO : config rate need mind
- // voting_delay: 60000 ms
- // voting_period: 3600000 ms
- // voting_quorum_rate: 4
- // min_action_delay: 3600000 ms
- let signer_cap = Account::get_genesis_capability();
- let upgrade_plan_cap = UpgradeModuleDaoProposal::get_genesis_upgrade_cap<STC>();
- StarcoinDAO::create_dao(signer_cap, upgrade_plan_cap, Dao::voting_delay<STC>(), Dao::voting_period<STC>(), Dao::voting_quorum_rate<STC>(), Dao::min_action_delay<STC>(), 1000 * 1000 * 1000 * 1000);
-
- StarcoinDAO::delegate_config_capability<STC, TransactionPublishOption::TransactionPublishOption>(
- OnChainConfigDao::config_cap<STC, TransactionPublishOption::TransactionPublishOption>());
- StarcoinDAO::delegate_config_capability<STC, VMConfig::VMConfig>(
- OnChainConfigDao::config_cap<STC, VMConfig::VMConfig>());
- StarcoinDAO::delegate_config_capability<STC, ConsensusConfig::ConsensusConfig>(
- OnChainConfigDao::config_cap<STC, ConsensusConfig::ConsensusConfig>());
- StarcoinDAO::delegate_config_capability<STC, RewardConfig::RewardConfig>(
- OnChainConfigDao::config_cap<STC, RewardConfig::RewardConfig>());
- StarcoinDAO::delegate_config_capability<STC, TransactionTimeoutConfig::TransactionTimeoutConfig>(
- OnChainConfigDao::config_cap<STC, TransactionTimeoutConfig::TransactionTimeoutConfig>());
- StarcoinDAO::delegate_config_capability<STC, LanguageVersion::LanguageVersion>(
- OnChainConfigDao::config_cap<STC, LanguageVersion::LanguageVersion>());
-
- let signer = GenesisSignerCapability::get_genesis_signer();
- let cap = TreasuryWithdrawDaoProposal::takeout_withdraw_capability<STC>(&signer);
- TreasuryPlugin::delegate_capability<STC>(&signer, cap);
- StarcoinDAO::set_treasury_withdraw_proposal_scale(100);
-
- // clean old DAO resources
- ModifyDaoConfigProposal::destroy_modify_config_capability<STC>(&genessis_signer);
-}
-
-
-
-
-
-
-
-
-## Function `upgrade_from_v12_to_v13`
-
-
-
-public(script) fun upgrade_from_v12_to_v13()
-
-
-
-
-
-Implementation
-
-
-public(script) fun upgrade_from_v12_to_v13() {
- do_upgrade_from_v12_to_v13();
-}
-
-
-
-
-
-
-
-
-## Function `do_upgrade_from_v12_to_v13`
-
-
-
-public fun do_upgrade_from_v12_to_v13()
-
-
-
-
-
-Implementation
-
-
-public fun do_upgrade_from_v12_to_v13() {
- let genessis_signer = GenesisSignerCapability::get_genesis_signer();
- WithdrawPlugin::initialize(&genessis_signer);
- StarcoinDAO::upgrade_dao();
-}
-
-
-
-
diff --git a/build/StarcoinFramework/docs/Token.md b/build/StarcoinFramework/docs/Token.md
index a32c5fb7..ec75f7fb 100644
--- a/build/StarcoinFramework/docs/Token.md
+++ b/build/StarcoinFramework/docs/Token.md
@@ -45,7 +45,6 @@ Token implementation of Starcoin.
- [Function `is_same_token`](#0x1_Token_is_same_token)
- [Function `token_address`](#0x1_Token_token_address)
- [Function `token_code`](#0x1_Token_token_code)
-- [Function `type_of`](#0x1_Token_type_of)
- [Function `name_of`](#0x1_Token_name_of)
- [Function `name_of_token`](#0x1_Token_name_of_token)
- [Module Specification](#@Module_Specification_1)
@@ -1710,30 +1709,6 @@ does not matter for the verification of callers.
-
-
-
-
-## Function `type_of`
-
-
-
-public(friend) fun type_of<T>(): (address, vector<u8>, vector<u8>)
-
-
-
-
-
-Implementation
-
-
-public (friend) fun type_of<T>(): (address, vector<u8>, vector<u8>){
- name_of<T>()
-}
-
-
-
-
@@ -1743,7 +1718,7 @@ does not matter for the verification of callers.
Return Token's module address, module name, and type name of TokenType
.
-fun name_of<TokenType>(): (address, vector<u8>, vector<u8>)
+fun name_of<TokenType: store>(): (address, vector<u8>, vector<u8>)
@@ -1752,7 +1727,7 @@ Return Token's module address, module name, and type name of TokenTypeImplementation
-native fun name_of<TokenType>(): (address, vector<u8>, vector<u8>);
+native fun name_of<TokenType: store>(): (address, vector<u8>, vector<u8>);
diff --git a/build/StarcoinFramework/docs/TransactionManager.md b/build/StarcoinFramework/docs/TransactionManager.md
index b1686d9e..6254c35f 100644
--- a/build/StarcoinFramework/docs/TransactionManager.md
+++ b/build/StarcoinFramework/docs/TransactionManager.md
@@ -23,12 +23,9 @@
use 0x1::CoreAddresses;
use 0x1::Epoch;
use 0x1::Errors;
-use 0x1::GasOracle;
-use 0x1::GasOracleProposalPlugin;
use 0x1::PackageTxnManager;
use 0x1::STC;
use 0x1::Signer;
-use 0x1::StarcoinDAO;
use 0x1::Timestamp;
use 0x1::Token;
use 0x1::TransactionFee;
@@ -157,21 +154,13 @@ It verifies:
// Check that the chain ID stored on-chain matches the chain ID
// specified by the transaction
assert!(ChainId::get() == chain_id, Errors::invalid_argument(EPROLOGUE_BAD_CHAIN_ID));
- let (stc_price,scaling_factor)= if (!STC::is_stc<TokenType>()){
- (GasOracleProposalPlugin::gas_oracle_read<StarcoinDAO, TokenType>(),GasOracle::get_scaling_factor<TokenType>())
- }else{
- (1,1)
- };
-
- Account::txn_prologue_v2<TokenType>(
+ Account::txn_prologue<TokenType>(
&account,
txn_sender,
txn_sequence_number,
txn_authentication_key_preimage,
txn_gas_price,
txn_max_gas_units,
- stc_price,
- scaling_factor,
);
assert!(
TransactionTimeout::is_valid_transaction_timestamp(txn_expiration_time),
@@ -221,6 +210,8 @@ It verifies:
include Timestamp::AbortsIfTimestampNotExists;
include Block::AbortsIfBlockMetadataNotExist;
aborts_if txn_gas_price * txn_max_gas_units > 0 && !exists<Account::Balance<TokenType>>(txn_sender);
+aborts_if txn_gas_price * txn_max_gas_units > 0 && StarcoinFramework::Token::spec_token_code<TokenType>() != StarcoinFramework::Token::spec_token_code<STC>();
+aborts_if txn_gas_price * txn_max_gas_units > 0 && global<Account::Balance<TokenType>>(txn_sender).token.value < txn_gas_price * txn_max_gas_units;
aborts_if txn_gas_price * txn_max_gas_units > 0 && txn_sequence_number >= max_u64();
aborts_if txn_sequence_number < global<Account::Account>(txn_sender).sequence_number;
aborts_if txn_sequence_number != global<Account::Account>(txn_sender).sequence_number;
@@ -332,13 +323,7 @@ It collects gas and bumps the sequence number
success: bool,
) {
CoreAddresses::assert_genesis_address(&account);
- let (stc_price,scaling_factor) =
- if (!STC::is_stc<TokenType>()){
- (GasOracleProposalPlugin::gas_oracle_read<StarcoinDAO, TokenType>(),GasOracle::get_scaling_factor<TokenType>())
- }else{
- (1,1)
- };
- Account::txn_epilogue_v3<TokenType>(
+ Account::txn_epilogue_v2<TokenType>(
&account,
txn_sender,
txn_sequence_number,
@@ -346,8 +331,6 @@ It collects gas and bumps the sequence number
txn_gas_price,
txn_max_gas_units,
gas_units_remaining,
- stc_price,
- scaling_factor
);
if (txn_payload_type == TXN_PAYLOAD_TYPE_PACKAGE) {
PackageTxnManager::package_txn_epilogue(
diff --git a/build/StarcoinFramework/docs/TransactionPublishOption.md b/build/StarcoinFramework/docs/TransactionPublishOption.md
index cc211f66..9507c62a 100644
--- a/build/StarcoinFramework/docs/TransactionPublishOption.md
+++ b/build/StarcoinFramework/docs/TransactionPublishOption.md
@@ -77,31 +77,31 @@ We represent these as the following resource.
-
+
+The script hash already exists in the allowlist
-const EPROLOGUE_ACCOUNT_DOES_NOT_EXIST: u64 = 0;
+const EALLOWLIST_ALREADY_CONTAINS_SCRIPT: u64 = 1002;
-
+
-The script hash already exists in the allowlist
+The script hash has an invalid length
-const EALLOWLIST_ALREADY_CONTAINS_SCRIPT: u64 = 1002;
+const EINVALID_SCRIPT_HASH: u64 = 1001;
-
+
-The script hash has an invalid length
-const EINVALID_SCRIPT_HASH: u64 = 1001;
+const EPROLOGUE_ACCOUNT_DOES_NOT_EXIST: u64 = 0;
diff --git a/build/StarcoinFramework/docs/TreasuryWithdrawDaoProposal.md b/build/StarcoinFramework/docs/TreasuryWithdrawDaoProposal.md
index 2854c0c7..0e13d8cc 100644
--- a/build/StarcoinFramework/docs/TreasuryWithdrawDaoProposal.md
+++ b/build/StarcoinFramework/docs/TreasuryWithdrawDaoProposal.md
@@ -10,7 +10,6 @@ TreasuryWithdrawDaoProposal is a dao proposal for withdraw Token from Treasury.
- [Struct `WithdrawToken`](#0x1_TreasuryWithdrawDaoProposal_WithdrawToken)
- [Constants](#@Constants_0)
- [Function `plugin`](#0x1_TreasuryWithdrawDaoProposal_plugin)
-- [Function `takeout_withdraw_capability`](#0x1_TreasuryWithdrawDaoProposal_takeout_withdraw_capability)
- [Function `propose_withdraw`](#0x1_TreasuryWithdrawDaoProposal_propose_withdraw)
- [Function `execute_withdraw_proposal`](#0x1_TreasuryWithdrawDaoProposal_execute_withdraw_proposal)
- [Function `withdraw_for_block_reward`](#0x1_TreasuryWithdrawDaoProposal_withdraw_for_block_reward)
@@ -109,11 +108,12 @@ WithdrawToken request.
-
+
+Only receiver can execute TreasuryWithdrawDaoProposal
-const ERR_CAPABILITY_NOT_EXIST: u64 = 104;
+const ERR_NEED_RECEIVER_TO_EXECUTE: u64 = 102;
@@ -128,16 +128,6 @@ The withdraw amount of propose is too many.
-
-
-Only receiver can execute TreasuryWithdrawDaoProposal
-
-
-const ERR_NEED_RECEIVER_TO_EXECUTE: u64 = 102;
-
-
-
-
## Function `plugin`
@@ -182,37 +172,6 @@ Should be called by token issuer.
-
-
-
-
-## Function `takeout_withdraw_capability`
-
-withdraw Treasury::WithdrawCapability
-
-
-public fun takeout_withdraw_capability<TokenT: store>(sender: &signer): Treasury::WithdrawCapability<TokenT>
-
-
-
-
-
-Implementation
-
-
-public fun takeout_withdraw_capability<TokenT: store>(sender: &signer): Treasury::WithdrawCapability<TokenT>
-acquires WrappedWithdrawCapability {
- let token_issuer = Token::token_address<TokenT>();
- assert!(Signer::address_of(sender) == token_issuer, Errors::requires_address(ERR_NOT_AUTHORIZED));
-
- assert!(exists<WrappedWithdrawCapability<TokenT>>(Signer::address_of(sender)), Errors::not_published(ERR_CAPABILITY_NOT_EXIST));
- let WrappedWithdrawCapability<TokenT> { cap } = move_from<WrappedWithdrawCapability<TokenT>>(Signer::address_of(sender));
- cap
-}
-
-
-
-
diff --git a/build/StarcoinFramework/docs/U256.md b/build/StarcoinFramework/docs/U256.md
index 4abb01ba..4236f4d3 100644
--- a/build/StarcoinFramework/docs/U256.md
+++ b/build/StarcoinFramework/docs/U256.md
@@ -22,6 +22,8 @@ Implementation u256.
- [Function `div`](#0x1_U256_div)
- [Function `rem`](#0x1_U256_rem)
- [Function `pow`](#0x1_U256_pow)
+- [Function `add_nocarry`](#0x1_U256_add_nocarry)
+- [Function `sub_noborrow`](#0x1_U256_sub_noborrow)
- [Function `from_bytes`](#0x1_U256_from_bytes)
- [Function `native_add`](#0x1_U256_native_add)
- [Function `native_sub`](#0x1_U256_native_sub)
@@ -32,7 +34,8 @@ Implementation u256.
- [Module Specification](#@Module_Specification_1)
-use 0x1::Errors;
+use 0x1::Arith;
+use 0x1::Errors;
use 0x1::Vector;
@@ -675,6 +678,79 @@ vector should always has two elements.
+
+
+
+
+## Function `add_nocarry`
+
+move implementation of native_add.
+
+
+fun add_nocarry(a: &mut U256::U256, b: &U256::U256)
+
+
+
+
+
+Implementation
+
+
+fun add_nocarry(a: &mut U256, b: &U256) {
+ let carry = 0;
+ let idx = 0;
+ let len = (WORD as u64);
+ while (idx < len) {
+ let a_bit = Vector::borrow_mut(&mut a.bits, idx);
+ let b_bit = Vector::borrow(&b.bits, idx);
+ *a_bit = StarcoinFramework::Arith::adc(*a_bit, *b_bit, &mut carry);
+ idx = idx + 1;
+ };
+
+ // check overflow
+ assert!(carry == 0, 100);
+}
+
+
+
+
+
+
+
+
+## Function `sub_noborrow`
+
+move implementation of native_sub.
+
+
+fun sub_noborrow(a: &mut U256::U256, b: &U256::U256)
+
+
+
+
+
+Implementation
+
+
+fun sub_noborrow(a: &mut U256, b: &U256) {
+ let borrow = 0;
+ let idx = 0;
+ let len = (WORD as u64);
+ while (idx < len) {
+ let a_bit = Vector::borrow_mut(&mut a.bits, idx);
+ let b_bit = Vector::borrow(&b.bits, idx);
+ *a_bit = StarcoinFramework::Arith::sbb(*a_bit, *b_bit, &mut borrow);
+ idx = idx + 1;
+ };
+
+ // check overflow
+ assert!(borrow == 0, 100);
+
+}
+
+
+
+
diff --git a/build/StarcoinFramework/docs/UpgradeModuleDaoProposal.md b/build/StarcoinFramework/docs/UpgradeModuleDaoProposal.md
index fc089941..add8f904 100644
--- a/build/StarcoinFramework/docs/UpgradeModuleDaoProposal.md
+++ b/build/StarcoinFramework/docs/UpgradeModuleDaoProposal.md
@@ -11,7 +11,6 @@ UpgradeModuleDaoProposal is a proposal moudle used to upgrade contract codes und
- [Struct `UpgradeModuleV2`](#0x1_UpgradeModuleDaoProposal_UpgradeModuleV2)
- [Constants](#@Constants_0)
- [Function `plugin`](#0x1_UpgradeModuleDaoProposal_plugin)
-- [Function `get_genesis_upgrade_cap`](#0x1_UpgradeModuleDaoProposal_get_genesis_upgrade_cap)
- [Function `propose_module_upgrade_v2`](#0x1_UpgradeModuleDaoProposal_propose_module_upgrade_v2)
- [Function `submit_module_upgrade_plan`](#0x1_UpgradeModuleDaoProposal_submit_module_upgrade_plan)
- [Module Specification](#@Module_Specification_1)
@@ -214,28 +213,16 @@ If this goverment can upgrade module, call this to register capability.
-
-
-
-
-## Function `get_genesis_upgrade_cap`
+
-public(friend) fun get_genesis_upgrade_cap<TokenT: store>(): PackageTxnManager::UpgradePlanCapability
-
-
-
-
-
-Implementation
-
-
-public (friend) fun get_genesis_upgrade_cap<TokenT:store>():PackageTxnManager::UpgradePlanCapability acquires UpgradeModuleCapability{
- let UpgradeModuleCapability<TokenT>{
- cap
- } = move_from(Token::token_address<TokenT>());
- cap
+schema AbortIfUnableUpgrade<TokenT> {
+ module_address: address;
+ let token_issuer = Token::SPEC_TOKEN_TEST_ADDRESS();
+ aborts_if !exists<UpgradeModuleCapability<TokenT>>(token_issuer);
+ let cap = global<UpgradeModuleCapability<TokenT>>(token_issuer).cap;
+ aborts_if PackageTxnManager::account_address(cap) != module_address;
}
diff --git a/build/StarcoinFramework/source_maps/Account.mvsm b/build/StarcoinFramework/source_maps/Account.mvsm
index 356adf3b..b1c5d6e5 100644
Binary files a/build/StarcoinFramework/source_maps/Account.mvsm and b/build/StarcoinFramework/source_maps/Account.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/AccountScripts.mvsm b/build/StarcoinFramework/source_maps/AccountScripts.mvsm
index 58f14083..ae3221c7 100644
Binary files a/build/StarcoinFramework/source_maps/AccountScripts.mvsm and b/build/StarcoinFramework/source_maps/AccountScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Arith.mvsm b/build/StarcoinFramework/source_maps/Arith.mvsm
index 2d249cc2..2d86c319 100644
Binary files a/build/StarcoinFramework/source_maps/Arith.mvsm and b/build/StarcoinFramework/source_maps/Arith.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/BCS.mvsm b/build/StarcoinFramework/source_maps/BCS.mvsm
index b6cf0c12..55ae8abc 100644
Binary files a/build/StarcoinFramework/source_maps/BCS.mvsm and b/build/StarcoinFramework/source_maps/BCS.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Block.mvsm b/build/StarcoinFramework/source_maps/Block.mvsm
index dee05fbb..eada550c 100644
Binary files a/build/StarcoinFramework/source_maps/Block.mvsm and b/build/StarcoinFramework/source_maps/Block.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/BlockReward.mvsm b/build/StarcoinFramework/source_maps/BlockReward.mvsm
index e8e01b8b..11f31a03 100644
Binary files a/build/StarcoinFramework/source_maps/BlockReward.mvsm and b/build/StarcoinFramework/source_maps/BlockReward.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Compare.mvsm b/build/StarcoinFramework/source_maps/Compare.mvsm
index 27000bfa..6469c37c 100644
Binary files a/build/StarcoinFramework/source_maps/Compare.mvsm and b/build/StarcoinFramework/source_maps/Compare.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/EVMAddress.mvsm b/build/StarcoinFramework/source_maps/EVMAddress.mvsm
index 0375d0f8..6e8ab0b4 100644
Binary files a/build/StarcoinFramework/source_maps/EVMAddress.mvsm and b/build/StarcoinFramework/source_maps/EVMAddress.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Genesis.mvsm b/build/StarcoinFramework/source_maps/Genesis.mvsm
index 8288658d..f8f0f361 100644
Binary files a/build/StarcoinFramework/source_maps/Genesis.mvsm and b/build/StarcoinFramework/source_maps/Genesis.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/GenesisNFT.mvsm b/build/StarcoinFramework/source_maps/GenesisNFT.mvsm
index 14a6f17f..2b02023b 100644
Binary files a/build/StarcoinFramework/source_maps/GenesisNFT.mvsm and b/build/StarcoinFramework/source_maps/GenesisNFT.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/GenesisNFTScripts.mvsm b/build/StarcoinFramework/source_maps/GenesisNFTScripts.mvsm
index d11198e8..d3936b96 100644
Binary files a/build/StarcoinFramework/source_maps/GenesisNFTScripts.mvsm and b/build/StarcoinFramework/source_maps/GenesisNFTScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/GenesisSignerCapability.mvsm b/build/StarcoinFramework/source_maps/GenesisSignerCapability.mvsm
index 998e3cd8..dcf6533e 100644
Binary files a/build/StarcoinFramework/source_maps/GenesisSignerCapability.mvsm and b/build/StarcoinFramework/source_maps/GenesisSignerCapability.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/IdentifierNFT.mvsm b/build/StarcoinFramework/source_maps/IdentifierNFT.mvsm
index 9f1b3d4c..991be210 100644
Binary files a/build/StarcoinFramework/source_maps/IdentifierNFT.mvsm and b/build/StarcoinFramework/source_maps/IdentifierNFT.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/IdentifierNFTScripts.mvsm b/build/StarcoinFramework/source_maps/IdentifierNFTScripts.mvsm
index 4e9e4589..9b3d3a60 100644
Binary files a/build/StarcoinFramework/source_maps/IdentifierNFTScripts.mvsm and b/build/StarcoinFramework/source_maps/IdentifierNFTScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm
deleted file mode 100644
index 2f0007d1..00000000
Binary files a/build/StarcoinFramework/source_maps/InstallPluginProposalPlugin.mvsm and /dev/null differ
diff --git a/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm b/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm
deleted file mode 100644
index b3485cbc..00000000
Binary files a/build/StarcoinFramework/source_maps/MemberProposalPlugin.mvsm and /dev/null differ
diff --git a/build/StarcoinFramework/source_maps/MerkleNFTDistributor.mvsm b/build/StarcoinFramework/source_maps/MerkleNFTDistributor.mvsm
index eb54fa0f..5b196958 100644
Binary files a/build/StarcoinFramework/source_maps/MerkleNFTDistributor.mvsm and b/build/StarcoinFramework/source_maps/MerkleNFTDistributor.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/MerkleProof.mvsm b/build/StarcoinFramework/source_maps/MerkleProof.mvsm
index 234610da..c9a44b97 100644
Binary files a/build/StarcoinFramework/source_maps/MerkleProof.mvsm and b/build/StarcoinFramework/source_maps/MerkleProof.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/ModifyDaoConfigProposal.mvsm b/build/StarcoinFramework/source_maps/ModifyDaoConfigProposal.mvsm
index e033d6cb..2149947d 100644
Binary files a/build/StarcoinFramework/source_maps/ModifyDaoConfigProposal.mvsm and b/build/StarcoinFramework/source_maps/ModifyDaoConfigProposal.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/ModuleUpgradeScripts.mvsm b/build/StarcoinFramework/source_maps/ModuleUpgradeScripts.mvsm
index a3981d95..53401317 100644
Binary files a/build/StarcoinFramework/source_maps/ModuleUpgradeScripts.mvsm and b/build/StarcoinFramework/source_maps/ModuleUpgradeScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/NFT.mvsm b/build/StarcoinFramework/source_maps/NFT.mvsm
index b27322cb..378db39f 100644
Binary files a/build/StarcoinFramework/source_maps/NFT.mvsm and b/build/StarcoinFramework/source_maps/NFT.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/NFTGallery.mvsm b/build/StarcoinFramework/source_maps/NFTGallery.mvsm
index 26147d3e..0cf28100 100644
Binary files a/build/StarcoinFramework/source_maps/NFTGallery.mvsm and b/build/StarcoinFramework/source_maps/NFTGallery.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/NFTGalleryScripts.mvsm b/build/StarcoinFramework/source_maps/NFTGalleryScripts.mvsm
index 4e781a7a..ab91419f 100644
Binary files a/build/StarcoinFramework/source_maps/NFTGalleryScripts.mvsm and b/build/StarcoinFramework/source_maps/NFTGalleryScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Offer.mvsm b/build/StarcoinFramework/source_maps/Offer.mvsm
index 9659b966..eed0447b 100644
Binary files a/build/StarcoinFramework/source_maps/Offer.mvsm and b/build/StarcoinFramework/source_maps/Offer.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/OnChainConfigDao.mvsm b/build/StarcoinFramework/source_maps/OnChainConfigDao.mvsm
index f9bd60c1..65d6cd52 100644
Binary files a/build/StarcoinFramework/source_maps/OnChainConfigDao.mvsm and b/build/StarcoinFramework/source_maps/OnChainConfigDao.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Oracle.mvsm b/build/StarcoinFramework/source_maps/Oracle.mvsm
index 5723aa3c..a620282d 100644
Binary files a/build/StarcoinFramework/source_maps/Oracle.mvsm and b/build/StarcoinFramework/source_maps/Oracle.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm b/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm
index 17c79436..ac4f936c 100644
Binary files a/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm and b/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/PriceOracle.mvsm b/build/StarcoinFramework/source_maps/PriceOracle.mvsm
index 73871f2f..1b14ce86 100644
Binary files a/build/StarcoinFramework/source_maps/PriceOracle.mvsm and b/build/StarcoinFramework/source_maps/PriceOracle.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/PriceOracleAggregator.mvsm b/build/StarcoinFramework/source_maps/PriceOracleAggregator.mvsm
index f892dfdc..39ed8375 100644
Binary files a/build/StarcoinFramework/source_maps/PriceOracleAggregator.mvsm and b/build/StarcoinFramework/source_maps/PriceOracleAggregator.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/PriceOracleScripts.mvsm b/build/StarcoinFramework/source_maps/PriceOracleScripts.mvsm
index 59a0413c..99f2e901 100644
Binary files a/build/StarcoinFramework/source_maps/PriceOracleScripts.mvsm and b/build/StarcoinFramework/source_maps/PriceOracleScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Ring.mvsm b/build/StarcoinFramework/source_maps/Ring.mvsm
deleted file mode 100644
index 1247e5ea..00000000
Binary files a/build/StarcoinFramework/source_maps/Ring.mvsm and /dev/null differ
diff --git a/build/StarcoinFramework/source_maps/STC.mvsm b/build/StarcoinFramework/source_maps/STC.mvsm
index f0bfaeec..9689fa7c 100644
Binary files a/build/StarcoinFramework/source_maps/STC.mvsm and b/build/StarcoinFramework/source_maps/STC.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/STCUSDOracle.mvsm b/build/StarcoinFramework/source_maps/STCUSDOracle.mvsm
index a1ef79bc..79d87d40 100644
Binary files a/build/StarcoinFramework/source_maps/STCUSDOracle.mvsm and b/build/StarcoinFramework/source_maps/STCUSDOracle.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Signature.mvsm b/build/StarcoinFramework/source_maps/Signature.mvsm
index b2b491f2..8ee4a28c 100644
Binary files a/build/StarcoinFramework/source_maps/Signature.mvsm and b/build/StarcoinFramework/source_maps/Signature.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/SignedInteger64.mvsm b/build/StarcoinFramework/source_maps/SignedInteger64.mvsm
index 1c9f9d8b..61f62596 100644
Binary files a/build/StarcoinFramework/source_maps/SignedInteger64.mvsm and b/build/StarcoinFramework/source_maps/SignedInteger64.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/StarcoinVerifier.mvsm b/build/StarcoinFramework/source_maps/StarcoinVerifier.mvsm
deleted file mode 100644
index 06917792..00000000
Binary files a/build/StarcoinFramework/source_maps/StarcoinVerifier.mvsm and /dev/null differ
diff --git a/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm b/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm
index a81d3d60..99d1ab52 100644
Binary files a/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm and b/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/StructuredHash.mvsm b/build/StarcoinFramework/source_maps/StructuredHash.mvsm
deleted file mode 100644
index a60c3dc6..00000000
Binary files a/build/StarcoinFramework/source_maps/StructuredHash.mvsm and /dev/null differ
diff --git a/build/StarcoinFramework/source_maps/Token.mvsm b/build/StarcoinFramework/source_maps/Token.mvsm
index cfb8ab7d..17143847 100644
Binary files a/build/StarcoinFramework/source_maps/Token.mvsm and b/build/StarcoinFramework/source_maps/Token.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/TransactionManager.mvsm b/build/StarcoinFramework/source_maps/TransactionManager.mvsm
index 25092a0c..58d95853 100644
Binary files a/build/StarcoinFramework/source_maps/TransactionManager.mvsm and b/build/StarcoinFramework/source_maps/TransactionManager.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/TreasuryWithdrawDaoProposal.mvsm b/build/StarcoinFramework/source_maps/TreasuryWithdrawDaoProposal.mvsm
index 84561dc8..697914b5 100644
Binary files a/build/StarcoinFramework/source_maps/TreasuryWithdrawDaoProposal.mvsm and b/build/StarcoinFramework/source_maps/TreasuryWithdrawDaoProposal.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/U256.mvsm b/build/StarcoinFramework/source_maps/U256.mvsm
index 78433b97..b552ee0e 100644
Binary files a/build/StarcoinFramework/source_maps/U256.mvsm and b/build/StarcoinFramework/source_maps/U256.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/UpgradeModuleDaoProposal.mvsm b/build/StarcoinFramework/source_maps/UpgradeModuleDaoProposal.mvsm
index 695f18f2..bdfc2b8a 100644
Binary files a/build/StarcoinFramework/source_maps/UpgradeModuleDaoProposal.mvsm and b/build/StarcoinFramework/source_maps/UpgradeModuleDaoProposal.mvsm differ
diff --git a/deprecated/integration-tests/dao/test_dao_failure.exp b/deprecated/integration-tests/dao/test_dao_failure.exp
deleted file mode 100644
index 2c5fcfe3..00000000
--- a/deprecated/integration-tests/dao/test_dao_failure.exp
+++ /dev/null
@@ -1,384 +0,0 @@
-processed 43 tasks
-
-task 5 'run'. lines 12-29:
-{
- "gas_used": 313160,
- "status": "Executed"
-}
-
-task 6 'run'. lines 31-41:
-{
- "gas_used": 12417,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "ModifyDaoConfigProposal"
- }
- },
- "abort_code": "102919"
- }
- }
-}
-
-task 7 'run'. lines 44-54:
-{
- "gas_used": 162267,
- "status": "Executed"
-}
-
-task 8 'run'. lines 58-68:
-{
- "gas_used": 162267,
- "status": "Executed"
-}
-
-task 9 'run'. lines 71-81:
-{
- "gas_used": 125294,
- "status": {
- "ExecutionFailure": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "function": 18,
- "code_offset": 45
- }
- }
-}
-
-task 11 'run'. lines 86-104:
-{
- "gas_used": 148929,
- "status": "Executed"
-}
-
-task 12 'run'. lines 107-127:
-{
- "gas_used": 162344,
- "status": "Executed"
-}
-
-task 13 'run'. lines 131-155:
-{
- "gas_used": 149577,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360449"
- }
- }
-}
-
-task 14 'run'. lines 158-176:
-{
- "gas_used": 94115,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360967"
- }
- }
-}
-
-task 15 'run'. lines 179-197:
-{
- "gas_used": 76714,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359431"
- }
- }
-}
-
-task 16 'run'. lines 200-218:
-{
- "gas_used": 59161,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359687"
- }
- }
-}
-
-task 17 'run'. lines 221-239:
-{
- "gas_used": 41374,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359431"
- }
- }
-}
-
-task 18 'run'. lines 242-255:
-{
- "gas_used": 32131,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359687"
- }
- }
-}
-
-task 19 'run'. lines 258-271:
-{
- "gas_used": 33839,
- "status": "Executed"
-}
-
-task 20 'run'. lines 274-287:
-{
- "gas_used": 15108,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359431"
- }
- }
-}
-
-task 21 'run'. lines 290-304:
-{
- "gas_used": 29499,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359169"
- }
- }
-}
-
-task 23 'run'. lines 309-324:
-{
- "gas_used": 37415,
- "status": "Executed"
-}
-
-task 24 'run'. lines 327-341:
-{
- "gas_used": 36805,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359682"
- }
- }
-}
-
-task 25 'run'. lines 344-364:
-{
- "gas_used": 102595,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359169"
- }
- }
-}
-
-task 26 'run'. lines 367-381:
-{
- "gas_used": 40995,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359169"
- }
- }
-}
-
-task 27 'run'. lines 384-402:
-{
- "gas_used": 53206,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359169"
- }
- }
-}
-
-task 28 'run'. lines 406-424:
-{
- "gas_used": 69415,
- "status": "Executed"
-}
-
-task 30 'run'. lines 430-452:
-{
- "gas_used": 163394,
- "status": "Executed"
-}
-
-task 32 'run'. lines 456-470:
-{
- "gas_used": 76680,
- "status": "Executed"
-}
-
-task 33 'run'. lines 473-488:
-{
- "gas_used": 39375,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359169"
- }
- }
-}
-
-task 34 'run'. lines 491-505:
-{
- "gas_used": 74710,
- "status": "Executed"
-}
-
-task 35 'run'. lines 508-519:
-{
- "gas_used": 162267,
- "status": "Executed"
-}
-
-task 37 'run'. lines 525-545:
-{
- "gas_used": 108170,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360967"
- }
- }
-}
-
-task 38 'run'. lines 548-566:
-{
- "gas_used": 59295,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360967"
- }
- }
-}
-
-task 39 'run'. lines 570-583:
-{
- "gas_used": 32279,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360967"
- }
- }
-}
-
-task 40 'run'. lines 586-606:
-{
- "gas_used": 162344,
- "status": "Executed"
-}
-
-task 42 'run'. lines 612-630:
-{
- "gas_used": 51131,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360967"
- }
- }
-}
diff --git a/deprecated/integration-tests/on_chain_config/test_onchain_config_dao.exp b/deprecated/integration-tests/on_chain_config/test_onchain_config_dao.exp
deleted file mode 100644
index dd472f39..00000000
--- a/deprecated/integration-tests/on_chain_config/test_onchain_config_dao.exp
+++ /dev/null
@@ -1,58 +0,0 @@
-processed 14 tasks
-
-task 4 'run'. lines 10-21:
-{
- "gas_used": 216046,
- "status": "Executed"
-}
-
-task 5 'run'. lines 22-31:
-{
- "gas_used": 21947,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "OnChainConfigDao"
- }
- },
- "abort_code": "102658"
- }
- }
-}
-
-task 6 'run'. lines 32-42:
-{
- "gas_used": 161955,
- "status": "Executed"
-}
-
-task 8 'run'. lines 47-60:
-{
- "gas_used": 148289,
- "status": "Executed"
-}
-
-task 11 'run'. lines 67-87:
-{
- "gas_used": 157265,
- "status": "Executed"
-}
-
-task 13 'run'. lines 92-106:
-{
- "gas_used": 68033,
- "status": {
- "ExecutionFailure": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "OnChainConfigDao"
- }
- },
- "function": 1,
- "code_offset": 6
- }
- }
-}
diff --git a/deprecated/integration-tests/token/init_stc.exp b/deprecated/integration-tests/token/init_stc.exp
deleted file mode 100644
index dbedd327..00000000
--- a/deprecated/integration-tests/token/init_stc.exp
+++ /dev/null
@@ -1,34 +0,0 @@
-processed 5 tasks
-
-task 3 'run'. lines 7-16:
-{
- "gas_used": 34612,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Token"
- }
- },
- "abort_code": "25858"
- }
- }
-}
-
-task 4 'run'. lines 20-30:
-{
- "gas_used": 80642,
- "status": {
- "ExecutionFailure": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Token"
- }
- },
- "function": 21,
- "code_offset": 42
- }
- }
-}
diff --git a/deprecated/integration-tests/transaction_scripts/execute_on_chain_config_proposal.exp b/deprecated/integration-tests/transaction_scripts/execute_on_chain_config_proposal.exp
deleted file mode 100644
index d8b6aa50..00000000
--- a/deprecated/integration-tests/transaction_scripts/execute_on_chain_config_proposal.exp
+++ /dev/null
@@ -1,42 +0,0 @@
-processed 12 tasks
-
-task 4 'run'. lines 10-20:
-{
- "gas_used": 168481,
- "status": "Executed"
-}
-
-task 6 'run'. lines 23-43:
-{
- "gas_used": 153230,
- "status": "Executed"
-}
-
-task 8 'run'. lines 48-64:
-{
- "gas_used": 40133,
- "status": "Executed"
-}
-
-task 9 'run'. lines 66-83:
-{
- "gas_used": 89072,
- "status": "Executed"
-}
-
-task 11 'run'. lines 87-100:
-{
- "gas_used": 54480,
- "status": {
- "ExecutionFailure": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "OnChainConfigDao"
- }
- },
- "function": 1,
- "code_offset": 6
- }
- }
-}
diff --git a/integration-tests/account/basic.exp b/integration-tests/account/basic.exp
index 7a886797..036af33e 100644
--- a/integration-tests/account/basic.exp
+++ b/integration-tests/account/basic.exp
@@ -3,21 +3,25 @@ processed 14 tasks
task 5 'run'. lines 30-41:
{
"gas_used": 139240,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 44-55:
{
"gas_used": 43065,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "26119"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 26119
+ ]
}
}
}
@@ -26,14 +30,16 @@ task 7 'run'. lines 58-74:
{
"gas_used": 58850,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "26369"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 26369
+ ]
}
}
}
@@ -41,35 +47,47 @@ task 7 'run'. lines 58-74:
task 8 'run'. lines 76-95:
{
"gas_used": 129486,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 98-110:
{
"gas_used": 154312,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 10 'run'. lines 112-121:
{
"gas_used": 11474,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 11 'run'. lines 123-135:
{
"gas_used": 396842,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 12 'run'. lines 138-147:
{
"gas_used": 20214,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 13 'run'. lines 150-159:
{
"gas_used": 52949,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/account/delegate_account.exp b/integration-tests/account/delegate_account.exp
index 55b9b9d3..8b42863a 100644
--- a/integration-tests/account/delegate_account.exp
+++ b/integration-tests/account/delegate_account.exp
@@ -2,12 +2,16 @@ processed 7 tasks
task 5 'run'. lines 27-44:
{
- "gas_used": 638014,
- "status": "Executed"
+ "gas_used": 618395,
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 47-62:
{
"gas_used": 139958,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/account/delegate_account_retry.exp b/integration-tests/account/delegate_account_retry.exp
deleted file mode 100644
index 95d7c98c..00000000
--- a/integration-tests/account/delegate_account_retry.exp
+++ /dev/null
@@ -1,7 +0,0 @@
-processed 3 tasks
-
-task 2 'run'. lines 5-26:
-{
- "gas_used": 13887841,
- "status": "Executed"
-}
diff --git a/integration-tests/account/delegate_account_retry.move b/integration-tests/account/delegate_account_retry.move
deleted file mode 100644
index 4fdaa1e3..00000000
--- a/integration-tests/account/delegate_account_retry.move
+++ /dev/null
@@ -1,27 +0,0 @@
-//# init -n dev
-
-//# faucet --addr alice --amount 2000000000
-
-//# run --signers alice
-
-script {
- use StarcoinFramework::Account;
-
- fun main(sender: signer) {
- let (_new_address, signer_cap) = Account::create_delegate_account(&sender);
- let new_account_signer = Account::create_signer_with_cap(&signer_cap);
-
- let (address_0, cap_0) = Account::create_delegate_account(&new_account_signer);
- let i = 1;
- while(i < 10){
- let (address_i, cap_i) = Account::create_delegate_account(&new_account_signer);
- assert!(address_0 != address_i, 1000);
- Account::destroy_signer_cap(cap_i);
- i = i + 1;
- };
- Account::destroy_signer_cap(cap_0);
- Account::destroy_signer_cap(signer_cap);
- }
-}
-// check: EXECUTED
-
diff --git a/integration-tests/account/deposit_zero_token.exp b/integration-tests/account/deposit_zero_token.exp
index a61232ce..3399f631 100644
--- a/integration-tests/account/deposit_zero_token.exp
+++ b/integration-tests/account/deposit_zero_token.exp
@@ -3,11 +3,15 @@ processed 4 tasks
task 2 'run'. lines 6-16:
{
"gas_used": 45962,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 3 'run'. lines 19-30:
{
"gas_used": 31287,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/account/remove_zero_balance.exp b/integration-tests/account/remove_zero_balance.exp
index 37e4e01c..ca19e51e 100644
--- a/integration-tests/account/remove_zero_balance.exp
+++ b/integration-tests/account/remove_zero_balance.exp
@@ -3,21 +3,25 @@ processed 4 tasks
task 2 'run'. lines 5-17:
{
"gas_used": 92550,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 3 'run'. lines 19-30:
{
"gas_used": 146733,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Token"
- }
- },
- "abort_code": "4097"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Token"
+ }
+ },
+ 4097
+ ]
}
}
}
diff --git a/integration-tests/account/txn_prologue_and_epilogue.exp b/integration-tests/account/txn_prologue_and_epilogue.exp
index 96cdc291..0ef2bb54 100644
--- a/integration-tests/account/txn_prologue_and_epilogue.exp
+++ b/integration-tests/account/txn_prologue_and_epilogue.exp
@@ -1,153 +1,143 @@
-processed 15 tasks
+processed 12 tasks
-task 3 'run'. lines 7-28:
+task 3 'run'. lines 8-23:
{
- "gas_used": 621301,
- "status": "Executed"
+ "gas_used": 494124,
+ "status": {
+ "Keep": "Executed"
+ }
}
-task 4 'run'. lines 30-62:
+task 4 'run'. lines 27-59:
{
- "gas_used": 180803,
+ "gas_used": 174759,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "CoreAddresses"
- }
- },
- "abort_code": "2818"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "CoreAddresses"
+ }
+ },
+ 2818
+ ]
}
}
}
-task 5 'run'. lines 66-92:
+task 5 'run'. lines 63-90:
{
- "gas_used": 330588,
+ "gas_used": 329083,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "1031"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 1031
+ ]
}
}
}
-task 6 'run'. lines 96-124:
+task 6 'run'. lines 94-122:
{
- "gas_used": 306856,
+ "gas_used": 300870,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "263"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 263
+ ]
}
}
}
-task 7 'run'. lines 128-158:
+task 7 'run'. lines 126-156:
{
- "gas_used": 355103,
+ "gas_used": 335601,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "775"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 775
+ ]
}
}
}
-task 8 'run'. lines 162-207:
-{
- "gas_used": 478362,
- "status": "Executed"
-}
-
-task 9 'run'. lines 211-241:
+task 8 'run'. lines 160-205:
{
- "gas_used": 354973,
+ "gas_used": 403810,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "519"
- }
+ "Keep": "Executed"
}
}
-task 10 'run'. lines 245-276:
+task 9 'run'. lines 209-239:
{
- "gas_used": 197287,
+ "gas_used": 335471,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "2568"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 519
+ ]
}
}
}
-task 11 'run'. lines 280-311:
+task 10 'run'. lines 243-274:
{
- "gas_used": 175186,
+ "gas_used": 180123,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "CoreAddresses"
- }
- },
- "abort_code": "2818"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 2568
+ ]
}
}
}
-task 12 'run'. lines 313-349:
+task 11 'run'. lines 278-309:
{
- "gas_used": 359119,
+ "gas_used": 174016,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "1031"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "CoreAddresses"
+ }
+ },
+ 2818
+ ]
}
}
}
-
-task 13 'run'. lines 351-401:
-{
- "gas_used": 517887,
- "status": "Executed"
-}
-
-task 14 'run'. lines 404-427:
-{
- "gas_used": 37463,
- "status": "Executed"
-}
diff --git a/integration-tests/account/txn_prologue_and_epilogue.move b/integration-tests/account/txn_prologue_and_epilogue.move
index 0dd194e8..ddb27004 100644
--- a/integration-tests/account/txn_prologue_and_epilogue.move
+++ b/integration-tests/account/txn_prologue_and_epilogue.move
@@ -1,8 +1,9 @@
//# init -n dev
+//# faucet --addr alice --amount 10000000
+
//# faucet --addr Genesis
-//# faucet --addr alice --amount 10000000
//# run --signers alice
// create txn sender account
@@ -10,8 +11,6 @@ script {
use StarcoinFramework::STC::STC;
use StarcoinFramework::Account;
use StarcoinFramework::Authenticator;
- use StarcoinFramework::DummyToken;
- use StarcoinFramework::DummyToken::DummyToken;
fun main(account: signer) {
let txn_public_key = x"c48b687a1dd8265101b33df6ae0b6825234e3f28df9ecb38fb286cf76dae919d";
@@ -19,14 +18,12 @@ script {
let address = Authenticator::derived_address(auth_key_vec);
Account::create_account_with_address(address);
Account::pay_from(&account, address, 5000);
- let coin = DummyToken::mint(&account, 500);
- Account::deposit(address, coin);
- assert!(Account::balance(address) == 500, 1000);
-
}
}
// check: EXECUTED
+
+
//# run --signers alice
// prologue sender is not genesis
script {
@@ -79,6 +76,7 @@ script {
let txn_sequence_number = 0;
let txn_gas_price = 1;
let txn_max_gas_units = 10000; //EPROLOGUE_CANT_PAY_GAS_DEPOSIT
+
Account::txn_prologue(
&account,
txn_sender,
@@ -308,120 +306,4 @@ script {
);
}
}
-// check: "Keep(ABORTED { code: 2818"
-
-//# run --signers Genesis
-// epilouge cant pay gas deposit
-
-script {
- use StarcoinFramework::Account;
- use StarcoinFramework::Authenticator;
- use StarcoinFramework::Vector;
- use StarcoinFramework::DummyToken::DummyToken;
-
- fun main(account: signer) {
- let txn_public_key = x"c48b687a1dd8265101b33df6ae0b6825234e3f28df9ecb38fb286cf76dae919d";
- let auth_key_vec = Authenticator::ed25519_authentication_key(copy txn_public_key);
- let txn_sender = Authenticator::derived_address(copy auth_key_vec);
- Vector::push_back(&mut txn_public_key, 0u8); //create preimage
-
- let seq = Account::sequence_number(txn_sender);
- assert!(seq == 1, 1005);
-
- let txn_sequence_number = 1;
- let txn_gas_price = 1;
- let txn_max_gas_units = 2510;
- Account::do_accept_token(&account);
-
- Account::txn_prologue_v2(
- &account,
- txn_sender,
- txn_sequence_number,
- txn_public_key,
- txn_gas_price,
- txn_max_gas_units,
- 2,
- 10,
- );
- }
-
-}
-// check: "Keep(ABORTED { code: 1031"
-
-//# run --signers Genesis
-// successfully executed
-script {
- use StarcoinFramework::Account;
- use StarcoinFramework::Authenticator;
- use StarcoinFramework::Vector;
- use StarcoinFramework::DummyToken::DummyToken;
-
- fun main(account: signer) {
- let txn_public_key = x"c48b687a1dd8265101b33df6ae0b6825234e3f28df9ecb38fb286cf76dae919d";
- let auth_key_vec = Authenticator::ed25519_authentication_key(copy txn_public_key);
- let txn_sender = Authenticator::derived_address(copy auth_key_vec);
- Vector::push_back(&mut txn_public_key, 0u8); //create preimage
-
- let seq = Account::sequence_number(txn_sender);
- assert!(seq == 1, 1005);
-
- let txn_sequence_number = 1;
- let txn_gas_price = 1;
- let txn_max_gas_units = 2500;
- Account::do_accept_token(&account);
-
- Account::txn_prologue_v2(
- &account,
- txn_sender,
- txn_sequence_number,
- txn_public_key,
- txn_gas_price,
- txn_max_gas_units,
- 2,
- 10,
- );
- // execute the txn...
- let gas_units_remaining = 10;
- Account::txn_epilogue_v3(
- &account,
- txn_sender,
- txn_sequence_number,
- Vector::empty(),
- txn_gas_price,
- txn_max_gas_units,
- gas_units_remaining,
- 2,
- 10,
- );
- let seq = Account::sequence_number(txn_sender);
- assert!(seq == 2, 1006);
- }
-
-}
-// check: EXECUTED
-
-
-//# run --signers Genesis
-script {
- use StarcoinFramework::Account;
-
- fun main(_account: signer){
- let (txn_gas_price, txn_max_gas_units, gas_units_remaining,
- stc_price, stc_price_scaling
- ) = (1, 100000, 0, 43793, 1000000000000000);
- let (stc_amount, token_amount) = Account::transaction_fee_simulate(txn_gas_price, txn_max_gas_units, gas_units_remaining,
- stc_price, stc_price_scaling);
- assert!(stc_amount==100000, 100);
- assert!(token_amount==1, 101);
-
- let (txn_gas_price, txn_max_gas_units, gas_units_remaining,
- stc_price, stc_price_scaling
- ) = (1000000, 100000, 0, 43793, 1000000000000000);
- let (stc_amount, token_amount) = Account::transaction_fee_simulate(txn_gas_price, txn_max_gas_units, gas_units_remaining,
- stc_price, stc_price_scaling);
- assert!(stc_amount==100000000000, 102);
- assert!(token_amount==4, 103);
-
- }
-}
-// check: EXECUTED
+// check: "Keep(ABORTED { code: 2818"
\ No newline at end of file
diff --git a/integration-tests/account/withdraw_capability.exp b/integration-tests/account/withdraw_capability.exp
index 639e8c7c..be6f17f9 100644
--- a/integration-tests/account/withdraw_capability.exp
+++ b/integration-tests/account/withdraw_capability.exp
@@ -3,21 +3,25 @@ processed 12 tasks
task 5 'run'. lines 25-38:
{
"gas_used": 60573,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 41-55:
{
"gas_used": 25450,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "25857"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 25857
+ ]
}
}
}
@@ -26,14 +30,16 @@ task 7 'run'. lines 58-73:
{
"gas_used": 25450,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Account"
- }
- },
- "abort_code": "25857"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Account"
+ }
+ },
+ 25857
+ ]
}
}
}
@@ -41,23 +47,31 @@ task 7 'run'. lines 58-73:
task 8 'run'. lines 76-88:
{
"gas_used": 139240,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 91-103:
{
"gas_used": 158256,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 10 'run'. lines 106-117:
{
"gas_used": 96005,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 11 'run'. lines 120-132:
{
"gas_used": 146440,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/account/withdraw_zero_token.exp b/integration-tests/account/withdraw_zero_token.exp
index fdd4ff3c..dd7fecb9 100644
--- a/integration-tests/account/withdraw_zero_token.exp
+++ b/integration-tests/account/withdraw_zero_token.exp
@@ -3,5 +3,7 @@ processed 3 tasks
task 2 'run'. lines 6-16:
{
"gas_used": 35928,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/authenticator/authenticator.exp b/integration-tests/authenticator/authenticator.exp
index 5a9c4861..adb13f22 100644
--- a/integration-tests/authenticator/authenticator.exp
+++ b/integration-tests/authenticator/authenticator.exp
@@ -3,21 +3,25 @@ processed 11 tasks
task 2 'run'. lines 6-50:
{
"gas_used": 447187,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 3 'run'. lines 52-67:
{
"gas_used": 14893,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Authenticator"
- }
- },
- "abort_code": "26119"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Authenticator"
+ }
+ },
+ 26119
+ ]
}
}
}
@@ -26,14 +30,16 @@ task 4 'run'. lines 69-84:
{
"gas_used": 14964,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Authenticator"
- }
- },
- "abort_code": "26375"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Authenticator"
+ }
+ },
+ 26375
+ ]
}
}
}
@@ -42,14 +48,16 @@ task 5 'run'. lines 86-106:
{
"gas_used": 100057,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Authenticator"
- }
- },
- "abort_code": "26631"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Authenticator"
+ }
+ },
+ 26631
+ ]
}
}
}
@@ -58,14 +66,16 @@ task 6 'run'. lines 109-128:
{
"gas_used": 19157,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Authenticator"
- }
- },
- "abort_code": "26375"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Authenticator"
+ }
+ },
+ 26375
+ ]
}
}
}
@@ -74,14 +84,16 @@ task 7 'run'. lines 131-150:
{
"gas_used": 19086,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Authenticator"
- }
- },
- "abort_code": "26119"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Authenticator"
+ }
+ },
+ 26119
+ ]
}
}
}
@@ -89,27 +101,33 @@ task 7 'run'. lines 131-150:
task 8 'run'. lines 153-182:
{
"gas_used": 75325,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 184-196:
{
"gas_used": 396842,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 10 'run'. lines 198-206:
{
"gas_used": 11900,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Authenticator"
- }
- },
- "abort_code": "25863"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Authenticator"
+ }
+ },
+ 25863
+ ]
}
}
}
diff --git a/integration-tests/bitwise/operators.exp b/integration-tests/bitwise/operators.exp
index d7d6efa3..0ce45086 100644
--- a/integration-tests/bitwise/operators.exp
+++ b/integration-tests/bitwise/operators.exp
@@ -3,11 +3,15 @@ processed 4 tasks
task 2 'run'. lines 6-26:
{
"gas_used": 65599,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 3 'run'. lines 28-43:
{
"gas_used": 33510,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/block/block_checkpoints.exp b/integration-tests/block/block_checkpoints.exp
deleted file mode 100644
index 4ffca21f..00000000
--- a/integration-tests/block/block_checkpoints.exp
+++ /dev/null
@@ -1,25 +0,0 @@
-processed 7 tasks
-
-task 3 'run'. lines 157-166:
-{
- "gas_used": 442844,
- "status": "Executed"
-}
-
-task 4 'run'. lines 168-179:
-{
- "gas_used": 73780,
- "status": "Executed"
-}
-
-task 5 'run'. lines 182-192:
-{
- "gas_used": 565771,
- "status": "Executed"
-}
-
-task 6 'run'. lines 194-205:
-{
- "gas_used": 95873,
- "status": "Executed"
-}
diff --git a/integration-tests/block/block_checkpoints.move b/integration-tests/block/block_checkpoints.move
deleted file mode 100644
index 1fe0810a..00000000
--- a/integration-tests/block/block_checkpoints.move
+++ /dev/null
@@ -1,205 +0,0 @@
-//# init -n dev
-
-//# faucet --addr alice
-
-//# publish
-module alice::Block_test{
- use StarcoinFramework::Errors;
- use StarcoinFramework::Vector;
- use StarcoinFramework::Option;
- use StarcoinFramework::Ring;
- use StarcoinFramework::BCS;
- use StarcoinFramework::Hash;
-
- struct Checkpoint has copy,drop,store{
- //number of the block
- block_number: u64,
- //Hash of the block
- block_hash: vector,
- //State root of the block
- state_root: Option::Option>,
- }
- const EBLOCK_NUMBER_MISMATCH : u64 = 17;
- const ERROR_NO_HAVE_CHECKPOINT: u64 = 18;
- const ERROR_NOT_BLOCK_HEADER : u64 = 19;
- const ERROR_INTERVAL_TOO_LITTLE: u64 = 20;
- const ERR_ALREADY_INITIALIZED : u64 = 21;
-
- const CHECKPOINT_LENGTH : u64 = 60;
- const BLOCK_HEADER_LENGTH : u64 = 247;
- const BLOCK_INTERVAL_NUMBER : u64 = 5;
- //
- struct Checkpoints has key,store{
- //all checkpoints
- checkpoints : Ring::Ring,
- index : u64,
- last_number : u64,
- }
- public fun checkpoints_init(account:&signer){
- assert!(!exists(@alice), Errors::already_published(ERR_ALREADY_INITIALIZED));
-
- let checkpoints = Ring::create_with_capacity(CHECKPOINT_LENGTH);
- move_to(
- account,
- Checkpoints {
- checkpoints : checkpoints,
- index : 0,
- last_number : 0,
- });
- }
-
- public fun checkpoint(parent_block_number:u64,parent_block_hash:vector) acquires Checkpoints{
- let checkpoints = borrow_global_mut(@alice);
- base_checkpoint(checkpoints, parent_block_number, parent_block_hash);
-
- }
-
- fun base_checkpoint(checkpoints: &mut Checkpoints, parent_block_number: u64, parent_block_hash:vector){
- assert!(checkpoints.last_number + BLOCK_INTERVAL_NUMBER <= parent_block_number || checkpoints.last_number == 0, Errors::invalid_argument(ERROR_INTERVAL_TOO_LITTLE));
-
- checkpoints.index = checkpoints.index + 1;
- checkpoints.last_number = parent_block_number;
- let op_checkpoint = Ring::push(&mut checkpoints.checkpoints, Checkpoint {
- block_number: parent_block_number,
- block_hash: parent_block_hash,
- state_root: Option::none>(),
- } );
- if(Option::is_some(&op_checkpoint)){
- Option::destroy_some(op_checkpoint);
- }else{
- Option::destroy_none(op_checkpoint);
- }
- }
-
- public fun latest_state_root():(u64,vector) acquires Checkpoints{
- let checkpoints = borrow_global(@alice);
- base_latest_state_root(checkpoints)
- }
-
- fun base_latest_state_root(checkpoints: &Checkpoints):(u64,vector){
- let len = Ring::capacity(&checkpoints.checkpoints);
- let j = if(checkpoints.index < len - 1){
- checkpoints.index
- }else{
- len
- };
- let i = checkpoints.index;
- while( j > 0){
- let op_checkpoint = Ring::borrow(&checkpoints.checkpoints, i - 1 );
- if( Option::is_some(op_checkpoint) && Option::is_some(&Option::borrow(op_checkpoint).state_root) ) {
- let state_root = Option::borrow(&Option::borrow(op_checkpoint).state_root);
- return (Option::borrow(op_checkpoint).block_number, *state_root)
- };
- j = j - 1;
- i = i - 1;
- };
-
- abort Errors::invalid_state(ERROR_NO_HAVE_CHECKPOINT)
- }
-
- public fun update_state_root(header: vector)acquires Checkpoints {
- let checkpoints = borrow_global_mut(@alice);
- base_update_state_root(checkpoints, header);
- }
-
-
- fun base_update_state_root(checkpoints: &mut Checkpoints, header: vector){
- let prefix = Hash::sha3_256(b"STARCOIN::BlockHeader");
-
- //parent_hash
- let new_offset = BCS::skip_bytes(&header,0);
- //timestamp
- let new_offset = BCS::skip_u64(&header,new_offset);
- //number
- let (number,new_offset) = BCS::deserialize_u64(&header,new_offset);
- //author
- new_offset = BCS::skip_address(&header,new_offset);
- //author_auth_key
- new_offset = BCS::skip_option_bytes(&header,new_offset);
- //txn_accumulator_root
- new_offset = BCS::skip_bytes(&header,new_offset);
- //block_accumulator_root
- new_offset = BCS::skip_bytes(&header,new_offset);
- //state_root
- let (state_root,_new_offset) = BCS::deserialize_bytes(&header,new_offset);
-
- Vector::append(&mut prefix,header);
- let block_hash = Hash::sha3_256(prefix);
-
- let len = Ring::capacity(&checkpoints.checkpoints);
- let j = if(checkpoints.index < len - 1){
- checkpoints.index
- }else{
- len
- };
- let i = checkpoints.index;
- while( j > 0){
- let op_checkpoint = Ring::borrow_mut(&mut checkpoints.checkpoints, i - 1);
-
- if( Option::is_some(op_checkpoint) && &Option::borrow(op_checkpoint).block_hash == &block_hash && Option::borrow(op_checkpoint).block_number == number) {
-
- let op_state_root = &mut Option::borrow_mut(op_checkpoint).state_root;
- if(Option::is_some(op_state_root)){
- Option::swap(op_state_root, state_root);
- }else{
- Option::fill(op_state_root, state_root);
- };
- return
- };
- j = j - 1;
- i = i - 1;
- };
-
- abort ERROR_NO_HAVE_CHECKPOINT
- }
-}
-
-//# run --signers alice
-script {
- use alice::Block_test;
-
-
- fun init(account: signer) {
- Block_test::checkpoints_init(&account);
- }
-}
-// check: EXECUTED
-
-//# run --signers alice
-script {
- use alice::Block_test;
-
-
- fun init(_account: signer) {
- let number = 6677628;
- let hash = x"e1bfffa1218462207a9807562422ccb40e2a27a6e3f0834a39364efd1cafb84f";
- Block_test::checkpoint(number, hash);
- }
-}
-// check: EXECUTED
-
-
-//# run --signers alice
-script {
- use alice::Block_test;
-
-
- fun update(_account: signer) {
- let header = x"20f9ccf1b2d18066977f1285aa23dd63a39739f22237aa2973476ed3326055369935d2e0db810100007ce46500000000005555ad74ce032cae631e7c83796880290020c0251fee2b98b5af7148ab4bcb5e0d65172b4639730d36208bb12fcfb581c01220211bdc20127db53f9179f8d873c0111cd971f852b8cacff91e801e7d27f74e182021e83a4306b24ba553f5b7b69a44d349d18cc3b52308994486fa3e53f69bb2860000000000000000000000000000000000000000000000000000000000000000000000001205509820c01e0329de6d899348a8ef4bd51db56175b3fa0988e57c3dcec8eaf13a164d9701a109000d694e533f";
- Block_test::update_state_root(header);
- }
-}
-// check: EXECUTED
-
-//# run --signers alice
-script {
- use alice::Block_test;
-
-
- fun latest(_account: signer) {
- let (number ,state_root) = Block_test::latest_state_root();
- assert!(number == 6677628, 10000);
- assert!(state_root == x"21e83a4306b24ba553f5b7b69a44d349d18cc3b52308994486fa3e53f69bb286",10001);
- }
-}
-// check: EXECUTED
\ No newline at end of file
diff --git a/integration-tests/block/block_metadata.exp b/integration-tests/block/block_metadata.exp
index 1643c9e6..93954344 100644
--- a/integration-tests/block/block_metadata.exp
+++ b/integration-tests/block/block_metadata.exp
@@ -3,5 +3,7 @@ processed 3 tasks
task 2 'run'. lines 5-15:
{
"gas_used": 16339,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/block/checkpoints_test.exp b/integration-tests/block/checkpoints_test.exp
deleted file mode 100644
index 78de5d73..00000000
--- a/integration-tests/block/checkpoints_test.exp
+++ /dev/null
@@ -1,35 +0,0 @@
-processed 13 tasks
-
-task 4 'run'. lines 9-27:
-{
- "gas_used": 114532,
- "status": "Executed"
-}
-
-task 7 'run'. lines 33-46:
-{
- "gas_used": 532278,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Block"
- }
- },
- "abort_code": "4609"
- }
- }
-}
-
-task 10 'run'. lines 53-64:
-{
- "gas_used": 577624,
- "status": "Executed"
-}
-
-task 12 'run'. lines 68-81:
-{
- "gas_used": 103932,
- "status": "Executed"
-}
diff --git a/integration-tests/block/checkpoints_test.move b/integration-tests/block/checkpoints_test.move
deleted file mode 100644
index 40fb48ed..00000000
--- a/integration-tests/block/checkpoints_test.move
+++ /dev/null
@@ -1,81 +0,0 @@
-//# init -n dev --debug
-
-//# faucet --addr alice
-
-//# block --author=0x2 --timestamp 86420000
-
-//# call-api chain.info
-
-//# run --signers alice --args {{$.call-api[0].head.parent_hash}} --args {{$.call-api[0].head.state_root}}
-script {
- use StarcoinFramework::Block;
- use StarcoinFramework::Debug;
-
- fun checkpoint(_account: signer, parent_hash: vector, state_root: vector) {
- let expect_parent_hash = Block::get_parent_hash();
- Debug::print(&expect_parent_hash);
- Debug::print(&parent_hash);
- Debug::print(&state_root);
- assert!( expect_parent_hash == parent_hash, 1001);
-
- let current_block_number = Block::get_current_block_number();
- Debug::print(¤t_block_number);
-
- Block::checkpoint();
- }
-}
-// check: EXECUTED
-
-//# block --author=0x2 --timestamp 86430000
-
-//# call-api chain.get_block_by_hash ["{{$.call-api[0].head.block_hash}}",{"raw":true}]
-
-//# run --signers alice --args {{$.call-api[1].raw.header}}
-
-script {
- use StarcoinFramework::Block;
- use StarcoinFramework::Debug;
-
- fun update(_account: signer, raw_header: vector) {
- let current_block_number = Block::get_current_block_number();
- Debug::print(¤t_block_number);
- Debug::print(&raw_header);
- Block::update_state_root(raw_header);
- }
-}
-// check: ABORT. reason: Block from call-api[0] is not in checkpoint, its parent is in.
-
-
-//# block --author=0x3
-
-//# call-api chain.get_block_by_hash ["{{$.call-api[0].head.parent_hash}}",{"raw":true}]
-
-//# run --signers alice --args {{$.call-api[2].raw.header}}
-
-script {
- use StarcoinFramework::Block;
- use StarcoinFramework::Debug;
-
- fun update(_account: signer, raw_header: vector) {
- Debug::print(&raw_header);
- Block::update_state_root(raw_header);
- }
-}
-// check: EXECUTED
-
-//# call-api chain.get_block_by_hash ["{{$.call-api[0].head.parent_hash}}"]
-
-//# run --signers alice --args {{$.call-api[3].header.state_root}}
-script {
- use StarcoinFramework::Block;
- use StarcoinFramework::Debug;
-
- fun latest(_account: signer, expect_state_root: vector) {
- let (number, state_root) = Block::latest_state_root();
- Debug::print(&number);
- Debug::print(&state_root);
- Debug::print(&expect_state_root);
- assert!(state_root == expect_state_root, 1002)
- }
-}
-// check: EXECUTED
\ No newline at end of file
diff --git a/integration-tests/block_reward/basic.exp b/integration-tests/block_reward/basic.exp
index bfc13109..4c7a11a7 100644
--- a/integration-tests/block_reward/basic.exp
+++ b/integration-tests/block_reward/basic.exp
@@ -3,21 +3,25 @@ processed 12 tasks
task 3 'run'. lines 7-21:
{
"gas_used": 202807,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 4 'run'. lines 24-40:
{
"gas_used": 30790,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "CoreAddresses"
- }
- },
- "abort_code": "2818"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "CoreAddresses"
+ }
+ },
+ 2818
+ ]
}
}
}
@@ -25,21 +29,25 @@ task 4 'run'. lines 24-40:
task 5 'run'. lines 43-58:
{
"gas_used": 35600,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 61-76:
{
"gas_used": 36780,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "BlockReward"
- }
- },
- "abort_code": "26119"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "BlockReward"
+ }
+ },
+ 26119
+ ]
}
}
}
@@ -47,29 +55,39 @@ task 6 'run'. lines 61-76:
task 7 'run'. lines 80-96:
{
"gas_used": 597319,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 8 'run'. lines 99-115:
{
"gas_used": 473890,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 118-133:
{
"gas_used": 210007,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 10 'run'. lines 136-150:
{
"gas_used": 95714,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 11 'run'. lines 153-167:
{
"gas_used": 210007,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/chain_id/chain_id.exp b/integration-tests/chain_id/chain_id.exp
index 0356c570..14d94b0f 100644
--- a/integration-tests/chain_id/chain_id.exp
+++ b/integration-tests/chain_id/chain_id.exp
@@ -3,5 +3,7 @@ processed 3 tasks
task 2 'run'. lines 5-12:
{
"gas_used": 14559,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/check/delta_size_check.exp b/integration-tests/check/delta_size_check.exp
index 5883fa11..7dc1c863 100644
--- a/integration-tests/check/delta_size_check.exp
+++ b/integration-tests/check/delta_size_check.exp
@@ -3,11 +3,15 @@ processed 7 tasks
task 5 'run'. lines 42-54:
{
"gas_used": 17924,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 58-74:
{
"gas_used": 17842,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/check/gas_check.exp b/integration-tests/check/gas_check.exp
index 8b4bbae0..0c5cdddd 100644
--- a/integration-tests/check/gas_check.exp
+++ b/integration-tests/check/gas_check.exp
@@ -3,17 +3,16 @@ processed 5 tasks
task 2 'run'. lines 5-14:
{
"gas_used": 1000,
- "status": "OutOfGas"
+ "status": {
+ "Keep": "OutOfGas"
+ }
}
task 3 'run'. lines 17-26:
{
"gas_used": 0,
"status": {
- "Discard": {
- "status_code": "14",
- "status_code_name": "MAX_GAS_UNITS_BELOW_MIN_TRANSACTION_GAS_UNITS"
- }
+ "Discard": 14
}
}
@@ -21,9 +20,6 @@ task 4 'run'. lines 29-38:
{
"gas_used": 0,
"status": {
- "Discard": {
- "status_code": "13",
- "status_code_name": "MAX_GAS_UNITS_EXCEEDS_MAX_GAS_UNITS_BOUND"
- }
+ "Discard": 13
}
}
diff --git a/integration-tests/check/gas_used_out.exp b/integration-tests/check/gas_used_out.exp
index e15038ba..2865080b 100644
--- a/integration-tests/check/gas_used_out.exp
+++ b/integration-tests/check/gas_used_out.exp
@@ -3,11 +3,15 @@ processed 6 tasks
task 4 'run'. lines 9-30:
{
"gas_used": 700,
- "status": "OutOfGas"
+ "status": {
+ "Keep": "OutOfGas"
+ }
}
task 5 'run'. lines 33-44:
{
"gas_used": 24183,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/check/resource_move_to_or_from.exp b/integration-tests/check/resource_move_to_or_from.exp
index 749a5076..feb90c02 100644
--- a/integration-tests/check/resource_move_to_or_from.exp
+++ b/integration-tests/check/resource_move_to_or_from.exp
@@ -3,23 +3,31 @@ processed 8 tasks
task 4 'run'. lines 45-56:
{
"gas_used": 15813,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 5 'run'. lines 60-71:
{
"gas_used": 25462,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 75-88:
{
"gas_used": 32836,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 7 'run'. lines 91-104:
{
"gas_used": 27668,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/collection2/collection_add_by_other.exp b/integration-tests/collection2/collection_add_by_other.exp
index 3f97aa29..65e72977 100644
--- a/integration-tests/collection2/collection_add_by_other.exp
+++ b/integration-tests/collection2/collection_add_by_other.exp
@@ -3,33 +3,41 @@ processed 9 tasks
task 5 'run'. lines 33-42:
{
"gas_used": 24244,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 45-58:
{
"gas_used": 76259,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 7 'run'. lines 61-73:
{
"gas_used": 64099,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 8 'run'. lines 76-93:
{
"gas_used": 40545,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Collection2"
- }
- },
- "abort_code": "26370"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Collection2"
+ }
+ },
+ 26370
+ ]
}
}
}
diff --git a/integration-tests/collection2/collection_by_owner.exp b/integration-tests/collection2/collection_by_owner.exp
index 83fccdb8..bb68201f 100644
--- a/integration-tests/collection2/collection_by_owner.exp
+++ b/integration-tests/collection2/collection_by_owner.exp
@@ -3,45 +3,57 @@ processed 13 tasks
task 5 'run'. lines 29-42:
{
"gas_used": 104529,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 45-61:
{
"gas_used": 89785,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 7 'run'. lines 64-81:
{
"gas_used": 107654,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 8 'run'. lines 84-107:
{
"gas_used": 102649,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 110-124:
{
"gas_used": 79522,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 10 'run'. lines 127-142:
{
"gas_used": 40869,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Collection2"
- }
- },
- "abort_code": "26626"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Collection2"
+ }
+ },
+ 26626
+ ]
}
}
}
@@ -49,21 +61,25 @@ task 10 'run'. lines 127-142:
task 11 'run'. lines 146-170:
{
"gas_used": 164204,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 12 'run'. lines 173-188:
{
"gas_used": 21613,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Collection2"
- }
- },
- "abort_code": "25857"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Collection2"
+ }
+ },
+ 25857
+ ]
}
}
}
diff --git a/integration-tests/collection2/collection_mut_by_other.exp b/integration-tests/collection2/collection_mut_by_other.exp
index 7eb7b245..3ded5848 100644
--- a/integration-tests/collection2/collection_mut_by_other.exp
+++ b/integration-tests/collection2/collection_mut_by_other.exp
@@ -3,21 +3,25 @@ processed 10 tasks
task 5 'run'. lines 35-44:
{
"gas_used": 24244,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 47-63:
{
"gas_used": 43443,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Collection2"
- }
- },
- "abort_code": "26114"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Collection2"
+ }
+ },
+ 26114
+ ]
}
}
}
@@ -25,17 +29,23 @@ task 6 'run'. lines 47-63:
task 7 'run'. lines 66-79:
{
"gas_used": 69059,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 8 'run'. lines 82-95:
{
"gas_used": 77874,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 98-111:
{
"gas_used": 69522,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/compare/compare.exp b/integration-tests/compare/compare.exp
index 51489a97..4cfd3bd0 100644
--- a/integration-tests/compare/compare.exp
+++ b/integration-tests/compare/compare.exp
@@ -2,6 +2,8 @@ processed 3 tasks
task 2 'run'. lines 5-62:
{
- "gas_used": 1789891,
- "status": "Executed"
+ "gas_used": 2338303,
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/dao/VoteStrategy.exp b/integration-tests/dao/VoteStrategy.exp
deleted file mode 100644
index fc5a4436..00000000
--- a/integration-tests/dao/VoteStrategy.exp
+++ /dev/null
@@ -1 +0,0 @@
-processed 3 tasks
diff --git a/integration-tests/dao/VoteStrategy.move b/integration-tests/dao/VoteStrategy.move
deleted file mode 100644
index cfc6d475..00000000
--- a/integration-tests/dao/VoteStrategy.move
+++ /dev/null
@@ -1,365 +0,0 @@
-//# init -n dev
-
-//# faucet --addr default
-
-//# publish
-module default::VoteStrategy{
-// use StarcoinFramework::DAOSpace::{Self, ProposalPluginCapability};
- use StarcoinFramework::DAORegistry;
- use StarcoinFramework::BCS;
- use StarcoinFramework::Signer;
- #[test_only]
- use StarcoinFramework::Debug;
- use StarcoinFramework::Vector;
- use StarcoinFramework::Errors;
-
- const ERR_VOTING_STRATEGY_MAPPING_EXIST: u64 = 1411;
- const ERR_PRE_ORDER_TYPE_INVALID: u64 = 1413;
- const ERR_BCS_STATE_NTFS_LENGHT_TYPE_INVALID: u64 = 1414;
-
-
- struct VoteStrategyPluginCapability has key{
- }
-
- struct SBTStrategy has key {
- // https://stcscan.io/barnard/address/0x6bfb460477adf9dd0455d3de2fc7f211/resources
- // 0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMember<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>, 0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMemberBody<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>>
- // {"json":{"nft":{"vec":[{"base_meta":{"description":"0x","image":"0x","image_data":"0x69616d67655f64617461","name":"0x64616f313031"},"body":{"sbt":{"value":100}},"creator":"0x6bfb460477adf9dd0455d3de2fc7f211","id":1,"type_meta":{"id":1111}}]}},"raw":"0x016bfb460477adf9dd0455d3de2fc7f21101000000000000000664616f313031000a69616d67655f6461746100570400000000000064000000000000000000000000000000"}
-
- strategy_name: vector,
- // access_path: vector,
- // access_path_suffix = user_address + access_path_suffix
- access_path_suffix: vector, // /1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMember<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>, 0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMemberBody<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>>
- // state: vector,
- pre_order_types_vector: vector>, //sbt token deserialize pre order types vector in state bcs value
- weight_factor: u128, // How to abstract into a function ? default 1
- }
-
- // veSTAR value
- struct VeSTARStrategy has key {
- strategy_name: vector,
- // 0x6E9B83ADaA64f901048AE4bEAD8A1016/1/0x8c109349c6bd91411d6bc962e080c4a3::TokenSwapFarmBoost::UserInfo<0x00000000000000000000000000000001::STC::STC,0x8c109349c6bd91411d6bc962e080c4a3::STAR::STAR>
- // access_path: vector,
- // access_path_suffix = user_address + access_path_suffix
- access_path_suffix: vector, // /1/0x8c109349c6bd91411d6bc962e080c4a3::TokenSwapFarmBoost::UserInfo<0x00000000000000000000000000000001::STC::STC,0x8c109349c6bd91411d6bc962e080c4a3::STAR::STAR>
- // state: vector,
- pre_order_types_vector: vector>, //sbt token deserialize pre order types vector in state bcs value
- weight_factor: u128, // How to abstract into a function ? default 1
- }
-
- struct BalanceStrategy has key {
- // 0x8c109349c6bd91411d6bc962e080c4a3::TokenSwapFarmBoost::UserInfo<0x00000000000000000000000000000001::STC::STC, 0x8c109349c6bd91411d6bc962e080c4a3::STAR::STAR>
- //
- // {"json":{"boost_factor":250,"locked_vetoken":{"token":{"value":47945205478}},"user_amount":0},"raw":"0xfa00000000000000e6c6c1290b000000000000000000000000000000000000000000000000000000"}
-
- strategy_name: vector, //need by unique
-// 0x00000000000000000000000000000001::Account::Balance<0x8c109349c6bd91411d6bc962e080c4a3::STAR::STAR>
-// 0xcCF1ADEdf0Ba6f9BdB9A6905173A5d72/1/0x00000000000000000000000000000001::Account::Balance<0x8c109349c6bd91411d6bc962e080c4a3::STAR::STAR>
- // access_path_suffix = user_address + access_path_suffix
- access_path_suffix: vector, // /1/0x00000000000000000000000000000001::Account::Balance<0x8c109349c6bd91411d6bc962e080c4a3::STAR::STAR>
- // state: vector,
- pre_order_types_vector: vector>, //token balance deserialize pre order types vector in state bcs value
- weight_factor: u128, // How to abstract into a function ? default 1
- }
-
-
- // TODO extend to List to support multi stragegies for a DAO ?
- struct StrategyMapping has key {
- strategy_name: vector,
- access_path_suffix: vector, // /1/0x8c109349c6bd91411d6bc962e080c4a3::TokenSwapFarmBoost::UserInfo<0x00000000000000000000000000000001::STC::STC,0x8c109349c6bd91411d6bc962e080c4a3::STAR::STAR>
- offset: u64, //sbt token deserialize offset in state bcs value
- weight_factor: u128, // How to abstract into a function ? default 1
- }
-
- public fun install_vote_strategy_plugin(_cap: &VoteStrategyPluginCapability, installer: &signer, strategy_name: vector, access_path_suffix:vector, offset: u64, weight_factor: u128){
- //TODO get dao_singer cap
- let dao_signer = installer;
- let dao_addr = Signer::address_of(dao_signer);
- //TODO support multi stragegies for a DAO ?
- assert!(exists>(dao_addr), ERR_VOTING_STRATEGY_MAPPING_EXIST);
-
- //TODO check vote strategy template
-
- let strategy = StrategyMapping{
- strategy_name,
- access_path_suffix,
- offset,
- weight_factor,
- };
- move_to(dao_signer, strategy);
- }
-
- public fun uninstall_vote_strategy_plugin(_cap: &VoteStrategyPluginCapability, _uninstaller: &signer) acquires StrategyMapping {
-// let dao_addr = Signer::address_of(dao_signer);
- let dao_addr = DAORegistry::dao_address();
- let StrategyMapping {
- strategy_name: _,
- access_path_suffix: _,
- offset: _,
- weight_factor: _,
- } = move_from>(dao_addr);
- }
-
-
- public fun get_vote_strategy_plugin():(vector, vector, u64, u128) acquires StrategyMapping{
- let dao_addr = DAORegistry::dao_address();
- let strategy_mapping = borrow_global>(dao_addr);
- (*&strategy_mapping.strategy_name, *&strategy_mapping.access_path_suffix, strategy_mapping.offset, strategy_mapping.weight_factor)
- }
-
- /// read snapshot vote value from state
- public fun get_voting_power(_sender: address, _state_root: &vector, state: &vector) : u128 acquires StrategyMapping{
- //TODO how to verify state ?
-
- let dao_addr = DAORegistry::dao_address();
- let strategy_mapping = borrow_global>(dao_addr);
-
- //TODO check state with access_path_suffix ?
- let offset = strategy_mapping.offset;
-
- let (value, _) = BCS::deserialize_u128(state, offset);
-
- //TODO calculate weight_factor
- value
- }
-
- /// Move types
- const TYPE_U8: vector = b"u8";
- const TYPE_U64: vector = b"u64";
- const TYPE_U128: vector = b"u128";
- const TYPE_BYTES: vector = b"bytes";
- const TYPE_BYTES_VECTOR: vector = b"bytes_vector";
- const TYPE_ADDRESS: vector = b"address";
- const TYPE_BOOL: vector = b"bool";
- const TYPE_OPTION_BYTES: vector = b"option_bytes";
-
-
- /// deserialize sbt value from bcs state
- public fun deserialize_sbt_value_from_bcs_state(state: &vector, pre_order_types_vector: &vector>) : u128{
- let len = Vector::length>(pre_order_types_vector);
- if (len == 0) {
- return 0u128
- };
-
- // nfts array length
- let ctype = Vector::borrow(&mut *pre_order_types_vector, 0);
- assert!(TYPE_U8 == *ctype, Errors::invalid_state(ERR_BCS_STATE_NTFS_LENGHT_TYPE_INVALID));
- let offset = 0;
- let (nfts_len, _offset) = BCS::deserialize_u8(state, offset);
- // user has no sbt yet
- if (nfts_len == 0) {
- return 0u128
- };
- deserialize_resource_value(state, pre_order_types_vector)
- }
-
- public fun deserialize_vestar_value_from_bcs_state(state: &vector, pre_order_types_vector: &vector>) : u128{
- let len = Vector::length>(pre_order_types_vector);
- if (len == 0) {
- return 0u128
- };
- deserialize_resource_value(state, pre_order_types_vector)
- }
-
- public fun deserialize_balance_from_bcs_state(state: &vector, pre_order_types_vector: &vector>) : u128{
- let len = Vector::length>(pre_order_types_vector);
- if (len == 0) {
- return 0u128
- };
- deserialize_resource_value(state, pre_order_types_vector)
- }
-
- public fun deserialize_resource_value(input: &vector, pre_order_types_vector: &vector>) : u128{
- // {address, u64, {...}, {...}, {...}}
- let len = Vector::length>(pre_order_types_vector);
- if (len == 0) {
- return 0u128
- };
- let idx = 0;
- let offset = 0;
- loop {
- if (idx >= len) {
- break
- };
- let ctype = Vector::borrow(pre_order_types_vector, idx);
- offset = deserialize_one_type_cursor(input, ctype, offset);
- idx = idx + 1;
- };
- let (amount_value, _offset) = BCS::deserialize_u128(input, offset);
- amount_value
- }
-
- public fun deserialize_one_type_cursor(input: &vector, ctype: &vector, offset:u64) : u64 {
- if (TYPE_U8 == *ctype) {
- offset = BCS::skip_u8(input, offset);
- } else if (TYPE_U64 == *ctype) {
- offset = BCS::skip_u64(input, offset);
- } else if (TYPE_U128 == *ctype) {
- offset = BCS::skip_u128(input, offset);
- } else if (TYPE_BYTES == *ctype) {
- offset = BCS::skip_bytes(input, offset);
- } else if (TYPE_BYTES_VECTOR == *ctype) {
- offset = BCS::skip_bytes_vector(input, offset);
- } else if (TYPE_ADDRESS == *ctype) {
- offset = BCS::skip_address(input, offset);
- } else if (TYPE_BOOL == *ctype) {
- offset = BCS::skip_bool(input, offset);
- } else if (TYPE_OPTION_BYTES == *ctype) {
- offset = BCS::skip_option_bytes(input, offset);
- } else {
- abort Errors::invalid_argument(ERR_PRE_ORDER_TYPE_INVALID)
- };
- offset
- }
-
- #[test]
- fun test_deserialize_sbt_value() {
- let _state = x"016bfb460477adf9dd0455d3de2fc7f21101000000000000000664616f313031000a69616d67655f6461746100570400000000000064000000000000000000000000000000";
-
- let pre_order_types_vector = Vector::empty>();
- Vector::push_back(&mut pre_order_types_vector, b"u8");
- Vector::push_back(&mut pre_order_types_vector, b"address");
- Vector::push_back(&mut pre_order_types_vector, b"u64");
- Vector::push_back(&mut pre_order_types_vector, b"bytes");
- Vector::push_back(&mut pre_order_types_vector, b"bytes");
- Vector::push_back(&mut pre_order_types_vector, b"bytes");
- Vector::push_back(&mut pre_order_types_vector, b"bytes");
- Vector::push_back(&mut pre_order_types_vector, b"u64");
-
- let sbt_value = deserialize_sbt_value_from_bcs_state(&_state, &pre_order_types_vector);
- let _expect_sb_value = 100;
- assert!(_expect_sb_value == sbt_value, 8001);
- Debug::print(&sbt_value);
- }
-
-
- #[test]
- fun test_origin_deserialize_sbt_value_from_bcs_state() {
- // https://stcscan.io/barnard/address/0x6bfb460477adf9dd0455d3de2fc7f211/resources
- // 0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMember<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>, 0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMemberBody<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>>
- // {"json":{"nft":{"vec":[{"base_meta":{"description":"0x","image":"0x","image_data":"0x69616d67655f64617461","name":"0x64616f313031"},"body":{"sbt":{"value":100}},"creator":"0x6bfb460477adf9dd0455d3de2fc7f211","id":1,"type_meta":{"id":1111}}]}},"raw":"0x016bfb460477adf9dd0455d3de2fc7f21101000000000000000664616f313031000a69616d67655f6461746100570400000000000064000000000000000000000000000000"}
- let bs = x"016bfb460477adf9dd0455d3de2fc7f21101000000000000000664616f313031000a69616d67655f6461746100570400000000000064000000000000000000000000000000";
- Debug::print>(&bs);
- let offset = 0;
-
- // array length
- let offset = BCS::skip_u8(&bs, offset);
- // creator
- let offset = BCS::skip_address(&bs, offset);
- // id
- let offset = BCS::skip_u64(&bs, offset);
- Debug::print(&offset);
- // base_meta
- let offset = BCS::skip_bytes(&bs, offset);
- let offset = BCS::skip_bytes(&bs, offset);
- let offset = BCS::skip_bytes(&bs, offset);
- let offset = BCS::skip_bytes(&bs, offset);
- // type_meta
- let offset = BCS::skip_u64(&bs, offset);
- Debug::print(&offset);
- // body
- let (sbt_value, offset) = BCS::deserialize_u128(&bs, offset);
- Debug::print(&sbt_value);
- Debug::print(&offset);
- let expect_sb_value = 100;
- assert!(expect_sb_value == sbt_value, 8003);
- Debug::print(&b"testdao02");
- }
-
-
- #[test]
- fun test_origin_deserialize_vestar_value_from_bcs_state() {
- // {"json":{"boost_factor":250,"locked_vetoken":{"token":{"value":47945205478}},"user_amount":0},"raw":"0xfa00000000000000e6c6c1290b000000000000000000000000000000000000000000000000000000"}
- let bs = x"fa0000000000000038bc7e1800000000000000000000000000000000000000000000000000000000";
- Debug::print>(&bs);
-
- let (r, offset) = BCS::deserialize_u64(&bs, 0);
- Debug::print(&r);
- Debug::print(&offset);
- let (r, offset) = BCS::deserialize_u128(&bs, offset);
- Debug::print(&r);
- Debug::print(&offset);
- let (r, offset) = BCS::deserialize_u128(&bs, offset);
- Debug::print(&r);
- Debug::print(&offset);
- }
-
- #[test]
- fun test_origin_deserialize_balance_from_bcs_state() {
- // {"json":{"token":{"value":40350083678552}},"raw":"0x588167bcb22400000000000000000000"}
-
- let bs = x"588167bcb22400000000000000000000";
- Debug::print>(&bs);
- let offset = 0;
-
- let (balance, offset) = BCS::deserialize_u128(&bs, offset);
- Debug::print(&balance);
- Debug::print(&offset);
- }
-
- #[test]
- fun test_bcs() {
- // vector
- let v = x"";
- let expected_output = x"00";
- let v_bcs = BCS::to_bytes(&v);
- Debug::print(&v_bcs);
- assert!(copy v_bcs == expected_output, 8006);
-
- let offset = 0;
- let (_r, offset) = BCS::deserialize_bytes(&v_bcs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
-
- // vector>
- }
-
- #[test]
- fun test_origin_deserialize_nfts_from_bcs_state() {
- // https://stcscan.io/main/address/0x44bc6adfdc1f718ed2014699b239f035/resources
- // 0x00000000000000000000000000000001::NFTGallery::NFTGallery<0x2d32bee4f260694a0b3f1143c64a505a::Market::GoodsNFTInfo, 0x2d32bee4f260694a0b3f1143c64a505a::Market::GoodsNFTBody>
- // {"json":{"deposit_events":{"counter":2,"guid":"0x180000000000000044bc6adfdc1f718ed2014699b239f035"},"items":[{"base_meta":{"description":"0x41646f707420746865206669727374204e4654206f6e2053746172636f696e2066726f6d2074686520426f72656420456c697a616265746820494920636f6c6c656374696f6e2e2068747470733a2f2f747769747465722e636f6d2f426f726564456c697a6162657468","image":"0x68747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f393437353333373132313434313834362e706e673f782d6f73732d70726f636573733d696d6167652f726573697a652c775f3634302f726573697a652c685f363430","image_data":"0x","name":"0x233131"},"body":{"quantity":1},"creator":"0xa86c0fdd86072f8a4a36c1eb756defec","id":499,"type_meta":{"has_in_kind":false,"mail":"0x","resource_url":"0x68747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f393437353333373132313434313834362e706e67","type":1002}},{"base_meta":{"description":"0x41646f707420746865206669727374204e4654206f6e2053746172636f696e2066726f6d2074686520426f72656420456c697a616265746820494920636f6c6c656374696f6e2e2068747470733a2f2f747769747465722e636f6d2f426f726564456c697a6162657468","image":"0x68747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f373336333338333932393234323336392e706e673f782d6f73732d70726f636573733d696d6167652f726573697a652c775f3634302f726573697a652c685f363430","image_data":"0x","name":"0x233233"},"body":{"quantity":1},"creator":"0xa86c0fdd86072f8a4a36c1eb756defec","id":501,"type_meta":{"has_in_kind":false,"mail":"0x","resource_url":"0x68747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f373336333338333932393234323336392e706e67","type":1002}}],"withdraw_events":{"counter":0,"guid":"0x170000000000000044bc6adfdc1f718ed2014699b239f035"}},"raw":"0x000000000000000018170000000000000044bc6adfdc1f718ed2014699b239f035020000000000000018180000000000000044bc6adfdc1f718ed2014699b239f03502a86c0fdd86072f8a4a36c1eb756defecf30100000000000003233131940168747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f393437353333373132313434313834362e706e673f782d6f73732d70726f636573733d696d6167652f726573697a652c775f3634302f726573697a652c685f363430006a41646f707420746865206669727374204e4654206f6e2053746172636f696e2066726f6d2074686520426f72656420456c697a616265746820494920636f6c6c656374696f6e2e2068747470733a2f2f747769747465722e636f6d2f426f726564456c697a616265746800ea030000000000006668747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f393437353333373132313434313834362e706e67000100000000000000a86c0fdd86072f8a4a36c1eb756defecf50100000000000003233233940168747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f373336333338333932393234323336392e706e673f782d6f73732d70726f636573733d696d6167652f726573697a652c775f3634302f726573697a652c685f363430006a41646f707420746865206669727374204e4654206f6e2053746172636f696e2066726f6d2074686520426f72656420456c697a616265746820494920636f6c6c656374696f6e2e2068747470733a2f2f747769747465722e636f6d2f426f726564456c697a616265746800ea030000000000006668747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f373336333338333932393234323336392e706e67000100000000000000"}
-
- let bs = x"000000000000000018170000000000000044bc6adfdc1f718ed2014699b239f035020000000000000018180000000000000044bc6adfdc1f718ed2014699b239f03502a86c0fdd86072f8a4a36c1eb756defecf30100000000000003233131940168747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f393437353333373132313434313834362e706e673f782d6f73732d70726f636573733d696d6167652f726573697a652c775f3634302f726573697a652c685f363430006a41646f707420746865206669727374204e4654206f6e2053746172636f696e2066726f6d2074686520426f72656420456c697a616265746820494920636f6c6c656374696f6e2e2068747470733a2f2f747769747465722e636f6d2f426f726564456c697a616265746800ea030000000000006668747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f393437353333373132313434313834362e706e67000100000000000000a86c0fdd86072f8a4a36c1eb756defecf50100000000000003233233940168747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f373336333338333932393234323336392e706e673f782d6f73732d70726f636573733d696d6167652f726573697a652c775f3634302f726573697a652c685f363430006a41646f707420746865206669727374204e4654206f6e2053746172636f696e2066726f6d2074686520426f72656420456c697a616265746820494920636f6c6c656374696f6e2e2068747470733a2f2f747769747465722e636f6d2f426f726564456c697a616265746800ea030000000000006668747470733a2f2f6333722e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6e6f726d616c2f307861383663306664643836303732663861346133366331656237353664656665632f373336333338333932393234323336392e706e67000100000000000000";
- Debug::print>(&bs);
- let offset = 0;
-
- let (_r, offset) = BCS::deserialize_u64(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
- let (_r, offset) = BCS::deserialize_bytes(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
-
- let (_r, offset) = BCS::deserialize_u64(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
- let (_r, offset) = BCS::deserialize_bytes(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
-
- // array length
- let (_r, offset) = BCS::deserialize_u8(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
-
- let (_r, offset) = BCS::deserialize_address(&bs, offset);
- Debug::print(&_r);
- Debug::print(&@0xa86c0fdd86072f8a4a36c1eb756defec);
- let (_r, offset) = BCS::deserialize_u64(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
- let (_r, offset) = BCS::deserialize_bytes(&bs, offset);
- let (_r, offset) = BCS::deserialize_bytes(&bs, offset);
- let offset = BCS::skip_bytes(&bs, offset);
- let offset = BCS::skip_bytes(&bs, offset);
- let offset = BCS::skip_u64(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
- let (_r, offset) = BCS::deserialize_u128(&bs, offset);
- Debug::print(&_r);
- Debug::print(&offset);
- }
-
-
-}
\ No newline at end of file
diff --git a/integration-tests/dao/test_dao_config.exp b/integration-tests/dao/test_dao_config.exp
index eed65019..8c1e1b3e 100644
--- a/integration-tests/dao/test_dao_config.exp
+++ b/integration-tests/dao/test_dao_config.exp
@@ -3,27 +3,33 @@ processed 18 tasks
task 4 'run'. lines 25-43:
{
"gas_used": 254270,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 5 'run'. lines 46-67:
{
"gas_used": 212057,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 70-85:
{
"gas_used": 38559,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
@@ -32,14 +38,16 @@ task 7 'run'. lines 88-103:
{
"gas_used": 38559,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
@@ -48,14 +56,16 @@ task 8 'run'. lines 106-121:
{
"gas_used": 38664,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359943"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359943
+ ]
}
}
}
@@ -64,14 +74,16 @@ task 9 'run'. lines 124-139:
{
"gas_used": 38559,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
@@ -80,14 +92,16 @@ task 10 'run'. lines 142-152:
{
"gas_used": 21364,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "ModifyDaoConfigProposal"
- }
- },
- "abort_code": "102658"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "ModifyDaoConfigProposal"
+ }
+ },
+ 102658
+ ]
}
}
}
@@ -95,21 +109,25 @@ task 10 'run'. lines 142-152:
task 11 'run'. lines 155-195:
{
"gas_used": 131941,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 12 'run'. lines 199-226:
{
"gas_used": 52355,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359943"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359943
+ ]
}
}
}
@@ -118,14 +136,16 @@ task 13 'run'. lines 229-249:
{
"gas_used": 11212,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
@@ -134,14 +154,16 @@ task 14 'run'. lines 252-272:
{
"gas_used": 11250,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
@@ -150,14 +172,16 @@ task 15 'run'. lines 275-295:
{
"gas_used": 11358,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
@@ -166,14 +190,16 @@ task 16 'run'. lines 298-318:
{
"gas_used": 11393,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
@@ -182,14 +208,16 @@ task 17 'run'. lines 321-341:
{
"gas_used": 11431,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "360199"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360199
+ ]
}
}
}
diff --git a/integration-tests/dao/test_dao_failure.exp b/integration-tests/dao/test_dao_failure.exp
new file mode 100644
index 00000000..618bc66b
--- /dev/null
+++ b/integration-tests/dao/test_dao_failure.exp
@@ -0,0 +1,448 @@
+processed 43 tasks
+
+task 5 'run'. lines 12-29:
+{
+ "gas_used": 313160,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 6 'run'. lines 31-41:
+{
+ "gas_used": 12417,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "ModifyDaoConfigProposal"
+ }
+ },
+ 102919
+ ]
+ }
+ }
+}
+
+task 7 'run'. lines 44-54:
+{
+ "gas_used": 162267,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 8 'run'. lines 58-68:
+{
+ "gas_used": 162267,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 9 'run'. lines 71-81:
+{
+ "gas_used": 125294,
+ "status": {
+ "Keep": {
+ "ExecutionFailure": {
+ "location": {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ "function": 18,
+ "code_offset": 45
+ }
+ }
+ }
+}
+
+task 11 'run'. lines 86-104:
+{
+ "gas_used": 148929,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 12 'run'. lines 107-127:
+{
+ "gas_used": 162344,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 13 'run'. lines 131-155:
+{
+ "gas_used": 149577,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360449
+ ]
+ }
+ }
+}
+
+task 14 'run'. lines 158-176:
+{
+ "gas_used": 94115,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360967
+ ]
+ }
+ }
+}
+
+task 15 'run'. lines 179-197:
+{
+ "gas_used": 76714,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359431
+ ]
+ }
+ }
+}
+
+task 16 'run'. lines 200-218:
+{
+ "gas_used": 59161,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359687
+ ]
+ }
+ }
+}
+
+task 17 'run'. lines 221-239:
+{
+ "gas_used": 41374,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359431
+ ]
+ }
+ }
+}
+
+task 18 'run'. lines 242-255:
+{
+ "gas_used": 32131,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359687
+ ]
+ }
+ }
+}
+
+task 19 'run'. lines 258-271:
+{
+ "gas_used": 33839,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 20 'run'. lines 274-287:
+{
+ "gas_used": 15108,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359431
+ ]
+ }
+ }
+}
+
+task 21 'run'. lines 290-304:
+{
+ "gas_used": 29499,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359169
+ ]
+ }
+ }
+}
+
+task 23 'run'. lines 309-324:
+{
+ "gas_used": 37415,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 24 'run'. lines 327-341:
+{
+ "gas_used": 36805,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359682
+ ]
+ }
+ }
+}
+
+task 25 'run'. lines 344-364:
+{
+ "gas_used": 102595,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359169
+ ]
+ }
+ }
+}
+
+task 26 'run'. lines 367-381:
+{
+ "gas_used": 40995,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359169
+ ]
+ }
+ }
+}
+
+task 27 'run'. lines 384-402:
+{
+ "gas_used": 53206,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359169
+ ]
+ }
+ }
+}
+
+task 28 'run'. lines 406-424:
+{
+ "gas_used": 69415,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 30 'run'. lines 430-452:
+{
+ "gas_used": 163394,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 32 'run'. lines 456-470:
+{
+ "gas_used": 76680,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 33 'run'. lines 473-488:
+{
+ "gas_used": 39375,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359169
+ ]
+ }
+ }
+}
+
+task 34 'run'. lines 491-505:
+{
+ "gas_used": 74710,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 35 'run'. lines 508-519:
+{
+ "gas_used": 162267,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 37 'run'. lines 525-545:
+{
+ "gas_used": 108170,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360967
+ ]
+ }
+ }
+}
+
+task 38 'run'. lines 548-566:
+{
+ "gas_used": 59295,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360967
+ ]
+ }
+ }
+}
+
+task 39 'run'. lines 570-583:
+{
+ "gas_used": 32279,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360967
+ ]
+ }
+ }
+}
+
+task 40 'run'. lines 586-606:
+{
+ "gas_used": 162344,
+ "status": {
+ "Keep": "Executed"
+ }
+}
+
+task 42 'run'. lines 612-630:
+{
+ "gas_used": 51131,
+ "status": {
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 360967
+ ]
+ }
+ }
+}
diff --git a/deprecated/integration-tests/dao/test_dao_failure.move b/integration-tests/dao/test_dao_failure.move
similarity index 100%
rename from deprecated/integration-tests/dao/test_dao_failure.move
rename to integration-tests/dao/test_dao_failure.move
diff --git a/deprecated/integration-tests/dao/test_dao_propose.exp b/integration-tests/dao/test_dao_propose.exp
similarity index 52%
rename from deprecated/integration-tests/dao/test_dao_propose.exp
rename to integration-tests/dao/test_dao_propose.exp
index 1c3ff333..52ecc619 100644
--- a/deprecated/integration-tests/dao/test_dao_propose.exp
+++ b/integration-tests/dao/test_dao_propose.exp
@@ -3,69 +3,89 @@ processed 21 tasks
task 4 'run'. lines 10-24:
{
"gas_used": 216046,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 5 'run'. lines 27-37:
{
"gas_used": 162267,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 40-62:
{
"gas_used": 26430,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 8 'run'. lines 68-84:
{
"gas_used": 148289,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 87-103:
{
"gas_used": 140583,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 11 'run'. lines 109-127:
{
"gas_used": 171029,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 12 'run'. lines 131-151:
{
"gas_used": 154638,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 13 'run'. lines 154-187:
{
"gas_used": 503674,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 15 'run'. lines 194-216:
{
"gas_used": 157265,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 17 'run'. lines 223-235:
{
"gas_used": 32339,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "359169"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 359169
+ ]
}
}
}
@@ -73,11 +93,15 @@ task 17 'run'. lines 223-235:
task 18 'run'. lines 238-254:
{
"gas_used": 163394,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 20 'run'. lines 261-275:
{
"gas_used": 76680,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/deprecated/integration-tests/dao/test_dao_propose.move b/integration-tests/dao/test_dao_propose.move
similarity index 100%
rename from deprecated/integration-tests/dao/test_dao_propose.move
rename to integration-tests/dao/test_dao_propose.move
diff --git a/integration-tests/dao/test_mint_dao_proposal.exp b/integration-tests/dao/test_mint_dao_proposal.exp
index b54a16e2..6b095d53 100644
--- a/integration-tests/dao/test_mint_dao_proposal.exp
+++ b/integration-tests/dao/test_mint_dao_proposal.exp
@@ -3,39 +3,49 @@ processed 19 tasks
task 5 'run'. lines 32-52:
{
"gas_used": 125500,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 6 'run'. lines 54-68:
{
"gas_used": 116988,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 7 'run'. lines 71-82:
{
"gas_used": 34360,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 8 'run'. lines 85-98:
{
"gas_used": 119972,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 9 'run'. lines 101-110:
{
"gas_used": 25986,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "Dao"
- }
- },
- "abort_code": "358658"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "Dao"
+ }
+ },
+ 358658
+ ]
}
}
}
@@ -44,14 +54,16 @@ task 10 'run'. lines 113-124:
{
"gas_used": 21364,
"status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "MintDaoProposal"
- }
- },
- "abort_code": "102658"
+ "Keep": {
+ "MoveAbort": [
+ {
+ "Module": {
+ "address": "0x00000000000000000000000000000001",
+ "name": "MintDaoProposal"
+ }
+ },
+ 102658
+ ]
}
}
}
@@ -59,29 +71,39 @@ task 10 'run'. lines 113-124:
task 11 'run'. lines 127-137:
{
"gas_used": 163397,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 12 'run'. lines 140-150:
{
"gas_used": 150826,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 14 'run'. lines 156-172:
{
"gas_used": 141603,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 16 'run'. lines 177-198:
{
"gas_used": 157785,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
task 18 'run'. lines 204-222:
{
"gas_used": 161473,
- "status": "Executed"
+ "status": {
+ "Keep": "Executed"
+ }
}
diff --git a/integration-tests/daospace/dao_account.exp b/integration-tests/daospace/dao_account.exp
deleted file mode 100644
index d5653729..00000000
--- a/integration-tests/daospace/dao_account.exp
+++ /dev/null
@@ -1,45 +0,0 @@
-processed 6 tasks
-
-task 2 'run'. lines 6-23:
-{
- "gas_used": 904650,
- "status": "Executed"
-}
-
-task 3 'run'. lines 28-40:
-{
- "gas_used": 95609,
- "status": "Executed"
-}
-
-task 4 'run'. lines 42-51:
-{
- "gas_used": 780020,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOAccount"
- }
- },
- "abort_code": "25862"
- }
- }
-}
-
-task 5 'run'. lines 53-61:
-{
- "gas_used": 778789,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOAccount"
- }
- },
- "abort_code": "25862"
- }
- }
-}
diff --git a/integration-tests/daospace/dao_account.move b/integration-tests/daospace/dao_account.move
deleted file mode 100644
index 04161ad9..00000000
--- a/integration-tests/daospace/dao_account.move
+++ /dev/null
@@ -1,61 +0,0 @@
-//# init -n dev
-
-//# faucet --addr alice --amount 10000000
-
-
-//# run --signers alice
-script {
- use StarcoinFramework::STC::STC;
- use StarcoinFramework::Account;
- use StarcoinFramework::DAOAccount;
- use StarcoinFramework::Signer;
-
- fun main(sender: signer) {
- let dao_cap = DAOAccount::create_account(&sender);
- let dao_signer = DAOAccount::dao_signer(&dao_cap);
- let dao_address= Signer::address_of(&dao_signer);
- Account::pay_from(&sender, dao_address, 10000);
- let dao_balance = Account::balance(dao_address);
- assert!(dao_balance == 10000, 1001);
- DAOAccount::restore_dao_account_cap(&sender, dao_cap);
- }
-}
-// check: EXECUTED
-
-
-
-
-//# run --signers alice
-script {
- use StarcoinFramework::DAOAccount;
- use StarcoinFramework::Vector;
-
- fun main(sender: signer) {
- let dao_cap = DAOAccount::extract_dao_account_cap(&sender);
- let package_hash = Vector::empty();
- DAOAccount::submit_upgrade_plan(&dao_cap, package_hash, 2, false);
- DAOAccount::restore_dao_account_cap(&sender, dao_cap);
- }
-}
-// check: EXECUTED
-
-//# run --signers alice
-script {
- use StarcoinFramework::DAOAccount;
-
- fun main(sender: signer) {
- let dao_cap = DAOAccount::create_account(&sender);
- DAOAccount::restore_dao_account_cap(&sender, dao_cap);
- }
-}
-// check: ABORT, code 25862. Reason: alice already has a DAOAccountCap
-
-//# run --signers alice
-script {
- use StarcoinFramework::DAOAccount;
-
- fun main(sender: signer) {
- DAOAccount::create_account_entry(sender);
- }
-}
-// check: ABORT, code 25862. Reason: alice already has a DAOAccountCap
\ No newline at end of file
diff --git a/integration-tests/daospace/dao_create.exp b/integration-tests/daospace/dao_create.exp
deleted file mode 100644
index 14bc41a1..00000000
--- a/integration-tests/daospace/dao_create.exp
+++ /dev/null
@@ -1,24 +0,0 @@
-processed 11 tasks
-
-task 4 'run'. lines 9-17:
-{
- "gas_used": 791553,
- "status": "Executed"
-}
-
-task 5 'view'. lines 19-19:
-store key 0x00000000000000000000000000000001::DAOAccount::DAOAccountCap {
- dao_address: bf3a917cf4fb6425b95cc12763e6038b
-}
-
-task 7 'run'. lines 55-63:
-{
- "gas_used": 79013,
- "status": "Executed"
-}
-
-task 10 'run'. lines 69-77:
-{
- "gas_used": 1058109,
- "status": "Executed"
-}
diff --git a/integration-tests/daospace/dao_create.move b/integration-tests/daospace/dao_create.move
deleted file mode 100644
index 03a0e3fc..00000000
--- a/integration-tests/daospace/dao_create.move
+++ /dev/null
@@ -1,77 +0,0 @@
-//# init -n dev
-
-//# faucet --addr alice --amount 10000000000
-
-//# faucet --addr bob --amount 10000000000
-
-//# block --author=0x3 --timestamp 900000
-
-//# run --signers alice
-script{
- use StarcoinFramework::DAOAccount;
-
- fun main(sender: signer){
- DAOAccount::create_account_entry(sender);
- }
-}
-// check: EXECUTED
-
-//# view --address alice --resource 0x1::DAOAccount::DAOAccountCap
-
-//# package
-module 0xbf3a917cf4fb6425b95cc12763e6038b::XDAO {
- use StarcoinFramework::Option;
- use StarcoinFramework::DAOSpace;
- use StarcoinFramework::DAOAccount;
- struct X has store, drop {}
-
- const NAME: vector = b"X";
- public (script) fun create_new_proposal_dao(
- sender: signer,
- voting_delay: u64,
- voting_period: u64,
- voting_quorum_rate: u8,
- min_action_delay: u64,
- min_proposal_deposit: u128,)
- {
-
- let config = DAOSpace::new_dao_config(
- voting_delay,
- voting_period,
- voting_quorum_rate,
- min_action_delay,
- min_proposal_deposit,
- );
-
- let cap = DAOAccount::extract_dao_account_cap(&sender);
- DAOSpace::create_dao(cap, *&NAME, Option::none>(), Option::none>(), b"ipfs://description", config);
-
- let witness = X {};
- let member_cap = DAOSpace::acquire_member_cap(&witness);
- DAOSpace::join_member_with_member_cap(&member_cap, &sender, Option::none>(), Option::none>(), 1);
- }
-}
-
-//# run --signers alice --args {{$.package[0].package_hash}}
-script{
- use StarcoinFramework::DAOAccount;
-
- fun main(sender: signer, package_hash: vector){
- DAOAccount::submit_upgrade_plan_entry(sender, package_hash, 1, false);
- }
-}
-// check: EXECUTED
-
-//# block --author=0x3 --timestamp 90240000
-
-//# deploy {{$.package[0].file}} --signers bob
-
-//# run --signers alice
-script{
- use 0xbf3a917cf4fb6425b95cc12763e6038b::XDAO;
-
- fun main(sender: signer){
- XDAO::create_new_proposal_dao(sender, 1000, 1000, 1, 1000, 1000);
- }
-}
-// check: EXECUTED
\ No newline at end of file
diff --git a/integration-tests/daospace/dao_extension_point_init.exp b/integration-tests/daospace/dao_extension_point_init.exp
deleted file mode 100644
index a5ebe27b..00000000
--- a/integration-tests/daospace/dao_extension_point_init.exp
+++ /dev/null
@@ -1,22 +0,0 @@
-processed 5 tasks
-
-task 3 'view'. lines 7-7:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 1
-}
-
-task 4 'run'. lines 9-17:
-{
- "gas_used": 13211,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOExtensionPoint"
- }
- },
- "abort_code": "25606"
- }
- }
-}
diff --git a/integration-tests/daospace/dao_extension_point_init.move b/integration-tests/daospace/dao_extension_point_init.move
deleted file mode 100644
index 39279266..00000000
--- a/integration-tests/daospace/dao_extension_point_init.move
+++ /dev/null
@@ -1,19 +0,0 @@
-//# init -n dev
-
-//# faucet --addr Genesis
-
-//# faucet --addr bob --amount 2000000000
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Registry
-
-//# run --signers Genesis
-script {
- use StarcoinFramework::DAOExtensionPoint;
-
- fun main(_sender: signer) {
- DAOExtensionPoint::initialize();
- }
-}
-// check: MoveAbort
-
-
diff --git a/integration-tests/daospace/dao_extension_point_publish_version.exp b/integration-tests/daospace/dao_extension_point_publish_version.exp
deleted file mode 100644
index d3083287..00000000
--- a/integration-tests/daospace/dao_extension_point_publish_version.exp
+++ /dev/null
@@ -1,178 +0,0 @@
-processed 16 tasks
-
-task 4 'run'. lines 46-54:
-{
- "gas_used": 418615,
- "status": "Executed"
-}
-
-task 5 'view'. lines 56-56:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 2
-}
-
-task 6 'view'. lines 58-58:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 54657374457874656e74696f6e506f696e74
- description: 697066733a2f2f6465736372697074696f6e
- labels: [
- ]
- next_version_number: 2
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f70625f646f63
- created_at: 10
- },
- ]
- star_count: 0
- created_at: 10
- updated_at: 10
-}
-
-task 7 'run'. lines 60-68:
-{
- "gas_used": 152078,
- "status": "Executed"
-}
-
-task 8 'view'. lines 70-70:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 2
-}
-
-task 9 'view'. lines 72-72:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 54657374457874656e74696f6e506f696e74
- description: 697066733a2f2f6465736372697074696f6e
- labels: [
- ]
- next_version_number: 3
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f70625f646f63
- created_at: 10
- },
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 2
- tag: 76302e312e31
- types_d_ts: 697066733a2f2f74797065735f645f74735f31
- document: 697066733a2f2f70625f646f6331
- created_at: 10
- },
- ]
- star_count: 0
- created_at: 10
- updated_at: 10
-}
-
-task 10 'run'. lines 74-82:
-{
- "gas_used": 156078,
- "status": "Executed"
-}
-
-task 11 'view'. lines 84-84:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 2
-}
-
-task 12 'view'. lines 86-86:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 54657374457874656e74696f6e506f696e74
- description: 697066733a2f2f6465736372697074696f6e
- labels: [
- ]
- next_version_number: 4
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f70625f646f63
- created_at: 10
- },
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 2
- tag: 76302e312e31
- types_d_ts: 697066733a2f2f74797065735f645f74735f31
- document: 697066733a2f2f70625f646f6331
- created_at: 10
- },
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 3
- tag: 76302e312e32
- types_d_ts: 697066733a2f2f74797065735f645f74735f32
- document: 697066733a2f2f6474735f646f6332
- created_at: 10
- },
- ]
- star_count: 0
- created_at: 10
- updated_at: 10
-}
-
-task 13 'run'. lines 88-96:
-{
- "gas_used": 111323,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOExtensionPoint"
- }
- },
- "abort_code": "27399"
- }
- }
-}
-
-task 14 'view'. lines 98-98:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 2
-}
-
-task 15 'view'. lines 100-100:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 54657374457874656e74696f6e506f696e74
- description: 697066733a2f2f6465736372697074696f6e
- labels: [
- ]
- next_version_number: 4
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f70625f646f63
- created_at: 10
- },
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 2
- tag: 76302e312e31
- types_d_ts: 697066733a2f2f74797065735f645f74735f31
- document: 697066733a2f2f70625f646f6331
- created_at: 10
- },
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 3
- tag: 76302e312e32
- types_d_ts: 697066733a2f2f74797065735f645f74735f32
- document: 697066733a2f2f6474735f646f6332
- created_at: 10
- },
- ]
- star_count: 0
- created_at: 10
- updated_at: 10
-}
diff --git a/integration-tests/daospace/dao_extension_point_publish_version.move b/integration-tests/daospace/dao_extension_point_publish_version.move
deleted file mode 100644
index e3ab3fa8..00000000
--- a/integration-tests/daospace/dao_extension_point_publish_version.move
+++ /dev/null
@@ -1,100 +0,0 @@
-//# init -n dev
-
-//# faucet --addr Genesis
-
-//# faucet --addr creator --amount 100000000000
-
-//# publish
-module creator::TestExtentionPoint {
- use StarcoinFramework::Option;
- use StarcoinFramework::DAOExtensionPoint;
-
- struct TestExtentionPoint has store, copy, drop {}
-
- const NAME: vector = b"TestExtentionPoint";
-
- public(script) fun initialize(sender: signer) {
- DAOExtensionPoint::register(
- &sender,
- NAME,
- b"ipfs://description",
- b"ipfs://types_d_ts",
- b"ipfs://pb_doc",
- Option::none(),
- );
- }
-
- public(script) fun publish_version_v1(sender: signer) {
- DAOExtensionPoint::publish_version(
- &sender,
- b"v0.1.1",
- b"ipfs://types_d_ts_1",
- b"ipfs://pb_doc1",
- );
- }
-
- public(script) fun publish_version_v2(sender: signer) {
- DAOExtensionPoint::publish_version(
- &sender,
- b"v0.1.2",
- b"ipfs://types_d_ts_2",
- b"ipfs://dts_doc2",
- );
- }
-}
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::initialize(sender);
- }
-}
-// check: EXECUTED
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Registry
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Entry<{{$.faucet[1].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}::TestExtentionPoint::TestExtentionPoint>
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::publish_version_v1(sender);
- }
-}
-// check: EXECUTED
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Registry
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Entry<{{$.faucet[1].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}::TestExtentionPoint::TestExtentionPoint>
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::publish_version_v2(sender);
- }
-}
-// check: EXECUTED
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Registry
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Entry<{{$.faucet[1].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}::TestExtentionPoint::TestExtentionPoint>
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::publish_version_v2(sender);
- }
-}
-// check: MoveAbort
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Registry
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Entry<{{$.faucet[1].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}::TestExtentionPoint::TestExtentionPoint>
diff --git a/integration-tests/daospace/dao_extension_point_register.exp b/integration-tests/daospace/dao_extension_point_register.exp
deleted file mode 100644
index 10b5f221..00000000
--- a/integration-tests/daospace/dao_extension_point_register.exp
+++ /dev/null
@@ -1,108 +0,0 @@
-processed 13 tasks
-
-task 4 'run'. lines 48-56:
-{
- "gas_used": 466466,
- "status": "Executed"
-}
-
-task 5 'view'. lines 58-58:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 2
-}
-
-task 6 'view'. lines 60-60:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 54657374457874656e74696f6e506f696e74
- description: 697066733a2f2f6465736372697074696f6e
- labels: [
- 4f533d53746172636f696e,
- 53746f72653d49504653,
- ]
- next_version_number: 2
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f6474735f646f63
- created_at: 10
- },
- ]
- star_count: 0
- created_at: 10
- updated_at: 10
-}
-
-task 7 'run'. lines 62-70:
-{
- "gas_used": 60246,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOExtensionPoint"
- }
- },
- "abort_code": "26630"
- }
- }
-}
-
-task 8 'view'. lines 72-72:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 54657374457874656e74696f6e506f696e74
- description: 697066733a2f2f6465736372697074696f6e
- labels: [
- 4f533d53746172636f696e,
- 53746f72653d49504653,
- ]
- next_version_number: 2
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f6474735f646f63
- created_at: 10
- },
- ]
- star_count: 0
- created_at: 10
- updated_at: 10
-}
-
-task 10 'run'. lines 100-108:
-{
- "gas_used": 38409,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOExtensionPoint"
- }
- },
- "abort_code": "28167"
- }
- }
-}
-
-task 12 'run'. lines 137-145:
-{
- "gas_used": 137491,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOExtensionPoint"
- }
- },
- "abort_code": "28167"
- }
- }
-}
diff --git a/integration-tests/daospace/dao_extension_point_register.move b/integration-tests/daospace/dao_extension_point_register.move
deleted file mode 100644
index c2f85179..00000000
--- a/integration-tests/daospace/dao_extension_point_register.move
+++ /dev/null
@@ -1,145 +0,0 @@
-//# init -n dev
-
-//# faucet --addr Genesis
-
-//# faucet --addr creator --amount 100000000000
-
-//# publish
-module creator::TestExtentionPoint {
- use StarcoinFramework::Option;
- use StarcoinFramework::Vector;
- use StarcoinFramework::DAOExtensionPoint;
-
- struct TestExtentionPoint has store, copy, drop {}
-
- const NAME: vector = b"TestExtentionPoint";
-
- public(script) fun initialize(sender: signer) {
- let labels = Vector::empty>();
- Vector::push_back>(&mut labels, b"OS=Starcoin");
- Vector::push_back>(&mut labels, b"Store=IPFS");
-
- DAOExtensionPoint::register(
- &sender,
- NAME,
- b"ipfs://description",
- b"ipfs://types_d_ts",
- b"ipfs://dts_doc",
- Option::some(labels),
- );
- }
-
- public(script) fun initialize_with_long_text(sender: signer) {
- let labels = Vector::empty>();
- Vector::push_back>(&mut labels, b"OS=Starcoin");
- Vector::push_back>(&mut labels, b"Store=IPFS");
-
- DAOExtensionPoint::register(
- &sender,
- b"0123456789012345678901234567890123456789012345678901234567890123456789",
- b"ipfs://description",
- b"ipfs://types_d_ts",
- b"ipfs://dts_doc",
- Option::some(labels),
- );
- }
-}
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::initialize(sender);
- }
-}
-// check: EXECUTED
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Registry
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Entry<{{$.faucet[1].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}::TestExtentionPoint::TestExtentionPoint>
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::initialize(sender);
- }
-}
-// check: MoveAbort
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Entry<{{$.faucet[1].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}::TestExtentionPoint::TestExtentionPoint>
-
-//# publish
-module creator::TestExtentionPoint2 {
- use StarcoinFramework::Option;
- use StarcoinFramework::Vector;
- use StarcoinFramework::DAOExtensionPoint;
-
- struct TestExtentionPoint2 has store, copy, drop {}
-
- const NAME: vector = b"TestExtentionPoint2";
-
- public(script) fun initialize_with_long_text(sender: signer) {
- let labels = Vector::empty>();
- Vector::push_back>(&mut labels, b"OS=Starcoin");
- Vector::push_back>(&mut labels, b"Store=IPFS");
-
- DAOExtensionPoint::register(
- &sender,
- b"0123456789012345678901234567890123456789012345678901234567890123456789",
- b"ipfs://description",
- b"ipfs://types_d_ts",
- b"ipfs://dts_doc",
- Option::some(labels),
- );
- }
-}
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint2;
-
- fun main(sender: signer) {
- TestExtentionPoint2::initialize_with_long_text(sender);
- }
-}
-// check: MoveAbort
-
-
-//# publish
-module creator::TestExtentionPoint3 {
- use StarcoinFramework::Option;
- use StarcoinFramework::Vector;
- use StarcoinFramework::DAOExtensionPoint;
-
- struct TestExtentionPoint3 has store, copy, drop {}
-
- const NAME: vector = b"TestExtentionPoint3";
-
- public(script) fun initialize_with_long_text(sender: signer) {
- let labels = Vector::empty>();
- Vector::push_back>(&mut labels, b"OS=Starcoin");
- Vector::push_back>(&mut labels, b"Store=ipfs://0123456789012345678901234567890123456789012345678901234567890123456789");
-
- DAOExtensionPoint::register(
- &sender,
- b"XXXX",
- b"ipfs://description",
- b"ipfs://types_d_ts",
- b"ipfs://dts_doc",
- Option::some(labels),
- );
- }
-}
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint3;
-
- fun main(sender: signer) {
- TestExtentionPoint3::initialize_with_long_text(sender);
- }
-}
-// check: MoveAbort
diff --git a/integration-tests/daospace/dao_extension_point_star_and_unstar.exp b/integration-tests/daospace/dao_extension_point_star_and_unstar.exp
deleted file mode 100644
index 38b8a71f..00000000
--- a/integration-tests/daospace/dao_extension_point_star_and_unstar.exp
+++ /dev/null
@@ -1,62 +0,0 @@
-processed 12 tasks
-
-task 6 'run'. lines 32-40:
-{
- "gas_used": 418615,
- "status": "Executed"
-}
-
-task 7 'run'. lines 42-51:
-{
- "gas_used": 59320,
- "status": "Executed"
-}
-
-task 8 'run'. lines 53-62:
-{
- "gas_used": 15374,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOExtensionPoint"
- }
- },
- "abort_code": "26881"
- }
- }
-}
-
-task 9 'run'. lines 64-73:
-{
- "gas_used": 59320,
- "status": "Executed"
-}
-
-task 10 'view'. lines 75-75:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 2
-}
-
-task 11 'view'. lines 77-77:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 54657374457874656e74696f6e506f696e74
- description: 697066733a2f2f6465736372697074696f6e
- labels: [
- ]
- next_version_number: 2
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f70625f646f63
- created_at: 10
- },
- ]
- star_count: 2
- created_at: 10
- updated_at: 10
-}
diff --git a/integration-tests/daospace/dao_extension_point_star_and_unstar.move b/integration-tests/daospace/dao_extension_point_star_and_unstar.move
deleted file mode 100644
index 434764af..00000000
--- a/integration-tests/daospace/dao_extension_point_star_and_unstar.move
+++ /dev/null
@@ -1,77 +0,0 @@
-//# init -n dev
-
-//# faucet --addr Genesis
-
-//# faucet --addr creator --amount 100000000000
-
-//# faucet --addr bob --amount 2000000000
-
-//# faucet --addr alice --amount 10000000000
-
-//# publish
-module creator::TestExtentionPoint {
- use StarcoinFramework::Option;
- use StarcoinFramework::DAOExtensionPoint;
-
- struct TestExtentionPoint has store, copy, drop {}
-
- const NAME: vector = b"TestExtentionPoint";
-
- public(script) fun initialize(sender: signer) {
- DAOExtensionPoint::register(
- &sender,
- NAME,
- b"ipfs://description",
- b"ipfs://types_d_ts",
- b"ipfs://pb_doc",
- Option::none(),
- );
- }
-}
-
-//# run --signers creator
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::initialize(sender);
- }
-}
-// check: EXECUTED
-
-//# run --signers bob
-script {
- use StarcoinFramework::DAOExtensionPoint;
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- DAOExtensionPoint::star(&sender);
- }
-}
-// check: EXECUTED
-
-//# run --signers bob
-script {
- use StarcoinFramework::DAOExtensionPoint;
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- DAOExtensionPoint::star(&sender);
- }
-}
-// check: MoveAbort
-
-//# run --signers alice
-script {
- use StarcoinFramework::DAOExtensionPoint;
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- DAOExtensionPoint::star(&sender);
- }
-}
-// check: EXECUTED
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Registry
-
-//# view --address Genesis --resource 0x1::DAOExtensionPoint::Entry<{{$.faucet[1].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}::TestExtentionPoint::TestExtentionPoint>
diff --git a/integration-tests/daospace/dao_extension_point_transfer_owner.exp b/integration-tests/daospace/dao_extension_point_transfer_owner.exp
deleted file mode 100644
index 6bef1039..00000000
--- a/integration-tests/daospace/dao_extension_point_transfer_owner.exp
+++ /dev/null
@@ -1,162 +0,0 @@
-processed 17 tasks
-
-task 6 'run'. lines 32-40:
-{
- "gas_used": 418615,
- "status": "Executed"
-}
-
-task 7 'run'. lines 42-61:
-{
- "gas_used": 64233,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "DAOExtensionPoint"
- }
- },
- "abort_code": "26113"
- }
- }
-}
-
-task 8 'run'. lines 63-72:
-{
- "gas_used": 80067,
- "status": "Executed"
-}
-
-task 9 'view'. lines 74-74:
-store key 0x00000000000000000000000000000001::NFTGallery::NFTGallery<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta, 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTBody> {
- withdraw_events: store 0x00000000000000000000000000000001::Event::EventHandle<0x00000000000000000000000000000001::NFTGallery::WithdrawEvent<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta>> {
- counter: 0
- guid: 0300000000000000b5d577dc9ce59725e29886632e69ecdf
- }
- deposit_events: store 0x00000000000000000000000000000001::Event::EventHandle<0x00000000000000000000000000000001::NFTGallery::DepositEvent<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta>> {
- counter: 1
- guid: 0400000000000000b5d577dc9ce59725e29886632e69ecdf
- }
- items: [
- store 0x00000000000000000000000000000001::NFT::NFT<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta, 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTBody> {
- creator: 1
- id: 1
- base_meta: copy drop store 0x00000000000000000000000000000001::NFT::Metadata {
- name: 457874506f696e744f776e65724e4654
- image:
- image_data: 697066733a2f2f516d6454776468466936317a68524d334d74504c78754b7961717633655045434c47734d6739704d726550763469
- description: 54686520657874656e73696f6e20706f696e74206f776e6572204e4654
- }
- type_meta: copy drop store 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta {
- extpoint_id: 1
- registry_address: 1
- }
- body: store 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTBody {
- dummy_field: false
- }
- },
- ]
-}
-
-task 10 'run'. lines 76-85:
-{
- "gas_used": 200904,
- "status": "Executed"
-}
-
-task 11 'view'. lines 87-87:
-store key 0x00000000000000000000000000000001::NFTGallery::NFTGallery<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta, 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTBody> {
- withdraw_events: store 0x00000000000000000000000000000001::Event::EventHandle<0x00000000000000000000000000000001::NFTGallery::WithdrawEvent<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta>> {
- counter: 1
- guid: 0300000000000000b5d577dc9ce59725e29886632e69ecdf
- }
- deposit_events: store 0x00000000000000000000000000000001::Event::EventHandle<0x00000000000000000000000000000001::NFTGallery::DepositEvent<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta>> {
- counter: 1
- guid: 0400000000000000b5d577dc9ce59725e29886632e69ecdf
- }
- items: [
- ]
-}
-
-task 12 'view'. lines 89-89:
-store key 0x00000000000000000000000000000001::NFTGallery::NFTGallery<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta, 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTBody> {
- withdraw_events: store 0x00000000000000000000000000000001::Event::EventHandle<0x00000000000000000000000000000001::NFTGallery::WithdrawEvent<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta>> {
- counter: 0
- guid: 0300000000000000a7dcef9aef26202fce82a7c7d6672afb
- }
- deposit_events: store 0x00000000000000000000000000000001::Event::EventHandle<0x00000000000000000000000000000001::NFTGallery::DepositEvent<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta>> {
- counter: 1
- guid: 0400000000000000a7dcef9aef26202fce82a7c7d6672afb
- }
- items: [
- store 0x00000000000000000000000000000001::NFT::NFT<0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta, 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTBody> {
- creator: 1
- id: 1
- base_meta: copy drop store 0x00000000000000000000000000000001::NFT::Metadata {
- name: 457874506f696e744f776e65724e4654
- image:
- image_data: 697066733a2f2f516d6454776468466936317a68524d334d74504c78754b7961717633655045434c47734d6739704d726550763469
- description: 54686520657874656e73696f6e20706f696e74206f776e6572204e4654
- }
- type_meta: copy drop store 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTMeta {
- extpoint_id: 1
- registry_address: 1
- }
- body: store 0x00000000000000000000000000000001::DAOExtensionPoint::OwnerNFTBody {
- dummy_field: false
- }
- },
- ]
-}
-
-task 13 'run'. lines 91-110:
-{
- "gas_used": 183643,
- "status": "Executed"
-}
-
-task 14 'view'. lines 112-112:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Registry {
- next_id: 2
-}
-
-task 15 'view'. lines 114-114:
-store key 0x00000000000000000000000000000001::DAOExtensionPoint::Entry<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::TestExtentionPoint::TestExtentionPoint> {
- id: 1
- name: 74657374
- description: 697066733a2f2f6465736372697074696f6e32
- labels: [
- 4f533d53746172636f696e,
- 53746f72653d49504653,
- ]
- next_version_number: 2
- versions: [
- store 0x00000000000000000000000000000001::DAOExtensionPoint::Version {
- number: 1
- tag: 76302e312e30
- types_d_ts: 697066733a2f2f74797065735f645f7473
- document: 697066733a2f2f70625f646f63
- created_at: 10
- },
- ]
- star_count: 0
- created_at: 10
- updated_at: 10
-}
-
-task 16 'run'. lines 117-133:
-{
- "gas_used": 150116,
- "status": {
- "MoveAbort": {
- "location": {
- "Module": {
- "address": "0x00000000000000000000000000000001",
- "name": "NFT"
- }
- },
- "abort_code": "26372"
- }
- }
-}
diff --git a/integration-tests/daospace/dao_extension_point_transfer_owner.move b/integration-tests/daospace/dao_extension_point_transfer_owner.move
deleted file mode 100644
index 9610ab56..00000000
--- a/integration-tests/daospace/dao_extension_point_transfer_owner.move
+++ /dev/null
@@ -1,133 +0,0 @@
-//# init -n dev
-
-//# faucet --addr Genesis
-
-//# faucet --addr creator --amount 100000000000
-
-//# faucet --addr bob --amount 2000000000
-
-//# faucet --addr alice --amount 10000000000
-
-//# publish
-module creator::TestExtentionPoint {
- use StarcoinFramework::Option;
- use StarcoinFramework::DAOExtensionPoint;
-
- struct TestExtentionPoint has store, copy, drop {}
-
- const NAME: vector = b"TestExtentionPoint";
-
- public(script) fun initialize(sender: signer) {
- DAOExtensionPoint::register(
- &sender,
- NAME,
- b"ipfs://description",
- b"ipfs://types_d_ts",
- b"ipfs://pb_doc",
- Option::none(),
- );
- }
-}
-
-//# run --signers bob
-script {
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- TestExtentionPoint::initialize(sender);
- }
-}
-// check: EXECUTED
-
-//# run --signers alice
-script {
- use StarcoinFramework::Option;
- use StarcoinFramework::Vector;
- use StarcoinFramework::DAOExtensionPoint;
- use creator::TestExtentionPoint;
-
- fun main(sender: signer) {
- let labels = Vector::empty>();
- Vector::push_back>(&mut labels, b"OS=Starcoin");
- Vector::push_back>(&mut labels, b"Store=IPFS");
-
- DAOExtensionPoint::update