├── .codecov.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── enhancement.md │ ├── feature.md │ └── refactor.md ├── PULL_REQUEST_TEMPLATE.md ├── release-drafter.yml └── workflows │ ├── analysis.yaml │ ├── chatgpt.yaml │ ├── ci.yaml │ ├── gosec.yaml │ └── release.yaml ├── .gitignore ├── .golangci.yml ├── .pre-commit-config.yaml ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── action ├── actctx.go ├── action.go ├── action_deserializer.go ├── action_deserializer_test.go ├── action_test.go ├── blob_data.go ├── blob_data_test.go ├── builder.go ├── builder_test.go ├── candidate_activate.go ├── candidate_endorsement.go ├── candidate_register.go ├── candidate_transfer_ownership.go ├── candidate_transfer_ownership_test.go ├── candidate_update.go ├── candidateregister_test.go ├── candidateupdate_test.go ├── claimreward.go ├── claimreward_test.go ├── consignment_transfer.go ├── consignment_transfer_test.go ├── const.go ├── const_test.go ├── depositreward.go ├── depositreward_test.go ├── envelope.go ├── envelope_test.go ├── evm_transaction.go ├── execution.go ├── execution_test.go ├── grantreward.go ├── grantreward_test.go ├── protocol │ ├── abiutil │ │ └── abiutil.go │ ├── account │ │ ├── accountpb │ │ │ ├── account.pb.go │ │ │ └── account.proto │ │ ├── protocol.go │ │ ├── protocol_test.go │ │ ├── transfer.go │ │ ├── transfer_test.go │ │ └── util │ │ │ └── util.go │ ├── context.go │ ├── context_test.go │ ├── eip1559.go │ ├── eip1559_test.go │ ├── eip4844.go │ ├── eip4844_test.go │ ├── execution │ │ ├── evm │ │ │ ├── access_list.go │ │ │ ├── access_list_test.go │ │ │ ├── context.go │ │ │ ├── contract.go │ │ │ ├── contract_adapter.go │ │ │ ├── contract_erigon.go │ │ │ ├── contract_test.go │ │ │ ├── evm.go │ │ │ ├── evm_test.go │ │ │ ├── evmstatedbadapter.go │ │ │ ├── evmstatedbadapter_erigon.go │ │ │ ├── evmstatedbadapter_test.go │ │ │ ├── testdata_test.go │ │ │ ├── transient_storage.go │ │ │ └── transient_storage_test.go │ │ ├── executionpb │ │ │ ├── execution.pb.go │ │ │ └── execution.proto │ │ ├── protocol.go │ │ ├── protocol_test.go │ │ ├── testdata-cancun │ │ │ ├── basefee.json │ │ │ ├── basefee.sol │ │ │ ├── blobbasefee.json │ │ │ ├── blobbasefee.sol │ │ │ ├── blobhash.json │ │ │ ├── blobhash.sol │ │ │ ├── mcopy.json │ │ │ ├── mcopy.sol │ │ │ ├── point_evaluation.json │ │ │ ├── point_evaluation.sol │ │ │ ├── selfdestruct.json │ │ │ ├── selfdestruct_oncreation.sol │ │ │ ├── selfdestruction.sol │ │ │ ├── transientstorage.json │ │ │ └── transientstorage.sol │ │ ├── testdata-istanbul │ │ │ ├── CVE-2021-39137-attack-replay.json │ │ │ ├── array-return.json │ │ │ ├── array-return.sol │ │ │ ├── basic-token.json │ │ │ ├── basic-token.sol │ │ │ ├── call-dynamic.json │ │ │ ├── call-dynamic.sol │ │ │ ├── chainid-selfbalance.json │ │ │ ├── chainid-selfbalance.sol │ │ │ ├── changestate.json │ │ │ ├── changestate.sol │ │ │ ├── datacopy.json │ │ │ ├── datacopy.sol │ │ │ ├── f.value.json │ │ │ ├── f.value.sol │ │ │ ├── gas-test.json │ │ │ ├── gas-test.sol │ │ │ ├── infiniteloop.json │ │ │ ├── infiniteloop.sol │ │ │ ├── mapping-delete.json │ │ │ ├── mapping-delete.sol │ │ │ ├── maxtime.json │ │ │ ├── maxtime.sol │ │ │ ├── modifiers.json │ │ │ ├── modifiers.sol │ │ │ ├── multisend.json │ │ │ ├── multisend.sol │ │ │ ├── no-variable-length-returns.json │ │ │ ├── no-variable-length-returns.sol │ │ │ ├── public-mapping.json │ │ │ ├── public-mapping.sol │ │ │ ├── reentry-attack.json │ │ │ ├── reentry-attack.sol │ │ │ ├── remove-from-array.json │ │ │ ├── remove-from-array.sol │ │ │ ├── self-destruct.json │ │ │ ├── self-destruct.sol │ │ │ ├── send-eth.json │ │ │ ├── send-eth.sol │ │ │ ├── sha3.json │ │ │ ├── sha3.sol │ │ │ ├── storage-test.json │ │ │ ├── storage-test.sol │ │ │ ├── tail-recursion.json │ │ │ ├── tail-recursion.sol │ │ │ ├── tuple.json │ │ │ ├── tuple.sol │ │ │ ├── wireconnection.json │ │ │ ├── wireconnection.sol │ │ │ ├── write-protection-001.json │ │ │ ├── write-protection-001.sol │ │ │ ├── write-protection-002.json │ │ │ ├── write-protection-002.sol │ │ │ ├── write-protection-003.json │ │ │ ├── write-protection-003.sol │ │ │ ├── write-protection-004.json │ │ │ ├── write-protection-004.sol │ │ │ ├── write-protection-005.json │ │ │ ├── write-protection-005.sol │ │ │ ├── write-protection-006.json │ │ │ ├── write-protection-006.sol │ │ │ ├── write-protection-007.json │ │ │ ├── write-protection-007.sol │ │ │ ├── write-protection-008.json │ │ │ ├── write-protection-008.sol │ │ │ ├── write-protection-009.json │ │ │ ├── write-protection-009.sol │ │ │ ├── write-protection-010.json │ │ │ ├── write-protection-010.sol │ │ │ ├── write-protection.json │ │ │ └── write-protection.sol │ │ ├── testdata-london │ │ │ ├── CVE-2021-39137-attack-replay.json │ │ │ ├── array-return.json │ │ │ ├── array-return.sol │ │ │ ├── basefee.json │ │ │ ├── basefee.sol │ │ │ ├── basic-token.json │ │ │ ├── basic-token.sol │ │ │ ├── call-dynamic.json │ │ │ ├── call-dynamic.sol │ │ │ ├── chainid-selfbalance.json │ │ │ ├── chainid-selfbalance.sol │ │ │ ├── changestate.json │ │ │ ├── changestate.sol │ │ │ ├── datacopy-accesslist.json │ │ │ ├── datacopy.json │ │ │ ├── datacopy.sol │ │ │ ├── difficulty.json │ │ │ ├── difficulty.sol │ │ │ ├── f.value.json │ │ │ ├── f.value.sol │ │ │ ├── factory.json │ │ │ ├── factory.sol │ │ │ ├── gas-test.json │ │ │ ├── gas-test.sol │ │ │ ├── infiniteloop.json │ │ │ ├── infiniteloop.sol │ │ │ ├── mapping-delete.json │ │ │ ├── mapping-delete.sol │ │ │ ├── maxtime.json │ │ │ ├── maxtime.sol │ │ │ ├── modifiers.json │ │ │ ├── modifiers.sol │ │ │ ├── multisend.json │ │ │ ├── multisend.sol │ │ │ ├── no-variable-length-returns.json │ │ │ ├── no-variable-length-returns.sol │ │ │ ├── public-mapping.json │ │ │ ├── public-mapping.sol │ │ │ ├── push0.json │ │ │ ├── push0.sol │ │ │ ├── reentry-attack.json │ │ │ ├── reentry-attack.sol │ │ │ ├── remove-from-array.json │ │ │ ├── remove-from-array.sol │ │ │ ├── self-destruct.json │ │ │ ├── self-destruct.sol │ │ │ ├── send-eth.json │ │ │ ├── send-eth.sol │ │ │ ├── sha3.json │ │ │ ├── sha3.sol │ │ │ ├── storage-test.json │ │ │ ├── storage-test.sol │ │ │ ├── tail-recursion.json │ │ │ ├── tail-recursion.sol │ │ │ ├── tuple.json │ │ │ ├── tuple.sol │ │ │ ├── wireconnection.json │ │ │ └── wireconnection.sol │ │ ├── testdata-shanghai │ │ │ ├── CVE-2021-39137-attack-replay.json │ │ │ ├── array-return.json │ │ │ ├── array-return.sol │ │ │ ├── basefee.json │ │ │ ├── basefee.sol │ │ │ ├── basic-token.json │ │ │ ├── basic-token.sol │ │ │ ├── call-dynamic.json │ │ │ ├── call-dynamic.sol │ │ │ ├── chainid-selfbalance.json │ │ │ ├── chainid-selfbalance.sol │ │ │ ├── changestate.json │ │ │ ├── changestate.sol │ │ │ ├── datacopy-accesslist.json │ │ │ ├── datacopy.json │ │ │ ├── datacopy.sol │ │ │ ├── f.value.json │ │ │ ├── f.value.sol │ │ │ ├── factory.json │ │ │ ├── factory.sol │ │ │ ├── gas-test.json │ │ │ ├── gas-test.sol │ │ │ ├── infiniteloop.json │ │ │ ├── infiniteloop.sol │ │ │ ├── mapping-delete.json │ │ │ ├── mapping-delete.sol │ │ │ ├── maxtime.json │ │ │ ├── maxtime.sol │ │ │ ├── modifiers.json │ │ │ ├── modifiers.sol │ │ │ ├── multisend.json │ │ │ ├── multisend.sol │ │ │ ├── no-variable-length-returns.json │ │ │ ├── no-variable-length-returns.sol │ │ │ ├── prevrandao.json │ │ │ ├── prevrandao.sol │ │ │ ├── public-mapping.json │ │ │ ├── public-mapping.sol │ │ │ ├── push0.json │ │ │ ├── push0.sol │ │ │ ├── reentry-attack.json │ │ │ ├── reentry-attack.sol │ │ │ ├── remove-from-array.json │ │ │ ├── remove-from-array.sol │ │ │ ├── self-destruct.json │ │ │ ├── self-destruct.sol │ │ │ ├── send-eth.json │ │ │ ├── send-eth.sol │ │ │ ├── sha3.json │ │ │ ├── sha3.sol │ │ │ ├── storage-test.json │ │ │ ├── storage-test.sol │ │ │ ├── tail-recursion.json │ │ │ ├── tail-recursion.sol │ │ │ ├── tuple.json │ │ │ ├── tuple.sol │ │ │ ├── wireconnection.json │ │ │ └── wireconnection.sol │ │ └── testdata │ │ │ ├── CVE-2021-39137-attack-replay.json │ │ │ ├── Ownable.sol │ │ │ ├── array-return.json │ │ │ ├── array-return.sol │ │ │ ├── basic-token.json │ │ │ ├── basic-token.sol │ │ │ ├── call-dynamic.json │ │ │ ├── call-dynamic.sol │ │ │ ├── cashier-bering.json │ │ │ ├── cashier.json │ │ │ ├── cashier.sol │ │ │ ├── changestate.json │ │ │ ├── changestate.sol │ │ │ ├── datacopy.json │ │ │ ├── datacopy.sol │ │ │ ├── delegate_erc20.json │ │ │ ├── erc20.json │ │ │ ├── f.value.json │ │ │ ├── f.value.sol │ │ │ ├── factory.json │ │ │ ├── factory.sol │ │ │ ├── gas-test.json │ │ │ ├── gas-test.sol │ │ │ ├── infiniteloop-bering.json │ │ │ ├── infiniteloop.json │ │ │ ├── infiniteloop.sol │ │ │ ├── mapping-delete.json │ │ │ ├── mapping-delete.sol │ │ │ ├── maxtime.json │ │ │ ├── maxtime.sol │ │ │ ├── maxtime2.json │ │ │ ├── maxtime2.sol │ │ │ ├── modifiers.json │ │ │ ├── modifiers.sol │ │ │ ├── multisend.json │ │ │ ├── multisend.sol │ │ │ ├── multisend2.json │ │ │ ├── multisend2.sol │ │ │ ├── no-variable-length-returns.json │ │ │ ├── no-variable-length-returns.sol │ │ │ ├── proposal.json │ │ │ ├── proposal.sol │ │ │ ├── public-length.json │ │ │ ├── public-length.sol │ │ │ ├── public-mapping.json │ │ │ ├── public-mapping.sol │ │ │ ├── reentry-attack.json │ │ │ ├── reentry-attack.sol │ │ │ ├── remove-from-array.json │ │ │ ├── remove-from-array.sol │ │ │ ├── rolldice.json │ │ │ ├── self-destruct.json │ │ │ ├── self-destruct.sol │ │ │ ├── send-eth.json │ │ │ ├── send-eth.sol │ │ │ ├── sha3.json │ │ │ ├── sha3.sol │ │ │ ├── storage-test.json │ │ │ ├── storage-test.sol │ │ │ ├── tail-recursion.json │ │ │ ├── tail-recursion.sol │ │ │ ├── tuple.json │ │ │ ├── tuple.sol │ │ │ ├── wireconnection.json │ │ │ └── wireconnection.sol │ ├── generic_validator.go │ ├── generic_validator_test.go │ ├── kvstorefortrie.go │ ├── kvstorefortrie_test.go │ ├── managers.go │ ├── mock_protocol.go │ ├── poll │ │ ├── blockmeta.go │ │ ├── blockmeta_test.go │ │ ├── blockmetapb │ │ │ ├── blockmeta.pb.go │ │ │ └── blockmeta.proto │ │ ├── candidateindexer.go │ │ ├── candidateindexer_test.go │ │ ├── consortium.go │ │ ├── consortiummanagement.abi │ │ ├── consortiummanagement.abi.go │ │ ├── governance_protocol.go │ │ ├── governance_protocol_test.go │ │ ├── lifelong_protocol.go │ │ ├── lifelong_protocol_test.go │ │ ├── nativeStaking.abi.go │ │ ├── nativestaking.go │ │ ├── nativestakingV2.go │ │ ├── nativestaking_test.go │ │ ├── protocol.go │ │ ├── protocol_test.go │ │ ├── slasher.go │ │ ├── staking_command.go │ │ ├── staking_committee.go │ │ ├── staking_committee_test.go │ │ └── util.go │ ├── protocol.go │ ├── registry.go │ ├── registry_test.go │ ├── rewarding │ │ ├── admin.go │ │ ├── admin_test.go │ │ ├── ethabi │ │ │ ├── availablebalance.go │ │ │ ├── availablebalance_test.go │ │ │ ├── base.go │ │ │ ├── base_test.go │ │ │ ├── totalbalance.go │ │ │ ├── totalbalance_test.go │ │ │ ├── unclaimedbalance.go │ │ │ └── unclaimedbalance_test.go │ │ ├── fund.go │ │ ├── fund_test.go │ │ ├── protocol.go │ │ ├── protocol_test.go │ │ ├── reward.go │ │ ├── reward_test.go │ │ └── rewardingpb │ │ │ ├── rewarding.pb.go │ │ │ └── rewarding.proto │ ├── rolldpos │ │ ├── epoch.go │ │ └── epoch_test.go │ ├── serializablebytes.go │ ├── serializablebytes_test.go │ ├── staking │ │ ├── bucket_index.go │ │ ├── bucket_index_test.go │ │ ├── bucket_pool.go │ │ ├── bucket_pool_test.go │ │ ├── bucket_validation.go │ │ ├── bucket_validation_test.go │ │ ├── builder.go │ │ ├── candidate.go │ │ ├── candidate_buckets_indexer.go │ │ ├── candidate_buckets_indexer_test.go │ │ ├── candidate_center.go │ │ ├── candidate_center_extra.go │ │ ├── candidate_center_test.go │ │ ├── candidate_statemanager.go │ │ ├── candidate_statereader.go │ │ ├── candidate_statereader_test.go │ │ ├── candidate_test.go │ │ ├── contract_staking_abi_v2.json │ │ ├── contractstake_bucket_type.go │ │ ├── contractstake_indexer.go │ │ ├── contractstake_indexer_mock.go │ │ ├── contractstake_indexer_test.go │ │ ├── endorsement.go │ │ ├── endorsement_statemanager.go │ │ ├── endorsement_statemanager_test.go │ │ ├── ethabi │ │ │ ├── common │ │ │ │ ├── buckets.go │ │ │ │ ├── bucketsbycandidate.go │ │ │ │ ├── bucketsbyindexes.go │ │ │ │ ├── bucketsbyvoter.go │ │ │ │ ├── bucketscount.go │ │ │ │ ├── candidatebyaddress.go │ │ │ │ ├── candidatebyname.go │ │ │ │ ├── candidates.go │ │ │ │ ├── error.go │ │ │ │ ├── stake_totalstakingamount.go │ │ │ │ └── types.go │ │ │ ├── stake_base.go │ │ │ ├── stakebase_test.go │ │ │ ├── v1 │ │ │ │ ├── builder.go │ │ │ │ ├── stake_buckets.go │ │ │ │ ├── stake_bucketsbycandidate.go │ │ │ │ ├── stake_bucketsbyindexes.go │ │ │ │ ├── stake_bucketsbyvoter.go │ │ │ │ ├── stake_bucketscount.go │ │ │ │ ├── stake_candidatebyaddress.go │ │ │ │ ├── stake_candidatebyname.go │ │ │ │ ├── stake_candidates.go │ │ │ │ ├── stake_totalstakingamount.go │ │ │ │ ├── stakebuckets_test.go │ │ │ │ ├── stakebucketsbycandidate_test.go │ │ │ │ ├── stakebucketsbyindexes_test.go │ │ │ │ ├── stakebucketsbyvoter_test.go │ │ │ │ ├── stakebucketscount_test.go │ │ │ │ ├── stakecandidatebyaddress_test.go │ │ │ │ ├── stakecandidatebyname_test.go │ │ │ │ ├── stakecandidates_test.go │ │ │ │ └── staketotalstakingamount_test.go │ │ │ ├── v2 │ │ │ │ ├── builder.go │ │ │ │ ├── stake_composite_buckets.go │ │ │ │ ├── stake_composite_buckets_test.go │ │ │ │ ├── stake_composite_bucketsbycandidate.go │ │ │ │ ├── stake_composite_bucketsbycandidate_test.go │ │ │ │ ├── stake_composite_bucketsbyindices.go │ │ │ │ ├── stake_composite_bucketsbyindices_test.go │ │ │ │ ├── stake_composite_bucketsbyvoter.go │ │ │ │ ├── stake_composite_bucketsbyvoter_test.go │ │ │ │ ├── stake_composite_bucketscount.go │ │ │ │ ├── stake_composite_bucketscount_test.go │ │ │ │ ├── stake_composite_totalstakingamount.go │ │ │ │ ├── stake_composite_totalstakingamount_test.go │ │ │ │ ├── stake_contract_buckettypes.go │ │ │ │ └── stake_contract_buckettypes_test.go │ │ │ └── v3 │ │ │ │ ├── builder.go │ │ │ │ ├── stake_candidatebyaddress.go │ │ │ │ ├── stake_candidatebyid.go │ │ │ │ ├── stake_candidatebyname.go │ │ │ │ ├── stake_candidates.go │ │ │ │ ├── stake_composite_buckets.go │ │ │ │ ├── stake_composite_buckets_test.go │ │ │ │ ├── stake_composite_bucketsbycandidate.go │ │ │ │ ├── stake_composite_bucketsbycandidate_test.go │ │ │ │ ├── stake_composite_bucketsbyindices.go │ │ │ │ ├── stake_composite_bucketsbyindices_test.go │ │ │ │ ├── stake_composite_bucketsbyvoter.go │ │ │ │ ├── stake_composite_bucketsbyvoter_test.go │ │ │ │ ├── stakecandidatebyaddress_test.go │ │ │ │ ├── stakecandidatebyid_test.go │ │ │ │ ├── stakecandidatebyname_test.go │ │ │ │ └── stakecandidates_test.go │ │ ├── handler_candidate_endorsement.go │ │ ├── handler_candidate_endorsement_test.go │ │ ├── handler_candidate_selfstake.go │ │ ├── handler_candidate_selfstake_test.go │ │ ├── handler_candidate_transfer_ownership.go │ │ ├── handler_candidate_transfer_ownership_test.go │ │ ├── handler_stake_migrate.go │ │ ├── handler_stake_migrate_test.go │ │ ├── handlers.go │ │ ├── handlers_test.go │ │ ├── patchstore.go │ │ ├── patchstore_test.go │ │ ├── protocol.go │ │ ├── protocol_test.go │ │ ├── read_state.go │ │ ├── receipt_log.go │ │ ├── receipt_log_test.go │ │ ├── staking_statereader.go │ │ ├── staking_statereader_test.go │ │ ├── stakingpb │ │ │ ├── staking.pb.go │ │ │ └── staking.proto │ │ ├── validations.go │ │ ├── validations_test.go │ │ ├── viewdata.go │ │ ├── viewdata_test.go │ │ ├── vote_bucket.go │ │ ├── vote_bucket_test.go │ │ ├── vote_reviser.go │ │ └── vote_reviser_test.go │ ├── types.go │ └── vote │ │ ├── candidatesutil │ │ └── candidatesutil.go │ │ ├── probationlist.go │ │ ├── probationlist_test.go │ │ ├── unproductivedelegate.go │ │ ├── unproductivedelegate_test.go │ │ └── unproductivedelegatepb │ │ ├── unproductivedelegate.pb.go │ │ └── unproductivedelegate.proto ├── putpollresult.go ├── putpollresult_test.go ├── receipt.go ├── receipt_test.go ├── reward_common.go ├── rlp_tx.go ├── rlp_tx_test.go ├── sealedenvelope.go ├── sealedenvelope_test.go ├── sealedenvelopevalidator.go ├── signedaction.go ├── signedaction_test.go ├── stake_adddeposit.go ├── stake_changecandidate.go ├── stake_changecandidate_test.go ├── stake_common.go ├── stake_create.go ├── stake_migrate.go ├── stake_reclaim.go ├── stake_restake.go ├── stake_transferownership.go ├── stake_transferownership_test.go ├── stakeadddeposit_test.go ├── stakecreate_test.go ├── stakereclaim_test.go ├── stakerestake_test.go ├── transfer.go ├── transfer_test.go ├── tx_access_list.go ├── tx_access_list_test.go ├── tx_blob.go ├── tx_blob_test.go ├── tx_container.go ├── tx_dynamic_fee.go ├── tx_dynamic_fee_test.go ├── tx_legacy.go └── tx_legacy_test.go ├── actpool ├── accountpool.go ├── accountpool_test.go ├── actioniterator │ ├── actioniterator.go │ └── actioniterator_test.go ├── actionstore.go ├── actionstore_test.go ├── actpool.go ├── actpool_test.go ├── actqueue.go ├── actqueue_test.go ├── config.go ├── options.go ├── priorityqueue.go ├── queueworker.go └── validator.go ├── actsync ├── actionsync.go ├── actionsync_test.go └── config.go ├── api ├── action_radio.go ├── action_radio_test.go ├── apitestserver.go ├── blockdaoservice.go ├── blocklistener.go ├── blocklistener_test.go ├── config.go ├── context.go ├── coreservice.go ├── coreservice_test.go ├── coreservice_with_height.go ├── grpcserver.go ├── grpcserver_integrity_test.go ├── grpcserver_test.go ├── http.go ├── http_test.go ├── listener.go ├── listener_test.go ├── logfilter │ ├── logfilter.go │ └── logfilter_test.go ├── loglistener.go ├── metrics.go ├── mock_apicoreservice.go ├── mock_coreservicewithheight.go ├── read_cache.go ├── read_cache_test.go ├── serverV2.go ├── serverV2_integrity_test.go ├── serverV2_test.go ├── types │ ├── traces.go │ └── types.go ├── web3server.go ├── web3server_integrity_test.go ├── web3server_marshal.go ├── web3server_marshal_test.go ├── web3server_test.go ├── web3server_utils.go ├── web3server_utils_test.go └── websocket.go ├── blockchain ├── block │ ├── block.go │ ├── block_deserializer.go │ ├── block_deserializer_test.go │ ├── block_test.go │ ├── blockstore.go │ ├── blockstore_test.go │ ├── body.go │ ├── body_test.go │ ├── builder.go │ ├── builder_test.go │ ├── footer.go │ ├── footer_test.go │ ├── genesis_block.go │ ├── genesis_block_test.go │ ├── header.go │ ├── header_test.go │ ├── runnable.go │ ├── runnable_test.go │ ├── systemlog.go │ ├── systemlog_test.go │ ├── testing.go │ ├── testing_test.go │ ├── utils.go │ ├── utils_test.go │ ├── validator.go │ └── validator_test.go ├── blockchain.go ├── blockcreationsubscriber.go ├── blockdao │ ├── blob_store.go │ ├── blob_store_test.go │ ├── blob_store_util.go │ ├── blobindexpb │ │ ├── blobindex.pb.go │ │ └── blobindex.proto │ ├── blockdao.go │ ├── blockdao_test.go │ ├── blockdaopb │ │ ├── blockdao.pb.go │ │ ├── blockdao.proto │ │ └── blockdao_grpc.pb.go │ ├── blockindexer.go │ ├── blockindexer_test.go │ └── grpcblockdao.go ├── config.go ├── config_privatekey.go ├── config_privatekey_test.go ├── config_test.go ├── filedao │ ├── filedao.go │ ├── filedao_header.go │ ├── filedao_header_test.go │ ├── filedao_legacy.go │ ├── filedao_legacy_test.go │ ├── filedao_test.go │ ├── filedao_util.go │ ├── filedao_v2.go │ ├── filedao_v2_manager.go │ ├── filedao_v2_test.go │ ├── filedao_v2_util.go │ ├── headerpb │ │ ├── header.pb.go │ │ └── header.proto │ ├── staging_buffer.go │ └── testing.go ├── genesis │ ├── context.go │ ├── genesis.go │ ├── genesis_test.go │ └── heightupgrade_test.go ├── integrity │ ├── benchmark_test.go │ ├── integrity_test.go │ └── testcontract_test.go └── pubsubmanager.go ├── blockindex ├── actionindex.go ├── blockindex.go ├── bloom_range.go ├── bloom_range_test.go ├── bloomfilterindexer.go ├── bloomfilterindexer_test.go ├── config.go ├── contractstaking │ ├── bucket.go │ ├── bucket_info.go │ ├── bucket_type.go │ ├── cache.go │ ├── cache_test.go │ ├── contractstakingpb │ │ ├── contractstaking.pb.go │ │ └── contractstaking.proto │ ├── delta_action.go │ ├── delta_cache.go │ ├── delta_cache_test.go │ ├── delta_state.go │ ├── delta_state_test.go │ ├── dirty_cache.go │ ├── dirty_cache_test.go │ ├── event_handler.go │ ├── indexer.go │ ├── indexer_test.go │ ├── stakeview.go │ └── util.go ├── index_test.go ├── indexbuilder.go ├── indexbuilder_test.go ├── indexer.go ├── indexer_test.go ├── indexpb │ ├── index.pb.go │ └── index.proto ├── sync_indexers.go └── sync_indexers_test.go ├── blocksync ├── blocksync.go ├── blocksync_test.go ├── buffer.go ├── buffer_test.go ├── config.go └── uniqueue.go ├── chainservice ├── builder.go ├── builder_test.go └── chainservice.go ├── config ├── config.go ├── config_test.go ├── standalone-config.yaml └── standalone-genesis.yaml ├── consensus ├── config.go ├── consensus.go ├── consensusfsm │ ├── consensus_ttl.go │ ├── consensus_ttl_test.go │ ├── consensusevent.go │ ├── context.go │ ├── endorsedmessage.go │ ├── fsm.go │ ├── fsm_test.go │ ├── mock_context_test.go │ └── mock_endorsement_test.go └── scheme │ ├── errors.go │ ├── noop.go │ ├── rolldpos │ ├── blockproposal.go │ ├── blockproposal_test.go │ ├── chainmanager.go │ ├── consensusvote.go │ ├── consensusvote_test.go │ ├── endorsedconsensusmessage.go │ ├── endorsedconsensusmessage_test.go │ ├── endorsementmanager.go │ ├── endorsementmanager_test.go │ ├── endorsementpb │ │ ├── endorsementmanager.pb.go │ │ └── endorsementmanager.proto │ ├── proposalpool.go │ ├── proposalpool_test.go │ ├── rolldpos.go │ ├── rolldpos_test.go │ ├── rolldposctx.go │ ├── rolldposctx_test.go │ ├── roundcalculator.go │ ├── roundcalculator_test.go │ ├── roundctx.go │ ├── roundctx_test.go │ └── state_machine.png │ ├── scheme.go │ └── standalone.go ├── crypto ├── README.md ├── cryptosort.go ├── cryptosort_test.go ├── merkle.go └── merkle_test.go ├── db ├── batch │ ├── batch.go │ ├── batch_impl.go │ ├── batch_impl_test.go │ ├── kv_cache.go │ ├── kv_cache_test.go │ ├── mock_batch_test.go │ ├── writeinfo.go │ └── writeinfo_test.go ├── builder.go ├── config.go ├── config_test.go ├── counting_index.go ├── counting_index_test.go ├── db_bolt.go ├── db_bolt_test.go ├── db_pebble.go ├── db_pebble_test.go ├── db_test.go ├── db_versioned.go ├── db_versioned_test.go ├── db_versioned_util.go ├── db_versioned_util_test.go ├── kvstore.go ├── kvstore_impl.go ├── kvstore_impl_test.go ├── kvstore_versioned.go ├── kvstore_versioned_test.go ├── kvstorewithbuffer.go ├── kvstorewithbuffer_test.go ├── kvstorewithcache.go ├── mock_kvstore.go ├── range_index.go ├── range_index_test.go ├── trie │ ├── kvstore.go │ ├── kvstoreimpl.go │ ├── kvstoreimpl_test.go │ ├── mptrie │ │ ├── branchnode.go │ │ ├── branchnode_test.go │ │ ├── cachenode.go │ │ ├── extensionnode.go │ │ ├── extensionnode_test.go │ │ ├── hashnode.go │ │ ├── layertwoleafiterator.go │ │ ├── leafiterator.go │ │ ├── leafiterator_test.go │ │ ├── leafnode.go │ │ ├── leafnode_test.go │ │ ├── log.go │ │ ├── log_test.go │ │ ├── merklepatriciatrie.go │ │ ├── merklepatriciatrie_benchmark_test.go │ │ ├── merklepatriciatrie_test.go │ │ ├── node.go │ │ ├── sortedlist.go │ │ ├── sortedlist_test.go │ │ ├── twolayertrie.go │ │ └── twolayertrie_test.go │ ├── trie.go │ └── triepb │ │ ├── trie.pb.go │ │ └── trie.proto └── versionpb │ ├── version.pb.go │ └── version.proto ├── dispatcher ├── dispatcher.go ├── dispatcher_test.go ├── msg_queue.go ├── ratelimiter.go └── subscriber.go ├── e2etest ├── bigint_test.go ├── blobtx_test.go ├── contract_staking_test.go ├── contract_staking_v2_test.go ├── dynamicfee_tx_test.go ├── e2etest.go ├── erc20_abi.json ├── erc20_bytecode ├── erigon_test.go ├── expect.go ├── local_actpool_test.go ├── local_test.go ├── local_transfer_test.go ├── native_staking_test.go ├── nodeinfo_test.go ├── rewarding_test.go ├── staking_contract_v2_bytecode ├── staking_contract_v3_bytecode ├── staking_test.go └── util.go ├── endorsement └── endorsement.go ├── entrypoint.sh ├── gasstation ├── config.go ├── gasstattion.go └── gasstattion_test.go ├── go.mod ├── go.sum ├── go.test.sh ├── hooks └── build ├── install-cli.sh ├── install-injector.sh ├── install-solc.sh ├── ioctl ├── client.go ├── client_test.go ├── cmd │ ├── account │ │ ├── account.go │ │ ├── account_test.go │ │ ├── accountactions.go │ │ ├── accountbalance.go │ │ ├── accountcreate.go │ │ ├── accountcreateadd.go │ │ ├── accountdelete.go │ │ ├── accountethaddr.go │ │ ├── accountexport.go │ │ ├── accountexportpublic.go │ │ ├── accountimport.go │ │ ├── accountinfo.go │ │ ├── accountlist.go │ │ ├── accountnonce.go │ │ ├── accountsign.go │ │ ├── accountupdate.go │ │ └── accountverify.go │ ├── action │ │ ├── action.go │ │ ├── actionclaim.go │ │ ├── actiondeploy.go │ │ ├── actiondeposit.go │ │ ├── actionhash.go │ │ ├── actioninvoke.go │ │ ├── actionread.go │ │ ├── actionsendraw.go │ │ ├── actiontransfer.go │ │ ├── stake2.go │ │ ├── stake2Transfer.go │ │ ├── stake2Withdraw.go │ │ ├── stake2activate.go │ │ ├── stake2add.go │ │ ├── stake2change.go │ │ ├── stake2create.go │ │ ├── stake2endorse.go │ │ ├── stake2migrate.go │ │ ├── stake2reclaim.go │ │ ├── stake2register.go │ │ ├── stake2release.go │ │ ├── stake2renew.go │ │ ├── stake2transfer_ownership.go │ │ ├── stake2update.go │ │ ├── xrc20.go │ │ ├── xrc20allowance.go │ │ ├── xrc20approve.go │ │ ├── xrc20balanceof.go │ │ ├── xrc20const.go │ │ ├── xrc20totalsupply.go │ │ ├── xrc20transfer.go │ │ └── xrc20transferfrom.go │ ├── alias │ │ ├── alias.go │ │ ├── alias_test.go │ │ ├── aliasexport.go │ │ ├── aliasimport.go │ │ ├── aliaslist.go │ │ ├── aliasremove.go │ │ └── aliasset.go │ ├── bc │ │ ├── bc.go │ │ ├── bcblock.go │ │ ├── bcbucket.go │ │ ├── bcbucketlist.go │ │ ├── bcdelegate.go │ │ ├── bcinfo.go │ │ └── bcversion.go │ ├── contract │ │ ├── contract.go │ │ ├── contract_test.go │ │ ├── contractcompile.go │ │ ├── contractdeploy.go │ │ ├── contractdeploybin.go │ │ ├── contractdeploybytecode.go │ │ ├── contractdeploysol.go │ │ ├── contractinvoke.go │ │ ├── contractinvokebytecode.go │ │ ├── contractinvokefunction.go │ │ ├── contractprepare.go │ │ ├── contractshare.go │ │ ├── contracttest.go │ │ ├── contracttestbytecode.go │ │ ├── contracttestfunction.go │ │ ├── parse.go │ │ └── test.abi │ ├── did │ │ ├── common.go │ │ ├── did.go │ │ ├── didderegister.go │ │ ├── diddoc.go │ │ ├── didgenerate.go │ │ ├── didget.go │ │ ├── didregister.go │ │ ├── didserviceadd.go │ │ └── didserviceremove.go │ ├── hdwallet │ │ ├── hdwallet.go │ │ ├── hdwallet_test.go │ │ ├── hdwalletcreate.go │ │ ├── hdwalletdelete.go │ │ ├── hdwalletderive.go │ │ ├── hdwalletexport.go │ │ └── hdwalletimport.go │ ├── ins │ │ ├── ins.go │ │ └── insregister.go │ ├── ioid │ │ ├── applyioid.go │ │ ├── contracts │ │ │ ├── abis │ │ │ │ ├── Project.json │ │ │ │ ├── ProjectRegistry.json │ │ │ │ ├── ioID.json │ │ │ │ ├── ioIDRegistry.json │ │ │ │ └── ioIDStore.json │ │ │ ├── project.go │ │ │ └── projectregistry.go │ │ ├── ioid.go │ │ ├── name.go │ │ ├── project.go │ │ ├── projectdevice.go │ │ ├── projectregister.go │ │ └── utils.go │ ├── jwt │ │ ├── jwt.go │ │ └── jwtsign.go │ ├── node │ │ ├── node.go │ │ ├── nodedelegate.go │ │ ├── nodeprobationlist.go │ │ └── nodereward.go │ ├── root.go │ ├── update │ │ └── update.go │ ├── version │ │ ├── version │ │ └── version.go │ └── ws │ │ ├── contracts │ │ ├── Makefile │ │ ├── abis │ │ │ ├── FleetManagement.json │ │ │ ├── ProjectDevice.json │ │ │ ├── ProjectRegistrar.json │ │ │ ├── W3bstreamProject.json │ │ │ ├── W3bstreamProver.json │ │ │ ├── W3bstreamRouter.json │ │ │ └── W3bstreamVMType.json │ │ ├── fleetmanagement.go │ │ ├── gen.go │ │ ├── projectdevice.go │ │ ├── projectregistrar.go │ │ ├── w3bstreamproject.go │ │ ├── w3bstreamprover.go │ │ ├── w3bstreamrouter.go │ │ └── w3bstreamvmtype.go │ │ ├── ws.go │ │ ├── wsdevice.go │ │ ├── wsdeviceapprove.go │ │ ├── wsdeviceapproved.go │ │ ├── wsdeviceunapprove.go │ │ ├── wsmessage.go │ │ ├── wsmessagequery.go │ │ ├── wsmessagesend.go │ │ ├── wsproject.go │ │ ├── wsprojectattribute.go │ │ ├── wsprojectconfig.go │ │ ├── wsprojectquery.go │ │ ├── wsprojectregister.go │ │ ├── wsprojectstate.go │ │ ├── wsprojectupdate.go │ │ ├── wsprover.go │ │ ├── wsproverquery.go │ │ ├── wsproverregister.go │ │ ├── wsproverstate.go │ │ ├── wsprovertransfer.go │ │ ├── wsproverupdate.go │ │ ├── wsrouter.go │ │ ├── wsrouterbinddapp.go │ │ ├── wsrouterunbinddapp.go │ │ ├── wsutil.go │ │ ├── wsvmtype.go │ │ ├── wsvmtypequery.go │ │ ├── wsvmtyperegister.go │ │ └── wsvmtypestate.go ├── config │ ├── config.go │ └── configsetget.go ├── doc │ └── doc.go ├── flag │ └── flag.go ├── newcmd │ ├── account │ │ ├── account.go │ │ ├── account_test.go │ │ ├── accountactions.go │ │ ├── accountactions_test.go │ │ ├── accountbalance.go │ │ ├── accountbalance_test.go │ │ ├── accountcreate.go │ │ ├── accountcreate_test.go │ │ ├── accountcreateadd.go │ │ ├── accountcreateadd_test.go │ │ ├── accountdelete.go │ │ ├── accountdelete_test.go │ │ ├── accountethaddr.go │ │ ├── accountethaddr_test.go │ │ ├── accountexport.go │ │ ├── accountexport_test.go │ │ ├── accountexportpublic.go │ │ ├── accountexportpublic_test.go │ │ ├── accountimport.go │ │ ├── accountimport_test.go │ │ ├── accountinfo.go │ │ ├── accountinfo_test.go │ │ ├── accountlist.go │ │ ├── accountlist_test.go │ │ ├── accountnonce.go │ │ ├── accountnonce_test.go │ │ ├── accountsign.go │ │ ├── accountsign_test.go │ │ ├── accountupdate.go │ │ ├── accountupdate_test.go │ │ ├── accountverify.go │ │ └── accountverify_test.go │ ├── action │ │ ├── action.go │ │ ├── action_test.go │ │ ├── actionclaim.go │ │ ├── actionclaim_test.go │ │ ├── actiondeposit.go │ │ ├── actiondeposit_test.go │ │ ├── actionhash.go │ │ ├── actionhash_test.go │ │ ├── actionread.go │ │ ├── actionread_test.go │ │ ├── actionsendraw.go │ │ ├── actionsendraw_test.go │ │ ├── actiontransfer.go │ │ ├── actiontransfer_test.go │ │ ├── stake2withdraw.go │ │ ├── stake2withdraw_test.go │ │ ├── xrc20.go │ │ ├── xrc20_const.go │ │ ├── xrc20_test.go │ │ ├── xrc20transferfrom.go │ │ └── xrc20transferfrom_test.go │ ├── alias │ │ ├── alias.go │ │ ├── aliasexport.go │ │ ├── aliasexport_test.go │ │ ├── aliasimport.go │ │ ├── aliasimport_test.go │ │ ├── aliaslist.go │ │ ├── aliaslist_test.go │ │ ├── aliasremove.go │ │ ├── aliasremove_test.go │ │ ├── aliasset.go │ │ └── aliasset_test.go │ ├── bc │ │ ├── bc.go │ │ ├── bc_test.go │ │ ├── bcblock.go │ │ ├── bcblock_test.go │ │ ├── bcbucket.go │ │ ├── bcbucket_test.go │ │ ├── bcbucketlist.go │ │ ├── bcbucketlist_test.go │ │ ├── bcinfo.go │ │ └── bcinfo_test.go │ ├── config │ │ ├── config.go │ │ ├── config_get.go │ │ ├── config_get_test.go │ │ ├── config_reset.go │ │ ├── config_reset_test.go │ │ ├── config_set.go │ │ ├── config_set_test.go │ │ └── config_test.go │ ├── contract │ │ ├── contract.go │ │ ├── contract_test.go │ │ ├── contractcompile.go │ │ ├── contractcompile_test.go │ │ ├── contractdeploy.go │ │ ├── contractdeploy_test.go │ │ ├── contractinvoke.go │ │ ├── contractinvoke_test.go │ │ ├── contractprepare.go │ │ ├── contractprepare_test.go │ │ ├── contracttestbytecode.go │ │ ├── contracttestbytecode_test.go │ │ ├── contracttestfunction.go │ │ ├── contracttestfunction_test.go │ │ ├── parse.go │ │ ├── parse_test.go │ │ └── test.abi │ ├── did │ │ ├── did.go │ │ ├── did_test.go │ │ ├── didderegister.go │ │ ├── didderegister_test.go │ │ ├── diddoc.go │ │ ├── didgenerate.go │ │ ├── didgenerate_test.go │ │ ├── didgethash.go │ │ ├── didgethash_test.go │ │ ├── didgeturi.go │ │ ├── didgeturi_test.go │ │ ├── didregister.go │ │ ├── didregister_test.go │ │ ├── didupdate.go │ │ └── didupdate_test.go │ ├── hdwallet │ │ ├── hdwallet.go │ │ ├── hdwallet_test.go │ │ ├── hdwalletcreate.go │ │ ├── hdwalletcreate_test.go │ │ ├── hdwalletdelete.go │ │ ├── hdwalletdelete_test.go │ │ ├── hdwalletderive.go │ │ ├── hdwalletderive_test.go │ │ ├── hdwalletexport.go │ │ ├── hdwalletexport_test.go │ │ ├── hdwalletimport.go │ │ └── hdwalletimport_test.go │ ├── jwt │ │ ├── jwt.go │ │ ├── jwt_test.go │ │ ├── jwtsign.go │ │ └── jwtsign_test.go │ ├── node │ │ ├── node.go │ │ ├── node_test.go │ │ ├── nodedelegate.go │ │ ├── nodedelegate_test.go │ │ ├── nodeprobationlist.go │ │ ├── nodeprobationlist_test.go │ │ ├── nodereward.go │ │ └── nodereward_test.go │ ├── root.go │ ├── root_test.go │ ├── update │ │ ├── update.go │ │ └── update_test.go │ └── version │ │ ├── version.go │ │ └── version_test.go ├── output │ └── format.go ├── util │ ├── abi_convert.go │ ├── chain_api.go │ ├── compiler_contract.go │ ├── compiler_contract_test.go │ ├── crypt.go │ ├── crypt_test.go │ ├── util.go │ └── util_test.go └── validator │ └── validator.go ├── logo └── IoTeX.png ├── logrotate.conf ├── misc └── scripts │ ├── license_header.txt │ ├── licenseheader.sh │ ├── mockgen.sh │ └── stringer.sh ├── nodeinfo ├── config.go ├── manager.go └── manager_test.go ├── p2p ├── agent.go ├── agent_test.go ├── node │ └── node.go ├── qos.go └── qos_test.go ├── pkg ├── compress │ ├── compress.go │ └── compress_test.go ├── counter │ ├── counter.go │ └── counter_test.go ├── enc │ └── enc.go ├── fastrand │ ├── fastrand.go │ └── fastrand_test.go ├── ha │ └── ha.go ├── lifecycle │ ├── lifecycle.go │ ├── lifecycle_test.go │ ├── ready.go │ └── ready_test.go ├── log │ ├── fields.go │ ├── log.go │ └── tracelog.go ├── messagebatcher │ ├── batchwriter.go │ └── batchwriter_test.go ├── probe │ ├── options.go │ ├── probe.go │ └── probe_test.go ├── prometheustimer │ ├── timer.go │ └── timer_test.go ├── recovery │ ├── recovery.go │ └── recovery_test.go ├── routine │ ├── delaytask.go │ ├── delaytask_test.go │ ├── options.go │ ├── recurringtask.go │ ├── recurringtask_test.go │ └── task.go ├── tracer │ ├── span.go │ ├── tracer.go │ └── tracer_test.go ├── unit │ └── unit.go ├── util │ ├── abiutil │ │ └── param.go │ ├── addrutil │ │ ├── addrutil.go │ │ └── addrutil_test.go │ ├── assertions │ │ └── must.go │ ├── blockutil │ │ ├── block_time_calculator.go │ │ └── block_time_calculator_test.go │ ├── byteutil │ │ ├── byteutil.go │ │ └── byteutil_test.go │ ├── fileutil │ │ ├── fileutil.go │ │ └── fileutil_test.go │ └── httputil │ │ ├── httputil.go │ │ └── httputil_test.go └── version │ └── version.go ├── pre-commit ├── server ├── itx │ ├── heartbeat.go │ ├── heartbeat_test.go │ ├── nodestats │ │ ├── apilocalstats.go │ │ ├── apilocalstats_test.go │ │ ├── nodestats.go │ │ └── systemstats.go │ ├── server.go │ └── server_test.go └── main.go ├── state ├── account.go ├── account_test.go ├── candidate.go ├── candidate_test.go ├── factory │ ├── blockpreparer.go │ ├── blockpreparer_test.go │ ├── daoretrofitter.go │ ├── factory.go │ ├── factory_test.go │ ├── minter.go │ ├── patchstore.go │ ├── patchstore_test.go │ ├── readonlykv.go │ ├── statedb.go │ ├── util.go │ ├── workingset.go │ ├── workingset_test.go │ ├── workingsetstore.go │ ├── workingsetstore_erigon.go │ ├── workingsetstore_erigon_simulate.go │ ├── workingsetstore_test.go │ └── workingsetstore_with_secondary.go ├── iterator.go ├── iterator_test.go ├── state.go └── state_test.go ├── systemcontractindex ├── common.go └── stakingindex │ ├── bucket.go │ ├── bucket_test.go │ ├── cache.go │ ├── event_handler.go │ ├── index.go │ ├── stakeview.go │ ├── staking_contract_abi_v3.json │ └── stakingpb │ ├── staking.pb.go │ └── staking.proto ├── test ├── identityset │ └── identityset.go └── mock │ ├── mock_actioniterator │ └── mock_actioniterator.go │ ├── mock_actpool │ └── mock_actpool.go │ ├── mock_apiresponder │ └── mock_apitypes.go │ ├── mock_apiserver │ └── mock_apiserver.go │ ├── mock_batch │ └── mock_batch.go │ ├── mock_blockchain │ └── mock_blockchain.go │ ├── mock_blockcreationsubscriber │ └── mock_blockcreationsubscriber.go │ ├── mock_blockdao │ ├── mock_blockdao.go │ ├── mock_blockindexer.go │ └── mock_blockindexer_withstart.go │ ├── mock_blockindex │ ├── mock_blockindex.go │ └── mock_indexer.go │ ├── mock_blocksync │ └── mock_blocksync.go │ ├── mock_chainmanager │ └── mock_chainmanager.go │ ├── mock_consensus │ └── mock_consensus.go │ ├── mock_dispatcher │ └── mock_dispatcher.go │ ├── mock_envelope │ └── mock_envelope.go │ ├── mock_factory │ └── mock_factory.go │ ├── mock_ioctlclient │ └── mock_ioctlclient.go │ ├── mock_lifecycle │ └── mock_lifecycle.go │ ├── mock_nodeinfo │ └── mock_manager.go │ ├── mock_poll │ └── mock_poll.go │ ├── mock_privatekey │ └── mock_privatekey.go │ ├── mock_sealed_envelope_validator │ └── mock_sealed_envelope_validator.go │ ├── mock_trie │ └── mock_trie.go │ └── mock_web3server │ └── mock_web3server.go ├── testutil ├── file.go ├── file_test.go ├── gas.go ├── genesis.go ├── network.go ├── network_test.go ├── testdb │ └── db.go ├── timestamp.go ├── timestamp_test.go ├── wait.go └── wait_test.go └── tools ├── actioninjector.v2 ├── README.md ├── build_injector.sh ├── gentsfaddrs.yaml ├── injector.go └── internal │ ├── client │ ├── client.go │ └── client_test.go │ └── cmd │ ├── abi.go │ ├── inject.go │ └── root.go ├── addrgen ├── addrgen.go └── internal │ └── cmd │ ├── createconfig.go │ ├── generate.go │ └── root.go ├── bot ├── Dockerfile ├── Makefile ├── README.md ├── config.yaml ├── config │ └── config.go ├── pkg │ └── util │ │ └── grpcutil │ │ └── grpc.go └── server │ ├── bot │ ├── contract │ │ ├── multisend.sol │ │ └── xrc20.sol │ ├── execution.go │ ├── server.go │ ├── transfer.go │ └── xrc20.go │ └── main.go ├── devenv ├── README.md ├── control.sh ├── docker-compose.yml ├── images │ └── 01.jpeg └── setup.sh ├── executiontester ├── assetcontract │ └── assetcontract.go ├── blockchain │ ├── array-delete-passing.go │ ├── array-delete-passing.sol │ ├── array-of-strings.go │ ├── array-of-strings.sol │ ├── contract.go │ ├── erc721.sol │ ├── erc721_token.go │ ├── fp_token.go │ ├── slice_assembler.go │ ├── slice_assembler_test.go │ ├── slice_pack.go │ ├── stable_token.go │ ├── trading.go │ └── typedef.go └── executiontester.go ├── ioctl ├── README.md ├── buildcli.sh ├── ioctl.go └── readme │ ├── docgen.go │ ├── ioctl_account.md │ ├── ioctl_account_actions.md │ ├── ioctl_account_balance.md │ ├── ioctl_account_create.md │ ├── ioctl_account_createadd.md │ ├── ioctl_account_delete.md │ ├── ioctl_account_ethaddr.md │ ├── ioctl_account_export.md │ ├── ioctl_account_exportpublic.md │ ├── ioctl_account_getVotes.md │ ├── ioctl_account_import.md │ ├── ioctl_account_import_key.md │ ├── ioctl_account_import_keystore.md │ ├── ioctl_account_import_pem.md │ ├── ioctl_account_info.md │ ├── ioctl_account_list.md │ ├── ioctl_account_nonce.md │ ├── ioctl_account_sign.md │ ├── ioctl_account_update.md │ ├── ioctl_account_verify.md │ ├── ioctl_action.md │ ├── ioctl_action_claim.md │ ├── ioctl_action_deploy.md │ ├── ioctl_action_deposit.md │ ├── ioctl_action_hash.md │ ├── ioctl_action_invoke.md │ ├── ioctl_action_read.md │ ├── ioctl_action_sendraw.md │ ├── ioctl_action_transfer.md │ ├── ioctl_alias.md │ ├── ioctl_alias_export.md │ ├── ioctl_alias_import.md │ ├── ioctl_alias_list.md │ ├── ioctl_alias_remove.md │ ├── ioctl_alias_set.md │ ├── ioctl_bc.md │ ├── ioctl_bc_block.md │ ├── ioctl_bc_bucket.md │ ├── ioctl_bc_bucketlist.md │ ├── ioctl_bc_info.md │ ├── ioctl_config.md │ ├── ioctl_config_get.md │ ├── ioctl_config_reset.md │ ├── ioctl_config_set.md │ ├── ioctl_contract.md │ ├── ioctl_contract_compile.md │ ├── ioctl_contract_deploy.md │ ├── ioctl_contract_deploy_bin.md │ ├── ioctl_contract_deploy_bytecode.md │ ├── ioctl_contract_deploy_sol.md │ ├── ioctl_contract_invoke.md │ ├── ioctl_contract_invoke_bytecode.md │ ├── ioctl_contract_invoke_function.md │ ├── ioctl_contract_prepare.md │ ├── ioctl_contract_share.md │ ├── ioctl_contract_test.md │ ├── ioctl_contract_test_bytecode.md │ ├── ioctl_contract_test_function.md │ ├── ioctl_did.md │ ├── ioctl_did_deregister.md │ ├── ioctl_did_generate.md │ ├── ioctl_did_get.md │ ├── ioctl_did_register.md │ ├── ioctl_hdwallet.md │ ├── ioctl_hdwallet_create.md │ ├── ioctl_hdwallet_delete.md │ ├── ioctl_hdwallet_derive.md │ ├── ioctl_hdwallet_export.md │ ├── ioctl_hdwallet_import.md │ ├── ioctl_jwt.md │ ├── ioctl_jwt_sign.md │ ├── ioctl_node.md │ ├── ioctl_node_delegate.md │ ├── ioctl_node_probationlist.md │ ├── ioctl_node_reward.md │ ├── ioctl_stake.md │ ├── ioctl_stake2.md │ ├── ioctl_stake2_add.md │ ├── ioctl_stake2_change.md │ ├── ioctl_stake2_create.md │ ├── ioctl_stake2_reclaim.md │ ├── ioctl_stake2_register.md │ ├── ioctl_stake2_release.md │ ├── ioctl_stake2_renew.md │ ├── ioctl_stake2_transfer.md │ ├── ioctl_stake2_update.md │ ├── ioctl_stake2_withdraw.md │ ├── ioctl_stake_add.md │ ├── ioctl_stake_create.md │ ├── ioctl_stake_release.md │ ├── ioctl_stake_renew.md │ ├── ioctl_stake_withdraw.md │ ├── ioctl_update.md │ ├── ioctl_version.md │ ├── ioctl_xrc20.md │ ├── ioctl_xrc20_allowance.md │ ├── ioctl_xrc20_approve.md │ ├── ioctl_xrc20_balanceOf.md │ ├── ioctl_xrc20_totalSupply.md │ ├── ioctl_xrc20_transfer.md │ └── ioctl_xrc20_transferFrom.md ├── iomigrater ├── cmds │ ├── check-height.go │ └── migrate-db.go ├── common │ └── lang.go ├── main.go └── root.go ├── minicluster ├── gentsfaddrs.yaml └── minicluster.go ├── multisend ├── contracts │ ├── Migrations.sol │ └── multisend.sol ├── migrations │ └── 1_initial_migration.js ├── multisend.go ├── test │ └── Multisend.test.js └── truffle-config.js ├── newioctl └── ioctl.go ├── newxctl └── xctl.go ├── readtip └── main.go ├── start_node.sh ├── staterecoverer └── staterecoverer.go ├── util └── injectorutil.go └── xctl ├── README.md ├── buildcli.sh ├── readme └── docgen.go └── xctl.go /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 50...90 3 | status: 4 | project: 5 | default: 6 | enabled: yes 7 | target: 85% 8 | patch: 9 | default: 10 | enabled: yes 11 | target: auto 12 | ignore: 13 | - "action/protocol/rewarding/rewardingpb" 14 | - "action/protocol/account/accountpb" 15 | - "action/protocol/poll/*.abi.go" 16 | - "blockindex/indexpb" 17 | - "consensus/scheme/rolldpos/endorsementpb" 18 | - "db/trie/triepb" 19 | - "db/mock_kvstore.go" 20 | - "e2etest/*" 21 | - "ioctl/cmd/**/*" 22 | - "ioctl/doc/*" 23 | - "ioctl/flag/*" 24 | - "ioctl/output/*" 25 | - "test/mock/**/*" 26 | - "tools/**/*" 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a bug report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | --- 8 | 9 | 10 | 11 | ### What version of iotex-core image (or code branch) are you using? 12 | 13 | ### What operating system and processor architecture are you using? 14 | 15 | ### What did you do? If possible, provide a recipe for reproducing the error. 16 | 17 | ### What did you expect to see? 18 | 19 | ### What did you see instead? 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Enhancement Request 3 | about: Suggest an enhancement to iotex-core project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | --- 8 | 9 | 10 | 11 | ### What would you like to be added 12 | 13 | ### Why is this needed 14 | 15 | ### How important you think this is for IoTeX 16 | - [] must have 17 | - [] should have 18 | - [] nice to have 19 | 20 | ### Additional information 21 | Let us know any background or context that would help us better understand the request (for example the particular use-case that prompted this request) -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: New feature request to iotex-core project 4 | title: '' 5 | labels: feature 6 | assignees: '' 7 | --- 8 | 9 | 10 | 11 | ### Description of new feature request 12 | 13 | ### Is this a hard-fork (and height to be activated) 14 | - [] Yes 15 | - Name of activation height: 16 | 17 | ### Implementation plan 18 | - [] Phase 1 description (PR number) 19 | - [] Phase 2 description (PR number) 20 | - [] Phase 3 description (PR number) 21 | 22 | ### Affected modules 23 | - [] action 24 | - [] actpool 25 | - [] api 26 | - [] blockchain 27 | - [] blockindex 28 | - [] blocksync 29 | - [] chainservice 30 | - [] config 31 | - [] consensus 32 | - [] db 33 | - [] dispatcher 34 | - [] ioctl 35 | - [] p2p 36 | - [] server 37 | - [] state 38 | - [] tools 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/refactor.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Code refactor 3 | about: File a code refactor task 4 | title: '' 5 | labels: refactor 6 | assignees: '' 7 | --- 8 | 9 | 10 | 11 | ### Description of the code refactor 12 | 13 | ### Why is this needed 14 | - [] better/less memory usage 15 | - [] reduce running time 16 | - [] clean (easy-to-understand) data structure or algorithm 17 | - [] remove dead code 18 | - [] better code design or structure (like reduce complexity) 19 | - [] reduce/decouple dependencies between code modules 20 | - [] increase test coverage 21 | - [] better code readability 22 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | template: | 4 | # What's Changed 5 | 6 | 7 | $CHANGES 8 | 9 | 10 | **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION 11 | 12 | categories: 13 | - title: 'Breaking' 14 | label: 'type: breaking' 15 | - title: 'New' 16 | label: 'type: feature' 17 | - title: 'Bug Fixes' 18 | label: 'type: bug' 19 | - title: 'Maintenance' 20 | label: 'type: maintenance' 21 | - title: 'Documentation' 22 | label: 'type: docs' 23 | - title: 'Other changes' 24 | - title: 'Dependency Updates' 25 | label: 'type: dependencies' 26 | collapse-after: 5 27 | 28 | version-resolver: 29 | major: 30 | labels: 31 | - 'type: breaking' 32 | minor: 33 | labels: 34 | - 'type: feature' 35 | patch: 36 | labels: 37 | - 'type: bug' 38 | - 'type: maintenance' 39 | - 'type: docs' 40 | - 'type: dependencies' 41 | - 'type: security' 42 | 43 | exclude-labels: 44 | - 'skip-changelog' 45 | -------------------------------------------------------------------------------- /.github/workflows/analysis.yaml: -------------------------------------------------------------------------------- 1 | name: "Code Scanning - CodeQL" 2 | 3 | on: 4 | schedule: 5 | - cron: "30 0 * * *" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | CodeQL-Build: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | security-events: write 13 | 14 | actions: read 15 | contents: read 16 | 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v3 20 | 21 | - name: Initialize CodeQL 22 | uses: github/codeql-action/init@v2 23 | with: 24 | languages: go 25 | 26 | - run: | 27 | make build 28 | 29 | - name: Perform CodeQL Analysis 30 | uses: github/codeql-action/analyze@v2 31 | -------------------------------------------------------------------------------- /.github/workflows/chatgpt.yaml: -------------------------------------------------------------------------------- 1 | name: ChatGPT Code Review 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize] 6 | 7 | jobs: 8 | CodeReview: 9 | permissions: write-all 10 | name: ChatGPT Code Review 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: fitomad/github-chatgpt-integration@main 14 | with: 15 | openai-api-key: ${{ secrets.OPENAI_TOKEN }} 16 | github-token: ${{ secrets.GITHUB_TOKEN }} 17 | github-pr-id: ${{ github.event.number }} 18 | dev-lang: Go 19 | openai-max-tokens: 3072 20 | #openai-engine: "code-davinci-002" # "gpt-4" 21 | #exclude-dir: "" 22 | -------------------------------------------------------------------------------- /.github/workflows/gosec.yaml: -------------------------------------------------------------------------------- 1 | name: "Code Scanning -Gosec" 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * *" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | tests: 10 | runs-on: ubuntu-latest 11 | env: 12 | GO111MODULE: on 13 | steps: 14 | - name: Checkout Source 15 | uses: actions/checkout@v3 16 | 17 | - name: Run Gosec Security Scanner 18 | uses: securego/gosec@master 19 | with: 20 | args: "-no-fail -fmt sarif -out results.sarif ./..." 21 | 22 | - name: Upload SARIF file 23 | uses: github/codeql-action/upload-sarif@v1 24 | with: 25 | sarif_file: results.sarif 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | *.db 4 | 5 | .cache 6 | .vscode 7 | 8 | *.DS_Store 9 | .AppleDouble 10 | .LSOverride 11 | 12 | # profiling output 13 | pprof* 14 | 15 | # Binaries for programs and plugins 16 | *.a 17 | *.exe 18 | *.dll 19 | *.dylib 20 | *.pyc 21 | 22 | # Test binary, build with `go test -c` 23 | data/* 24 | *.test 25 | *.gz 26 | 27 | #git patch 28 | *.patch 29 | 30 | # Output of the go coverage tool, specifically when used with LiteIDE 31 | *.out 32 | 33 | # wallet date file 34 | *.dat 35 | 36 | # binary 37 | bin/* 38 | */release 39 | coverage.txt 40 | *.log 41 | .editorconfig 42 | 43 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.4.0 4 | hooks: 5 | - id: detect-private-key 6 | - id: detect-aws-credentials 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to IoTeX Core 2 | ============================ 3 | 4 | The IoTeX Core project operates an open contributor model where anyone is welcome to contribute towards development in the form of peer review, testing and patches. If you are interested in contributing to the project then checkout the [Contributor's Guide](https://github.com/iotexproject/iotex-core/wiki/IoTex-Contributor-Guide) 5 | 6 | Copyright 7 | --------- 8 | 9 | By contributing to this repository, you agree to license your work under the 10 | Apache 2.0 license. Any work contributed where you are not the original 11 | author must contain its license header with the original author(s) and source. 12 | -------------------------------------------------------------------------------- /action/protocol/abiutil/abiutil.go: -------------------------------------------------------------------------------- 1 | package abiutil 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/ethereum/go-ethereum/accounts/abi" 7 | ) 8 | 9 | // MustLoadMethod must load abi method 10 | func MustLoadMethod(abiStr, method string) abi.Method { 11 | _interface, err := abi.JSON(strings.NewReader(abiStr)) 12 | if err != nil { 13 | panic(err) 14 | } 15 | _method, ok := _interface.Methods[method] 16 | if !ok { 17 | panic("fail to load the method") 18 | } 19 | return _method 20 | } 21 | -------------------------------------------------------------------------------- /action/protocol/account/accountpb/account.proto: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | // To compile the proto, run: 7 | // protoc --go_out=plugins=grpc:. *.proto 8 | syntax = "proto3"; 9 | package accountpb; 10 | option go_package = "github.com/iotexproject/iotex-core/action/protocol/account/accountpb"; 11 | 12 | enum AccountType { 13 | DEFAULT = 0; 14 | ZERO_NONCE = 1; 15 | } 16 | 17 | message Account { 18 | // used by state-based model 19 | uint64 nonce = 1; 20 | string balance = 2; 21 | bytes root = 3; 22 | bytes codeHash = 4; 23 | bool isCandidate = 5; 24 | bytes votingWeight = 6; 25 | AccountType type = 7; 26 | } 27 | -------------------------------------------------------------------------------- /action/protocol/execution/evm/context.go: -------------------------------------------------------------------------------- 1 | package evm 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/iotexproject/iotex-core/v2/action/protocol" 7 | "github.com/iotexproject/iotex-core/v2/pkg/log" 8 | ) 9 | 10 | type ( 11 | helperContextKey struct{} 12 | 13 | // HelperContext is the context for EVM helper 14 | HelperContext struct { 15 | GetBlockHash GetBlockHash 16 | GetBlockTime GetBlockTime 17 | DepositGasFunc protocol.DepositGas 18 | } 19 | ) 20 | 21 | // WithHelperCtx returns a new context with helper context 22 | func WithHelperCtx(ctx context.Context, hctx HelperContext) context.Context { 23 | return context.WithValue(ctx, helperContextKey{}, hctx) 24 | } 25 | 26 | // mustGetHelperCtx returns the helper context from the context 27 | func mustGetHelperCtx(ctx context.Context) HelperContext { 28 | hc, ok := ctx.Value(helperContextKey{}).(HelperContext) 29 | if !ok { 30 | log.S().Panic("Miss evm helper context") 31 | } 32 | return hc 33 | } 34 | -------------------------------------------------------------------------------- /action/protocol/execution/executionpb/execution.proto: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | // To compile the proto, run: 7 | // protoc --go_out=plugins=grpc:. *.proto 8 | syntax = "proto3"; 9 | package executionpb; 10 | 11 | message EvmTransfer { 12 | string amount = 1; 13 | string from = 2; 14 | string to = 3; 15 | } 16 | 17 | message EvmTransferList { 18 | repeated EvmTransfer evmTransfers = 1; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/basefee.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.24; 3 | 4 | contract BaseFeeTest { 5 | function getBaseFee() public view returns (uint256) { 6 | uint256 baseFee; 7 | assembly { 8 | baseFee := basefee() 9 | } 10 | return baseFee; 11 | } 12 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/blobbasefee.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.24; 3 | 4 | contract BlobBaseFeeTest { 5 | function getBlobBaseFee() public view returns (uint256) { 6 | uint256 blobBaseFee; 7 | assembly { 8 | blobBaseFee := blobbasefee() 9 | } 10 | return blobBaseFee; 11 | } 12 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/blobhash.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.24; 3 | 4 | contract BlobHashTest { 5 | function getBlobHash() public view returns (bytes32) { 6 | bytes32 hash; 7 | assembly { 8 | hash := blobhash(0) 9 | } 10 | return hash; 11 | } 12 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/mcopy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.25; 3 | 4 | contract MemoryCopyExample { 5 | function copyData() public pure returns (bytes memory) { 6 | bytes memory source = new bytes(5); 7 | bytes memory dest = new bytes(5); 8 | 9 | source[0] = 0x41; // 'A' 10 | source[1] = 0x42; // 'B' 11 | source[2] = 0x43; // 'C' 12 | source[3] = 0x44; // 'D' 13 | source[4] = 0x45; // 'E' 14 | 15 | assembly { 16 | mcopy(add(dest, 0x20), add(source, 0x20), 5) 17 | } 18 | 19 | return dest; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/point_evaluation.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.25; 3 | 4 | contract PointEvaluationTest { 5 | 6 | function evaluate() public view returns (bytes memory) { 7 | bytes memory input = new bytes(192); 8 | input = hex"016ba00cade4653a609ffbfb20363fbc5ec4d09f58f3598fc96677a2aaad283701020000000000000000000000000000000000000000000000000000000000004694f6339d1000d34e693cb767c18c5050fe74ec37e131d4edbe67981ab684daacf5a66c385c699499e40c9b33631bd23341229b9766dad873f04850fcea87309152dbf33f71001495d94772a596f140874a7613e31ecf82254e385162167d6a0909fd5deec5a0dba6ee660dd079a5fe863cc22d2b6dd0a4d64e6218945d8ce9"; 9 | // call precompile contract 10 | (bool ok, bytes memory out) = address(0x0a).staticcall(input); 11 | require(ok); 12 | return out; 13 | } 14 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/selfdestruct_oncreation.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.24; 3 | 4 | // this is the contract for "_selfdestructOnCreationContract" under blockchain/integrity 5 | 6 | contract SelfDestructOnCreation { 7 | address payable public owner; 8 | 9 | constructor() payable { 10 | owner = payable(msg.sender); // Set contract deployer as owner 11 | selfdestruct(owner); // Self-destruct the contract immediately, sending any funds to the recipient 12 | } 13 | 14 | // Function to check balance of the contract 15 | function getBalance() external view returns (uint256) { 16 | return address(this).balance; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/selfdestruction.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.24; 3 | 4 | contract SelfDestructExample { 5 | address payable public owner; 6 | 7 | constructor() { 8 | owner = payable(msg.sender); // Set contract deployer as owner 9 | } 10 | 11 | // Function to self-destruct the contract 12 | function terminate() external { 13 | require(msg.sender == owner, "Only the owner can destroy the contract"); 14 | selfdestruct(owner); // Send remaining funds to the owner and destroy the contract 15 | } 16 | 17 | // Fallback function to receive Ether 18 | receive() external payable {} 19 | 20 | // Function to check balance of the contract 21 | function getBalance() external view returns (uint256) { 22 | return address(this).balance; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-cancun/transientstorage.sol: -------------------------------------------------------------------------------- 1 | // This support was introduced with Solidity 0.8.24 2 | pragma solidity 0.8.24; 3 | // SPDX-License-Identifier: Unlicensed 4 | 5 | contract TransientStorage { 6 | 7 | // Sets a number in the transient storage 8 | function getNumber() public returns (uint) { 9 | tstore(0, uint(33)); 10 | return uint(tload(0)); 11 | } 12 | 13 | // Sets an address in the transient storage 14 | function getAddress() public returns (address) { 15 | tstore(1, uint(uint160(address(3)))); 16 | return address(uint160(tload(1))); 17 | } 18 | 19 | function tstore(uint location, uint value) public { 20 | assembly { 21 | tstore(location, value) 22 | } 23 | } 24 | 25 | function tload(uint location) public view returns (uint value) { 26 | assembly { 27 | value := tload(location) 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/array-return.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | contract A { 3 | 4 | uint[] xs; 5 | 6 | function Apush() internal { 7 | xs.push(100); 8 | xs.push(200); 9 | xs.push(300); 10 | } 11 | 12 | // can be called from web3 13 | function foo() public view returns(uint[] memory) { 14 | return xs; 15 | } 16 | } 17 | 18 | // trying to call foo from another contract does not work 19 | contract B { 20 | 21 | A a; 22 | 23 | function Bnew() internal { 24 | a = new A(); 25 | } 26 | 27 | // COMPILATION ERROR 28 | // Return argument type inaccessible dynamic type is not implicitly convertible 29 | // to expected type (type of first return variable) uint256[] memory. 30 | function bar() public view returns(uint[] memory) { 31 | return a.foo(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/basic-token.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | 3 | contract BasicToken { 4 | 5 | mapping(address => uint256) balances; 6 | 7 | function transfer(address recipient, uint256 value) public { 8 | if (balances[msg.sender] >= value) { 9 | balances[msg.sender] -= value; 10 | } 11 | balances[recipient] += value; 12 | } 13 | 14 | function balanceOf(address account) public view returns (uint256) { 15 | return balances[account]; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/call-dynamic.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | 3 | contract MyContract { 4 | 5 | uint x = 0; 6 | 7 | function foo(uint256 _x) public { 8 | x = 10 + _x; 9 | } 10 | 11 | function bar() public returns(uint) { 12 | address(this).call(abi.encodeWithSignature('foo(uint256)', 1)); 13 | return x; // returns 11 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/chainid-selfbalance.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | 3 | contract ChainidAndSelfbalance { 4 | uint256 counter = 0; 5 | 6 | function getChainID() public view returns (uint256) { 7 | return block.chainid; 8 | } 9 | 10 | function getSelfBalance() public view returns (uint256) { 11 | return address(this).balance; 12 | } 13 | 14 | function increment() public { 15 | counter++; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/changestate.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | 3 | contract ChangeState { 4 | uint public n = 0; 5 | event Log(uint n); 6 | function ChangeStateWithLogFail(uint add) public { 7 | n += add; 8 | emit Log(n); 9 | require(false); 10 | n++; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/datacopy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.3; 2 | 3 | contract Datacopy { 4 | bytes store; 5 | function dataCopy() public { 6 | bytes memory arr = new bytes(3); 7 | arr[0] = 0x11; 8 | arr[1] = 0x22; 9 | arr[2] = 0x33; 10 | uint length = arr.length; 11 | bytes memory result = new bytes(3); 12 | bool ret; 13 | assembly { 14 | // Call precompiled contract to copy data 15 | ret := staticcall(0x10000, 0x04, add(arr, 0x20), length, add(arr, 0x21), length) 16 | returndatacopy(add(result, 0x20), 0x00, length) 17 | } 18 | updateStore(result); 19 | } 20 | 21 | function updateStore(bytes memory ret) internal { 22 | store = ret; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/f.value.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | contract One{ 3 | string public word; 4 | 5 | function setMsg(string calldata whatever) public { 6 | word = whatever; 7 | } 8 | function getMsg() public returns(string memory) { 9 | return word; 10 | } 11 | } 12 | 13 | contract Two{ 14 | One o; 15 | constructor(address one){ 16 | o = One(one); 17 | o.setMsg("test"); 18 | } 19 | function getMsg() public returns(string memory){ 20 | return o.getMsg(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/gas-test.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | contract tester { 3 | string public A; 4 | event logTest(uint n); 5 | function test(uint mul,uint shift,uint add,uint log) public returns (uint a){ 6 | a = 7; 7 | for (uint i=0;i Data) public items; 8 | constructor() { 9 | items[0] = Data(1,2); 10 | items[1] = Data(3,4); 11 | items[2] = Data(5,6); 12 | delete items[1]; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/modifiers.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | contract MyContract { 3 | 4 | bool locked = false; 5 | 6 | modifier validAddress(address account) { 7 | if (account == address(0x0)) { revert(); } 8 | _; 9 | } 10 | 11 | modifier greaterThan(uint value, uint limit) { 12 | if(value <= limit) { revert(); } 13 | _; 14 | } 15 | 16 | modifier lock() { 17 | if(locked) { 18 | locked = true; 19 | _; 20 | locked = false; 21 | } 22 | } 23 | 24 | function f(address account) public validAddress(account) {} 25 | function g(uint a) public greaterThan(a, 10) {} 26 | function refund() public payable { 27 | payable(msg.sender).transfer(0); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/no-variable-length-returns.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | 3 | contract A { 4 | bytes8[] stuff; 5 | function get() public view returns(bytes8[] memory) { 6 | return stuff; 7 | } 8 | } 9 | 10 | contract B { 11 | A a; 12 | bytes8[] mystuff; 13 | function assign(address _a) public { 14 | a = A(_a); 15 | } 16 | 17 | function copyToMemory() public view { 18 | // VM does not support variably-sized return types from external function calls 19 | // (ERROR: Type inaccessible dynamic type is not implicitly convertible...) 20 | bytes8[] memory stuff = a.get(); 21 | } 22 | 23 | function copyToStorage() public { 24 | // ERROR 25 | mystuff = a.get(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/public-mapping.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | contract AA { 3 | mapping(uint => uint) public objects; 4 | 5 | function Set() public { 6 | objects[0] = 42; 7 | } 8 | } 9 | 10 | contract BB { 11 | // insert address of deployed First here 12 | AA a; 13 | function setContract(address addr) public { 14 | a = AA(addr); 15 | } 16 | 17 | function get() public view returns(uint) { 18 | return a.objects(0); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/self-destruct.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >0.6.0; 2 | contract Storage { 3 | address payable private owner; 4 | uint256 number; 5 | 6 | constructor() { 7 | owner = payable(msg.sender); 8 | } 9 | 10 | function store(uint256 num) public { 11 | number = num; 12 | } 13 | 14 | function retrieve() public view returns (uint256){ 15 | return number; 16 | } 17 | 18 | function close() public { 19 | selfdestruct(owner); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/send-eth.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | contract MyContract { 3 | constructor() payable {} 4 | address a = 0x1e14d5373E1AF9Cc77F0032aD2cd0FBA8be5Ea2e; 5 | function transferTo() public payable{} 6 | function foo() public { 7 | 8 | // send ether with default 21,000 gas 9 | // likely causes OOG in callee 10 | payable(a).send(1 ether); 11 | 12 | // send ether with all remaining gas 13 | // but no success check! 14 | payable(a).call{value: 1 ether}(""); 15 | 16 | // RECOMMENDED 17 | // send all remaining gas 18 | // explicitly handle callee throw 19 | bool ok; 20 | bytes memory ret; 21 | (ok, ret) = a.call{value: 1 ether}(""); 22 | if(!ok) revert(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-istanbul/storage-test.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.4; 2 | contract tester { 3 | string[] public A; 4 | function storeStrings(string memory a,int n) public{ 5 | for (int i=0;i uint256) balances; 7 | 8 | function transfer(address recipient, uint256 value) public { 9 | if (balances[msg.sender] >= value) { 10 | balances[msg.sender] -= value; 11 | } 12 | balances[recipient] += value; 13 | } 14 | 15 | function balanceOf(address account) public view returns (uint256) { 16 | return balances[account]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/call-dynamic.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | uint256 x = 0; 7 | 8 | function foo(uint256 _x) public { 9 | x = 10 + _x; 10 | } 11 | 12 | function bar() public returns (uint256) { 13 | address(this).call(abi.encodeWithSignature("foo(uint256)", 1)); 14 | return x; // returns 11 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/chainid-selfbalance.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract ChainidAndSelfbalance { 6 | uint256 counter = 0; 7 | 8 | function getChainID() public view returns (uint256) { 9 | return block.chainid; 10 | } 11 | 12 | function getSelfBalance() public view returns (uint256) { 13 | return address(this).balance; 14 | } 15 | 16 | function increment() public { 17 | counter++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/changestate.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract ChangeState { 6 | uint256 public n = 0; 7 | event Log(uint256 n); 8 | 9 | function ChangeStateWithLogFail(uint256 add) public { 10 | n += add; 11 | emit Log(n); 12 | require(false); 13 | n++; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/datacopy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract Datacopy { 6 | bytes store; 7 | 8 | function dataCopy() public { 9 | bytes memory arr = new bytes(3); 10 | arr[0] = 0x11; 11 | arr[1] = 0x22; 12 | arr[2] = 0x33; 13 | uint256 length = arr.length; 14 | bytes memory result = new bytes(3); 15 | bool ret; 16 | assembly { 17 | // Call precompiled contract to copy data 18 | ret := staticcall( 19 | 0x10000, 20 | 0x04, 21 | add(arr, 0x20), 22 | length, 23 | add(arr, 0x21), 24 | length 25 | ) 26 | returndatacopy(add(result, 0x20), 0x00, length) 27 | } 28 | updateStore(result); 29 | } 30 | 31 | function updateStore(bytes memory ret) internal { 32 | store = ret; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/difficulty.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity =0.8.17; 4 | 5 | contract Difficulty { 6 | 7 | function diffi() public view returns (uint256 r) { 8 | assembly { 9 | r := difficulty() 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/f.value.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract One { 6 | string public word; 7 | 8 | function setMsg(string calldata whatever) public { 9 | word = whatever; 10 | } 11 | 12 | function getMsg() public view returns (string memory) { 13 | return word; 14 | } 15 | } 16 | 17 | contract Two { 18 | One o; 19 | 20 | constructor(address one) { 21 | o = One(one); 22 | o.setMsg("test"); 23 | } 24 | 25 | function getMsg() public view returns (string memory) { 26 | return o.getMsg(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/factory.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract A { 6 | uint256[] public amounts; 7 | 8 | function init(uint256[] memory _amounts) public { 9 | amounts = _amounts; 10 | } 11 | } 12 | 13 | contract Factory { 14 | struct AData { 15 | uint256[] amounts; 16 | } 17 | mapping(address => AData) listOfData; 18 | 19 | function set(uint256[] memory _amounts) public { 20 | listOfData[msg.sender] = AData(_amounts); 21 | } 22 | 23 | function make() public returns (address) { 24 | A a = new A(); 25 | a.init(listOfData[msg.sender].amounts); 26 | return address(a); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/gas-test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract tester { 6 | string public A; 7 | event logTest(uint256 n); 8 | 9 | function test( 10 | uint256 mul, 11 | uint256 shift, 12 | uint256 add, 13 | uint256 log 14 | ) public returns (uint256 a) { 15 | a = 7; 16 | for (uint256 i = 0; i < mul; i++) { 17 | a = (a * 10007) % 100000007; 18 | } 19 | for (uint256 i = 0; i < shift; i++) { 20 | a = i << 7; 21 | } 22 | for (uint256 i = 0; i < add; i++) { 23 | a = (a + 100000009) % 10007; 24 | } 25 | for (uint256 i = 0; i < log; i++) { 26 | emit logTest(i); 27 | } 28 | } 29 | 30 | function storeString(string memory a) public { 31 | A = a; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/infiniteloop.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract SimpleStorage { 6 | uint256 storedData; 7 | 8 | event Set(uint256); 9 | event Get(address, uint256); 10 | event Deadlock(); 11 | 12 | function set(uint256 x) public { 13 | storedData = x; 14 | emit Set(x); 15 | } 16 | 17 | function get(address _to) public returns (uint256) { 18 | require(_to != address(0)); 19 | emit Get(_to, storedData); 20 | return storedData; 21 | } 22 | 23 | function infinite() public { 24 | while (true) { 25 | storedData++; 26 | } 27 | emit Deadlock(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/mapping-delete.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | struct Data { 7 | uint256 a; 8 | uint256 b; 9 | } 10 | mapping(uint256 => Data) public items; 11 | 12 | constructor() { 13 | items[0] = Data(1, 2); 14 | items[1] = Data(3, 4); 15 | items[2] = Data(5, 6); 16 | delete items[1]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/modifiers.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | bool locked = false; 7 | 8 | modifier validAddress(address account) { 9 | if (account == address(0x0)) { 10 | revert(); 11 | } 12 | _; 13 | } 14 | 15 | modifier greaterThan(uint256 value, uint256 limit) { 16 | if (value <= limit) { 17 | revert(); 18 | } 19 | _; 20 | } 21 | 22 | modifier lock() { 23 | if (locked) { 24 | locked = true; 25 | _; 26 | locked = false; 27 | } 28 | } 29 | 30 | function f(address account) public validAddress(account) {} 31 | 32 | function g(uint256 a) public greaterThan(a, 10) {} 33 | 34 | function refund() public payable { 35 | payable(msg.sender).transfer(0); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/no-variable-length-returns.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract A { 6 | bytes8[] stuff; 7 | 8 | function get() public view returns (bytes8[] memory) { 9 | return stuff; 10 | } 11 | } 12 | 13 | contract B { 14 | A a; 15 | bytes8[] mystuff; 16 | 17 | function assign(address _a) public { 18 | a = A(_a); 19 | } 20 | 21 | function copyToMemory() public view { 22 | // VM does not support variably-sized return types from external function calls 23 | // (ERROR: Type inaccessible dynamic type is not implicitly convertible...) 24 | bytes8[] memory stuff = a.get(); 25 | } 26 | 27 | function copyToStorage() public { 28 | // ERROR 29 | mystuff = a.get(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/public-mapping.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract AA { 6 | mapping(uint256 => uint256) public objects; 7 | 8 | function Set() public { 9 | objects[0] = 42; 10 | } 11 | } 12 | 13 | contract BB { 14 | // insert address of deployed First here 15 | AA a; 16 | 17 | function setContract(address addr) public { 18 | a = AA(addr); 19 | } 20 | 21 | function get() public view returns (uint256) { 22 | return a.objects(0); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/push0.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.8.20; 4 | 5 | contract SimpleStorage { 6 | 7 | uint256 favoriteNumber; 8 | 9 | function retrieve() public view returns (uint256){ 10 | return favoriteNumber; 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/self-destruct.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract Storage { 6 | address payable private owner; 7 | uint256 number; 8 | 9 | constructor() { 10 | owner = payable(msg.sender); 11 | } 12 | 13 | function store(uint256 num) public { 14 | number = num; 15 | } 16 | 17 | function retrieve() public view returns (uint256) { 18 | return number; 19 | } 20 | 21 | function close() public { 22 | selfdestruct(owner); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/send-eth.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | constructor() payable {} 7 | 8 | address a = 0x1e14d5373E1AF9Cc77F0032aD2cd0FBA8be5Ea2e; 9 | 10 | function transferTo() public payable {} 11 | 12 | function foo() public { 13 | // send ether with default 21,000 gas 14 | // likely causes OOG in callee 15 | payable(a).transfer(1 ether); 16 | 17 | // send ether with all remaining gas 18 | // but no success check! 19 | payable(a).call{value: 1 ether}(""); 20 | 21 | // RECOMMENDED 22 | // send all remaining gas 23 | // explicitly handle callee throw 24 | bool ok; 25 | bytes memory ret; 26 | (ok, ret) = a.call{value: 1 ether}(""); 27 | if (!ok) revert(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/storage-test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract tester { 6 | string[] public A; 7 | 8 | function storeStrings(string memory a, int256 n) public { 9 | for (int256 i = 0; i < n; i++) { 10 | A.push(a); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/tail-recursion.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | // naive recursion 7 | function sum(uint256 n) public returns (uint256) { 8 | return n == 0 ? 0 : n + sum(n - 1); 9 | } 10 | 11 | // loop 12 | function sumloop(uint256 n) public pure returns (uint256) { 13 | uint256 total = 0; 14 | for (uint256 i = 1; i <= n; i++) { 15 | total += i; 16 | } 17 | return total; 18 | } 19 | 20 | // tail-recursion 21 | function sumtailHelper(uint256 n, uint256 acc) private returns (uint256) { 22 | return n == 0 ? acc : sumtailHelper(n - 1, acc + n); 23 | } 24 | 25 | function sumtail(uint256 n) public returns (uint256) { 26 | return sumtailHelper(n, 0); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/tuple.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract A { 6 | function tuple() public pure returns (uint256, string memory) { 7 | return (1, "Hi"); 8 | } 9 | 10 | function getOne() public pure returns (uint256) { 11 | uint256 a; 12 | (a, ) = tuple(); 13 | return a; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-london/wireconnection.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | abstract contract Feline { 6 | // This is how we write the abstract contract 7 | bytes32 name; 8 | 9 | function setname(bytes32 _name) public { 10 | name = _name; 11 | } 12 | 13 | function utterance() public virtual returns (bytes32); 14 | 15 | function Utterance() public virtual returns (bytes32); 16 | } 17 | 18 | // inherit the contract in cat and then override the function utterance with some full definition 19 | contract Cat is Feline { 20 | function utterance() public pure override returns (bytes32) { 21 | return "miaow"; 22 | } 23 | 24 | function Utterance() public pure override returns (bytes32) { 25 | return utterance(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/array-return.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract A { 6 | uint256[] xs; 7 | 8 | function Apush() internal { 9 | xs.push(100); 10 | xs.push(200); 11 | xs.push(300); 12 | } 13 | 14 | // can be called from web3 15 | function foo() public view returns (uint256[] memory) { 16 | return xs; 17 | } 18 | } 19 | 20 | // trying to call foo from another contract does not work 21 | contract B { 22 | A a; 23 | 24 | function Bnew() internal { 25 | a = new A(); 26 | } 27 | 28 | // COMPILATION ERROR 29 | // Return argument type inaccessible dynamic type is not implicitly convertible 30 | // to expected type (type of first return variable) uint256[] memory. 31 | function bar() public view returns (uint256[] memory) { 32 | return a.foo(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/basefee.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract One { 6 | function getBaseFee() public view returns (uint256) { 7 | return block.basefee; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/basic-token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract BasicToken { 6 | mapping(address => uint256) balances; 7 | 8 | function transfer(address recipient, uint256 value) public { 9 | if (balances[msg.sender] >= value) { 10 | balances[msg.sender] -= value; 11 | } 12 | balances[recipient] += value; 13 | } 14 | 15 | function balanceOf(address account) public view returns (uint256) { 16 | return balances[account]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/call-dynamic.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | uint256 x = 0; 7 | 8 | function foo(uint256 _x) public { 9 | x = 10 + _x; 10 | } 11 | 12 | function bar() public returns (uint256) { 13 | address(this).call(abi.encodeWithSignature("foo(uint256)", 1)); 14 | return x; // returns 11 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/chainid-selfbalance.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract ChainidAndSelfbalance { 6 | uint256 counter = 0; 7 | 8 | function getChainID() public view returns (uint256) { 9 | return block.chainid; 10 | } 11 | 12 | function getSelfBalance() public view returns (uint256) { 13 | return address(this).balance; 14 | } 15 | 16 | function increment() public { 17 | counter++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/changestate.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract ChangeState { 6 | uint256 public n = 0; 7 | event Log(uint256 n); 8 | 9 | function ChangeStateWithLogFail(uint256 add) public { 10 | n += add; 11 | emit Log(n); 12 | require(false); 13 | n++; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/datacopy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract Datacopy { 6 | bytes store; 7 | 8 | function dataCopy() public { 9 | bytes memory arr = new bytes(3); 10 | arr[0] = 0x11; 11 | arr[1] = 0x22; 12 | arr[2] = 0x33; 13 | uint256 length = arr.length; 14 | bytes memory result = new bytes(3); 15 | bool ret; 16 | assembly { 17 | // Call precompiled contract to copy data 18 | ret := staticcall( 19 | 0x10000, 20 | 0x04, 21 | add(arr, 0x20), 22 | length, 23 | add(arr, 0x21), 24 | length 25 | ) 26 | returndatacopy(add(result, 0x20), 0x00, length) 27 | } 28 | updateStore(result); 29 | } 30 | 31 | function updateStore(bytes memory ret) internal { 32 | store = ret; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/f.value.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract One { 6 | string public word; 7 | 8 | function setMsg(string calldata whatever) public { 9 | word = whatever; 10 | } 11 | 12 | function getMsg() public view returns (string memory) { 13 | return word; 14 | } 15 | } 16 | 17 | contract Two { 18 | One o; 19 | 20 | constructor(address one) { 21 | o = One(one); 22 | o.setMsg("test"); 23 | } 24 | 25 | function getMsg() public view returns (string memory) { 26 | return o.getMsg(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/factory.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract A { 6 | uint256[] public amounts; 7 | 8 | function init(uint256[] memory _amounts) public { 9 | amounts = _amounts; 10 | } 11 | } 12 | 13 | contract Factory { 14 | struct AData { 15 | uint256[] amounts; 16 | } 17 | mapping(address => AData) listOfData; 18 | 19 | function set(uint256[] memory _amounts) public { 20 | listOfData[msg.sender] = AData(_amounts); 21 | } 22 | 23 | function make() public returns (address) { 24 | A a = new A(); 25 | a.init(listOfData[msg.sender].amounts); 26 | return address(a); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/gas-test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract tester { 6 | string public A; 7 | event logTest(uint256 n); 8 | 9 | function test( 10 | uint256 mul, 11 | uint256 shift, 12 | uint256 add, 13 | uint256 log 14 | ) public returns (uint256 a) { 15 | a = 7; 16 | for (uint256 i = 0; i < mul; i++) { 17 | a = (a * 10007) % 100000007; 18 | } 19 | for (uint256 i = 0; i < shift; i++) { 20 | a = i << 7; 21 | } 22 | for (uint256 i = 0; i < add; i++) { 23 | a = (a + 100000009) % 10007; 24 | } 25 | for (uint256 i = 0; i < log; i++) { 26 | emit logTest(i); 27 | } 28 | } 29 | 30 | function storeString(string memory a) public { 31 | A = a; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/infiniteloop.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract SimpleStorage { 6 | uint256 storedData; 7 | 8 | event Set(uint256); 9 | event Get(address, uint256); 10 | event Deadlock(); 11 | 12 | function set(uint256 x) public { 13 | storedData = x; 14 | emit Set(x); 15 | } 16 | 17 | function get(address _to) public returns (uint256) { 18 | require(_to != address(0)); 19 | emit Get(_to, storedData); 20 | return storedData; 21 | } 22 | 23 | function infinite() public { 24 | while (true) { 25 | storedData++; 26 | } 27 | emit Deadlock(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/mapping-delete.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | struct Data { 7 | uint256 a; 8 | uint256 b; 9 | } 10 | mapping(uint256 => Data) public items; 11 | 12 | constructor() { 13 | items[0] = Data(1, 2); 14 | items[1] = Data(3, 4); 15 | items[2] = Data(5, 6); 16 | delete items[1]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/modifiers.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | bool locked = false; 7 | 8 | modifier validAddress(address account) { 9 | if (account == address(0x0)) { 10 | revert(); 11 | } 12 | _; 13 | } 14 | 15 | modifier greaterThan(uint256 value, uint256 limit) { 16 | if (value <= limit) { 17 | revert(); 18 | } 19 | _; 20 | } 21 | 22 | modifier lock() { 23 | if (locked) { 24 | locked = true; 25 | _; 26 | locked = false; 27 | } 28 | } 29 | 30 | function f(address account) public validAddress(account) {} 31 | 32 | function g(uint256 a) public greaterThan(a, 10) {} 33 | 34 | function refund() public payable { 35 | payable(msg.sender).transfer(0); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/no-variable-length-returns.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract A { 6 | bytes8[] stuff; 7 | 8 | function get() public view returns (bytes8[] memory) { 9 | return stuff; 10 | } 11 | } 12 | 13 | contract B { 14 | A a; 15 | bytes8[] mystuff; 16 | 17 | function assign(address _a) public { 18 | a = A(_a); 19 | } 20 | 21 | function copyToMemory() public view { 22 | // VM does not support variably-sized return types from external function calls 23 | // (ERROR: Type inaccessible dynamic type is not implicitly convertible...) 24 | bytes8[] memory stuff = a.get(); 25 | } 26 | 27 | function copyToStorage() public { 28 | // ERROR 29 | mystuff = a.get(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/prevrandao.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.8.18; 4 | 5 | contract Prevrandao { 6 | 7 | function random() public view returns (uint256 r) { 8 | assembly { 9 | r := prevrandao() 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/public-mapping.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract AA { 6 | mapping(uint256 => uint256) public objects; 7 | 8 | function Set() public { 9 | objects[0] = 42; 10 | } 11 | } 12 | 13 | contract BB { 14 | // insert address of deployed First here 15 | AA a; 16 | 17 | function setContract(address addr) public { 18 | a = AA(addr); 19 | } 20 | 21 | function get() public view returns (uint256) { 22 | return a.objects(0); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/push0.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.8.20; 4 | 5 | contract SimpleStorage { 6 | 7 | uint256 favoriteNumber; 8 | 9 | function retrieve() public view returns (uint256){ 10 | return favoriteNumber; 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/self-destruct.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract Storage { 6 | address payable private owner; 7 | uint256 number; 8 | 9 | constructor() { 10 | owner = payable(msg.sender); 11 | } 12 | 13 | function store(uint256 num) public { 14 | number = num; 15 | } 16 | 17 | function retrieve() public view returns (uint256) { 18 | return number; 19 | } 20 | 21 | function close() public { 22 | selfdestruct(owner); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/send-eth.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | constructor() payable {} 7 | 8 | address a = 0x1e14d5373E1AF9Cc77F0032aD2cd0FBA8be5Ea2e; 9 | 10 | function transferTo() public payable {} 11 | 12 | function foo() public { 13 | // send ether with default 21,000 gas 14 | // likely causes OOG in callee 15 | payable(a).transfer(1 ether); 16 | 17 | // send ether with all remaining gas 18 | // but no success check! 19 | payable(a).call{value: 1 ether}(""); 20 | 21 | // RECOMMENDED 22 | // send all remaining gas 23 | // explicitly handle callee throw 24 | bool ok; 25 | bytes memory ret; 26 | (ok, ret) = a.call{value: 1 ether}(""); 27 | if (!ok) revert(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/storage-test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract tester { 6 | string[] public A; 7 | 8 | function storeStrings(string memory a, int256 n) public { 9 | for (int256 i = 0; i < n; i++) { 10 | A.push(a); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/tail-recursion.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract MyContract { 6 | // naive recursion 7 | function sum(uint256 n) public returns (uint256) { 8 | return n == 0 ? 0 : n + sum(n - 1); 9 | } 10 | 11 | // loop 12 | function sumloop(uint256 n) public pure returns (uint256) { 13 | uint256 total = 0; 14 | for (uint256 i = 1; i <= n; i++) { 15 | total += i; 16 | } 17 | return total; 18 | } 19 | 20 | // tail-recursion 21 | function sumtailHelper(uint256 n, uint256 acc) private returns (uint256) { 22 | return n == 0 ? acc : sumtailHelper(n - 1, acc + n); 23 | } 24 | 25 | function sumtail(uint256 n) public returns (uint256) { 26 | return sumtailHelper(n, 0); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/tuple.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract A { 6 | function tuple() public pure returns (uint256, string memory) { 7 | return (1, "Hi"); 8 | } 9 | 10 | function getOne() public pure returns (uint256) { 11 | uint256 a; 12 | (a, ) = tuple(); 13 | return a; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata-shanghai/wireconnection.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | abstract contract Feline { 6 | // This is how we write the abstract contract 7 | bytes32 name; 8 | 9 | function setname(bytes32 _name) public { 10 | name = _name; 11 | } 12 | 13 | function utterance() public virtual returns (bytes32); 14 | 15 | function Utterance() public virtual returns (bytes32); 16 | } 17 | 18 | // inherit the contract in cat and then override the function utterance with some full definition 19 | contract Cat is Feline { 20 | function utterance() public pure override returns (bytes32) { 21 | return "miaow"; 22 | } 23 | 24 | function Utterance() public pure override returns (bytes32) { 25 | return utterance(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/array-return.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | contract A { 3 | 4 | uint[] xs; 5 | 6 | function A() { 7 | xs.push(100); 8 | xs.push(200); 9 | xs.push(300); 10 | } 11 | 12 | // can be called from web3 13 | function foo() constant returns(uint[]) { 14 | return xs; 15 | } 16 | } 17 | 18 | // trying to call foo from another contract does not work 19 | contract B { 20 | 21 | A a; 22 | 23 | function B() { 24 | a = new A(); 25 | } 26 | 27 | // COMPILATION ERROR 28 | // Return argument type inaccessible dynamic type is not implicitly convertible 29 | // to expected type (type of first return variable) uint256[] memory. 30 | function bar() constant returns(uint[]) { 31 | return a.foo(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/basic-token.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract BasicToken { 4 | 5 | mapping(address => uint256) balances; 6 | 7 | function transfer(address recipient, uint256 value) public { 8 | balances[msg.sender] -= value; 9 | balances[recipient] += value; 10 | } 11 | 12 | function balanceOf(address account) public constant returns (uint256) { 13 | return balances[account]; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/call-dynamic.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract MyContract { 4 | 5 | uint x = 0; 6 | 7 | function foo(uint _x) { 8 | x = 10 + _x; 9 | } 10 | 11 | function bar() constant returns(uint) { 12 | this.call(bytes4(sha3('foo(uint256)')), 1); 13 | return x; // returns 11 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/changestate.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | contract ChangeState { 3 | uint public n = 0; 4 | event Log(uint n); 5 | function ChangeStateWithLogFail(uint add) public { 6 | n += add; 7 | emit Log(n); 8 | require(false); 9 | n++; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/datacopy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.3; 2 | 3 | contract Datacopy { 4 | bytes store; 5 | function dataCopy() public { 6 | bytes memory arr = new bytes(3); 7 | arr[0] = 0x11; 8 | arr[1] = 0x22; 9 | arr[2] = 0x33; 10 | uint length = arr.length; 11 | bytes memory result = new bytes(3); 12 | bool ret; 13 | assembly { 14 | // Call precompiled contract to copy data 15 | ret := staticcall(0x10000, 0x04, add(arr, 0x20), length, add(arr, 0x21), length) 16 | returndatacopy(add(result, 0x20), 0x00, length) 17 | } 18 | updateStore(result); 19 | } 20 | 21 | function updateStore(bytes memory ret) internal { 22 | store = ret; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/f.value.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | contract One{ 3 | string public word; 4 | 5 | function setMsg(string whatever) { 6 | word = whatever; 7 | } 8 | function getMsg() returns(string) { 9 | return word; 10 | } 11 | } 12 | 13 | contract Two{ 14 | One o; 15 | function Two(address one){ 16 | o = One(one); 17 | o.setMsg("test"); 18 | } 19 | function getMsg() returns(string){ 20 | return o.getMsg(); 21 | } 22 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata/factory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract A { 4 | uint[] public amounts; 5 | function init(uint[] _amounts) { 6 | amounts = _amounts; 7 | } 8 | } 9 | 10 | contract Factory { 11 | struct AData { 12 | uint[] amounts; 13 | } 14 | mapping (address => AData) listOfData; 15 | 16 | function set(uint[] _amounts) { 17 | listOfData[msg.sender] = AData(_amounts); 18 | } 19 | 20 | function make() returns(address) { 21 | A a = new A(); 22 | a.init(listOfData[msg.sender].amounts); 23 | return address(a); 24 | } 25 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata/gas-test.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.6.0; 2 | contract tester { 3 | string public A; 4 | event logTest(uint n); 5 | function test(uint mul,uint shift,uint add,uint log) public returns (uint a){ 6 | a = 7; 7 | for (uint i=0;i Data) public items; 8 | function MyContract() { 9 | items[0] = Data(1,2); 10 | items[1] = Data(3,4); 11 | items[2] = Data(5,6); 12 | delete items[1]; 13 | } 14 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata/modifiers.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | contract MyContract { 3 | 4 | bool locked = false; 5 | 6 | modifier validAddress(address account) { 7 | if (account == 0x0) { throw; } 8 | _; 9 | } 10 | 11 | modifier greaterThan(uint value, uint limit) { 12 | if(value <= limit) { throw; } 13 | _; 14 | } 15 | 16 | modifier lock() { 17 | if(locked) { 18 | locked = true; 19 | _; 20 | locked = false; 21 | } 22 | } 23 | 24 | function f(address account) validAddress(account) {} 25 | function g(uint a) greaterThan(a, 10) {} 26 | function refund() lock { 27 | msg.sender.send(0); 28 | } 29 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata/no-variable-length-returns.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | 3 | contract A { 4 | bytes8[] stuff; 5 | function get() constant returns(bytes8[]) { 6 | return stuff; 7 | } 8 | } 9 | 10 | contract B { 11 | A a; 12 | bytes8[] mystuff; 13 | function assign(address _a) { 14 | a = A(_a); 15 | } 16 | 17 | function copyToMemory() { 18 | // VM does not support variably-sized return types from external function calls 19 | // (ERROR: Type inaccessible dynamic type is not implicitly convertible...) 20 | bytes8[] memory stuff = a.get(); 21 | } 22 | 23 | function copyToStorage() { 24 | // ERROR 25 | mystuff = a.get(); 26 | } 27 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata/proposal.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | 3 | /** A proposal contract with O(1) approvals. */ 4 | 5 | contract Proposal { 6 | mapping (address => bool) approvals; 7 | bytes32 public approvalMask; 8 | bytes32 public approver1; 9 | bytes32 public approver2; 10 | bytes32 public target; 11 | 12 | function Proposal() public { 13 | approver1 = 0x00000000000000000000000000000000000000123; 14 | approver2 = bytes32(msg.sender); 15 | target = approver1 | approver2; 16 | } 17 | 18 | function approve(address approver) public { 19 | approvalMask = bytes32(approver) | bytes32(msg.sender); 20 | approvals[approver] = true; 21 | } 22 | 23 | function isApproved() public constant returns(bool) { 24 | return approvalMask == target; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/public-length.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | contract A { 3 | uint[] public nums; 4 | function getNumLength() returns(uint) { 5 | return nums.length; 6 | } 7 | } 8 | 9 | contract B { 10 | A a; 11 | function test() constant returns (uint) { 12 | a=new A(); 13 | // length is not accessible on public array from other contract 14 | //return a.nums.length(); 15 | return a.getNumLength(); 16 | } 17 | } -------------------------------------------------------------------------------- /action/protocol/execution/testdata/public-mapping.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | contract AA { 3 | mapping(uint => uint) public objects; 4 | 5 | function Set() { 6 | objects[0] = 42; 7 | } 8 | } 9 | 10 | contract BB { 11 | // insert address of deployed First here 12 | AA a; 13 | function setContract(address addr) { 14 | a = AA(addr); 15 | } 16 | 17 | function get() returns(uint) { 18 | return a.objects(0); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/self-destruct.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >0.6.0; 2 | contract Storage { 3 | address payable private owner; 4 | uint256 number; 5 | 6 | constructor() { 7 | owner = payable(msg.sender); 8 | } 9 | 10 | function store(uint256 num) public { 11 | number = num; 12 | } 13 | 14 | function retrieve() public view returns (uint256){ 15 | return number; 16 | } 17 | 18 | function close() public { 19 | selfdestruct(owner); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/send-eth.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | contract MyContract { 3 | constructor() public payable {} 4 | address a = 0x1e14d5373E1AF9Cc77F0032aD2cd0FBA8be5Ea2e; 5 | function transferTo()payable{} 6 | function foo() { 7 | 8 | // send ether with default 21,000 gas 9 | // likely causes OOG in callee 10 | a.send(1 ether); 11 | 12 | // send ether with all remaining gas 13 | // but no success check! 14 | a.call.value(1 ether)(); 15 | 16 | // RECOMMENDED 17 | // send all remaining gas 18 | // explicitly handle callee throw 19 | if(!a.call.value(1 ether)()) throw; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /action/protocol/execution/testdata/storage-test.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.6.0; 2 | contract tester { 3 | string[] public A; 4 | function storeStrings(string memory a,int n) public{ 5 | for (int i=0;i coverage.txt 5 | 6 | for dir in $(go list -f '{{.ImportPath}}={{join .TestGoFiles ","}}' ./...);do 7 | array=(${dir//=/ }) 8 | if [ -n "${array[1]}" ]; then 9 | go test -gcflags="all=-N -l" -short -v -coverprofile=coverage.out -covermode=count "${array[0]}" 10 | courtney -l=coverage.out -o=profile.out 11 | if [ -f profile.out ]; then 12 | cat profile.out >> coverage.txt 13 | rm profile.out coverage.out 14 | fi 15 | fi 16 | done 17 | -------------------------------------------------------------------------------- /hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker build --build-arg PACKAGE_COMMIT_ID=$SOURCE_COMMIT --build-arg PACKAGE_VERSION=$DOCKER_TAG --build-arg GIT_STATUS=clean -f $DOCKERFILE_PATH -t $IMAGE_NAME . -------------------------------------------------------------------------------- /ioctl/cmd/ioid/utils.go: -------------------------------------------------------------------------------- 1 | package ioid 2 | 3 | import ( 4 | "encoding/hex" 5 | 6 | "github.com/ethereum/go-ethereum/accounts/abi" 7 | "github.com/iotexproject/iotex-address/address" 8 | 9 | "github.com/iotexproject/iotex-core/v2/ioctl/cmd/action" 10 | ) 11 | 12 | func readContract( 13 | contract address.Address, 14 | contractABI abi.ABI, 15 | method string, 16 | value string, 17 | args ...interface{}, 18 | ) ([]interface{}, error) { 19 | data, err := contractABI.Pack(method, args...) 20 | if err != nil { 21 | return nil, err 22 | } 23 | res, err := action.Read(contract, value, data) 24 | if err != nil { 25 | return nil, err 26 | } 27 | data, _ = hex.DecodeString(res) 28 | return contractABI.Unpack(method, data) 29 | } 30 | -------------------------------------------------------------------------------- /ioctl/cmd/version/version: -------------------------------------------------------------------------------- 1 | 1.0.0 -------------------------------------------------------------------------------- /ioctl/cmd/ws/contracts/gen.go: -------------------------------------------------------------------------------- 1 | package contracts 2 | 3 | //go:generate abigen --abi abis/W3bstreamProver.json --pkg contracts --type W3bstreamProver -out ./w3bstreamprover.go 4 | //go:generate abigen --abi abis/W3bstreamProject.json --pkg contracts --type W3bstreamProject -out ./w3bstreamproject.go 5 | //go:generate abigen --abi abis/ProjectRegistrar.json --pkg contracts --type ProjectRegistrar -out ./projectregistrar.go 6 | //go:generate abigen --abi abis/FleetManagement.json --pkg contracts --type FleetManagement -out ./fleetmanagement.go 7 | //go:generate abigen --abi abis/ProjectDevice.json --pkg contracts --type ProjectDevice -out ./projectdevice.go 8 | //go:generate abigen --abi abis/W3bstreamRouter.json --pkg contracts --type W3bstreamRouter -out ./w3bstreamrouter.go 9 | //go:generate abigen --abi abis/W3bstreamVMType.json --pkg contracts --type W3bstreamVMType -out ./w3bstreamvmtype.go 10 | -------------------------------------------------------------------------------- /ioctl/newcmd/action/xrc20_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/golang/mock/gomock" 7 | "github.com/stretchr/testify/require" 8 | 9 | "github.com/iotexproject/iotex-core/v2/ioctl/config" 10 | "github.com/iotexproject/iotex-core/v2/ioctl/util" 11 | "github.com/iotexproject/iotex-core/v2/test/mock/mock_ioctlclient" 12 | ) 13 | 14 | func TestNewXrc20Cmd(t *testing.T) { 15 | require := require.New(t) 16 | ctrl := gomock.NewController(t) 17 | defer ctrl.Finish() 18 | client := mock_ioctlclient.NewMockClient(ctrl) 19 | client.EXPECT().SelectTranslation(gomock.Any()).Return("xrc20", config.English).AnyTimes() 20 | client.EXPECT().SetEndpointWithFlag(gomock.Any()) 21 | client.EXPECT().SetInsecureWithFlag(gomock.Any()) 22 | 23 | cmd := NewXrc20Cmd(client) 24 | result, err := util.ExecuteCmd(cmd) 25 | require.NoError(err) 26 | require.Contains(result, "Available Commands") 27 | } 28 | -------------------------------------------------------------------------------- /ioctl/newcmd/jwt/jwt_test.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/golang/mock/gomock" 7 | "github.com/stretchr/testify/require" 8 | 9 | "github.com/iotexproject/iotex-core/v2/ioctl/config" 10 | "github.com/iotexproject/iotex-core/v2/ioctl/util" 11 | "github.com/iotexproject/iotex-core/v2/test/mock/mock_ioctlclient" 12 | ) 13 | 14 | func TestNewJwtCmd(t *testing.T) { 15 | require := require.New(t) 16 | ctrl := gomock.NewController(t) 17 | defer ctrl.Finish() 18 | client := mock_ioctlclient.NewMockClient(ctrl) 19 | 20 | client.EXPECT().SelectTranslation(gomock.Any()).Return("jwt", config.English).AnyTimes() 21 | 22 | cmd := NewJwtCmd(client) 23 | result, err := util.ExecuteCmd(cmd) 24 | require.NoError(err) 25 | require.Contains(result, "Available Commands") 26 | } 27 | -------------------------------------------------------------------------------- /ioctl/newcmd/node/node.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "github.com/spf13/cobra" 5 | 6 | "github.com/iotexproject/iotex-core/v2/ioctl" 7 | "github.com/iotexproject/iotex-core/v2/ioctl/config" 8 | ) 9 | 10 | // Multi-language support 11 | var ( 12 | _nodeCmdShorts = map[config.Language]string{ 13 | config.English: "Deal with nodes of IoTeX blockchain", 14 | config.Chinese: "处理IoTeX区块链的节点", 15 | } 16 | ) 17 | 18 | // NewNodeCmd represents the new node command. 19 | func NewNodeCmd(client ioctl.Client) *cobra.Command { 20 | nodeShorts, _ := client.SelectTranslation(_nodeCmdShorts) 21 | 22 | nc := &cobra.Command{ 23 | Use: "node", 24 | Short: nodeShorts, 25 | } 26 | nc.AddCommand(NewNodeDelegateCmd(client)) 27 | nc.AddCommand(NewNodeRewardCmd(client)) 28 | nc.AddCommand(NewNodeProbationlistCmd(client)) 29 | 30 | client.SetEndpointWithFlag(nc.PersistentFlags().StringVar) 31 | client.SetInsecureWithFlag(nc.PersistentFlags().BoolVar) 32 | return nc 33 | } 34 | -------------------------------------------------------------------------------- /ioctl/util/abi_convert.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // vars 8 | var ( 9 | ErrWrongType = errors.New("wrong data type held by interface{}") 10 | ) 11 | 12 | // To32Bytes asserts/converts interface{} to [32]byte 13 | func To32Bytes(v interface{}) ([32]byte, error) { 14 | if b32, ok := v.([32]byte); ok { 15 | return b32, nil 16 | } 17 | return [32]byte{}, ErrWrongType 18 | } 19 | 20 | // ToByteSlice asserts/converts interface{} to []byte 21 | func ToByteSlice(v interface{}) ([]byte, error) { 22 | if b, ok := v.([]byte); ok { 23 | return b, nil 24 | } 25 | return nil, ErrWrongType 26 | } 27 | -------------------------------------------------------------------------------- /ioctl/util/crypt_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package util 7 | 8 | import ( 9 | "testing" 10 | 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestEnc(t *testing.T) { 15 | require := require.New(t) 16 | 17 | data := []struct { 18 | input string 19 | key string 20 | }{ 21 | {"Foo", "Boo"}, 22 | {"Bar", "Car"}, 23 | {"Bar", ""}, 24 | {"", "Car"}, 25 | {"Long input with more than 16 characters", "Car"}, 26 | } 27 | for _, d := range data { 28 | enc, err := Encrypt([]byte(d.input), HashSHA256([]byte(d.key))) 29 | require.NoError(err) 30 | 31 | dec, err := Decrypt(enc, HashSHA256([]byte(d.key))) 32 | require.NoError(err) 33 | 34 | require.Equal(string(dec), d.input) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /logo/IoTeX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotexproject/iotex-core/c82aba788139169800d82bab083e8bd546cad8d2/logo/IoTeX.png -------------------------------------------------------------------------------- /logrotate.conf: -------------------------------------------------------------------------------- 1 | /var/log/s.log { 2 | rotate 30 3 | daily 4 | nocompress 5 | missingok 6 | copytruncate 7 | notifempty 8 | dateext 9 | dateformat -%Y-%m-%d 10 | extension .log 11 | } 12 | -------------------------------------------------------------------------------- /misc/scripts/license_header.txt: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | -------------------------------------------------------------------------------- /misc/scripts/licenseheader.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in $(du -a . | awk '{print $2}' | grep '\.go$' | grep -v '/vendor/' | grep -v 'test/mock' | grep -v '\.pb.go$' | grep -v 'explorer/idl'); do 4 | if !(grep Copyright $f);then 5 | cat misc/scripts/license_header.txt $f > $f.new 6 | mv $f.new $f 7 | fi 8 | done 9 | -------------------------------------------------------------------------------- /misc/scripts/stringer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | go get golang.org/x/tools/cmd/stringer 3 | export PATH=$PATH:"$GOPATH/bin" 4 | find . -name '*_string.go' -type f -not -path "./vendor/*" -not -path "$GOPATH/vendor/*" -delete 5 | go generate `glide nv | grep -v go-build` 6 | -------------------------------------------------------------------------------- /nodeinfo/config.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package nodeinfo 7 | 8 | import "time" 9 | 10 | // Config node config 11 | type Config struct { 12 | EnableBroadcastNodeInfo bool `yaml:"enableBroadcastNodeInfo"` 13 | BroadcastNodeInfoInterval time.Duration `yaml:"broadcastNodeInfoInterval"` 14 | BroadcastListTTL time.Duration `yaml:"broadcastListTTL"` 15 | NodeMapSize int `yaml:"nodeMapSize"` 16 | } 17 | 18 | // DefaultConfig is the default config 19 | var DefaultConfig = Config{ 20 | EnableBroadcastNodeInfo: false, 21 | BroadcastNodeInfoInterval: 5 * time.Minute, 22 | BroadcastListTTL: 30 * time.Minute, 23 | NodeMapSize: 1000, 24 | } 25 | -------------------------------------------------------------------------------- /pkg/enc/enc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package enc 7 | 8 | import ( 9 | "encoding/binary" 10 | ) 11 | 12 | // MachineEndian is the endianess of the machine 13 | var MachineEndian = binary.LittleEndian 14 | -------------------------------------------------------------------------------- /pkg/fastrand/fastrand.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package fastrand 7 | 8 | import ( 9 | _ "unsafe" // for go link runtime fastrand 10 | ) 11 | 12 | // Uint32 returns a random 32-bit 13 | // 14 | //go:linkname Uint32 runtime.fastrand 15 | func Uint32() uint32 16 | 17 | // Uint32n returns a random 32-bit in the range [0..n). 18 | // 19 | //go:linkname Uint32n runtime.fastrandn 20 | func Uint32n(n uint32) uint32 21 | 22 | // Read generates len(p) random bytes and writes them into p 23 | func Read(p []byte) (n int) { 24 | for n < len(p) { 25 | val := Uint32() 26 | i := 0 27 | for ; i < 4; i++ { 28 | if n+i > len(p)-1 { 29 | break 30 | } 31 | p[n+i] = byte(val) 32 | val >>= 8 33 | } 34 | n = n + i 35 | } 36 | return 37 | } 38 | -------------------------------------------------------------------------------- /pkg/fastrand/fastrand_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package fastrand 7 | 8 | import ( 9 | "testing" 10 | 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestRead(t *testing.T) { 15 | for _, test := range []int{16, 17} { 16 | p := make([]byte, test) 17 | n := Read(p) 18 | require.Equal(t, test, n) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/lifecycle/ready_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package lifecycle 7 | 8 | import ( 9 | "testing" 10 | 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestReady(t *testing.T) { 15 | r := require.New(t) 16 | 17 | ready := Readiness{} 18 | r.False(ready.IsReady()) 19 | r.Equal(ErrWrongState, ready.TurnOff()) 20 | 21 | // ready after turn on 22 | r.NoError(ready.TurnOn()) 23 | r.True(ready.IsReady()) 24 | r.Equal(ErrWrongState, ready.TurnOn()) // cannot turn on again 25 | 26 | // not ready after turn off 27 | r.NoError(ready.TurnOff()) 28 | r.False(ready.IsReady()) 29 | r.Equal(ErrWrongState, ready.TurnOff()) // cannot turn off again 30 | } 31 | -------------------------------------------------------------------------------- /pkg/log/fields.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | // A warrper for Zerolog (https://github.com/rs/zerolog) 7 | // 8 | // Package log provides a global logger for zerolog. 9 | // derived from https://github.com/rs/zerolog/blob/master/log/log.go 10 | // putting here to get a better integration 11 | 12 | package log 13 | 14 | import ( 15 | "encoding/hex" 16 | 17 | "go.uber.org/zap" 18 | ) 19 | 20 | // Hex creates a zap field which convert binary to hex. 21 | func Hex(k string, d []byte) zap.Field { 22 | return zap.String(k, hex.EncodeToString(d)) 23 | } 24 | -------------------------------------------------------------------------------- /pkg/probe/options.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package probe 7 | 8 | import "net/http" 9 | 10 | // WithReadinessHandler is an option to set a readiness handler for probe server. 11 | func WithReadinessHandler(h http.Handler) interface{ Option } { 12 | return &readinessOption{h} 13 | } 14 | 15 | type readinessOption struct{ h http.Handler } 16 | 17 | func (o *readinessOption) SetOption(s *Server) { s.readinessHandler = o.h } 18 | -------------------------------------------------------------------------------- /pkg/prometheustimer/timer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package prometheustimer 7 | 8 | import ( 9 | "testing" 10 | 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestPrometheusTimer(t *testing.T) { 15 | require := require.New(t) 16 | factory, err := New("test", "test", []string{"default"}, nil) 17 | require.Error(err) 18 | require.Nil(factory) 19 | timer := factory.NewTimer("test") 20 | require.NotNil(timer) 21 | factory, err = New("test", "test", []string{"default"}, []string{"default"}) 22 | require.NoError(err) 23 | require.NotNil(factory) 24 | timer = factory.NewTimer("label") 25 | require.NotNil(timer) 26 | } 27 | -------------------------------------------------------------------------------- /pkg/recovery/recovery_test.go: -------------------------------------------------------------------------------- 1 | package recovery 2 | 3 | import ( 4 | "errors" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestCrashLog(t *testing.T) { 11 | require := require.New(t) 12 | heapdumpDir := t.TempDir() 13 | require.NoError(SetCrashlogDir(heapdumpDir)) 14 | 15 | t.Run("index out of range", func(t *testing.T) { 16 | defer Recover() 17 | strs := make([]string, 2) 18 | strs[0] = "a" 19 | strs[1] = "b" 20 | strs[2] = "c" 21 | }) 22 | t.Run("invaled memory address or nil pointer", func(t *testing.T) { 23 | defer Recover() 24 | var i *int 25 | *i = 1 26 | }) 27 | t.Run("divide by zero", func(t *testing.T) { 28 | defer Recover() 29 | a, b := 10, 0 30 | a = a / b 31 | }) 32 | } 33 | 34 | func TestPrintInfo(t *testing.T) { 35 | printInfo("test", func() (interface{}, error) { 36 | return nil, errors.New("make error") 37 | }) 38 | } 39 | -------------------------------------------------------------------------------- /pkg/routine/options.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package routine 7 | 8 | import ( 9 | "github.com/facebookgo/clock" 10 | ) 11 | 12 | type clockOption struct{ c clock.Clock } 13 | 14 | // WithClock set a clock to a task. 15 | func WithClock(c clock.Clock) interface { 16 | RecurringTaskOption 17 | DelayTaskOption 18 | } { 19 | return &clockOption{c} 20 | } 21 | 22 | func (o *clockOption) SetRecurringTaskOption(r *RecurringTask) { 23 | r.clock = o.c 24 | } 25 | 26 | func (o *clockOption) SetDelayTaskOption(d *DelayTask) { 27 | d.clock = o.c 28 | } 29 | -------------------------------------------------------------------------------- /pkg/routine/task.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package routine 7 | 8 | // Task is the task logic to run. 9 | type Task func() 10 | -------------------------------------------------------------------------------- /pkg/tracer/span.go: -------------------------------------------------------------------------------- 1 | package tracer 2 | 3 | import ( 4 | "context" 5 | 6 | "go.opentelemetry.io/otel" 7 | "go.opentelemetry.io/otel/trace" 8 | ) 9 | 10 | // NewSpan returns a new span from the global tracer. 11 | // span must be completed with `defer span.End()` right after the call. 12 | func NewSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { 13 | return otel.Tracer("").Start(ctx, name, opts...) 14 | } 15 | 16 | // SpanFromContext returns the current span from a context. 17 | func SpanFromContext(ctx context.Context) trace.Span { 18 | return trace.SpanFromContext(ctx) 19 | } 20 | -------------------------------------------------------------------------------- /pkg/tracer/tracer_test.go: -------------------------------------------------------------------------------- 1 | package tracer 2 | 3 | import ( 4 | "strconv" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestTracer(t *testing.T) { 11 | require := require.New(t) 12 | prv, err := NewProvider() 13 | require.NoError(err) 14 | require.Nil(prv) 15 | 16 | _, err = NewProvider( 17 | WithEndpoint("http://aa"), 18 | WithSamplingRatio("4a32"), 19 | ) 20 | require.ErrorIs(err, strconv.ErrSyntax) 21 | 22 | _, err = NewProvider( 23 | WithEndpoint("http://aa"), 24 | WithSamplingRatio(".5"), 25 | ) 26 | require.NoError(err) 27 | } 28 | -------------------------------------------------------------------------------- /pkg/unit/unit.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package unit 7 | 8 | import ( 9 | "math/big" 10 | ) 11 | 12 | const ( 13 | // Rau is the smallest non-fungible token unit 14 | Rau int64 = 1 15 | // KRau is 1000 Rau 16 | KRau = Rau * 1000 17 | // MRau is 1000 KRau 18 | MRau = KRau * 1000 19 | // GRau is 1000 MRau 20 | GRau = MRau * 1000 21 | // Qev is 1000 GRau 22 | Qev = GRau * 1000 23 | // Jin is 1000 Qev 24 | Jin = Qev * 1000 25 | // Iotx is 1000 Jin, which should be fit into int64 26 | Iotx = Jin * 1000 27 | ) 28 | 29 | // ConvertIotxToRau converts an Iotx to Rau 30 | func ConvertIotxToRau(iotx int64) *big.Int { 31 | itx := big.NewInt(iotx) 32 | return itx.Mul(itx, big.NewInt(1e18)) 33 | } 34 | -------------------------------------------------------------------------------- /pkg/util/addrutil/addrutil.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package addrutil 7 | 8 | import ( 9 | "github.com/ethereum/go-ethereum/common" 10 | "github.com/iotexproject/iotex-address/address" 11 | ) 12 | 13 | // IoAddrToEvmAddr converts IoTeX address into evm address 14 | func IoAddrToEvmAddr(ioAddr string) (common.Address, error) { 15 | address, err := address.FromString(ioAddr) 16 | if err != nil { 17 | return common.Address{}, err 18 | } 19 | return common.BytesToAddress(address.Bytes()), nil 20 | } 21 | -------------------------------------------------------------------------------- /pkg/util/assertions/must.go: -------------------------------------------------------------------------------- 1 | package assertions 2 | 3 | func MustNoErrorV[V any](v V, err error) V { 4 | if err != nil { 5 | panic(err) 6 | } 7 | return v 8 | } 9 | 10 | func MustBeTrueV[V any](v V, ok bool) V { 11 | if !ok { 12 | panic("must ok") 13 | } 14 | return v 15 | } 16 | -------------------------------------------------------------------------------- /pkg/util/fileutil/fileutil.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package fileutil 7 | 8 | import ( 9 | "os" 10 | ) 11 | 12 | // FileExists checks if a file or a directory already exists 13 | func FileExists(path string) bool { 14 | if _, err := os.Stat(path); os.IsNotExist(err) { 15 | return false 16 | } 17 | return true 18 | } 19 | -------------------------------------------------------------------------------- /pkg/util/fileutil/fileutil_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package fileutil 7 | 8 | import ( 9 | "testing" 10 | 11 | // "github.com/pkg/errors" 12 | "github.com/stretchr/testify/require" 13 | ) 14 | 15 | func TestFileExists(t *testing.T) { 16 | t.Run("valid file path", func(t *testing.T) { 17 | isFileExists := FileExists("./fileutil.go") 18 | require.True(t, isFileExists) 19 | }) 20 | 21 | t.Run("invalid file path", func(t *testing.T) { 22 | isFileExists := FileExists("") 23 | require.False(t, isFileExists) 24 | }) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package version 7 | 8 | const ( 9 | // ProtocolVersion defines Protocol version, starting from 1 10 | ProtocolVersion = 0x01 11 | ) 12 | 13 | var ( 14 | // PackageVersion gets version of code from git tag 15 | PackageVersion = "NoBuildInfo" 16 | // PackageCommitID gets latest commit id of code from git 17 | PackageCommitID = "NoBuildInfo" 18 | // GitStatus gets git tree status from git 19 | GitStatus = "NoBuildInfo" 20 | // GoVersion gets go version of package 21 | GoVersion = "NoBuildInfo" 22 | // BuildTime gets building time 23 | BuildTime = "NoBuildInfo" 24 | ) 25 | -------------------------------------------------------------------------------- /pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # if [ ! -f /usr/local/bin/circleci ]; then 4 | # curl -fLSs https://circle.ci/cli | sudo bash 5 | # echo "Please enter the apitoken" 6 | # circleci setup 7 | # fi 8 | 9 | #CURR_DIR="$(dirname $0)" 10 | #workspace=$(cd ../../) 11 | export LD_LIBRARY_PATH=:$GOPATH/src/github.com/iotexproject/iotex-core/crypto/lib 12 | check_result() { 13 | if [ $? != 0 ]; then 14 | echo "$1 failed!!" 15 | echo "commit will not execute" 16 | echo "$?" 17 | exit 1 18 | else 19 | echo "$1 passed." 20 | echo "commit will execute" 21 | echo "$?" 22 | fi 23 | } 24 | 25 | ./go.test.sh 26 | check_result go.test.sh 27 | curl -s https://codecov.io/bash|bash 28 | go test -run=XXX -bench=. $(go list ./crypto) 29 | check_result go_test_run 30 | make minicluster 31 | check_result make_minicluster 32 | -------------------------------------------------------------------------------- /state/factory/readonlykv.go: -------------------------------------------------------------------------------- 1 | package factory 2 | 3 | import ( 4 | "github.com/iotexproject/iotex-core/v2/db" 5 | "github.com/iotexproject/iotex-core/v2/db/batch" 6 | ) 7 | 8 | type readOnlyKV struct { 9 | db.KVStore 10 | } 11 | 12 | func (r *readOnlyKV) Put(string, []byte, []byte) error { 13 | return db.ErrNotSupported 14 | } 15 | 16 | func (r *readOnlyKV) Delete(string, []byte) error { 17 | return db.ErrNotSupported 18 | } 19 | 20 | func (r *readOnlyKV) WriteBatch(batch.KVStoreBatch) error { 21 | return db.ErrNotSupported 22 | } 23 | -------------------------------------------------------------------------------- /systemcontractindex/stakingindex/stakingpb/staking.proto: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | // To compile the proto, run: 7 | // protoc --go_out=plugins=grpc:. *.proto 8 | syntax = "proto3"; 9 | package contractstakingpb; 10 | option go_package = "github.com/iotexproject/iotex-core/systemcontractindex/stakingindex/stakingpb"; 11 | 12 | message Bucket { 13 | string candidate = 1; 14 | string owner = 2; 15 | string amount = 3; 16 | uint64 duration = 4; 17 | uint64 createdAt = 5; 18 | uint64 unlockedAt = 6; 19 | uint64 unstakedAt = 7; 20 | bool muted = 8; 21 | bool timestamped = 9; 22 | } -------------------------------------------------------------------------------- /testutil/file.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package testutil 7 | 8 | import ( 9 | "os" 10 | 11 | "github.com/iotexproject/iotex-core/v2/pkg/util/fileutil" 12 | ) 13 | 14 | // PathOfTempFile returns path of a new temporary file 15 | func PathOfTempFile(dirName string) (string, error) { 16 | tempFile, err := os.CreateTemp(os.TempDir(), dirName) 17 | if err != nil { 18 | return "", err 19 | } 20 | return tempFile.Name(), tempFile.Close() 21 | } 22 | 23 | // CleanupPath detects the existence of test DB file and removes it if found 24 | func CleanupPath(path string) { 25 | if fileutil.FileExists(path) && os.RemoveAll(path) != nil { 26 | panic("Fail to remove testDB file") 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /testutil/file_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package testutil 7 | 8 | import ( 9 | "os" 10 | "testing" 11 | 12 | "github.com/stretchr/testify/assert" 13 | ) 14 | 15 | func TestFile(t *testing.T) { 16 | assert := assert.New(t) 17 | tmpPath, err := PathOfTempFile("iotx") 18 | assert.NoError(err) 19 | _, err = os.Stat(tmpPath) 20 | assert.NoError(err) 21 | defer CleanupPath(tmpPath) 22 | } 23 | -------------------------------------------------------------------------------- /testutil/gas.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package testutil 7 | 8 | import ( 9 | "math/big" 10 | 11 | "github.com/iotexproject/iotex-core/v2/pkg/unit" 12 | ) 13 | 14 | // TestGasLimit represents the gas limit used for test actions 15 | const TestGasLimit uint64 = 20000 16 | 17 | // TestGasPriceInt64 represents the gas price for test actions in int64 18 | const TestGasPriceInt64 = 0 19 | 20 | // TestGasPrice represents the gas price for test actions in big int 21 | var TestGasPrice = big.NewInt(unit.Qev) 22 | -------------------------------------------------------------------------------- /testutil/network_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package testutil 7 | 8 | import ( 9 | "testing" 10 | 11 | "github.com/stretchr/testify/assert" 12 | ) 13 | 14 | func TestRandomPort(t *testing.T) { 15 | assert := assert.New(t) 16 | rndPort := RandomPort() 17 | assert.Greater(rndPort, 2000) 18 | } 19 | -------------------------------------------------------------------------------- /testutil/timestamp.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package testutil 7 | 8 | import ( 9 | "time" 10 | ) 11 | 12 | // TimestampNow returns current time from new clock 13 | func TimestampNow() time.Time { 14 | return time.Now() 15 | } 16 | -------------------------------------------------------------------------------- /testutil/timestamp_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package testutil 7 | 8 | import ( 9 | "testing" 10 | "time" 11 | 12 | "github.com/stretchr/testify/assert" 13 | ) 14 | 15 | func TestTimestamp(t *testing.T) { 16 | assert := assert.New(t) 17 | time1 := TimestampNow() 18 | assert.False(time.Now().Before(time1)) 19 | } 20 | -------------------------------------------------------------------------------- /testutil/wait_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package testutil 7 | 8 | import ( 9 | "testing" 10 | "time" 11 | 12 | "github.com/stretchr/testify/assert" 13 | ) 14 | 15 | func TestWaitUntil(t *testing.T) { 16 | assert := assert.New(t) 17 | threshold := time.Now() 18 | check1 := CheckCondition(func() (bool, error) { 19 | return time.Now().UnixNano() > threshold.UnixNano()+int64(1000), nil 20 | }) 21 | err := WaitUntil(time.Millisecond, time.Second, check1) 22 | assert.Nil(err) 23 | check2 := CheckCondition(func() (bool, error) { 24 | return time.Now().UnixNano() > threshold.UnixNano()+int64(1000000000), nil 25 | }) 26 | err = WaitUntil(time.Millisecond, time.Millisecond*10, check2) 27 | assert.Equal(ErrTimeout, err) 28 | } 29 | -------------------------------------------------------------------------------- /tools/actioninjector.v2/README.md: -------------------------------------------------------------------------------- 1 | # injector 2 | injector is a command-line interface for interacting with IoTeX blockchains. 3 | 4 | # Build 5 | `./buildcli.sh` 6 | 7 | After this command, target bin files will be placed in ./release/ folder, upload them to 8 | specific release so install-cli.sh can download them. 9 | 10 | # Intall 11 | ## Install released build 12 | curl --silent https://raw.githubusercontent.com/iotexproject/iotex-core/master/install-injector.sh | sh 13 | 14 | ## Install latest build 15 | curl https://raw.githubusercontent.com/iotexproject/iotex-core/master/install-injector.sh | sh -s "unstable" 16 | 17 | # Usage 18 | injector [command] 19 | 20 | Available Commands: 21 | help Help about any command 22 | random inject random actions 23 | 24 | Flags: 25 | -h, --help help for injector 26 | 27 | Use "injector [command] --help" for more information about a command. 28 | -------------------------------------------------------------------------------- /tools/actioninjector.v2/injector.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/iotexproject/iotex-core/v2/tools/actioninjector.v2/internal/cmd" 4 | 5 | func main() { 6 | cmd.Execute() 7 | } 8 | -------------------------------------------------------------------------------- /tools/actioninjector.v2/internal/cmd/abi.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | var _abiStr = ` 4 | [ 5 | { 6 | "constant": true, 7 | "inputs": [ 8 | { 9 | "name": "_member", 10 | "type": "address" 11 | }, 12 | { 13 | "name": "_timestamp", 14 | "type": "uint64" 15 | } 16 | ], 17 | "name": "hash", 18 | "outputs": [ 19 | { 20 | "name": "", 21 | "type": "string" 22 | } 23 | ], 24 | "payable": false, 25 | "stateMutability": "view", 26 | "type": "function" 27 | }, 28 | { 29 | "constant": false, 30 | "inputs": [ 31 | { 32 | "name": "_timestamp", 33 | "type": "uint64" 34 | }, 35 | { 36 | "name": "_hash", 37 | "type": "string" 38 | } 39 | ], 40 | "name": "addHash", 41 | "outputs": [], 42 | "payable": false, 43 | "stateMutability": "nonpayable", 44 | "type": "function" 45 | } 46 | ] 47 | ` 48 | -------------------------------------------------------------------------------- /tools/actioninjector.v2/internal/cmd/root.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package cmd 7 | 8 | import ( 9 | "github.com/spf13/cobra" 10 | "go.uber.org/zap" 11 | 12 | "github.com/iotexproject/iotex-core/v2/pkg/log" 13 | ) 14 | 15 | // rootCmd represents the base command when called without any subcommands 16 | var rootCmd = &cobra.Command{ 17 | Use: "injector [command] [flags]", 18 | Short: "Command-line interface for injecting actions", 19 | Long: "injector is a command-line interface to generate address.", 20 | } 21 | 22 | // Execute adds all child commands to the root command and sets flags appropriately. 23 | func Execute() { 24 | if err := rootCmd.Execute(); err != nil { 25 | log.L().Fatal("failed to add cmd", zap.Error(err)) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/addrgen/addrgen.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 IoTeX 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | // This is a testing tool to generate iotex addresses 7 | // To use, run "make build" and " ./bin/addrgen" 8 | package main 9 | 10 | import "github.com/iotexproject/iotex-core/v2/tools/addrgen/internal/cmd" 11 | 12 | func main() { 13 | cmd.Execute() 14 | } 15 | -------------------------------------------------------------------------------- /tools/addrgen/internal/cmd/root.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package cmd 7 | 8 | import ( 9 | "github.com/spf13/cobra" 10 | "go.uber.org/zap" 11 | 12 | "github.com/iotexproject/iotex-core/v2/pkg/log" 13 | ) 14 | 15 | // rootCmd represents the base command when called without any subcommands 16 | var rootCmd = &cobra.Command{ 17 | Use: "addrgen [command] [flags]", 18 | Short: "Command-line interface for address generator", 19 | Long: "addrgen is a command-line interface to generate address.", 20 | } 21 | 22 | // Execute adds all child commands to the root command and sets flags appropriately. 23 | func Execute() { 24 | if err := rootCmd.Execute(); err != nil { 25 | log.L().Fatal("failed to add cmd", zap.Error(err)) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/bot/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.18.5-bullseye 2 | 3 | WORKDIR apps/iotex-bot 4 | 5 | RUN apt-get install -y --no-install-recommends make 6 | RUN git clone https://github.com/iotexproject/iotex-core 7 | RUN cd iotex-core/tools/bot && \ 8 | make build && \ 9 | cp ./bot /usr/local/bin/bot && \ 10 | mkdir -p /etc/iotex/ && \ 11 | rm -rf apps/iotex-bot 12 | 13 | CMD [ "bot -config-path=/etc/iotex/config.yaml"] 14 | -------------------------------------------------------------------------------- /tools/bot/config.yaml: -------------------------------------------------------------------------------- 1 | 2 | api: 3 | url: api.testnet.iotex.one:80 4 | log: 5 | zap: 6 | level: info 7 | encoding: json 8 | disableStacktrace: true 9 | outputPaths: ["stderr", "stdout"] 10 | errorOutputPaths: ["stderr"] 11 | stderrRedirectFile: /var/log/s.log 12 | stdLogRedirect: true 13 | 14 | runInterval: 20 #run once every 20 seconds 15 | gaslimit: 5000000 16 | gasprice: 1000000000000 17 | alertThreshold: 20 18 | transfer: 19 | signer: 0d4d9b248110257c575ef2e8d93dd53471d9178984482817dcbd6edb607f8cc5 20 | amountInRau: 0 21 | xrc20: 22 | contract: io1hhu3gwt5uankzl3zlp2cz8w0sl9uj336rq0334 23 | signer: 0d4d9b248110257c575ef2e8d93dd53471d9178984482817dcbd6edb607f8cc5 24 | amount: 1 25 | execution: 26 | contract: io1hxfy5pf0ykws7gk0mznt48jw5ejf47qqmje3dv 27 | signer: 0d4d9b248110257c575ef2e8d93dd53471d9178984482817dcbd6edb607f8cc5 28 | amount: 5 #amount should be bigger than sum of to's amount 29 | to: 30 | address: ["io1vdtfpzkwpyngzvx7u2mauepnzja7kd5rryp0sg","io1vdtfpzkwpyngzvx7u2mauepnzja7kd5rryp0sg"] 31 | amount: [1,1] -------------------------------------------------------------------------------- /tools/devenv/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | iotex: 5 | container_name: iotex 6 | image: ${IOTEX_IMAGE} 7 | restart: on-failure 8 | ports: 9 | - 14014:14014 10 | volumes: 11 | - $IOTEX_HOME/data:/var/data:rw 12 | - $IOTEX_HOME/log:/var/log:rw 13 | - $IOTEX_HOME/etc/config.yaml:/etc/iotex/config_override.yaml:ro 14 | - $IOTEX_HOME/etc/genesis.yaml:/etc/iotex/genesis.yaml:ro 15 | command: iotex-server -config-path=/etc/iotex/config_override.yaml -genesis-path=/etc/iotex/genesis.yaml -plugin=gateway 16 | -------------------------------------------------------------------------------- /tools/devenv/images/01.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotexproject/iotex-core/c82aba788139169800d82bab083e8bd546cad8d2/tools/devenv/images/01.jpeg -------------------------------------------------------------------------------- /tools/executiontester/blockchain/array-delete-passing.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | contract A { 3 | uint256[] public numbers; 4 | function A(uint256[] _numbers) { 5 | for(uint256 i=0; i<_numbers.length; i++) { 6 | numbers.push(_numbers[i]); 7 | } 8 | } 9 | 10 | function get() returns (uint256[]) { 11 | return numbers; 12 | } 13 | } 14 | 15 | contract Manager { 16 | uint[] numbers; 17 | function makeA() returns (uint256) { 18 | uint256[] numbers; 19 | numbers.push(10); 20 | 21 | A a = new A(numbers); 22 | 23 | return a.numbers(0); 24 | } 25 | function getArray() returns (uint[]) { 26 | numbers.push(100); 27 | numbers.push(200); 28 | numbers.push(300); 29 | numbers.push(400); 30 | numbers.push(500); 31 | 32 | delete numbers[2]; 33 | 34 | // 100, 200, 0, 400, 500 35 | return numbers; 36 | } 37 | } -------------------------------------------------------------------------------- /tools/executiontester/blockchain/array-of-strings.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.24; 2 | contract MyContract { 3 | string[] strings; 4 | 5 | function MyContract() { 6 | strings.push("hi"); 7 | strings.push("bye"); 8 | } 9 | 10 | function bar() constant returns(string) { 11 | return strings[1]; 12 | } 13 | } -------------------------------------------------------------------------------- /tools/ioctl/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package main 7 | 8 | import ( 9 | "os" 10 | 11 | "github.com/iotexproject/iotex-core/v2/ioctl/cmd" 12 | ) 13 | 14 | func main() { 15 | rootCmd := cmd.NewIoctl() 16 | if err := rootCmd.Execute(); err != nil { 17 | os.Exit(1) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_actions.md: -------------------------------------------------------------------------------- 1 | ## ioctl account actions 2 | 3 | Show the list of actions for an account 4 | 5 | ### Synopsis 6 | 7 | Show the list of actions for an account 8 | 9 | ``` 10 | ioctl account actions (ALIAS|ADDRESS) [SKIP] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for actions 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_balance.md: -------------------------------------------------------------------------------- 1 | ## ioctl account balance 2 | 3 | Get balance of an account 4 | 5 | ### Synopsis 6 | 7 | Get balance of an account 8 | 9 | ``` 10 | ioctl account balance [ALIAS|ADDRESS] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for balance 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_create.md: -------------------------------------------------------------------------------- 1 | ## ioctl account create 2 | 3 | Create N new accounts and print them 4 | 5 | ### Synopsis 6 | 7 | Create N new accounts and print them 8 | 9 | ``` 10 | ioctl account create [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for create 17 | -n, --num uint number of accounts to create (default 1) 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --endpoint string set endpoint for once 24 | --insecure insecure connection for once 25 | -o, --output-format string output format 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 31 | 32 | ###### Auto generated by docgen on 7-Mar-2022 33 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_createadd.md: -------------------------------------------------------------------------------- 1 | ## ioctl account createadd 2 | 3 | Create new account for ioctl 4 | 5 | ### Synopsis 6 | 7 | Create new account for ioctl 8 | 9 | ``` 10 | ioctl account createadd ALIAS [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for createadd 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_delete.md: -------------------------------------------------------------------------------- 1 | ## ioctl account delete 2 | 3 | Delete an IoTeX account/address from wallet/config 4 | 5 | ### Synopsis 6 | 7 | Delete an IoTeX account/address from wallet/config 8 | 9 | ``` 10 | ioctl account delete [ALIAS|ADDRESS] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for delete 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_ethaddr.md: -------------------------------------------------------------------------------- 1 | ## ioctl account ethaddr 2 | 3 | Translate address between IOTX and ETH 4 | 5 | ### Synopsis 6 | 7 | Translate address between IOTX and ETH 8 | 9 | ``` 10 | ioctl account ethaddr (ALIAS|IOTEX_ADDRESS|ETH_ADDRESS) [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for ethaddr 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_export.md: -------------------------------------------------------------------------------- 1 | ## ioctl account export 2 | 3 | Export IoTeX private key from wallet 4 | 5 | ### Synopsis 6 | 7 | Export IoTeX private key from wallet 8 | 9 | ``` 10 | ioctl account export (ALIAS|ADDRESS) [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for export 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_exportpublic.md: -------------------------------------------------------------------------------- 1 | ## ioctl account exportpublic 2 | 3 | Export IoTeX public key from wallet 4 | 5 | ### Synopsis 6 | 7 | Export IoTeX public key from wallet 8 | 9 | ``` 10 | ioctl account exportpublic (ALIAS|ADDRESS) [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for exportpublic 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_getVotes.md: -------------------------------------------------------------------------------- 1 | ## ioctl account getVotes 2 | 3 | Get votes of this votee 4 | 5 | ### Synopsis 6 | 7 | Get votes of this votee 8 | 9 | ``` 10 | ioctl account getVotes VOTEE HEIGHT OFFSET LIMIT [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for getVotes 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by ioctl on 17-Dec-2019 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_import.md: -------------------------------------------------------------------------------- 1 | ## ioctl account import 2 | 3 | Import IoTeX private key or keystore into wallet 4 | 5 | ### Synopsis 6 | 7 | Import IoTeX private key or keystore into wallet 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for import 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --endpoint string set endpoint for once 19 | --insecure insecure connection for once 20 | -o, --output-format string output format 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 26 | * [ioctl account import key](ioctl_account_import_key.md) - Import IoTeX private key into wallet 27 | * [ioctl account import keystore](ioctl_account_import_keystore.md) - Import IoTeX keystore into wallet 28 | * [ioctl account import pem](ioctl_account_import_pem.md) - Import IoTeX key from pem file into wallet 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_import_key.md: -------------------------------------------------------------------------------- 1 | ## ioctl account import key 2 | 3 | Import IoTeX private key into wallet 4 | 5 | ### Synopsis 6 | 7 | Import IoTeX private key into wallet 8 | 9 | ``` 10 | ioctl account import key ALIAS [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for key 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account import](ioctl_account_import.md) - Import IoTeX private key or keystore into wallet 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_import_keystore.md: -------------------------------------------------------------------------------- 1 | ## ioctl account import keystore 2 | 3 | Import IoTeX keystore into wallet 4 | 5 | ### Synopsis 6 | 7 | Import IoTeX keystore into wallet 8 | 9 | ``` 10 | ioctl account import keystore ALIAS FILEPATH [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for keystore 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account import](ioctl_account_import.md) - Import IoTeX private key or keystore into wallet 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_import_pem.md: -------------------------------------------------------------------------------- 1 | ## ioctl account import pem 2 | 3 | Import IoTeX key from pem file into wallet 4 | 5 | ### Synopsis 6 | 7 | Import IoTeX key from pem file into wallet 8 | 9 | ``` 10 | ioctl account import pem ALIAS FILEPATH [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for pem 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account import](ioctl_account_import.md) - Import IoTeX private key or keystore into wallet 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_info.md: -------------------------------------------------------------------------------- 1 | ## ioctl account info 2 | 3 | Display an account's information 4 | 5 | ### Synopsis 6 | 7 | Display an account's information 8 | 9 | ``` 10 | ioctl account info [ALIAS|ADDRESS] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for info 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_list.md: -------------------------------------------------------------------------------- 1 | ## ioctl account list 2 | 3 | List existing account for ioctl 4 | 5 | ### Synopsis 6 | 7 | List existing account for ioctl 8 | 9 | ``` 10 | ioctl account list [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for list 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_nonce.md: -------------------------------------------------------------------------------- 1 | ## ioctl account nonce 2 | 3 | Get nonce of an account 4 | 5 | ### Synopsis 6 | 7 | Get nonce of an account 8 | 9 | ``` 10 | ioctl account nonce [ALIAS|ADDRESS] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for nonce 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_sign.md: -------------------------------------------------------------------------------- 1 | ## ioctl account sign 2 | 3 | Sign message with private key from wallet 4 | 5 | ### Synopsis 6 | 7 | Sign message with private key from wallet 8 | 9 | ``` 10 | ioctl account sign MESSAGE [-s SIGNER] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for sign 17 | -s, --signer string choose a signing account 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --endpoint string set endpoint for once 24 | --insecure insecure connection for once 25 | -o, --output-format string output format 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 31 | 32 | ###### Auto generated by docgen on 7-Mar-2022 33 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_update.md: -------------------------------------------------------------------------------- 1 | ## ioctl account update 2 | 3 | Update password for IoTeX account 4 | 5 | ### Synopsis 6 | 7 | Update password for IoTeX account 8 | 9 | ``` 10 | ioctl account update [ALIAS|ADDRESS] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for update 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_account_verify.md: -------------------------------------------------------------------------------- 1 | ## ioctl account verify 2 | 3 | Verify IoTeX public key and address by private key 4 | 5 | ### Synopsis 6 | 7 | Verify IoTeX public key and address by private key 8 | 9 | ``` 10 | ioctl account verify [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for verify 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl account](ioctl_account.md) - Manage accounts of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_action_hash.md: -------------------------------------------------------------------------------- 1 | ## ioctl action hash 2 | 3 | Get action by hash 4 | 5 | ### Synopsis 6 | 7 | Get action by hash 8 | 9 | ``` 10 | ioctl action hash ACTION_HASH [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for hash 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl action](ioctl_action.md) - Manage actions of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_action_read.md: -------------------------------------------------------------------------------- 1 | ## ioctl action read 2 | 3 | read smart contract on IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | read smart contract on IoTeX blockchain 8 | 9 | ``` 10 | ioctl action read (ALIAS|CONTRACT_ADDRESS) -b BYTE_CODE [-s SIGNER] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -b, --bytecode string set the byte code 17 | -h, --help help for read 18 | -s, --signer string choose a signing account 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --endpoint string set endpoint for once 25 | --insecure insecure connection for once 26 | -o, --output-format string output format 27 | ``` 28 | 29 | ### SEE ALSO 30 | 31 | * [ioctl action](ioctl_action.md) - Manage actions of IoTeX blockchain 32 | 33 | ###### Auto generated by docgen on 7-Mar-2022 34 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_alias.md: -------------------------------------------------------------------------------- 1 | ## ioctl alias 2 | 3 | Manage aliases of IoTeX addresses 4 | 5 | ### Synopsis 6 | 7 | Manage aliases of IoTeX addresses 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for alias 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | -o, --output-format string output format 19 | ``` 20 | 21 | ### SEE ALSO 22 | 23 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 24 | * [ioctl alias export](ioctl_alias_export.md) - Export aliases to either json or yaml format 25 | * [ioctl alias import](ioctl_alias_import.md) - Import aliases 26 | * [ioctl alias list](ioctl_alias_list.md) - List aliases 27 | * [ioctl alias remove](ioctl_alias_remove.md) - Remove alias 28 | * [ioctl alias set](ioctl_alias_set.md) - Set alias for address 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_alias_export.md: -------------------------------------------------------------------------------- 1 | ## ioctl alias export 2 | 3 | Export aliases to either json or yaml format 4 | 5 | ### Synopsis 6 | 7 | Export aliases to either json or yaml format 8 | 9 | ``` 10 | ioctl alias export [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -f, --format string set format: json/yaml (default "json") 17 | -h, --help help for export 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | -o, --output-format string output format 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [ioctl alias](ioctl_alias.md) - Manage aliases of IoTeX addresses 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_alias_import.md: -------------------------------------------------------------------------------- 1 | ## ioctl alias import 2 | 3 | Import aliases 4 | 5 | ### Synopsis 6 | 7 | Import aliases 8 | 9 | ``` 10 | ioctl alias import 'DATA' [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -F, --force-import override existing aliases 17 | -f, --format= string set format: json/yaml (default "json") 18 | -h, --help help for import 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl alias](ioctl_alias.md) - Manage aliases of IoTeX addresses 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_alias_list.md: -------------------------------------------------------------------------------- 1 | ## ioctl alias list 2 | 3 | List aliases 4 | 5 | ### Synopsis 6 | 7 | List aliases 8 | 9 | ``` 10 | ioctl alias list [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for list 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl alias](ioctl_alias.md) - Manage aliases of IoTeX addresses 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_alias_remove.md: -------------------------------------------------------------------------------- 1 | ## ioctl alias remove 2 | 3 | Remove alias 4 | 5 | ### Synopsis 6 | 7 | Remove alias 8 | 9 | ``` 10 | ioctl alias remove ALIAS [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for remove 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl alias](ioctl_alias.md) - Manage aliases of IoTeX addresses 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_alias_set.md: -------------------------------------------------------------------------------- 1 | ## ioctl alias set 2 | 3 | Set alias for address 4 | 5 | ### Synopsis 6 | 7 | Set alias for address 8 | 9 | ``` 10 | ioctl alias set ALIAS ADDRESS [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for set 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl alias](ioctl_alias.md) - Manage aliases of IoTeX addresses 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_bc.md: -------------------------------------------------------------------------------- 1 | ## ioctl bc 2 | 3 | Deal with block chain of IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Deal with block chain of IoTeX blockchain 8 | 9 | ### Options 10 | 11 | ``` 12 | --endpoint string set endpoint for once 13 | -h, --help help for bc 14 | --insecure insecure connection for once 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | -o, --output-format string output format 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 26 | * [ioctl bc block](ioctl_bc_block.md) - Get block from block chain 27 | * [ioctl bc bucket](ioctl_bc_bucket.md) - Get bucket for given index on IoTeX blockchain 28 | * [ioctl bc bucketlist](ioctl_bc_bucketlist.md) - Get bucket list with method and arg(s) on IoTeX blockchain 29 | * [ioctl bc info](ioctl_bc_info.md) - Get current blockchain information 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_bc_block.md: -------------------------------------------------------------------------------- 1 | ## ioctl bc block 2 | 3 | Get block from block chain 4 | 5 | ### Synopsis 6 | 7 | Get block from block chain 8 | 9 | ``` 10 | ioctl bc block [HEIGHT|HASH] [--verbose] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for block 17 | --verbose returns block info and all actions within this block. 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --endpoint string set endpoint for once 24 | --insecure insecure connection for once 25 | -o, --output-format string output format 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [ioctl bc](ioctl_bc.md) - Deal with block chain of IoTeX blockchain 31 | 32 | ###### Auto generated by docgen on 7-Mar-2022 33 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_bc_bucket.md: -------------------------------------------------------------------------------- 1 | ## ioctl bc bucket 2 | 3 | Get bucket for given index on IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Get bucket for given index on IoTeX blockchain 8 | 9 | ``` 10 | ioctl bc bucket [OPTION|BUCKET_INDEX] [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | ioctl bc bucket [BUCKET_INDEX], to read bucket information by bucket index 17 | ioctl bc bucket max, to query the max bucket index 18 | ioctl bc bucket count, to query total number of active buckets 19 | 20 | ``` 21 | 22 | ### Options 23 | 24 | ``` 25 | -h, --help help for bucket 26 | ``` 27 | 28 | ### Options inherited from parent commands 29 | 30 | ``` 31 | --endpoint string set endpoint for once 32 | --insecure insecure connection for once 33 | -o, --output-format string output format 34 | ``` 35 | 36 | ### SEE ALSO 37 | 38 | * [ioctl bc](ioctl_bc.md) - Deal with block chain of IoTeX blockchain 39 | 40 | ###### Auto generated by docgen on 7-Mar-2022 41 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_bc_bucketlist.md: -------------------------------------------------------------------------------- 1 | ## ioctl bc bucketlist 2 | 3 | Get bucket list with method and arg(s) on IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Read bucket list 8 | Valid methods: [voter, cand] 9 | 10 | ``` 11 | ioctl bc bucketlist [arguments] [flags] 12 | ``` 13 | 14 | ### Examples 15 | 16 | ``` 17 | ioctl bc bucketlist voter [VOTER_ADDRESS] [OFFSET] [LIMIT] 18 | ioctl bc bucketlist cand [CANDIDATE_NAME] [OFFSET] [LIMIT] 19 | ``` 20 | 21 | ### Options 22 | 23 | ``` 24 | -h, --help help for bucketlist 25 | ``` 26 | 27 | ### Options inherited from parent commands 28 | 29 | ``` 30 | --endpoint string set endpoint for once 31 | --insecure insecure connection for once 32 | -o, --output-format string output format 33 | ``` 34 | 35 | ### SEE ALSO 36 | 37 | * [ioctl bc](ioctl_bc.md) - Deal with block chain of IoTeX blockchain 38 | 39 | ###### Auto generated by docgen on 7-Mar-2022 40 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_bc_info.md: -------------------------------------------------------------------------------- 1 | ## ioctl bc info 2 | 3 | Get current blockchain information 4 | 5 | ### Synopsis 6 | 7 | Get current blockchain information 8 | 9 | ``` 10 | ioctl bc info [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for info 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl bc](ioctl_bc.md) - Deal with block chain of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_config.md: -------------------------------------------------------------------------------- 1 | ## ioctl config 2 | 3 | Get, set, or reset configuration for ioctl 4 | 5 | ### Synopsis 6 | 7 | Get, set, or reset configuration for ioctl 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for config 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | -o, --output-format string output format 19 | ``` 20 | 21 | ### SEE ALSO 22 | 23 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 24 | * [ioctl config get](ioctl_config_get.md) - Get config fields from ioctl 25 | * [ioctl config reset](ioctl_config_reset.md) - Reset config to default 26 | * [ioctl config set](ioctl_config_set.md) - Set config fields for ioctl 27 | 28 | ###### Auto generated by docgen on 7-Mar-2022 29 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_config_get.md: -------------------------------------------------------------------------------- 1 | ## ioctl config get 2 | 3 | Get config fields from ioctl 4 | 5 | ### Synopsis 6 | 7 | Get config fields from ioctl 8 | Valid Variables: [endpoint, wallet, explorer, defaultacc, language, nsv2height, analyserEndpoint, all] 9 | 10 | ``` 11 | ioctl config get VARIABLE [flags] 12 | ``` 13 | 14 | ### Options 15 | 16 | ``` 17 | -h, --help help for get 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | -o, --output-format string output format 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [ioctl config](ioctl_config.md) - Get, set, or reset configuration for ioctl 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_config_reset.md: -------------------------------------------------------------------------------- 1 | ## ioctl config reset 2 | 3 | Reset config to default 4 | 5 | ### Synopsis 6 | 7 | Reset config to default 8 | 9 | ``` 10 | ioctl config reset [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for reset 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl config](ioctl_config.md) - Get, set, or reset configuration for ioctl 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_config_set.md: -------------------------------------------------------------------------------- 1 | ## ioctl config set 2 | 3 | Set config fields for ioctl 4 | 5 | ### Synopsis 6 | 7 | Set config fields for ioctl 8 | Valid Variables: [endpoint, wallet, explorer, defaultacc, language, nsv2height] 9 | 10 | ``` 11 | ioctl config set VARIABLE VALUE [flags] 12 | ``` 13 | 14 | ### Options 15 | 16 | ``` 17 | -h, --help help for set 18 | --insecure set insecure connection as default 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl config](ioctl_config.md) - Get, set, or reset configuration for ioctl 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_contract_compile.md: -------------------------------------------------------------------------------- 1 | ## ioctl contract compile 2 | 3 | Compile smart contract of IoTeX blockchain from source code file(s). 4 | 5 | ### Synopsis 6 | 7 | Compile smart contract of IoTeX blockchain from source code file(s). 8 | 9 | ``` 10 | ioctl contract compile CONTRACT_NAME [CODE_FILES...] [--abi-out ABI_PATH] [--bin-out BIN_PATH] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | --abi-out string set abi file output path 17 | --bin-out string set bin file output path 18 | -h, --help help for compile 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --endpoint string set endpoint for once 25 | --insecure insecure connection for once 26 | -o, --output-format string output format 27 | ``` 28 | 29 | ### SEE ALSO 30 | 31 | * [ioctl contract](ioctl_contract.md) - Deal with smart contract of IoTeX blockchain 32 | 33 | ###### Auto generated by docgen on 7-Mar-2022 34 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_contract_deploy.md: -------------------------------------------------------------------------------- 1 | ## ioctl contract deploy 2 | 3 | Deploy smart contract of IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Deploy smart contract of IoTeX blockchain 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for deploy 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --endpoint string set endpoint for once 19 | --insecure insecure connection for once 20 | -o, --output-format string output format 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [ioctl contract](ioctl_contract.md) - Deal with smart contract of IoTeX blockchain 26 | * [ioctl contract deploy bin](ioctl_contract_deploy_bin.md) - deploy smart contract with bin on IoTeX blockchain 27 | * [ioctl contract deploy bytecode](ioctl_contract_deploy_bytecode.md) - deploy smart contract with bytecode on IoTeX blockchain 28 | * [ioctl contract deploy sol](ioctl_contract_deploy_sol.md) - deploy smart contract with sol files on IoTeX blockchain 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_contract_invoke.md: -------------------------------------------------------------------------------- 1 | ## ioctl contract invoke 2 | 3 | Invoke smart contract on IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Invoke smart contract on IoTeX blockchain 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for invoke 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --endpoint string set endpoint for once 19 | --insecure insecure connection for once 20 | -o, --output-format string output format 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [ioctl contract](ioctl_contract.md) - Deal with smart contract of IoTeX blockchain 26 | * [ioctl contract invoke bytecode](ioctl_contract_invoke_bytecode.md) - invoke smart contract on IoTex blockchain with packed arguments 27 | * [ioctl contract invoke function](ioctl_contract_invoke_function.md) - invoke smart contract on IoTeX blockchain with function name 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_contract_prepare.md: -------------------------------------------------------------------------------- 1 | ## ioctl contract prepare 2 | 3 | Prepare solidity compiler 4 | 5 | ### Synopsis 6 | 7 | Prepare solidity compiler 8 | 9 | ``` 10 | ioctl contract prepare [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for prepare 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl contract](ioctl_contract.md) - Deal with smart contract of IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_contract_share.md: -------------------------------------------------------------------------------- 1 | ## ioctl contract share 2 | 3 | share a folder from your local computer to the IoTex smart contract dev.(default to https://ide.iotex.io) 4 | 5 | ### Synopsis 6 | 7 | share a folder from your local computer to the IoTex smart contract dev.(default to https://ide.iotex.io) 8 | 9 | ``` 10 | ioctl contract share LOCAL_FOLDER_PATH [--iotex-ide YOUR_IOTEX_IDE_URL_INSTANCE] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for share 17 | --iotex-ide string set your IoTeX IDE url instance (default "https://ide.iotex.io") 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --endpoint string set endpoint for once 24 | --insecure insecure connection for once 25 | -o, --output-format string output format 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [ioctl contract](ioctl_contract.md) - Deal with smart contract of IoTeX blockchain 31 | 32 | ###### Auto generated by docgen on 7-Mar-2022 33 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_contract_test.md: -------------------------------------------------------------------------------- 1 | ## ioctl contract test 2 | 3 | Test smart contract of IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Test smart contract of IoTeX blockchain 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for test 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --endpoint string set endpoint for once 19 | --insecure insecure connection for once 20 | -o, --output-format string output format 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [ioctl contract](ioctl_contract.md) - Deal with smart contract of IoTeX blockchain 26 | * [ioctl contract test bytecode](ioctl_contract_test_bytecode.md) - test smart contract on IoTeX blockchain with packed arguments 27 | * [ioctl contract test function](ioctl_contract_test_function.md) - test smart contract on IoTeX blockchain with function name 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_did.md: -------------------------------------------------------------------------------- 1 | ## ioctl did 2 | 3 | DID command 4 | 5 | ### Synopsis 6 | 7 | DID command 8 | 9 | ### Options 10 | 11 | ``` 12 | --endpoint string set endpoint for once (default "api.iotex.one:80") 13 | -h, --help help for did 14 | --insecure insecure connection for once 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | -o, --output-format string output format 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 26 | * [ioctl did deregister](ioctl_did_deregister.md) - Deregister DID on IoTeX blockchain 27 | * [ioctl did generate](ioctl_did_generate.md) - Generate DID document using private key from wallet 28 | * [ioctl did get](ioctl_did_get.md) - Get get DID Document on IoTeX blockchain 29 | * [ioctl did register](ioctl_did_register.md) - Register DID on IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 5-Apr-2023 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_did_get.md: -------------------------------------------------------------------------------- 1 | ## ioctl did get 2 | 3 | Get get DID Document on IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Get get DID Document on IoTeX blockchain 8 | 9 | ``` 10 | ioctl did get (RESOLVER_ENDPOINT) ADDRESS [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for get 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --endpoint string set endpoint for once (default "api.iotex.one:80") 23 | --insecure insecure connection for once 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl did](ioctl_did.md) - DID command 30 | 31 | ###### Auto generated by docgen on 5-Apr-2023 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_hdwallet.md: -------------------------------------------------------------------------------- 1 | ## ioctl hdwallet 2 | 3 | Manage hdwallets of IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Manage hdwallets of IoTeX blockchain 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for hdwallet 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | -o, --output-format string output format 19 | ``` 20 | 21 | ### SEE ALSO 22 | 23 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 24 | * [ioctl hdwallet create](ioctl_hdwallet_create.md) - create hdwallet using mnemonic 25 | * [ioctl hdwallet delete](ioctl_hdwallet_delete.md) - delete hdwallet 26 | * [ioctl hdwallet derive](ioctl_hdwallet_derive.md) - derive key from HDWallet 27 | * [ioctl hdwallet export](ioctl_hdwallet_export.md) - export hdwallet mnemonic using password 28 | * [ioctl hdwallet import](ioctl_hdwallet_import.md) - import hdwallet using mnemonic 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_hdwallet_create.md: -------------------------------------------------------------------------------- 1 | ## ioctl hdwallet create 2 | 3 | create hdwallet using mnemonic 4 | 5 | ### Synopsis 6 | 7 | create hdwallet using mnemonic 8 | 9 | ``` 10 | ioctl hdwallet create [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for create 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl hdwallet](ioctl_hdwallet.md) - Manage hdwallets of IoTeX blockchain 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_hdwallet_delete.md: -------------------------------------------------------------------------------- 1 | ## ioctl hdwallet delete 2 | 3 | delete hdwallet 4 | 5 | ### Synopsis 6 | 7 | delete hdwallet 8 | 9 | ``` 10 | ioctl hdwallet delete [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for delete 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl hdwallet](ioctl_hdwallet.md) - Manage hdwallets of IoTeX blockchain 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_hdwallet_derive.md: -------------------------------------------------------------------------------- 1 | ## ioctl hdwallet derive 2 | 3 | derive key from HDWallet 4 | 5 | ### Synopsis 6 | 7 | derive key from HDWallet 8 | 9 | ``` 10 | ioctl hdwallet derive id1/id2/id3 [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for derive 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl hdwallet](ioctl_hdwallet.md) - Manage hdwallets of IoTeX blockchain 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_hdwallet_export.md: -------------------------------------------------------------------------------- 1 | ## ioctl hdwallet export 2 | 3 | export hdwallet mnemonic using password 4 | 5 | ### Synopsis 6 | 7 | export hdwallet mnemonic using password 8 | 9 | ``` 10 | ioctl hdwallet export [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for export 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl hdwallet](ioctl_hdwallet.md) - Manage hdwallets of IoTeX blockchain 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_hdwallet_import.md: -------------------------------------------------------------------------------- 1 | ## ioctl hdwallet import 2 | 3 | import hdwallet using mnemonic 4 | 5 | ### Synopsis 6 | 7 | import hdwallet using mnemonic 8 | 9 | ``` 10 | ioctl hdwallet import [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for import 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -o, --output-format string output format 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [ioctl hdwallet](ioctl_hdwallet.md) - Manage hdwallets of IoTeX blockchain 28 | 29 | ###### Auto generated by docgen on 7-Mar-2022 30 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_jwt.md: -------------------------------------------------------------------------------- 1 | ## ioctl jwt 2 | 3 | Manage Json Web Token on IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Manage Json Web Token on IoTeX blockchain 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for jwt 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | -o, --output-format string output format 19 | ``` 20 | 21 | ### SEE ALSO 22 | 23 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 24 | * [ioctl jwt sign](ioctl_jwt_sign.md) - Sign Json Web Token on IoTeX blockchain 25 | 26 | ###### Auto generated by docgen on 7-Mar-2022 27 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_node.md: -------------------------------------------------------------------------------- 1 | ## ioctl node 2 | 3 | Deal with nodes of IoTeX blockchain 4 | 5 | ### Synopsis 6 | 7 | Deal with nodes of IoTeX blockchain 8 | 9 | ### Options 10 | 11 | ``` 12 | --endpoint string set endpoint for once 13 | -h, --help help for node 14 | --insecure insecure connection for once 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | -o, --output-format string output format 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 26 | * [ioctl node delegate](ioctl_node_delegate.md) - Print consensus delegates information in certain epoch 27 | * [ioctl node probationlist](ioctl_node_probationlist.md) - Print probation list at given epoch 28 | * [ioctl node reward](ioctl_node_reward.md) - Query rewards 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_node_delegate.md: -------------------------------------------------------------------------------- 1 | ## ioctl node delegate 2 | 3 | Print consensus delegates information in certain epoch 4 | 5 | ### Synopsis 6 | 7 | Print consensus delegates information in certain epoch 8 | 9 | ``` 10 | ioctl node delegate [-e epoch-num] [-a] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -a, --all returns all delegates 17 | -e, --epoch-num uint specify specific epoch 18 | -h, --help help for delegate 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --endpoint string set endpoint for once 25 | --insecure insecure connection for once 26 | -o, --output-format string output format 27 | ``` 28 | 29 | ### SEE ALSO 30 | 31 | * [ioctl node](ioctl_node.md) - Deal with nodes of IoTeX blockchain 32 | 33 | ###### Auto generated by docgen on 7-Mar-2022 34 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_node_probationlist.md: -------------------------------------------------------------------------------- 1 | ## ioctl node probationlist 2 | 3 | Print probation list at given epoch 4 | 5 | ### Synopsis 6 | 7 | Print probation list at given epoch 8 | 9 | ``` 10 | ioctl node probationlist [-e epoch-num] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -e, --epoch-num uint specify specific epoch 17 | -h, --help help for probationlist 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --endpoint string set endpoint for once 24 | --insecure insecure connection for once 25 | -o, --output-format string output format 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [ioctl node](ioctl_node.md) - Deal with nodes of IoTeX blockchain 31 | 32 | ###### Auto generated by docgen on 7-Mar-2022 33 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_node_reward.md: -------------------------------------------------------------------------------- 1 | ## ioctl node reward 2 | 3 | Query rewards 4 | 5 | ### Synopsis 6 | 7 | ioctl node reward pool returns unclaimed and available Rewards in fund pool. 8 | TotalUnclaimed is the amount of all delegates that have been issued but are not claimed; 9 | TotalAvailable is the amount of balance that has not been issued to anyone. 10 | 11 | ioctl node reward unclaimed [ALIAS|DELEGATE_ADDRESS] returns unclaimed rewards of a specific delegate. 12 | 13 | ``` 14 | ioctl node reward unclaimed|pool [ALIAS|DELEGATE_ADDRESS] [flags] 15 | ``` 16 | 17 | ### Options 18 | 19 | ``` 20 | -h, --help help for reward 21 | ``` 22 | 23 | ### Options inherited from parent commands 24 | 25 | ``` 26 | --endpoint string set endpoint for once 27 | --insecure insecure connection for once 28 | -o, --output-format string output format 29 | ``` 30 | 31 | ### SEE ALSO 32 | 33 | * [ioctl node](ioctl_node.md) - Deal with nodes of IoTeX blockchain 34 | 35 | ###### Auto generated by docgen on 7-Mar-2022 36 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_update.md: -------------------------------------------------------------------------------- 1 | ## ioctl update 2 | 3 | Update ioctl with latest version 4 | 5 | ### Synopsis 6 | 7 | Update ioctl with latest version 8 | 9 | ``` 10 | ioctl update [-t version-type] [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for update 17 | -t, --version-type string set version type, "stable" or "unstable" (default "stable") 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | -o, --output-format string output format 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 29 | 30 | ###### Auto generated by docgen on 7-Mar-2022 31 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_version.md: -------------------------------------------------------------------------------- 1 | ## ioctl version 2 | 3 | Print the version of ioctl and node 4 | 5 | ### Synopsis 6 | 7 | Print the version of ioctl and node 8 | 9 | ``` 10 | ioctl version [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | --endpoint string set endpoint for once 17 | -h, --help help for version 18 | --insecure insecure connection for once 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | -o, --output-format string output format 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | * [ioctl](../README.md) - Command-line interface for IoTeX blockchain 30 | 31 | ###### Auto generated by docgen on 7-Mar-2022 32 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_xrc20_balanceOf.md: -------------------------------------------------------------------------------- 1 | ## ioctl xrc20 balanceOf 2 | 3 | Get account balance 4 | 5 | ### Synopsis 6 | 7 | Get account balance 8 | 9 | ``` 10 | ioctl xrc20 balanceOf (ALIAS|OWNER_ADDRESS) -c ALIAS|CONTRACT_ADDRESS [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for balanceOf 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -c, --contract-address string set contract address 23 | --endpoint string set endpoint for once 24 | --insecure insecure connection for once (default false) 25 | -o, --output-format string output format 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [ioctl xrc20](ioctl_xrc20.md) - Support ERC20 standard command-line 31 | 32 | ###### Auto generated by docgen on 7-Mar-2022 33 | -------------------------------------------------------------------------------- /tools/ioctl/readme/ioctl_xrc20_totalSupply.md: -------------------------------------------------------------------------------- 1 | ## ioctl xrc20 totalSupply 2 | 3 | Get total supply 4 | 5 | ### Synopsis 6 | 7 | Get total supply 8 | 9 | ``` 10 | ioctl xrc20 totalSupply -c ALIAS|CONTRACT_ADDRESS [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for totalSupply 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | -c, --contract-address string set contract address 23 | --endpoint string set endpoint for once 24 | --insecure insecure connection for once (default false) 25 | -o, --output-format string output format 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [ioctl xrc20](ioctl_xrc20.md) - Support ERC20 standard command-line 31 | 32 | ###### Auto generated by docgen on 7-Mar-2022 33 | -------------------------------------------------------------------------------- /tools/iomigrater/common/lang.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | // TranslateInLang Switch language output. 8 | func TranslateInLang(cmdString map[string]string) string { 9 | langEnv := os.Getenv("LANG") 10 | switch langEnv { 11 | case "zh_CN.UTF-8": 12 | return cmdString["chinese"] 13 | default: 14 | return cmdString["english"] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tools/iomigrater/main.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package main 7 | 8 | func main() { 9 | Execute() 10 | } 11 | -------------------------------------------------------------------------------- /tools/multisend/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.6.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | constructor() public { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier restricted() { 12 | if (msg.sender == owner) _; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tools/multisend/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /tools/newioctl/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package main 7 | 8 | import ( 9 | "os" 10 | 11 | "github.com/iotexproject/iotex-core/v2/ioctl" 12 | "github.com/iotexproject/iotex-core/v2/ioctl/newcmd" 13 | "github.com/iotexproject/iotex-core/v2/ioctl/newcmd/config" 14 | "github.com/iotexproject/iotex-core/v2/pkg/log" 15 | ) 16 | 17 | func main() { 18 | readConfig, defaultConfigFile, err := config.InitConfig() 19 | if err != nil { 20 | log.L().Panic(err.Error()) 21 | } 22 | client := ioctl.NewClient(readConfig, defaultConfigFile) 23 | if err := newcmd.NewIoctl(client).Execute(); err != nil { 24 | os.Exit(1) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tools/newxctl/xctl.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package main 7 | 8 | import ( 9 | "os" 10 | 11 | "github.com/iotexproject/iotex-core/v2/ioctl" 12 | "github.com/iotexproject/iotex-core/v2/ioctl/newcmd" 13 | "github.com/iotexproject/iotex-core/v2/ioctl/newcmd/config" 14 | "github.com/iotexproject/iotex-core/v2/pkg/log" 15 | ) 16 | 17 | func main() { 18 | readConfig, defaultConfigFile, err := config.InitConfig() 19 | if err != nil { 20 | log.L().Panic(err.Error()) 21 | } 22 | client := ioctl.NewClient(readConfig, defaultConfigFile, ioctl.EnableCryptoSm2()) 23 | if err := newcmd.NewXctl(client).Execute(); err != nil { 24 | os.Exit(1) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tools/start_node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | file=$GOPATH/src/github.com/iotexproject/iotex-core/sampleconfig/stonevan/config_$1.yaml 4 | echo "Starting node with config file:" $file 5 | $GOPATH/src/github.com/iotexproject/iotex-core/bin/server -stderrthreshold=WARNING -log_dir=./log -config=$file 6 | 7 | exit 0 -------------------------------------------------------------------------------- /tools/xctl/xctl.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 IoTeX Foundation 2 | // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 | // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 | // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 | 6 | package main 7 | 8 | import ( 9 | "os" 10 | 11 | "github.com/iotexproject/iotex-core/v2/ioctl/cmd" 12 | "github.com/iotexproject/iotex-core/v2/ioctl/cmd/account" 13 | ) 14 | 15 | func main() { 16 | rootCmd := cmd.NewXctl() 17 | if err := rootCmd.Execute(); err != nil { 18 | os.Exit(1) 19 | } 20 | } 21 | 22 | func init() { 23 | account.CryptoSm2 = true 24 | } 25 | --------------------------------------------------------------------------------