├── .dockerignore ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── enahancement.yml │ └── general_issue.md ├── pull_request_template.md └── workflows │ ├── codeql.yml │ ├── compatiblity_check.yml │ ├── dapp_tests.yml │ ├── docker_build.yml │ ├── docker_publish.yml │ ├── enforce-labels.yml │ ├── eth_blocktests.yml │ ├── forge-test.yml │ ├── golangci.yml │ ├── integration-test.yml │ ├── proto-registry.yml │ └── unit_tests.yml ├── .gitignore ├── .gitmodules ├── .gitpod.yml ├── .golangci.yml ├── CHANGELOG.md ├── Dockerfile ├── LICENSE.md ├── Makefile ├── SECURITY.md ├── aclmapping ├── bank │ ├── mappings.go │ └── mappings_test.go ├── dependency_generator.go ├── evm │ ├── mappings.go │ └── mappings_test.go ├── oracle │ ├── mappings.go │ └── mappings_test.go ├── staking │ ├── mappings.go │ └── mappings_test.go ├── tokenfactory │ ├── mappings.go │ └── mappings_test.go ├── utils │ ├── resource_type.go │ ├── resource_type_test.go │ ├── test_utils.go │ └── test_utils_test.go └── wasm │ ├── mappings.go │ └── mappings_test.go ├── app ├── abci.go ├── ante.go ├── ante_test.go ├── antedecorators │ ├── accesscontrol_wasm_dependency.go │ ├── authz_nested_message.go │ ├── authz_nested_message_test.go │ ├── depdecorators │ │ └── signers.go │ ├── gas.go │ ├── gas_test.go │ ├── gasless.go │ ├── gasless_test.go │ ├── priority.go │ ├── priority_test.go │ ├── traced.go │ └── traced_test.go ├── app.go ├── app_test.go ├── apptesting │ └── test_suite.go ├── const.go ├── encoding.go ├── eth_replay.go ├── export.go ├── genesis.go ├── invariance.go ├── invariance_test.go ├── params │ ├── amino.go │ ├── config.go │ ├── doc.go │ ├── encoding.go │ └── proto.go ├── receipt.go ├── receipt_test.go ├── seidb.go ├── seidb_test.go ├── test_helpers.go ├── test_state_store.go ├── test_state_store_test.go ├── upgrade_test.go ├── upgrades.go ├── upgrades │ ├── fork_manager.go │ ├── fork_manager_test.go │ └── v0 │ │ └── upgrade.go ├── upgrades_test.go ├── utils.go └── wasm_abi.json ├── assets └── SeiLogo.png ├── cmd └── seid │ ├── cmd │ ├── blocktest.go │ ├── compact.go │ ├── debug.go │ ├── ethreplay.go │ ├── genaccounts.go │ ├── genwasm.go │ ├── iavl_parser.go │ ├── init.go │ └── root.go │ └── main.go ├── codecov.yml ├── config.yml ├── contracts ├── .gitignore ├── README.md ├── config │ └── client.toml ├── hardhat.config.js ├── package-lock.json ├── package.json ├── scripts │ └── deploy.js ├── src │ ├── Box.sol │ ├── BoxV2.sol │ ├── CW1155ERC1155Pointer.sol │ ├── CW20ERC20Pointer.sol │ ├── CW721ERC721Pointer.sol │ ├── ERC1155.sol │ ├── ERC721.sol │ ├── EVMCompatibilityTester.sol │ ├── MultiSender.sol │ ├── NativeSeiTokensERC20.sol │ ├── TestToken.sol │ ├── WSEI.sol │ └── precompiles │ │ ├── IAddr.sol │ │ ├── IBank.sol │ │ ├── IJson.sol │ │ └── IWasmd.sol ├── test │ ├── AssociateTest.js │ ├── CW1155ERC1155PointerTest.t.sol │ ├── CW1155toERC1155PointerTest.js │ ├── CW20toERC20PointerTest.js │ ├── CW721ERC721PointerTest.t.sol │ ├── CW721toERC721PointerTest.js │ ├── ERC1155toCW1155PointerTest.js │ ├── ERC20toCW20PointerTest-backup.js │ ├── ERC20toCW20PointerTest.js │ ├── ERC20toNativePointerTest.js │ ├── ERC721Test.js │ ├── ERC721toCW721PointerTest.js │ ├── EVMCompatabilityTest.js │ ├── EVMPrecompileTest.js │ ├── NativeSeiTokensERC20Test.t.sol │ ├── SeiEndpointsTest.js │ ├── lib.js │ ├── param_change_proposal.json │ ├── test1.key │ ├── test2.key │ └── test3.key └── wasm │ ├── cw1155_base.wasm │ ├── cw1155_royalties.wasm │ ├── cw20_base.wasm │ ├── cw721_base.wasm │ ├── cw721_royalties.wasm │ ├── cwerc1155.wasm │ └── cwerc721.wasm ├── docker ├── README.md ├── docker-compose.yml ├── localnode │ ├── Dockerfile │ ├── config │ │ ├── app.toml │ │ ├── config.toml │ │ └── price_feeder_config.toml │ └── scripts │ │ ├── deploy.sh │ │ ├── step0_build.sh │ │ ├── step1_configure_init.sh │ │ ├── step2_genesis.sh │ │ ├── step3_add_validator_to_genesis.sh │ │ ├── step4_config_override.sh │ │ ├── step5_start_sei.sh │ │ └── step6_start_price_feeder.sh └── rpcnode │ ├── Dockerfile │ ├── config │ ├── app.toml │ └── config.toml │ └── scripts │ ├── deploy.sh │ ├── step0_build.sh │ ├── step1_configure_init.sh │ └── step2_start_sei.sh ├── docs ├── README.md ├── migration │ ├── seidb_architecture.png │ ├── seidb_archive_migration.md │ ├── seidb_migration.md │ └── seiv2_config_migration.md ├── rfc │ ├── README.md │ ├── access_control.drawio.png │ ├── optimistic_processing.png │ ├── rfc-000-optimistic-proposal-processing.md │ ├── rfc-001-parallel-tx-processing.md │ └── rfc-template.md ├── swagger-ui │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── index.css │ ├── index.html │ ├── oauth2-redirect.html │ ├── swagger-initializer.js │ ├── swagger-ui-bundle.js │ ├── swagger-ui-bundle.js.map │ ├── swagger-ui-es-bundle-core.js │ ├── swagger-ui-es-bundle-core.js.map │ ├── swagger-ui-es-bundle.js │ ├── swagger-ui-es-bundle.js.map │ ├── swagger-ui-standalone-preset.js │ ├── swagger-ui-standalone-preset.js.map │ ├── swagger-ui.css │ ├── swagger-ui.css.map │ ├── swagger-ui.js │ ├── swagger-ui.js.map │ └── swagger.yml └── swagger │ ├── init.go │ └── statik.go ├── evmrpc ├── README.md ├── association.go ├── association_test.go ├── block.go ├── block_test.go ├── bloom.go ├── bloom_test.go ├── config.go ├── config_test.go ├── echo.go ├── endpoints.go ├── filter.go ├── filter_test.go ├── info.go ├── info_test.go ├── jwt_handler.go ├── net.go ├── query_builder.go ├── rpcstack.go ├── rpcstack_test.go ├── send.go ├── send_test.go ├── server.go ├── setup_test.go ├── simulate.go ├── simulate_test.go ├── state.go ├── state_test.go ├── subscribe.go ├── subscribe_test.go ├── test.go ├── tests │ ├── block_test.go │ ├── log_test.go │ ├── mock_accounts.go │ ├── mock_client.go │ ├── mock_contracts.go │ ├── mock_upgrade.go │ ├── state_test.go │ ├── tracers_test.go │ ├── tx.go │ └── utils.go ├── tracers.go ├── tracers_test.go ├── tx.go ├── tx_test.go ├── txpool.go ├── txpool_test.go ├── utils.go ├── utils_test.go ├── web3.go ├── web3_test.go └── websockets.go ├── example ├── contracts │ ├── README │ ├── echo │ │ ├── Echo.abi │ │ ├── Echo.bin │ │ ├── Echo.go │ │ └── Echo.sol │ ├── erc1155 │ │ ├── ERC1155Example.abi │ │ ├── ERC1155Example.bin │ │ ├── ERC1155Example.sol │ │ └── erc1155.go │ ├── erc20 │ │ ├── ERC20.abi │ │ ├── ERC20.bin │ │ ├── ERC20.go │ │ ├── ERC20.sol │ │ ├── IERC20.abi │ │ ├── IERC20.bin │ │ └── README.md │ ├── erc2981 │ │ ├── ERC2981Example.abi │ │ ├── ERC2981Example.bin │ │ ├── ERC2981Example.sol │ │ └── erc2981.go │ ├── erc721 │ │ ├── DummyERC721.abi │ │ ├── DummyERC721.bin │ │ ├── ERC721.sol │ │ └── README.md │ ├── sendall │ │ ├── IBank.abi │ │ ├── IBank.bin │ │ ├── SendAll.abi │ │ ├── SendAll.bin │ │ ├── SendAll.go │ │ └── SendAll.sol │ └── simplestorage │ │ ├── SimpleStorage.abi │ │ ├── SimpleStorage.bin │ │ ├── SimpleStorage.go │ │ └── SimpleStorage.sol └── cosmwasm │ ├── cw1155 │ ├── Cargo.lock │ ├── Cargo.toml │ ├── artifacts │ │ ├── checksums.txt │ │ └── cwerc1155.wasm │ └── src │ │ ├── contract.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── msg.rs │ │ ├── querier.rs │ │ └── state.rs │ ├── cw20 │ ├── Cargo.lock │ ├── Cargo.toml │ ├── artifacts │ │ ├── checksums.txt │ │ ├── checksums_intermediate.txt │ │ └── cwerc20.wasm │ └── src │ │ ├── contract.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── msg.rs │ │ ├── querier.rs │ │ └── state.rs │ ├── cw721 │ ├── Cargo.lock │ ├── Cargo.toml │ ├── artifacts │ │ ├── checksums.txt │ │ └── cwerc721.wasm │ └── src │ │ ├── contract.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── msg.rs │ │ ├── querier.rs │ │ └── state.rs │ ├── echo │ ├── Cargo.lock │ ├── Cargo.toml │ ├── artifacts │ │ ├── checksums.txt │ │ ├── checksums_intermediate.txt │ │ └── echo.wasm │ └── src │ │ ├── contract.rs │ │ ├── lib.rs │ │ └── msg.rs │ └── iter │ ├── Cargo.lock │ ├── Cargo.toml │ ├── artifacts │ ├── checksums.txt │ └── iter.wasm │ └── src │ ├── contract.rs │ ├── lib.rs │ └── msg.rs ├── foundry.toml ├── go.mod ├── go.sum ├── integration_test ├── README.md ├── authz_module │ ├── generic_authorization_test.yaml │ ├── send_authorization_test.yaml │ └── staking_authorization_test.yaml ├── bank_module │ ├── multi_sig_send_test.yaml │ ├── send_funds_test.yaml │ └── simulation_tx.yaml ├── chain_operation │ ├── snapshot_operation.yaml │ └── statesync_operation.yaml ├── contracts │ ├── bad_parallelism_template.json │ ├── contract_dep_generator.py │ ├── counter_parallel.wasm │ ├── create_tokenfactory_denoms.sh │ ├── deploy_dex_contract.sh │ ├── deploy_timelocked_token_contract.sh │ ├── deploy_wasm_contracts.sh │ ├── goblin.wasm │ ├── gringotts.wasm │ ├── mars.wasm │ ├── parallelism_template.json │ ├── saturn.wasm │ └── venus.wasm ├── dapp_tests │ ├── README.md │ ├── constants.js │ ├── contracts │ │ ├── MockERC20.sol │ │ ├── MockERC721.sol │ │ └── NftMarketplace.sol │ ├── dapp_tests.sh │ ├── hardhat.config.js │ ├── nftMarketplace │ │ ├── cw721_base.wasm │ │ └── nftMarketplaceTests.js │ ├── package-lock.json │ ├── package.json │ ├── steak │ │ ├── SteakTests.js │ │ ├── contracts │ │ │ ├── steak_hub.wasm │ │ │ └── steak_token.wasm │ │ └── utils.js │ ├── uniswap │ │ ├── cw20_base.wasm │ │ └── uniswapTest.js │ └── utils.js ├── distribution_module │ ├── community_pool.yaml │ └── rewards.yaml ├── evm_module │ └── scripts │ │ ├── evm_interoperability_tests.sh │ │ └── evm_tests.sh ├── gov_module │ ├── gov_proposal_test.yaml │ ├── proposal │ │ ├── expedited_proposal.json │ │ ├── param_change_proposal.json │ │ └── staking_proposal.json │ └── staking_proposal_test.yaml ├── mint_module │ └── mint_test.yaml ├── oracle_module │ ├── set_feeder_test.yaml │ └── verify_penalty_counts.yaml ├── scripts │ └── runner.py ├── seidb │ └── state_store_test.yaml ├── staking_module │ └── staking_test.yaml ├── startup │ └── startup_test.yaml ├── template │ └── template_test.yaml ├── tokenfactory_module │ └── create_tokenfactory_test.yaml ├── upgrade_module │ ├── major_upgrade_test.yaml │ ├── minor_upgrade_test.yaml │ └── scripts │ │ ├── launch_cluster.sh │ │ ├── proposal_submit.sh │ │ ├── proposal_target_height.sh │ │ ├── proposal_vote.sh │ │ ├── proposal_wait_for_pass.sh │ │ ├── seid_downgrade.sh │ │ ├── seid_upgrade.sh │ │ ├── verify_panic.sh │ │ ├── verify_running.sh │ │ ├── verify_upgrade_needed_log.sh │ │ └── wait_for_height.sh └── wasm_module │ ├── timelocked_token_admin_test.yaml │ ├── timelocked_token_delegation_test.yaml │ ├── timelocked_token_emergency_withdraw_test.yaml │ └── timelocked_token_withdraw_test.yaml ├── loadtest ├── config.json ├── contracts │ ├── deploy.sh │ ├── deploy_erc20.sh │ ├── deploy_erc721.sh │ ├── deploy_fifty_contracts.sh │ ├── deploy_sei_tester.sh │ ├── deploy_ten_contracts.sh │ ├── deploy_univ2.sh │ ├── evm │ │ ├── .gitignore │ │ ├── bindings │ │ │ ├── erc20 │ │ │ │ ├── abi.json │ │ │ │ └── erc20.go │ │ │ ├── erc721 │ │ │ │ ├── abi.json │ │ │ │ └── erc721.go │ │ │ └── univ2_swapper │ │ │ │ ├── abi.json │ │ │ │ └── univ2_swapper.go │ │ ├── foundry.toml │ │ ├── remappings.txt │ │ ├── setup.sh │ │ └── src │ │ │ ├── ERC20Token.sol │ │ │ ├── ERC721.sol │ │ │ ├── NoopToken.sol │ │ │ ├── UniV2Swapper.sol │ │ │ └── univ2 │ │ │ ├── UniswapV2Factory.sol │ │ │ ├── UniswapV2Pair.sol │ │ │ ├── UniswapV2Router.sol │ │ │ ├── interfaces │ │ │ ├── IERC20.sol │ │ │ ├── IUniswapV2Factory.sol │ │ │ └── IUniswapV2Pair.sol │ │ │ └── libraries │ │ │ ├── Math.sol │ │ │ ├── UQ112x112.sol │ │ │ └── UniswapV2Library.sol │ ├── jupiter │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── contract.rs │ │ │ ├── lib.rs │ │ │ ├── msg.rs │ │ │ └── state.rs │ ├── mars │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── contract.rs │ │ │ ├── lib.rs │ │ │ └── msg.rs │ ├── parser.py │ ├── saturn │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── contract.rs │ │ │ ├── lib.rs │ │ │ └── msg.rs │ ├── sei_tester.wasm │ └── venus │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ ├── contract.rs │ │ ├── lib.rs │ │ └── msg.rs ├── evm.go ├── loadtest_client.go ├── main.go ├── metrics.go ├── scripts │ ├── generate_bindings.sh │ ├── metrics.py │ ├── populate_genesis_accounts.py │ ├── run_tests.py │ └── validator_failures.py ├── sign.go ├── tx.go └── types.go ├── occ_tests ├── messages │ └── test_msgs.go ├── occ_test.go └── utils │ └── utils.go ├── oracle ├── .env ├── .eslintrc.js ├── deploy.yaml ├── main.js ├── oracle.js ├── package.json ├── price-feeder │ ├── .gitignore │ ├── .gitpod.Dockerfile │ ├── .gitpod.yml │ ├── .goreleaser.yml │ ├── .tool-versions │ ├── Makefile │ ├── README.md │ ├── cmd │ │ ├── price-feeder.go │ │ └── version.go │ ├── config.example.toml │ ├── config │ │ ├── config.go │ │ └── config_test.go │ ├── dockerfile │ │ ├── Dockerfile │ │ ├── README.md │ │ └── commands.sh │ ├── main.go │ ├── oracle │ │ ├── client │ │ │ ├── client.go │ │ │ ├── height_updater.go │ │ │ └── tx_account.go │ │ ├── convert.go │ │ ├── convert_test.go │ │ ├── filter.go │ │ ├── filter_test.go │ │ ├── grpc.go │ │ ├── jail.go │ │ ├── oracle.go │ │ ├── oracle_test.go │ │ ├── param.go │ │ ├── param_test.go │ │ ├── provider │ │ │ ├── binance.go │ │ │ ├── binance_test.go │ │ │ ├── coinbase.go │ │ │ ├── coinbase_test.go │ │ │ ├── crypto.go │ │ │ ├── crypto_test.go │ │ │ ├── gate.go │ │ │ ├── gate_test.go │ │ │ ├── huobi.go │ │ │ ├── huobi_test.go │ │ │ ├── kraken.go │ │ │ ├── kraken_test.go │ │ │ ├── mexc.go │ │ │ ├── mexc_test.go │ │ │ ├── mock.go │ │ │ ├── mock_server.go │ │ │ ├── mock_server_test.go │ │ │ ├── mock_test.go │ │ │ ├── okx.go │ │ │ ├── okx_test.go │ │ │ ├── provider.go │ │ │ ├── ws_controller.go │ │ │ └── ws_controller_test.go │ │ ├── types │ │ │ └── currency.go │ │ ├── util.go │ │ └── util_test.go │ ├── pkg │ │ ├── httputil │ │ │ └── http.go │ │ └── sync │ │ │ └── sync.go │ ├── router │ │ ├── middleware │ │ │ └── middleware.go │ │ └── v1 │ │ │ ├── metrics.go │ │ │ ├── oracle.go │ │ │ ├── response.go │ │ │ ├── router.go │ │ │ └── router_test.go │ ├── scripts │ │ └── monitor-oracle.sh │ └── tools │ │ └── tools.go ├── prices.js ├── readme.md ├── roles │ ├── configure_oracle │ │ └── tasks │ │ │ └── main.yaml │ └── terraform │ │ └── tasks │ │ └── main.yaml ├── terraform │ └── oracle.tf └── utils.js ├── parallelization ├── bank │ ├── Cargo.toml │ ├── deps.json │ └── src │ │ ├── contract.rs │ │ ├── lib.rs │ │ └── msg.rs ├── staking │ ├── Cargo.toml │ └── src │ │ ├── contract.rs │ │ ├── lib.rs │ │ └── msg.rs └── wasm │ ├── Cargo.toml │ └── src │ ├── contract.rs │ ├── lib.rs │ └── msg.rs ├── precompiles ├── addr │ ├── Addr.sol │ ├── abi.json │ ├── addr.go │ ├── addr_test.go │ └── legacy │ │ ├── v552 │ │ ├── abi.json │ │ └── addr.go │ │ ├── v555 │ │ ├── abi.json │ │ └── addr.go │ │ ├── v562 │ │ ├── abi.json │ │ └── addr.go │ │ ├── v575 │ │ ├── abi.json │ │ └── addr.go │ │ ├── v600 │ │ ├── abi.json │ │ └── addr.go │ │ ├── v601 │ │ ├── abi.json │ │ └── addr.go │ │ ├── v603 │ │ ├── abi.json │ │ └── addr.go │ │ ├── v605 │ │ ├── abi.json │ │ └── addr.go │ │ └── v606 │ │ ├── abi.json │ │ └── addr.go ├── bank │ ├── Bank.sol │ ├── abi.json │ ├── bank.go │ ├── bank_test.go │ └── legacy │ │ ├── v552 │ │ ├── abi.json │ │ └── bank.go │ │ ├── v555 │ │ ├── abi.json │ │ └── bank.go │ │ ├── v562 │ │ ├── abi.json │ │ └── bank.go │ │ ├── v580 │ │ ├── abi.json │ │ └── bank.go │ │ ├── v600 │ │ ├── abi.json │ │ └── bank.go │ │ ├── v601 │ │ ├── abi.json │ │ └── bank.go │ │ ├── v603 │ │ ├── abi.json │ │ └── bank.go │ │ ├── v605 │ │ ├── abi.json │ │ └── bank.go │ │ └── v606 │ │ ├── abi.json │ │ └── bank.go ├── common │ ├── erc20_abi.json │ ├── expected_keepers.go │ ├── legacy │ │ ├── v552 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ │ ├── v555 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ │ ├── v562 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ │ ├── v575 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ │ ├── v580 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ │ ├── v600 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ │ ├── v605 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ │ └── v606 │ │ │ ├── expected_keepers.go │ │ │ └── precompiles.go │ ├── precompiles.go │ └── precompiles_test.go ├── distribution │ ├── Distribution.sol │ ├── abi.json │ ├── distribution.go │ ├── distribution_test.go │ ├── legacy │ │ ├── v552 │ │ │ ├── abi.json │ │ │ └── distribution.go │ │ ├── v555 │ │ │ ├── abi.json │ │ │ └── distribution.go │ │ ├── v562 │ │ │ ├── abi.json │ │ │ └── distribution.go │ │ ├── v580 │ │ │ ├── abi.json │ │ │ └── distribution.go │ │ ├── v605 │ │ │ ├── abi.json │ │ │ └── distribution.go │ │ └── v606 │ │ │ ├── abi.json │ │ │ └── distribution.go │ └── staking_abi.json ├── gov │ ├── Gov.sol │ ├── abi.json │ ├── gov.go │ ├── gov_test.go │ ├── handler.go │ └── legacy │ │ ├── v552 │ │ ├── abi.json │ │ └── gov.go │ │ ├── v555 │ │ ├── abi.json │ │ └── gov.go │ │ ├── v562 │ │ ├── abi.json │ │ └── gov.go │ │ ├── v580 │ │ ├── abi.json │ │ └── gov.go │ │ ├── v605 │ │ ├── abi.json │ │ └── gov.go │ │ └── v606 │ │ ├── abi.json │ │ └── gov.go ├── ibc │ ├── IBC.sol │ ├── abi.json │ ├── ibc.go │ ├── ibc_test.go │ └── legacy │ │ ├── v552 │ │ ├── abi.json │ │ └── ibc.go │ │ ├── v555 │ │ ├── abi.json │ │ └── ibc.go │ │ ├── v562 │ │ ├── abi.json │ │ └── ibc.go │ │ ├── v580 │ │ ├── abi.json │ │ └── ibc.go │ │ ├── v601 │ │ ├── abi.json │ │ └── ibc.go │ │ ├── v603 │ │ ├── abi.json │ │ └── ibc.go │ │ ├── v605 │ │ ├── abi.json │ │ └── ibc.go │ │ └── v606 │ │ ├── abi.json │ │ └── ibc.go ├── json │ ├── Json.sol │ ├── abi.json │ ├── json.go │ ├── json_test.go │ └── legacy │ │ ├── v552 │ │ ├── abi.json │ │ └── json.go │ │ ├── v555 │ │ ├── abi.json │ │ └── json.go │ │ ├── v562 │ │ ├── abi.json │ │ └── json.go │ │ ├── v603 │ │ ├── abi.json │ │ └── json.go │ │ ├── v605 │ │ ├── abi.json │ │ └── json.go │ │ └── v606 │ │ ├── abi.json │ │ └── json.go ├── oracle │ ├── Oracle.sol │ ├── abi.json │ ├── legacy │ │ ├── v552 │ │ │ ├── abi.json │ │ │ └── oracle.go │ │ ├── v555 │ │ │ ├── abi.json │ │ │ └── oracle.go │ │ ├── v562 │ │ │ ├── abi.json │ │ │ └── oracle.go │ │ ├── v600 │ │ │ ├── abi.json │ │ │ └── oracle.go │ │ ├── v601 │ │ │ ├── abi.json │ │ │ └── oracle.go │ │ ├── v603 │ │ │ ├── abi.json │ │ │ └── oracle.go │ │ ├── v605 │ │ │ ├── abi.json │ │ │ └── oracle.go │ │ └── v606 │ │ │ ├── abi.json │ │ │ └── oracle.go │ ├── oracle.go │ └── oracle_test.go ├── p256 │ ├── P256VERIFY.sol │ ├── abi.json │ ├── legacy │ │ └── v606 │ │ │ ├── abi.json │ │ │ ├── p256.go │ │ │ └── verifier.go │ ├── p256.go │ ├── p256_test.go │ ├── verifier.go │ └── verifier_test.go ├── pointer │ ├── Pointer.sol │ ├── abi.json │ ├── legacy │ │ ├── v552 │ │ │ ├── abi.json │ │ │ └── pointer.go │ │ ├── v555 │ │ │ ├── abi.json │ │ │ └── pointer.go │ │ ├── v562 │ │ │ ├── abi.json │ │ │ └── pointer.go │ │ ├── v575 │ │ │ ├── abi.json │ │ │ └── pointer.go │ │ ├── v580 │ │ │ ├── abi.json │ │ │ └── pointer.go │ │ ├── v600 │ │ │ ├── abi.json │ │ │ └── pointer.go │ │ ├── v605 │ │ │ ├── abi.json │ │ │ └── pointer.go │ │ └── v606 │ │ │ ├── abi.json │ │ │ └── pointer.go │ ├── pointer.go │ └── pointer_test.go ├── pointerview │ ├── Pointerview.sol │ ├── abi.json │ ├── legacy │ │ ├── v552 │ │ │ ├── abi.json │ │ │ └── pointerview.go │ │ ├── v555 │ │ │ ├── abi.json │ │ │ └── pointerview.go │ │ ├── v562 │ │ │ ├── abi.json │ │ │ └── pointerview.go │ │ ├── v605 │ │ │ ├── abi.json │ │ │ └── pointerview.go │ │ └── v606 │ │ │ ├── abi.json │ │ │ └── pointerview.go │ ├── pointerview.go │ └── pointerview_test.go ├── setup.go ├── staking │ ├── Staking.sol │ ├── abi.json │ ├── legacy │ │ ├── v552 │ │ │ ├── abi.json │ │ │ └── staking.go │ │ ├── v555 │ │ │ ├── abi.json │ │ │ └── staking.go │ │ ├── v562 │ │ │ ├── abi.json │ │ │ └── staking.go │ │ ├── v580 │ │ │ ├── abi.json │ │ │ └── staking.go │ │ ├── v605 │ │ │ ├── abi.json │ │ │ └── staking.go │ │ └── v606 │ │ │ ├── abi.json │ │ │ └── staking.go │ ├── staking.go │ └── staking_test.go └── wasmd │ ├── Wasmd.sol │ ├── abi.json │ ├── legacy │ ├── v552 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v555 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v562 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v575 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v580 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v600 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v601 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v603 │ │ ├── abi.json │ │ └── wasmd.go │ ├── v605 │ │ ├── abi.json │ │ └── wasmd.go │ └── v606 │ │ ├── abi.json │ │ └── wasmd.go │ ├── wasmd.go │ └── wasmd_test.go ├── proto ├── README.md ├── buf.gen.gogo.yaml ├── buf.lock ├── buf.yaml ├── epoch │ ├── epoch.proto │ ├── genesis.proto │ ├── params.proto │ ├── query.proto │ └── tx.proto ├── eth │ └── tx.proto ├── evm │ ├── config.proto │ ├── enums.proto │ ├── genesis.proto │ ├── gov.proto │ ├── params.proto │ ├── query.proto │ ├── receipt.proto │ ├── tx.proto │ └── types.proto ├── mint │ └── v1beta1 │ │ ├── genesis.proto │ │ ├── gov.proto │ │ ├── mint.proto │ │ └── query.proto ├── oracle │ ├── genesis.proto │ ├── oracle.proto │ ├── query.proto │ └── tx.proto └── tokenfactory │ ├── authorityMetadata.proto │ ├── genesis.proto │ ├── params.proto │ ├── query.proto │ └── tx.proto ├── readme.md ├── run_blocktests.sh ├── run_constant_load.sh ├── run_loadtest.sh ├── runtests.py ├── scripts ├── dump_app_state_for_height.sh ├── initialize_local_chain.sh ├── oracle │ ├── abstain_oracle_voting.py │ ├── price_feeder.py │ ├── price_fetcher.py │ └── readme.md ├── run-node.py ├── run-sha256sum.sh ├── run_snapshot.sh ├── setup │ ├── README.md │ └── setup.py ├── snapshot.sh ├── start_faucet.sh ├── state_sync.sh └── update-swagger-ui-statik.sh ├── store ├── testutils.go └── whitelist │ ├── cachemulti │ ├── store.go │ └── store_test.go │ ├── kv │ ├── store.go │ └── store_test.go │ └── multi │ ├── store.go │ └── store_test.go ├── sync └── gas.go ├── tests ├── distribution_test.go ├── epoch_test.go ├── mars.wasm ├── mint_test.go └── template_test.go ├── testutil ├── fuzzing │ └── cosmos.go ├── keeper │ ├── epoch.go │ └── evm.go ├── network │ └── network.go ├── nullify │ └── nullify.go ├── processblock │ ├── common.go │ ├── genesisacc.go │ ├── genesisbank.go │ ├── genesisepoch.go │ ├── genesismint.go │ ├── genesisstaking.go │ ├── genesiswasm.go │ ├── msgs │ │ └── bank.go │ ├── presets.go │ ├── tx.go │ └── verify │ │ ├── bank.go │ │ ├── common.go │ │ ├── distribution.go │ │ ├── epoch.go │ │ └── mint.go └── sample │ └── sample.go ├── tools ├── README.md ├── cmd.go ├── hash_verification │ ├── cmd │ │ └── cmd.go │ ├── hasher │ │ ├── types.go │ │ └── xor_hasher.go │ ├── iavl │ │ └── scanner.go │ └── pebbledb │ │ └── scanner.go ├── migration │ ├── cmd │ │ └── cmd.go │ ├── sc │ │ └── migrator.go │ └── ss │ │ └── migrator.go ├── tx-scanner │ ├── client │ │ └── grpc.go │ ├── cmd │ │ └── scan.go │ ├── query │ │ ├── block.go │ │ └── tx.go │ └── state │ │ └── types.go └── utils │ └── helper.go ├── types └── settlement.go ├── utils ├── constants.go ├── datastructures │ ├── set.go │ ├── set_test.go │ ├── typed_sync_map.go │ └── typed_sync_map_test.go ├── helpers │ ├── address.go │ ├── associate.go │ └── legacy │ │ ├── v575 │ │ ├── address.go │ │ └── associate.go │ │ └── v600 │ │ ├── address.go │ │ └── asssociate.go ├── logging │ ├── time.go │ └── time_test.go ├── metadata.go ├── metrics │ ├── README.md │ ├── labels.go │ └── metrics_util.go ├── panic.go ├── panic_test.go ├── slice.go └── slice_test.go ├── wasmbinding ├── README.md ├── bindings │ ├── errors.go │ └── msg.go ├── encoder.go ├── message_plugin.go ├── queries.go ├── query_plugin.go ├── test │ ├── encoder_test.go │ └── query_test.go └── wasm.go ├── whitepaper ├── Sei_Giga.pdf └── Sei_Whitepaper.pdf └── x ├── README.md ├── epoch ├── README.md ├── client │ ├── cli │ │ ├── query.go │ │ ├── query_epoch.go │ │ ├── query_params.go │ │ └── tx.go │ └── wasm │ │ ├── bindings │ │ └── queries.go │ │ └── query.go ├── genesis.go ├── genesis_test.go ├── handler.go ├── handler_test.go ├── keeper │ ├── epoch.go │ ├── epoch_test.go │ ├── grpc_query.go │ ├── grpc_query_epoch.go │ ├── grpc_query_epoch_test.go │ ├── grpc_query_params.go │ ├── grpc_query_params_test.go │ ├── hooks.go │ ├── hooks_test.go │ ├── keeper.go │ ├── msg_server.go │ ├── msg_server_test.go │ ├── params.go │ └── params_test.go ├── module.go ├── module_simulation.go ├── module_test.go ├── simulation │ ├── simap.go │ └── simap_test.go ├── spec │ └── README.md └── types │ ├── codec.go │ ├── epoch.go │ ├── epoch.pb.go │ ├── errors.go │ ├── events.go │ ├── expected_keepers.go │ ├── genesis.go │ ├── genesis.pb.go │ ├── genesis_test.go │ ├── hooks.go │ ├── hooks_test.go │ ├── keys.go │ ├── params.go │ ├── params.pb.go │ ├── query.pb.go │ ├── query.pb.gw.go │ ├── tx.pb.go │ └── types.go ├── evm ├── ante │ ├── basic.go │ ├── basic_test.go │ ├── fee.go │ ├── fee_test.go │ ├── gas.go │ ├── gas_test.go │ ├── preprocess.go │ ├── preprocess_test.go │ ├── router.go │ ├── router_test.go │ ├── sig.go │ └── sig_test.go ├── artifacts │ ├── README │ ├── artifacts.go │ ├── cw1155 │ │ ├── CW1155ERC1155Pointer.abi │ │ ├── CW1155ERC1155Pointer.bin │ │ ├── artifacts.go │ │ └── cw1155.go │ ├── cw20 │ │ ├── CW20ERC20Pointer.abi │ │ ├── CW20ERC20Pointer.bin │ │ ├── artifacts.go │ │ ├── cw20.go │ │ └── legacy.bin │ ├── cw721 │ │ ├── CW721ERC721Pointer.abi │ │ ├── CW721ERC721Pointer.bin │ │ ├── artifacts.go │ │ ├── cw721.go │ │ └── legacy.bin │ ├── erc1155 │ │ ├── artifacts.go │ │ └── cwerc1155.wasm │ ├── erc20 │ │ ├── artifacts.go │ │ └── cwerc20.wasm │ ├── erc721 │ │ ├── artifacts.go │ │ └── cwerc721.wasm │ ├── native │ │ ├── NativeSeiTokensERC20.abi │ │ ├── NativeSeiTokensERC20.bin │ │ ├── artifacts.go │ │ ├── artifacts_test.go │ │ └── native.go │ ├── utils │ │ └── utils.go │ └── wsei │ │ ├── WSEI.abi │ │ ├── WSEI.bin │ │ └── artifacts.go ├── blocktest │ └── config.go ├── client │ ├── cli │ │ ├── common.go │ │ ├── gov_tx.go │ │ ├── native_tx.go │ │ ├── query.go │ │ └── tx.go │ └── wasm │ │ ├── bindings │ │ └── queries.go │ │ ├── encoder.go │ │ ├── query.go │ │ └── query_test.go ├── config │ └── config.go ├── derived │ └── derived.go ├── genesis.go ├── genesis_test.go ├── gov.go ├── gov_test.go ├── handler.go ├── integration_test.go ├── keeper │ ├── address.go │ ├── address_test.go │ ├── ante.go │ ├── balance.go │ ├── code.go │ ├── code_test.go │ ├── coinbase.go │ ├── coinbase_test.go │ ├── deferred.go │ ├── evm.go │ ├── evm_test.go │ ├── fee.go │ ├── fee_test.go │ ├── genesis.go │ ├── genesis_test.go │ ├── grpc_query.go │ ├── grpc_query_test.go │ ├── keeper.go │ ├── keeper_test.go │ ├── log.go │ ├── log_test.go │ ├── msg_server.go │ ├── msg_server_test.go │ ├── nonce.go │ ├── nonce_test.go │ ├── params.go │ ├── params_test.go │ ├── pointer.go │ ├── pointer_test.go │ ├── pointer_upgrade.go │ ├── pointer_upgrade_test.go │ ├── precompile.go │ ├── precompile_test.go │ ├── receipt.go │ ├── receipt_test.go │ ├── replay.go │ ├── state.go │ ├── state_test.go │ ├── tx.go │ ├── tx_test.go │ └── view.go ├── migrations │ ├── add_new_param_migration.go │ ├── add_new_param_migration_test.go │ ├── fix_total_supply.go │ ├── fix_total_supply_test.go │ ├── migrate_all_pointers.go │ ├── migrate_all_pointers_test.go │ ├── migrate_base_fee_off_by_one.go │ ├── migrate_base_fee_off_by_one_test.go │ ├── migrate_block_bloom.go │ ├── migrate_block_bloom_test.go │ ├── migrate_cast_address_balances.go │ ├── migrate_cast_address_balances_test.go │ ├── migrate_deliver_tx_gas_limit.go │ ├── migrate_deliver_tx_gas_limit_test.go │ ├── migrate_eip_1559_max_base_fee.go │ ├── migrate_eip_1559_max_base_fee_test.go │ ├── migrate_eip_1559_params.go │ ├── migrate_eip_1559_params_test.go │ ├── migrate_remove_tx_hashes.go │ ├── migrate_remove_tx_hashes_test.go │ └── store_cw_pointer_code.go ├── module.go ├── module_test.go ├── pointer_abi.json ├── querier │ └── config.go ├── replay │ └── config.go ├── state │ ├── accesslist.go │ ├── accesslist_test.go │ ├── balance.go │ ├── balance_test.go │ ├── check.go │ ├── check_test.go │ ├── code.go │ ├── code_test.go │ ├── expected_keepers.go │ ├── keys.go │ ├── log.go │ ├── log_test.go │ ├── nonce.go │ ├── nonce_test.go │ ├── refund.go │ ├── refund_test.go │ ├── state.go │ ├── state_test.go │ ├── statedb.go │ ├── transfer.go │ ├── transfer_test.go │ ├── utils.go │ └── utils_test.go └── types │ ├── NativeSeiTokensERC20.bin │ ├── codec.go │ ├── config.go │ ├── config.pb.go │ ├── constants.go │ ├── enums.pb.go │ ├── errors.go │ ├── errors_test.go │ ├── ethtx │ ├── access_list.go │ ├── access_list_test.go │ ├── access_list_tx.go │ ├── access_list_tx_setter.go │ ├── access_list_tx_test.go │ ├── associate_tx.go │ ├── blob_tx.go │ ├── blob_tx_setter.go │ ├── blob_tx_test.go │ ├── dynamic_fee_tx.go │ ├── dynamic_fee_tx_setter.go │ ├── dynamic_fee_tx_test.go │ ├── int.go │ ├── legacy_tx.go │ ├── legacy_tx_setter.go │ ├── legacy_tx_test.go │ ├── tx.pb.go │ ├── txdata.go │ ├── utils.go │ ├── validations.go │ └── validations_test.go │ ├── events.go │ ├── genesis.go │ ├── genesis.pb.go │ ├── gov.go │ ├── gov.pb.go │ ├── gov_test.go │ ├── keys.go │ ├── keys_test.go │ ├── logs.go │ ├── message_associate.go │ ├── message_associate_contract_address.go │ ├── message_evm_transaction.go │ ├── message_evm_transaction_test.go │ ├── message_internal_evm_call.go │ ├── message_internal_evm_delegate_call.go │ ├── message_register_pointer.go │ ├── message_send.go │ ├── message_send_test.go │ ├── params.go │ ├── params.pb.go │ ├── params_test.go │ ├── query.pb.go │ ├── query.pb.gw.go │ ├── receipt.pb.go │ ├── tx.pb.go │ ├── types.pb.go │ └── whitelist.go ├── mint ├── README.md ├── client │ ├── cli │ │ ├── query.go │ │ └── tx.go │ └── rest │ │ ├── grpc_query_test.go │ │ ├── query.go │ │ └── rest.go ├── gov.go ├── keeper │ ├── genesis.go │ ├── genesis_test.go │ ├── grpc_query.go │ ├── grpc_query_test.go │ ├── hooks.go │ ├── hooks_test.go │ ├── integration_test.go │ ├── keeper.go │ ├── keeper_test.go │ ├── migrations.go │ └── migrations_test.go ├── module.go ├── module_test.go ├── simulation │ ├── decoder.go │ ├── decoder_test.go │ ├── genesis.go │ └── genesis_test.go └── types │ ├── codec.go │ ├── events.go │ ├── expected_keepers.go │ ├── genesis.go │ ├── genesis.pb.go │ ├── gov.go │ ├── gov.pb.go │ ├── hooks.go │ ├── keys.go │ ├── mint.pb.go │ ├── minter.go │ ├── minter_test.go │ ├── params.go │ ├── params_test.go │ ├── query.pb.go │ └── query.pb.gw.go ├── oracle ├── README.md ├── abci.go ├── abci_test.go ├── ante.go ├── ante_test.go ├── client │ ├── cli │ │ ├── query.go │ │ └── tx.go │ ├── rest │ │ ├── query.go │ │ ├── rest.go │ │ └── tx.go │ └── wasm │ │ ├── bindings │ │ └── queries.go │ │ └── query.go ├── common_test.go ├── exported │ └── alias.go ├── genesis.go ├── genesis_test.go ├── handler.go ├── handler_test.go ├── keeper │ ├── alias_functions.go │ ├── ballot.go │ ├── ballot_test.go │ ├── keeper.go │ ├── keeper_test.go │ ├── migrations.go │ ├── migrations_test.go │ ├── msg_server.go │ ├── params.go │ ├── querier.go │ ├── querier_test.go │ ├── slash.go │ ├── slash_test.go │ ├── test_utils.go │ ├── vote_target.go │ └── vote_target_test.go ├── module.go ├── simulation │ ├── decoder.go │ ├── decoder_test.go │ ├── genesis.go │ ├── operations.go │ └── params.go ├── spec │ ├── 01_concepts.md │ ├── 02_state.md │ ├── 03_end_block.md │ ├── 04_messages.md │ ├── 05_events.md │ ├── 06_params.md │ ├── MidBlock.md │ └── README.md ├── tally.go ├── types │ ├── ballot.go │ ├── ballot_test.go │ ├── codec.go │ ├── denom.go │ ├── denom_test.go │ ├── errors.go │ ├── events.go │ ├── expected_keeper.go │ ├── genesis.go │ ├── genesis.pb.go │ ├── genesis_test.go │ ├── keys.go │ ├── msgs.go │ ├── msgs_test.go │ ├── oracle.pb.go │ ├── params.go │ ├── params_test.go │ ├── querier.go │ ├── query.pb.go │ ├── query.pb.gw.go │ ├── snapshots.go │ ├── snapshots_test.go │ ├── test_utils.go │ ├── tx.pb.go │ ├── vote.go │ └── vote_test.go └── utils │ ├── assets.go │ └── period.go ├── store └── handler.go └── tokenfactory ├── README.md ├── client ├── cli │ ├── query.go │ ├── tx.go │ └── tx_test.go └── wasm │ ├── bindings │ └── queries.go │ ├── encoder.go │ └── query.go ├── handler.go ├── keeper ├── admins.go ├── admins_test.go ├── bankactions.go ├── bankactions_test.go ├── createdenom.go ├── createdenom_test.go ├── creators.go ├── genesis.go ├── genesis_test.go ├── grpc_query.go ├── grpc_query_test.go ├── keeper.go ├── keeper_test.go ├── migrations.go ├── migrations_test.go ├── msg_server.go └── params.go ├── module.go └── types ├── authorityMetadata.go ├── authorityMetadata.pb.go ├── codec.go ├── denoms.go ├── denoms_test.go ├── errors.go ├── events.go ├── expected_keepers.go ├── genesis.go ├── genesis.pb.go ├── genesis_test.go ├── keys.go ├── msgs.go ├── msgs_test.go ├── params.go ├── params.pb.go ├── params_test.go ├── query.pb.go ├── query.pb.gw.go └── tx.pb.go /.dockerignore: -------------------------------------------------------------------------------- 1 | build/ 2 | # The .git folder must be transferred to Docker context since the Makefile 3 | # uses git commands to get the current commit hash and tag for versioning. 4 | # .git/ -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG] Issue Title" 5 | labels: bug, linear 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Seid version** 11 | Show us output of `seid version --long | head` 12 | 13 | **Chain ID** 14 | Which chain are you running into issues with? 15 | 16 | **Describe the bug** 17 | A clear and concise description of what the bug is. 18 | 19 | **To Reproduce** 20 | Steps to reproduce the behavior: 21 | 1. Go to '...' 22 | 2. Click on '....' 23 | 3. Scroll down to '....' 24 | 4. See error 25 | 26 | **Expected behavior** 27 | A clear and concise description of what you expected to happen. 28 | 29 | **Screenshots** 30 | If applicable, add screenshots to help explain your problem. 31 | 32 | **Additional context** 33 | Add any other context about the problem here. 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general_issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Anything Else 3 | about: Create a general issue, not described above 4 | title: "[Misc] Issue Title" 5 | labels: linear 6 | assignees: 'dunand0nuts' 7 | 8 | --- 9 | 10 | **Seid version** 11 | Show us output of `seid version --long | head` 12 | 13 | **Chain ID** 14 | Which chain are you running into issues with? 15 | 16 | **Describe the Issue** 17 | A clear and concise description of what the issue is 18 | 19 | **Additional context** 20 | Add any other context about the problem here. 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Describe your changes and provide context 2 | 3 | ## Testing performed to validate your change 4 | 5 | -------------------------------------------------------------------------------- /.github/workflows/enforce-labels.yml: -------------------------------------------------------------------------------- 1 | name: Enforce PR labels 2 | 3 | on: 4 | pull_request: 5 | types: [labeled, unlabeled, opened, edited, synchronize] 6 | jobs: 7 | enforce-label: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: yogevbd/enforce-label-action@2.1.0 11 | with: 12 | REQUIRED_LABELS_ANY: "app-hash-breaking,non-app-hash-breaking" 13 | REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['app-hash-breaking', 'non-app-hash-breaking']" 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/forge-test.yml: -------------------------------------------------------------------------------- 1 | name: Forge test 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | - evm 9 | - release/** 10 | 11 | env: 12 | FOUNDRY_PROFILE: ci 13 | 14 | jobs: 15 | check: 16 | strategy: 17 | fail-fast: true 18 | 19 | name: Foundry project 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: actions/checkout@v4 23 | with: 24 | submodules: recursive 25 | 26 | - name: Install Foundry 27 | uses: foundry-rs/foundry-toolchain@v1 28 | with: 29 | version: nightly 30 | 31 | - name: Run Forge build 32 | run: | 33 | forge --version 34 | forge build --evm-version=cancun 35 | id: build 36 | 37 | - name: Run Forge tests 38 | run: | 39 | forge test -vvv --evm-version=cancun 40 | id: test 41 | -------------------------------------------------------------------------------- /.github/workflows/golangci.yml: -------------------------------------------------------------------------------- 1 | name: golangci-lint 2 | on: 3 | push: 4 | tags: 5 | - v* 6 | branches: 7 | - master 8 | - main 9 | - seiv2 10 | pull_request: 11 | permissions: 12 | contents: read 13 | # Optional: allow read access to pull request. Use with `only-new-issues` option. 14 | # pull-requests: read 15 | jobs: 16 | golangci: 17 | name: lint 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/setup-go@v3 21 | with: 22 | go-version: 1.21 23 | - uses: actions/checkout@v3 24 | - name: golangci-lint 25 | uses: golangci/golangci-lint-action@v3 26 | with: 27 | # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version 28 | version: v1.60.1 29 | args: --timeout 10m0s 30 | -------------------------------------------------------------------------------- /.github/workflows/proto-registry.yml: -------------------------------------------------------------------------------- 1 | name: Buf-Push 2 | # Protobuf runs buf (https://buf.build/) push updated proto files to https://buf.build/sei-protocol/sei-chain 3 | # This workflow is only run when a .proto file has been changed 4 | on: 5 | workflow_dispatch: 6 | push: 7 | branches: 8 | - main 9 | - seiv2 10 | paths: 11 | - "proto/**" 12 | 13 | jobs: 14 | push: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | - uses: bufbuild/buf-setup-action@v1.26.1 19 | - uses: bufbuild/buf-push-action@v1 20 | with: 21 | input: "proto" 22 | buf_token: ${{ secrets.BUF_TOKEN }} 23 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "contracts/lib/forge-std"] 2 | path = contracts/lib/forge-std 3 | url = https://github.com/foundry-rs/forge-std 4 | [submodule "contracts/lib/openzeppelin-contracts"] 5 | path = contracts/lib/openzeppelin-contracts 6 | url = https://github.com/openzeppelin/openzeppelin-contracts 7 | [submodule "loadtest/contracts/evm/lib/openzeppelin-contracts"] 8 | path = loadtest/contracts/evm/lib/openzeppelin-contracts 9 | url = https://github.com/OpenZeppelin/openzeppelin-contracts 10 | [submodule "loadtest/contracts/evm/lib/solmate"] 11 | path = loadtest/contracts/evm/lib/solmate 12 | url = https://github.com/transmissions11/solmate 13 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: ghcr.io/faddat/cosmos 2 | -------------------------------------------------------------------------------- /aclmapping/utils/test_utils.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | func CacheTxContext(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore) { 8 | ms := ctx.MultiStore() 9 | msCache := ms.CacheMultiStore() 10 | return ctx.WithMultiStore(msCache), msCache 11 | } 12 | -------------------------------------------------------------------------------- /aclmapping/utils/test_utils_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "testing" 5 | 6 | tmdb "github.com/tendermint/tm-db" 7 | 8 | "github.com/cosmos/cosmos-sdk/store" 9 | sdk "github.com/cosmos/cosmos-sdk/types" 10 | "github.com/stretchr/testify/require" 11 | tmproto "github.com/tendermint/tendermint/proto/tendermint/types" 12 | ) 13 | 14 | func TestCacheTxContext(t *testing.T) { 15 | // Create a new Context with MultiStore 16 | db := tmdb.NewMemDB() 17 | ms := store.NewCommitMultiStore(db) 18 | ctx := sdk.NewContext(ms, tmproto.Header{}, false, nil) 19 | 20 | // Call the CacheTxContext method 21 | newCtx, newMs := CacheTxContext(ctx) 22 | 23 | // Verify that newCtx has the same MultiStore as newMs 24 | require.Equal(t, newMs, newCtx.MultiStore()) 25 | 26 | // Verify that the original Context was not modified 27 | require.Equal(t, ms, ctx.MultiStore()) 28 | } 29 | -------------------------------------------------------------------------------- /app/antedecorators/traced.go: -------------------------------------------------------------------------------- 1 | package antedecorators 2 | 3 | import ( 4 | "fmt" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | "github.com/cosmos/cosmos-sdk/utils/tracing" 8 | ) 9 | 10 | type TracedAnteDecorator struct { 11 | wrapped sdk.AnteDecorator 12 | 13 | traceName string 14 | tracingInfo *tracing.Info 15 | } 16 | 17 | func NewTracedAnteDecorator(wrapped sdk.AnteDecorator, tracingInfo *tracing.Info) TracedAnteDecorator { 18 | return TracedAnteDecorator{wrapped: wrapped, traceName: fmt.Sprintf("%T", wrapped), tracingInfo: tracingInfo} 19 | } 20 | 21 | func (d TracedAnteDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { 22 | if d.tracingInfo != nil { 23 | _, span := d.tracingInfo.Start(d.traceName) 24 | defer span.End() 25 | } 26 | return d.wrapped.AnteHandle(ctx, tx, simulate, next) 27 | } 28 | -------------------------------------------------------------------------------- /app/const.go: -------------------------------------------------------------------------------- 1 | package app 2 | 3 | const ( 4 | // Prefix of bech32 encoded address 5 | AccountAddressPrefix = "sei" 6 | // Application name 7 | AppName = "sei" 8 | 9 | OptimisticProcessingTimeoutInSeconds = 5 10 | ) 11 | -------------------------------------------------------------------------------- /app/encoding.go: -------------------------------------------------------------------------------- 1 | package app 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/std" 5 | "github.com/sei-protocol/sei-chain/app/params" 6 | ) 7 | 8 | // MakeEncodingConfig creates an EncodingConfig for testing. 9 | func MakeEncodingConfig() params.EncodingConfig { 10 | encodingConfig := params.MakeEncodingConfig() 11 | std.RegisterLegacyAminoCodec(encodingConfig.Amino) 12 | std.RegisterInterfaces(encodingConfig.InterfaceRegistry) 13 | ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) 14 | ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) 15 | return encodingConfig 16 | } 17 | -------------------------------------------------------------------------------- /app/params/amino.go: -------------------------------------------------------------------------------- 1 | //go:build test_amino 2 | // +build test_amino 3 | 4 | package params 5 | 6 | import ( 7 | "github.com/cosmos/cosmos-sdk/codec" 8 | "github.com/cosmos/cosmos-sdk/codec/types" 9 | authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" 10 | ) 11 | 12 | // MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. 13 | func MakeEncodingConfig() EncodingConfig { 14 | cdc := codec.New() 15 | interfaceRegistry := types.NewInterfaceRegistry() 16 | marshaler := codec.NewAminoCodec(cdc) 17 | 18 | return EncodingConfig{ 19 | InterfaceRegistry: interfaceRegistry, 20 | Marshaler: marshaler, 21 | TxConfig: authtypes.StdTxConfig{Cdc: cdc}, 22 | Amino: cdc, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/params/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package params defines the simulation parameters in the simapp. 3 | 4 | It contains the default weights used for each transaction used on the module's 5 | simulation. These weights define the chance for a transaction to be simulated at 6 | any gived operation. 7 | 8 | You can repace the default values for the weights by providing a params.json 9 | file with the weights defined for each of the transaction operations: 10 | 11 | { 12 | "op_weight_msg_send": 60, 13 | "op_weight_msg_delegate": 100, 14 | } 15 | 16 | In the example above, the `MsgSend` has 60% chance to be simulated, while the 17 | `MsgDelegate` will always be simulated. 18 | */ 19 | package params 20 | -------------------------------------------------------------------------------- /app/params/encoding.go: -------------------------------------------------------------------------------- 1 | package params 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/client" 5 | "github.com/cosmos/cosmos-sdk/codec" 6 | "github.com/cosmos/cosmos-sdk/codec/types" 7 | ) 8 | 9 | // EncodingConfig specifies the concrete encoding types to use for a given app. 10 | // This is provided for compatibility between protobuf and amino implementations. 11 | type EncodingConfig struct { 12 | InterfaceRegistry types.InterfaceRegistry 13 | Marshaler codec.Codec 14 | TxConfig client.TxConfig 15 | Amino *codec.LegacyAmino 16 | } 17 | -------------------------------------------------------------------------------- /app/params/proto.go: -------------------------------------------------------------------------------- 1 | //go:build !test_amino 2 | // +build !test_amino 3 | 4 | package params 5 | 6 | import ( 7 | "github.com/cosmos/cosmos-sdk/codec" 8 | "github.com/cosmos/cosmos-sdk/codec/types" 9 | "github.com/cosmos/cosmos-sdk/x/auth/tx" 10 | ) 11 | 12 | // MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. 13 | func MakeEncodingConfig() EncodingConfig { 14 | amino := codec.NewLegacyAmino() 15 | interfaceRegistry := types.NewInterfaceRegistry() 16 | marshaler := codec.NewProtoCodec(interfaceRegistry) 17 | txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) 18 | 19 | return EncodingConfig{ 20 | InterfaceRegistry: interfaceRegistry, 21 | Marshaler: marshaler, 22 | TxConfig: txCfg, 23 | Amino: amino, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/utils.go: -------------------------------------------------------------------------------- 1 | package app 2 | 3 | import ( 4 | "time" 5 | 6 | abci "github.com/tendermint/tendermint/abci/types" 7 | ) 8 | 9 | type OptimisticProcessingInfo struct { 10 | Height int64 11 | Hash []byte 12 | Aborted bool 13 | Completion chan struct{} 14 | // result fields 15 | Events []abci.Event 16 | TxRes []*abci.ExecTxResult 17 | EndBlockResp abci.ResponseEndBlock 18 | } 19 | 20 | type BlockProcessRequest interface { 21 | GetHash() []byte 22 | GetTxs() [][]byte 23 | GetByzantineValidators() []abci.Misbehavior 24 | GetHeight() int64 25 | GetTime() time.Time 26 | } 27 | -------------------------------------------------------------------------------- /assets/SeiLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/assets/SeiLogo.png -------------------------------------------------------------------------------- /cmd/seid/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/sei-protocol/sei-chain/app/params" 7 | "github.com/sei-protocol/sei-chain/cmd/seid/cmd" 8 | 9 | svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" 10 | "github.com/sei-protocol/sei-chain/app" 11 | ) 12 | 13 | func main() { 14 | params.SetAddressPrefixes() 15 | rootCmd, _ := cmd.NewRootCmd() 16 | if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { 17 | os.Exit(1) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | status: 5 | project: 6 | default: 7 | target: 60% 8 | threshold: 1% # allow this much decrease on project 9 | 10 | comment: 11 | layout: "reach,diff,flags,tree,betaprofiling" 12 | behavior: default # update if exists else create new 13 | require_changes: true 14 | 15 | ignore: 16 | - "docs" 17 | - "*.md" 18 | - "*.rst" 19 | - "**/*pb*.go" 20 | - "tests/**/*" 21 | - "x/**/test_common.go" 22 | - "scripts/" 23 | - "contrib" 24 | - "intetgration_test/**/*" 25 | - "docker/**/*" 26 | -------------------------------------------------------------------------------- /config.yml: -------------------------------------------------------------------------------- 1 | build: 2 | main: './cmd/seid' 3 | accounts: 4 | - name: alice 5 | coins: ['20000token', '200000000stake'] 6 | - name: bob 7 | coins: ['10000token', '100000000stake'] 8 | validator: 9 | name: alice 10 | staked: '100000000stake' 11 | client: 12 | openapi: 13 | path: 'docs/swagger-ui/swagger.yml' 14 | vuex: 15 | path: 'vue/src/store' 16 | faucet: 17 | name: bob 18 | coins: ['5token', '100000stake'] 19 | -------------------------------------------------------------------------------- /contracts/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiler files 2 | cache/ 3 | out/ 4 | 5 | # Ignores development broadcast logs 6 | !/broadcast 7 | /broadcast/*/31337/ 8 | /broadcast/**/dry-run/ 9 | 10 | # Docs 11 | docs/ 12 | 13 | # Dotenv file 14 | .env 15 | .openzeppelin 16 | -------------------------------------------------------------------------------- /contracts/README.md: -------------------------------------------------------------------------------- 1 | ## Running hardhat tests locally 2 | * start up a local instance of sei: `./scripts/initialize_local_chain.sh` 3 | * run a hardhat tests: 4 | * `cd contracts` 5 | * `npx hardhat test --network seilocal test/ERC20toCW20PointerTest.js` 6 | 7 | ## Compile and build contracts with Foundry 8 | * run: `forge install` and `forge build` 9 | * This will generate binaries and abis in the `contracts/out/` directory 10 | 11 | ## Updating Pointer contracts across codebase 12 | * Follow instructions above to compile and build the contracts 13 | * copy the binary under the corresponding `bytecode:object` into `x/evm/contracts` `.bin` file 14 | * restart seid -------------------------------------------------------------------------------- /contracts/config/client.toml: -------------------------------------------------------------------------------- 1 | # This is a TOML config file. 2 | # For more information, see https://github.com/toml-lang/toml 3 | 4 | ############################################################################### 5 | ### Client Configuration ### 6 | ############################################################################### 7 | 8 | # The network chain ID 9 | chain-id = "" 10 | # The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) 11 | keyring-backend = "os" 12 | # CLI output format (text|json) 13 | output = "text" 14 | # : to Tendermint RPC interface for this chain 15 | node = "tcp://localhost:26657" 16 | # Transaction broadcasting mode (sync|async|block) 17 | broadcast-mode = "sync" 18 | -------------------------------------------------------------------------------- /contracts/src/Box.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract Box { 5 | uint256 private _value; 6 | 7 | event ValueChanged(uint256 value); 8 | 9 | function store(uint256 value) public { 10 | _value = value; 11 | emit ValueChanged(value); 12 | } 13 | 14 | function retrieve() public view returns (uint256) { 15 | return _value; 16 | } 17 | 18 | function boxIncr() public { 19 | _value = _value + 1; 20 | emit ValueChanged(_value); 21 | } 22 | } -------------------------------------------------------------------------------- /contracts/src/BoxV2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract BoxV2 { 5 | uint256 private _value; 6 | uint256 private _value2; 7 | 8 | event ValueChanged(uint256 value); 9 | 10 | function store(uint256 value) public { 11 | _value = value; 12 | emit ValueChanged(value); 13 | } 14 | 15 | function retrieve() public view returns (uint256) { 16 | return _value; 17 | } 18 | 19 | function boxV2Incr() public { 20 | _value = _value + 1; 21 | emit ValueChanged(_value); 22 | } 23 | 24 | function store2(uint256 value) public { 25 | _value2 = value; 26 | emit ValueChanged(value); 27 | } 28 | 29 | function retrieve2() public view returns (uint256) { 30 | return _value2; 31 | } 32 | } -------------------------------------------------------------------------------- /contracts/src/TestToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.20; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "@openzeppelin/contracts/access/Ownable.sol"; 6 | 7 | contract TestToken is ERC20, Ownable { 8 | constructor(string memory name, string memory symbol) Ownable(msg.sender) ERC20(name, symbol) { 9 | _mint(msg.sender, 1000 * (10 ** uint256(decimals()))); 10 | } 11 | 12 | // setBalance verifies modifier works 13 | function setBalance(address account, uint256 amount) public onlyOwner { 14 | uint256 currentBalance = balanceOf(account); 15 | if (amount > currentBalance) { 16 | _mint(account, amount - currentBalance); 17 | } else if (amount < currentBalance) { 18 | _burn(account, currentBalance - amount); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contracts/src/precompiles/IAddr.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | address constant ADDR_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000001004; 5 | 6 | IAddr constant ADDR_CONTRACT = IAddr( 7 | ADDR_PRECOMPILE_ADDRESS 8 | ); 9 | 10 | interface IAddr { 11 | // Queries 12 | function getSeiAddr(address addr) external view returns (string memory response); 13 | function getEvmAddr(string memory addr) external view returns (address response); 14 | } 15 | -------------------------------------------------------------------------------- /contracts/src/precompiles/IJson.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | address constant JSON_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000001003; 5 | 6 | IJson constant JSON_CONTRACT = IJson( 7 | JSON_PRECOMPILE_ADDRESS 8 | ); 9 | 10 | interface IJson { 11 | // Queries 12 | function extractAsBytes(bytes memory input, string memory key) external view returns (bytes memory response); 13 | 14 | function extractAsBytesList(bytes memory input, string memory key) external view returns (bytes[] memory response); 15 | 16 | function extractAsUint256(bytes memory input, string memory key) external view returns (uint256 response); 17 | } 18 | -------------------------------------------------------------------------------- /contracts/test/param_change_proposal.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Gov Param Change", 3 | "description": "Update quorum to 0.45", 4 | "changes": [ 5 | { 6 | "subspace": "gov", 7 | "key": "tallyparams", 8 | "value": { 9 | "quorum":"0.45" 10 | } 11 | } 12 | ], 13 | "is_expedited": false 14 | } 15 | -------------------------------------------------------------------------------- /contracts/test/test1.key: -------------------------------------------------------------------------------- 1 | -----BEGIN TENDERMINT PRIVATE KEY----- 2 | kdf: bcrypt 3 | salt: 89506FFD109DF716C20A5427C280729B 4 | type: secp256k1 5 | 6 | Nx/BNMoD68Z3kvWLgPFtHH/FaAmPvyXWcCu5851IqRuhGrEIyURXcJRcnvnVzM+A 7 | r7QRMyl+rS0Ou7r2RDvOIoSAnh+IkAM9 8 | =NUNH 9 | -----END TENDERMINT PRIVATE KEY----- 10 | -------------------------------------------------------------------------------- /contracts/test/test2.key: -------------------------------------------------------------------------------- 1 | -----BEGIN TENDERMINT PRIVATE KEY----- 2 | kdf: bcrypt 3 | salt: 37C7A4DBD31BE5B0E4D92E5E3C73214F 4 | type: secp256k1 5 | 6 | qPsq965ObBiM7Q0GCABpND9UkbexAqX1CpVYsRk++Pn6RAxCRPgiv+dMcOw1YUV8 7 | 08k95UFXYVTHdm2wZjA6DKX0q6vIfzBJ 8 | =8y08 9 | -----END TENDERMINT PRIVATE KEY----- 10 | -------------------------------------------------------------------------------- /contracts/test/test3.key: -------------------------------------------------------------------------------- 1 | -----BEGIN TENDERMINT PRIVATE KEY----- 2 | kdf: bcrypt 3 | salt: 0570173472CE9A5A3CB974CCDAD21D76 4 | type: secp256k1 5 | 6 | kry2bSNSVxxHLXBATiPIWVx+0nDXYWCiV6v7j3OkjelzqB+jAZkRUeAs3kedSy33 7 | U1CzLAbWEei6E9y8wio04J46nWpbVCRH 8 | =uItf 9 | -----END TENDERMINT PRIVATE KEY----- 10 | -------------------------------------------------------------------------------- /contracts/wasm/cw1155_base.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/contracts/wasm/cw1155_base.wasm -------------------------------------------------------------------------------- /contracts/wasm/cw1155_royalties.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/contracts/wasm/cw1155_royalties.wasm -------------------------------------------------------------------------------- /contracts/wasm/cw20_base.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/contracts/wasm/cw20_base.wasm -------------------------------------------------------------------------------- /contracts/wasm/cw721_base.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/contracts/wasm/cw721_base.wasm -------------------------------------------------------------------------------- /contracts/wasm/cw721_royalties.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/contracts/wasm/cw721_royalties.wasm -------------------------------------------------------------------------------- /contracts/wasm/cwerc1155.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/contracts/wasm/cwerc1155.wasm -------------------------------------------------------------------------------- /contracts/wasm/cwerc721.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/contracts/wasm/cwerc721.wasm -------------------------------------------------------------------------------- /docker/localnode/scripts/step0_build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Input parameters 4 | NODE_ID=${ID:-0} 5 | ARCH=$(uname -m) 6 | 7 | # Build seid 8 | echo "Building seid from local branch" 9 | git config --global --add safe.directory /sei-protocol/sei-chain 10 | export LEDGER_ENABLED=false 11 | make clean 12 | make build-linux 13 | make build-price-feeder-linux 14 | mkdir -p build/generated 15 | echo "DONE" > build/generated/build.complete 16 | -------------------------------------------------------------------------------- /docker/localnode/scripts/step4_config_override.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | NODE_ID=${ID:-0} 4 | 5 | APP_CONFIG_FILE="build/generated/node_$NODE_ID/app.toml" 6 | TENDERMINT_CONFIG_FILE="build/generated/node_$NODE_ID/config.toml" 7 | cp build/generated/genesis.json ~/.sei/config/genesis.json 8 | cp "$APP_CONFIG_FILE" ~/.sei/config/app.toml 9 | cp "$TENDERMINT_CONFIG_FILE" ~/.sei/config/config.toml 10 | 11 | # Override up persistent peers 12 | NODE_IP=$(hostname -i | awk '{print $1}') 13 | PEERS=$(cat build/generated/persistent_peers.txt |grep -v "$NODE_IP" | paste -sd "," -) 14 | sed -i'' -e 's/persistent-peers = ""/persistent-peers = "'$PEERS'"/g' ~/.sei/config/config.toml 15 | 16 | # Override snapshot directory 17 | sed -i.bak -e "s|^snapshot-directory *=.*|snapshot-directory = \"./build/generated/node_$NODE_ID/snapshots\"|" ~/.sei/config/app.toml 18 | -------------------------------------------------------------------------------- /docker/localnode/scripts/step5_start_sei.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | NODE_ID=${ID:-0} 4 | INVARIANT_CHECK_INTERVAL=${INVARIANT_CHECK_INTERVAL:-0} 5 | 6 | LOG_DIR="build/generated/logs" 7 | mkdir -p $LOG_DIR 8 | 9 | echo "Starting the seid process for node $NODE_ID with invariant check interval=$INVARIANT_CHECK_INTERVAL..." 10 | 11 | seid start --chain-id sei --inv-check-period ${INVARIANT_CHECK_INTERVAL} > "$LOG_DIR/seid-$NODE_ID.log" 2>&1 & 12 | echo "Node $NODE_ID seid is started now" 13 | echo "Done" >> build/generated/launch.complete 14 | -------------------------------------------------------------------------------- /docker/rpcnode/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | ENV HOME="/root" PATH="/root/go/bin:$PATH" 3 | RUN apt-get update && \ 4 | apt-get install -y make git build-essential jq python3 curl vim uuid-runtime 5 | RUN curl -L https://go.dev/dl/go1.21.4.linux-amd64.tar.gz | tar xvzf - -C /usr/local/ 6 | RUN mkdir -p /root/go/pkg/mod && \ 7 | mkdir -p /root/.cache && \ 8 | chmod -R a+rwX /root 9 | SHELL ["/bin/bash", "-c"] 10 | 11 | WORKDIR /sei-protocol/sei-chain 12 | 13 | EXPOSE 26656 26657 26658 9090 9091 14 | 15 | CMD ["/usr/bin/deploy.sh"] 16 | 17 | STOPSIGNAL SIGTERM 18 | 19 | COPY scripts/deploy.sh /usr/bin/deploy.sh 20 | COPY scripts/step0_build.sh /usr/bin/build.sh 21 | COPY scripts/step1_configure_init.sh /usr/bin/configure_init.sh 22 | COPY scripts/step2_start_sei.sh /usr/bin/start_sei.sh 23 | -------------------------------------------------------------------------------- /docker/rpcnode/scripts/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | SKIP_BUILD=${SKIP_BUILD:-""} 4 | 5 | # Set up env 6 | export GOPATH=$HOME/go 7 | export GOBIN=$GOPATH/bin 8 | export BUILD_PATH=/sei-protocol/sei-chain/build 9 | export PATH=$GOBIN:$PATH:/usr/local/go/bin:$BUILD_PATH 10 | echo "export GOPATH=$HOME/go" >> /root/.bashrc 11 | echo "GOBIN=$GOPATH/bin" >> /root/.bashrc 12 | echo "export PATH=$GOBIN:$PATH:/usr/local/go/bin:$BUILD_PATH" >> /root/.bashrc 13 | /bin/bash -c "source /root/.bashrc" 14 | mkdir -p $GOBIN 15 | 16 | # Step 1 build seid 17 | if [ -z "$SKIP_BUILD" ] 18 | then 19 | /usr/bin/build.sh 20 | fi 21 | cp build/seid "$GOBIN"/ 22 | 23 | # Run init to set up state sync configurations 24 | /usr/bin/configure_init.sh 25 | 26 | # Start the chain 27 | /usr/bin/start_sei.sh 28 | 29 | tail -f /dev/null -------------------------------------------------------------------------------- /docker/rpcnode/scripts/step0_build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Input parameters 4 | ARCH=$(uname -m) 5 | 6 | # Build seid 7 | echo "Building seid from local branch" 8 | git config --global --add safe.directory /sei-protocol/sei-chain 9 | LEDGER_ENABLED=false 10 | make install 11 | mkdir -p build/generated 12 | echo "DONE" > build/generated/build.complete 13 | -------------------------------------------------------------------------------- /docker/rpcnode/scripts/step2_start_sei.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | LOG_DIR="build/generated/logs" 4 | mkdir -p $LOG_DIR 5 | 6 | # Starting sei chain 7 | echo "RPC Node is starting now, check logs under $LOG_DIR" 8 | 9 | seid start --chain-id sei > "$LOG_DIR/rpc-node.log" 2>&1 & 10 | echo "Done" >> build/generated/rpc-launch.complete -------------------------------------------------------------------------------- /docs/migration/seidb_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/docs/migration/seidb_architecture.png -------------------------------------------------------------------------------- /docs/rfc/access_control.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/docs/rfc/access_control.drawio.png -------------------------------------------------------------------------------- /docs/rfc/optimistic_processing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/docs/rfc/optimistic_processing.png -------------------------------------------------------------------------------- /docs/swagger-ui/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/docs/swagger-ui/favicon-16x16.png -------------------------------------------------------------------------------- /docs/swagger-ui/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/docs/swagger-ui/favicon-32x32.png -------------------------------------------------------------------------------- /docs/swagger-ui/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | box-sizing: border-box; 3 | overflow: -moz-scrollbars-vertical; 4 | overflow-y: scroll; 5 | } 6 | 7 | *, 8 | *:before, 9 | *:after { 10 | box-sizing: inherit; 11 | } 12 | 13 | body { 14 | margin: 0; 15 | background: #fafafa; 16 | } 17 | -------------------------------------------------------------------------------- /docs/swagger-ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/swagger-ui/swagger-initializer.js: -------------------------------------------------------------------------------- 1 | window.onload = function() { 2 | // 3 | 4 | // the following lines will be replaced by docker/configurator, when it runs in a docker-container 5 | window.ui = SwaggerUIBundle({ 6 | url: "./swagger.yml", 7 | dom_id: '#swagger-ui', 8 | deepLinking: true, 9 | presets: [ 10 | SwaggerUIBundle.presets.apis, 11 | SwaggerUIStandalonePreset 12 | ], 13 | plugins: [ 14 | SwaggerUIBundle.plugins.DownloadUrl 15 | ], 16 | layout: "StandaloneLayout" 17 | }); 18 | 19 | // 20 | }; 21 | -------------------------------------------------------------------------------- /docs/swagger/init.go: -------------------------------------------------------------------------------- 1 | package swagger 2 | 3 | // This just for fixing the error in importing empty github.com/cosmos/cosmos-sdk/client/docs/statik 4 | -------------------------------------------------------------------------------- /evmrpc/echo.go: -------------------------------------------------------------------------------- 1 | package evmrpc 2 | 3 | type EchoAPI struct{} 4 | 5 | func NewEchoAPI() *EchoAPI { 6 | return &EchoAPI{} 7 | } 8 | 9 | func (a *EchoAPI) Echo(data string) string { 10 | return data 11 | } 12 | -------------------------------------------------------------------------------- /evmrpc/query_builder.go: -------------------------------------------------------------------------------- 1 | package evmrpc 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | type QueryBuilder struct { 8 | conditions []string 9 | } 10 | 11 | func NewHeadQueryBuilder() *QueryBuilder { 12 | return &QueryBuilder{ 13 | conditions: []string{ 14 | "tm.event = 'NewBlockHeader'", 15 | }, 16 | } 17 | } 18 | 19 | func NewBlockQueryBuilder() *QueryBuilder { 20 | return &QueryBuilder{ 21 | conditions: []string{ 22 | "tm.event = 'NewBlock'", 23 | }, 24 | } 25 | } 26 | 27 | func (q *QueryBuilder) Build() string { 28 | return strings.Join(q.conditions, " AND ") 29 | } 30 | -------------------------------------------------------------------------------- /evmrpc/test.go: -------------------------------------------------------------------------------- 1 | package evmrpc 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/sei-protocol/sei-chain/x/evm/artifacts/cw20" 7 | ) 8 | 9 | type TestAPI struct{} 10 | 11 | func NewTestAPI() *TestAPI { 12 | return &TestAPI{} 13 | } 14 | 15 | func (a *TestAPI) IncrementPointerVersion(pointerType string, offset int16) error { 16 | switch pointerType { 17 | case "cw20": 18 | cw20.SetVersionWithOffset(offset) 19 | default: 20 | return errors.New("invalid pointer type") 21 | } 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /evmrpc/tests/mock_upgrade.go: -------------------------------------------------------------------------------- 1 | package tests 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/app" 6 | ) 7 | 8 | func mockUpgrade(version string, height int64) func(ctx sdk.Context, a *app.App) { 9 | return func(ctx sdk.Context, a *app.App) { 10 | a.UpgradeKeeper.SetDone(ctx.WithBlockHeight(height), version) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /evmrpc/utils_test.go: -------------------------------------------------------------------------------- 1 | package evmrpc_test 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/sei-protocol/sei-chain/app" 8 | "github.com/sei-protocol/sei-chain/evmrpc" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestCheckVersion(t *testing.T) { 13 | testApp := app.Setup(false, false) 14 | k := &testApp.EvmKeeper 15 | ctx := testApp.GetContextForDeliverTx([]byte{}).WithBlockHeight(1) 16 | testApp.Commit(context.Background()) // bump store version to 1 17 | require.Nil(t, evmrpc.CheckVersion(ctx, k)) 18 | ctx = ctx.WithBlockHeight(2) 19 | require.NotNil(t, evmrpc.CheckVersion(ctx, k)) 20 | } 21 | 22 | func TestParallelRunnerPanicRecovery(t *testing.T) { 23 | r := evmrpc.NewParallelRunner(10, 10) 24 | r.Queue <- func() { 25 | panic("should be handled") 26 | } 27 | close(r.Queue) 28 | require.NotPanics(t, r.Done.Wait) 29 | } 30 | -------------------------------------------------------------------------------- /evmrpc/web3.go: -------------------------------------------------------------------------------- 1 | package evmrpc 2 | 3 | import "runtime" 4 | 5 | type Web3API struct{} 6 | 7 | func (w *Web3API) ClientVersion() string { 8 | name := "Geth" // Sei EVM is backed by go-ethereum 9 | name += "/" + runtime.GOOS + "-" + runtime.GOARCH 10 | name += "/" + runtime.Version() 11 | return name 12 | } 13 | -------------------------------------------------------------------------------- /evmrpc/web3_test.go: -------------------------------------------------------------------------------- 1 | package evmrpc_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/sei-protocol/sei-chain/evmrpc" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestClientVersion(t *testing.T) { 11 | w := evmrpc.Web3API{} 12 | require.NotEmpty(t, w.ClientVersion()) 13 | } 14 | -------------------------------------------------------------------------------- /evmrpc/websockets.go: -------------------------------------------------------------------------------- 1 | package evmrpc 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/sei-protocol/sei-chain/utils/metrics" 7 | ) 8 | 9 | type wsConnectionHandler struct { 10 | underlying http.Handler 11 | } 12 | 13 | func (h *wsConnectionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { 14 | metrics.IncWebsocketConnects() 15 | h.underlying.ServeHTTP(w, r) 16 | } 17 | 18 | func NewWSConnectionHandler(handler http.Handler) http.Handler { 19 | return &wsConnectionHandler{underlying: handler} 20 | } 21 | -------------------------------------------------------------------------------- /example/contracts/README: -------------------------------------------------------------------------------- 1 | # Install solc (on Mac) 2 | brew update 3 | brew tap ethereum/ethereum 4 | brew install solidity 5 | 6 | # Install abigen 7 | go get -u github.com/ethereum/go-ethereum 8 | cd $GOPATH/src/github.com/ethereum/go-ethereum/ 9 | make 10 | make devtools 11 | 12 | # Compile sol 13 | solc --bin -o example/contracts/simplestorage example/contracts/simplestorage/SimpleStorage.sol 14 | solc @openzeppelin=contracts/lib/openzeppelin-contracts --bin -o x/evm/artifacts/cw721 contracts/src/CW721ERC721Pointer.sol 15 | 16 | # Generate ABI in Go 17 | solc --abi -o example/contracts/simplestorage example/contracts/simplestorage/SimpleStorage.sol 18 | abigen --abi=example/contracts/simplestorage/SimpleStorage.abi --pkg=simplestorage --out=example/contracts/simplestorage/SimpleStorage.go 19 | -------------------------------------------------------------------------------- /example/contracts/echo/Echo.abi: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"echo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"setTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /example/contracts/echo/Echo.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract Echo { 5 | mapping(uint256 => uint) public timestamps; 6 | 7 | function echo(uint256 value) public pure returns (uint256) { 8 | return value; 9 | } 10 | 11 | function setTime(uint256 epoch) public { 12 | timestamps[epoch] = block.timestamp; 13 | } 14 | } -------------------------------------------------------------------------------- /example/contracts/erc20/IERC20.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/contracts/erc20/IERC20.bin -------------------------------------------------------------------------------- /example/contracts/erc20/README.md: -------------------------------------------------------------------------------- 1 | To regenerate these files, run: 2 | ``` 3 | solc --bin -o example/contracts/erc20 example/contracts/erc20/ERC20.sol --overwrite 4 | solc --abi -o example/contracts/erc20 example/contracts/erc20/ERC20.sol --overwrite 5 | abigen --abi=example/contracts/erc20/ERC20.abi --pkg=erc20 --out=example/contracts/erc20/ERC20.go 6 | ``` -------------------------------------------------------------------------------- /example/contracts/erc721/README.md: -------------------------------------------------------------------------------- 1 | To regenerate these files, run: 2 | ``` 3 | solc --bin -o example/contracts/erc721 example/contracts/erc721/ERC721.sol --overwrite 4 | solc --abi -o example/contracts/erc721 example/contracts/erc721/ERC721.sol --overwrite 5 | abigen --abi=example/contracts/erc721/DummyERC721.abi --pkg=erc721 --out=example/contracts/erc721/ERC721.go 6 | ``` -------------------------------------------------------------------------------- /example/contracts/sendall/IBank.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/contracts/sendall/IBank.bin -------------------------------------------------------------------------------- /example/contracts/sendall/SendAll.abi: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"fromAddress","type":"address"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"string","name":"denom","type":"string"}],"name":"sendAll","outputs":[],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /example/contracts/sendall/SendAll.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | import "../../../precompiles/bank/Bank.sol"; 5 | 6 | contract SendAll { 7 | function sendAll( 8 | address fromAddress, 9 | address toAddress, 10 | string memory denom 11 | ) public { 12 | uint256 amount = BANK_CONTRACT.balance(fromAddress, denom); 13 | BANK_CONTRACT.send(fromAddress, toAddress, denom, amount); 14 | } 15 | } -------------------------------------------------------------------------------- /example/contracts/simplestorage/SimpleStorage.abi: -------------------------------------------------------------------------------- 1 | [{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SetEvent","type":"event"},{"inputs":[],"name":"bad","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /example/contracts/simplestorage/SimpleStorage.bin: -------------------------------------------------------------------------------- 1 | 608060405234801561000f575f80fd5b506101938061001d5f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c806360fe47b1146100435780636d4ce63c1461005f5780639c3674fc1461007d575b5f80fd5b61005d6004803603810190610058919061010a565b610087565b005b6100676100c7565b6040516100749190610144565b60405180910390f35b6100856100cf565b005b805f819055507f0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1816040516100bc9190610144565b60405180910390a150565b5f8054905090565b5f80fd5b5f80fd5b5f819050919050565b6100e9816100d7565b81146100f3575f80fd5b50565b5f81359050610104816100e0565b92915050565b5f6020828403121561011f5761011e6100d3565b5b5f61012c848285016100f6565b91505092915050565b61013e816100d7565b82525050565b5f6020820190506101575f830184610135565b9291505056fea2646970667358221220bb55137839ea2afda11ab2d30ad07fee30bb9438caaa46e30ccd1053ed72439064736f6c63430008150033 -------------------------------------------------------------------------------- /example/contracts/simplestorage/SimpleStorage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract SimpleStorage { 5 | uint256 private storedData; 6 | 7 | event SetEvent(uint256 value); 8 | 9 | function set(uint256 value) public { 10 | storedData = value; 11 | emit SetEvent(value); 12 | } 13 | 14 | function get() public view returns (uint256) { 15 | return storedData; 16 | } 17 | 18 | function bad() public pure { 19 | revert(); 20 | } 21 | } -------------------------------------------------------------------------------- /example/cosmwasm/cw1155/artifacts/checksums.txt: -------------------------------------------------------------------------------- 1 | d9b503836b6fbec7f0385461b9ce2620c63414b15c7e1ccab714dd54e3833e00 cwerc1155.wasm 2 | -------------------------------------------------------------------------------- /example/cosmwasm/cw1155/artifacts/cwerc1155.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/cosmwasm/cw1155/artifacts/cwerc1155.wasm -------------------------------------------------------------------------------- /example/cosmwasm/cw1155/src/error.rs: -------------------------------------------------------------------------------- 1 | use cosmwasm_std::StdError; 2 | use thiserror::Error; 3 | 4 | #[derive(Error, Debug, PartialEq)] 5 | pub enum ContractError { 6 | #[error("{0}")] 7 | Std(#[from] StdError), 8 | 9 | #[error("ERC1155 does not have the requested functionality in specification")] 10 | NotSupported {}, 11 | } 12 | -------------------------------------------------------------------------------- /example/cosmwasm/cw1155/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod error; 3 | pub mod msg; 4 | pub mod querier; 5 | pub mod state; 6 | -------------------------------------------------------------------------------- /example/cosmwasm/cw1155/src/state.rs: -------------------------------------------------------------------------------- 1 | use cw_storage_plus::Item; 2 | 3 | pub const ERC1155_ADDRESS: Item = Item::new("erc1155_address"); -------------------------------------------------------------------------------- /example/cosmwasm/cw20/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cwerc20" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [features] 12 | backtraces = ["cosmwasm-std/backtraces"] 13 | # use library feature to disable all instantiate/execute/query exports 14 | library = [] 15 | 16 | [dependencies] 17 | cosmwasm-schema = "1.5.0" 18 | cosmwasm-std = { version = "1.3.1", features = ["staking", "stargate"] } 19 | cw-storage-plus = "1.2.0" 20 | cw-utils = "1.0.3" 21 | cw20 = "1.1.2" 22 | schemars = "0.8.16" 23 | serde = "1.0.195" 24 | thiserror = "1.0.56" 25 | -------------------------------------------------------------------------------- /example/cosmwasm/cw20/artifacts/checksums.txt: -------------------------------------------------------------------------------- 1 | e9b4fe3e450fc29f1a4ad3fc65217a687e24a36ab2bc76a673e5593b92c0a1d7 cwerc20.wasm 2 | -------------------------------------------------------------------------------- /example/cosmwasm/cw20/artifacts/checksums_intermediate.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/cosmwasm/cw20/artifacts/checksums_intermediate.txt -------------------------------------------------------------------------------- /example/cosmwasm/cw20/artifacts/cwerc20.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/cosmwasm/cw20/artifacts/cwerc20.wasm -------------------------------------------------------------------------------- /example/cosmwasm/cw20/src/error.rs: -------------------------------------------------------------------------------- 1 | use cosmwasm_std::StdError; 2 | use thiserror::Error; 3 | 4 | #[derive(Error, Debug, PartialEq)] 5 | pub enum ContractError { 6 | #[error("{0}")] 7 | Std(#[from] StdError), 8 | 9 | #[error("ERC20 does not support the requested functionality in it's base spec")] 10 | NotSupported {}, 11 | } -------------------------------------------------------------------------------- /example/cosmwasm/cw20/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod error; 3 | pub mod msg; 4 | pub mod querier; 5 | pub mod state; 6 | -------------------------------------------------------------------------------- /example/cosmwasm/cw20/src/state.rs: -------------------------------------------------------------------------------- 1 | use cw_storage_plus::Item; 2 | 3 | pub const ERC20_ADDRESS: Item = Item::new("erc20_address"); -------------------------------------------------------------------------------- /example/cosmwasm/cw721/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cwerc721" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [features] 12 | backtraces = ["cosmwasm-std/backtraces"] 13 | # use library feature to disable all instantiate/execute/query exports 14 | library = [] 15 | 16 | [dependencies] 17 | cosmwasm-schema = "1.5.0" 18 | cosmwasm-std = { version = "1.3.1", features = ["staking", "stargate"] } 19 | cw-storage-plus = "1.2.0" 20 | cw2981-royalties = "0.18.0" 21 | cw721 = "0.18.0" 22 | cw721-base = "0.18.0" 23 | schemars = "0.8.16" 24 | serde = "1.0.195" 25 | thiserror = "1.0.56" -------------------------------------------------------------------------------- /example/cosmwasm/cw721/artifacts/checksums.txt: -------------------------------------------------------------------------------- 1 | 9c685821723e723bf949314d4511ef2695a1440d8e33eecf30e11bb8b6b2a445 cwerc721.wasm 2 | -------------------------------------------------------------------------------- /example/cosmwasm/cw721/artifacts/cwerc721.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/cosmwasm/cw721/artifacts/cwerc721.wasm -------------------------------------------------------------------------------- /example/cosmwasm/cw721/src/error.rs: -------------------------------------------------------------------------------- 1 | use cosmwasm_std::StdError; 2 | use thiserror::Error; 3 | 4 | #[derive(Error, Debug, PartialEq)] 5 | pub enum ContractError { 6 | #[error("{0}")] 7 | Std(#[from] StdError), 8 | 9 | #[error("ERC721 does not have the requested functionality in specification")] 10 | NotSupported {}, 11 | } 12 | -------------------------------------------------------------------------------- /example/cosmwasm/cw721/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod error; 3 | pub mod msg; 4 | pub mod querier; 5 | pub mod state; 6 | -------------------------------------------------------------------------------- /example/cosmwasm/cw721/src/state.rs: -------------------------------------------------------------------------------- 1 | use cw_storage_plus::Item; 2 | 3 | pub const ERC721_ADDRESS: Item = Item::new("erc721_address"); -------------------------------------------------------------------------------- /example/cosmwasm/echo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "echo" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [features] 11 | backtraces = ["cosmwasm-std/backtraces"] 12 | # use library feature to disable all instantiate/execute/query exports 13 | library = [] 14 | 15 | [dependencies] 16 | cosmwasm-schema = { version = "1.3.1" } 17 | cw-utils = "1.0.1" 18 | cw-storage-plus = "1.0.1" 19 | cosmwasm-std = { version = "1.3.1", features = ["staking", "stargate"] } 20 | schemars = "0.8.1" 21 | serde = { version = "1.0.103", default-features = false, features = ["derive"] } 22 | thiserror = { version = "1.0.23" } 23 | semver = "1" 24 | -------------------------------------------------------------------------------- /example/cosmwasm/echo/artifacts/checksums.txt: -------------------------------------------------------------------------------- 1 | 96442088387551ac7656847625a7507acba32716336fc9e961e284e7cd2f89c8 echo.wasm 2 | -------------------------------------------------------------------------------- /example/cosmwasm/echo/artifacts/checksums_intermediate.txt: -------------------------------------------------------------------------------- 1 | 81aee154f416ddc87abe87352e55ecafbe8e53b9d175fae6eda637a592d3669e /target/wasm32-unknown-unknown/release/echo.wasm 2 | -------------------------------------------------------------------------------- /example/cosmwasm/echo/artifacts/echo.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/cosmwasm/echo/artifacts/echo.wasm -------------------------------------------------------------------------------- /example/cosmwasm/echo/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /example/cosmwasm/echo/src/msg.rs: -------------------------------------------------------------------------------- 1 | use cosmwasm_schema::{QueryResponses, cw_serde}; 2 | 3 | #[cw_serde] 4 | pub struct InstantiateMsg {} 5 | 6 | #[cw_serde] 7 | pub enum ExecuteMsg { 8 | Echo { 9 | message: String, 10 | }, 11 | } 12 | 13 | #[cw_serde] 14 | #[derive(QueryResponses)] 15 | pub enum QueryMsg { 16 | #[returns(InfoResponse)] 17 | Info {}, 18 | } 19 | 20 | #[cw_serde] 21 | pub struct InfoResponse { 22 | pub message: String, 23 | } -------------------------------------------------------------------------------- /example/cosmwasm/iter/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "iter" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [features] 11 | backtraces = ["cosmwasm-std/backtraces"] 12 | # use library feature to disable all instantiate/execute/query exports 13 | library = [] 14 | 15 | [dependencies] 16 | cosmwasm-schema = { version = "1.3.1" } 17 | cw-utils = "1.0.1" 18 | cw-storage-plus = "1.0.1" 19 | cosmwasm-std = { version = "1.3.1", features = ["staking", "stargate"] } 20 | schemars = "0.8.1" 21 | serde = { version = "1.0.103", default-features = false, features = ["derive"] } 22 | thiserror = { version = "1.0.23" } 23 | semver = "1" 24 | -------------------------------------------------------------------------------- /example/cosmwasm/iter/artifacts/checksums.txt: -------------------------------------------------------------------------------- 1 | 57314352dd749759f27bb04665c5e060714b697102f43fe1cb8ba8783cc2d0d0 iter.wasm 2 | -------------------------------------------------------------------------------- /example/cosmwasm/iter/artifacts/iter.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/example/cosmwasm/iter/artifacts/iter.wasm -------------------------------------------------------------------------------- /example/cosmwasm/iter/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /example/cosmwasm/iter/src/msg.rs: -------------------------------------------------------------------------------- 1 | use cosmwasm_schema::{cw_serde}; 2 | 3 | #[cw_serde] 4 | pub struct InstantiateMsg {} 5 | 6 | #[cw_serde] 7 | pub enum ExecuteMsg { 8 | DoSomething {}, 9 | } -------------------------------------------------------------------------------- /foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = "contracts/src" 3 | out = "contracts/out" 4 | test = "contracts/test" 5 | libs = ["contracts/lib"] 6 | 7 | # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options 8 | -------------------------------------------------------------------------------- /integration_test/chain_operation/snapshot_operation.yaml: -------------------------------------------------------------------------------- 1 | - name: Test validators should be able to create snapshot with custom location 2 | inputs: 3 | # Check if snapshots are created 4 | - cmd: if [ -d "./build/generated/node_0/snapshots" ]; then echo "true"; else echo "false"; fi 5 | env: FOUND 6 | node: sei-node-0 7 | verifiers: 8 | - type: eval 9 | expr: FOUND == "true" 10 | -------------------------------------------------------------------------------- /integration_test/chain_operation/statesync_operation.yaml: -------------------------------------------------------------------------------- 1 | - name: Test rpc node should be able to state sync from the snapshots 2 | inputs: 3 | # Check if rpc node is up and running 4 | - cmd: seid status |jq -M -r .SyncInfo.latest_block_height 5 | env: HEIGHT 6 | node: sei-rpc-node 7 | verifiers: 8 | - type: eval 9 | expr: HEIGHT > 0 10 | -------------------------------------------------------------------------------- /integration_test/contracts/counter_parallel.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/contracts/counter_parallel.wasm -------------------------------------------------------------------------------- /integration_test/contracts/goblin.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/contracts/goblin.wasm -------------------------------------------------------------------------------- /integration_test/contracts/gringotts.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/contracts/gringotts.wasm -------------------------------------------------------------------------------- /integration_test/contracts/mars.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/contracts/mars.wasm -------------------------------------------------------------------------------- /integration_test/contracts/saturn.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/contracts/saturn.wasm -------------------------------------------------------------------------------- /integration_test/contracts/venus.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/contracts/venus.wasm -------------------------------------------------------------------------------- /integration_test/dapp_tests/constants.js: -------------------------------------------------------------------------------- 1 | const rpcUrls = { 2 | "testnet": "https://rpc-testnet.sei-apis.com", 3 | "devnet": "https://rpc-arctic-1.sei-apis.com" 4 | } 5 | 6 | const evmRpcUrls = { 7 | "testnet": "https://evm-rpc-testnet.sei-apis.com", 8 | "devnet": "https://evm-rpc-arctic-1.sei-apis.com" 9 | } 10 | 11 | const chainIds = { 12 | "testnet": "atlantic-2", 13 | "devnet": "arctic-1" 14 | } 15 | 16 | module.exports = { 17 | rpcUrls, 18 | evmRpcUrls, 19 | chainIds 20 | } -------------------------------------------------------------------------------- /integration_test/dapp_tests/contracts/MockERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.20; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | 6 | contract MockERC20 is ERC20 { 7 | constructor(string memory name, string memory symbol, uint256 initialSupply) ERC20(name, symbol) { 8 | _mint(msg.sender, initialSupply); 9 | } 10 | 11 | function mint(address to, uint256 amount) public { 12 | _mint(to, amount); 13 | } 14 | } -------------------------------------------------------------------------------- /integration_test/dapp_tests/nftMarketplace/cw721_base.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/dapp_tests/nftMarketplace/cw721_base.wasm -------------------------------------------------------------------------------- /integration_test/dapp_tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dapp-tests", 3 | "version": "1.0.0", 4 | "description": "Project for dapp based integration tests", 5 | "main": "index.js", 6 | "author": "", 7 | "license": "MIT", 8 | "dependencies": { 9 | "@nomiclabs/hardhat-ethers": "^2.2.3", 10 | "@nomiclabs/hardhat-waffle": "^2.0.6", 11 | "@openzeppelin/contracts": "^5.0.2", 12 | "@openzeppelin/test-helpers": "^0.5.16", 13 | "@uniswap/v2-periphery": "^1.1.0-beta.0", 14 | "@uniswap/v3-core": "^1.0.1", 15 | "@uniswap/v3-periphery": "^1.4.4", 16 | "chai": "^4.2.0", 17 | "ethers": "^5.7.2" 18 | }, 19 | "devDependencies": { 20 | "hardhat": "^2.22.6", 21 | "it-each": "^0.5.0", 22 | "uuid": "^10.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /integration_test/dapp_tests/steak/contracts/steak_hub.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/dapp_tests/steak/contracts/steak_hub.wasm -------------------------------------------------------------------------------- /integration_test/dapp_tests/steak/contracts/steak_token.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/dapp_tests/steak/contracts/steak_token.wasm -------------------------------------------------------------------------------- /integration_test/dapp_tests/uniswap/cw20_base.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/integration_test/dapp_tests/uniswap/cw20_base.wasm -------------------------------------------------------------------------------- /integration_test/distribution_module/community_pool.yaml: -------------------------------------------------------------------------------- 1 | - name: Test funding community pool 2 | inputs: 3 | # Start with initial community pool amount 4 | - cmd: printf "12345678\n" | seid tx distribution fund-community-pool 10sei --from admin -b block --fees 2000usei --chain-id sei -y 5 | - cmd: seid q distribution community-pool -o json | jq -r ".pool[0].amount" 6 | env: COMMUNITY_FUND_POOL_START 7 | # Fund community pool 8 | - cmd: printf "12345678\n" | seid tx distribution fund-community-pool 10sei --from admin -b block --fees 2000usei --chain-id sei -y 9 | - cmd: seid q distribution community-pool -o json | jq -r ".pool[0].amount" 10 | env: COMMUNITY_FUND_POOL_END 11 | verifiers: 12 | # Community fund pool should have increased 13 | - type: eval 14 | expr: COMMUNITY_FUND_POOL_START < COMMUNITY_FUND_POOL_END 15 | 16 | -------------------------------------------------------------------------------- /integration_test/evm_module/scripts/evm_interoperability_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | cd contracts 6 | npm ci 7 | npx hardhat test --network seilocal test/CW20toERC20PointerTest.js 8 | npx hardhat test --network seilocal test/ERC20toCW20PointerTest.js 9 | npx hardhat test --network seilocal test/ERC20toNativePointerTest.js 10 | npx hardhat test --network seilocal test/CW721toERC721PointerTest.js 11 | npx hardhat test --network seilocal test/ERC721toCW721PointerTest.js 12 | npx hardhat test --network seilocal test/CW1155toERC1155PointerTest.js 13 | npx hardhat test --network seilocal test/ERC1155toCW1155PointerTest.js 14 | -------------------------------------------------------------------------------- /integration_test/evm_module/scripts/evm_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | cd contracts 6 | npm ci 7 | npx hardhat test --network seilocal test/EVMCompatabilityTest.js 8 | npx hardhat test --network seilocal test/EVMPrecompileTest.js 9 | npx hardhat test --network seilocal test/SeiEndpointsTest.js 10 | npx hardhat test --network seilocal test/AssociateTest.js -------------------------------------------------------------------------------- /integration_test/gov_module/proposal/expedited_proposal.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Gov Param Change Expedited", 3 | "description": "Update expedited_quorum to 0.75", 4 | "changes": [ 5 | { 6 | "subspace": "gov", 7 | "key": "tallyparams", 8 | "value": { 9 | "expedited_quorum":"0.75" 10 | } 11 | } 12 | ], 13 | "deposit": "10000000usei", 14 | "is_expedited": true 15 | } -------------------------------------------------------------------------------- /integration_test/gov_module/proposal/param_change_proposal.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Gov Param Change", 3 | "description": "Update quorum to 0.45", 4 | "changes": [ 5 | { 6 | "subspace": "gov", 7 | "key": "tallyparams", 8 | "value": { 9 | "quorum":"0.45" 10 | } 11 | } 12 | ], 13 | "deposit": "10000000usei", 14 | "is_expedited": false 15 | } -------------------------------------------------------------------------------- /integration_test/gov_module/proposal/staking_proposal.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Update Unbonding Time", 3 | "description": "Update UnbondingTime to 21 days", 4 | "changes": [ 5 | { 6 | "subspace": "staking", 7 | "key": "UnbondingTime", 8 | "value": "1814400000000000" 9 | } 10 | ], 11 | "deposit": "10000000usei", 12 | "is_expedited": true 13 | } 14 | -------------------------------------------------------------------------------- /integration_test/startup/startup_test.yaml: -------------------------------------------------------------------------------- 1 | - name: Test number of validators should be equal to 4 2 | inputs: 3 | # Query num of validators 4 | - cmd: seid q tendermint-validator-set |grep address |wc -l 5 | env: RESULT 6 | verifiers: 7 | - type: eval 8 | expr: RESULT == 4 9 | 10 | - name: Test block height should be greater than 0 11 | inputs: 12 | # Get the current block height 13 | - cmd: seid status |jq -M -r .SyncInfo.latest_block_height 14 | env: RESULT 15 | verifiers: 16 | - type: eval 17 | expr: RESULT > 0 18 | -------------------------------------------------------------------------------- /integration_test/template/template_test.yaml: -------------------------------------------------------------------------------- 1 | - name: 2 | inputs: 3 | # Add comments for what this command is doing 4 | - cmd: 5 | env: 6 | node: 7 | # Add comments for what this command is doing 8 | - cmd: 9 | env: RESULT 10 | verifiers: 11 | # Add comments for what should the expected result 12 | - type: eval 13 | expr: 14 | - type: regex 15 | result: RESULT 16 | expr: -------------------------------------------------------------------------------- /integration_test/upgrade_module/scripts/launch_cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make clean 4 | 5 | # Check if $1 is set and use its value for UPGRADE_VERSION_LIST 6 | if [ -n "$1" ]; then 7 | INVARIANT_CHECK_INTERVAL=10 UPGRADE_VERSION_LIST=$1 make docker-cluster-start & 8 | else 9 | INVARIANT_CHECK_INTERVAL=10 make docker-cluster-start & 10 | fi 11 | 12 | # wait for launch.complete 13 | until [ $(cat build/generated/launch.complete | wc -l) = 4 ] 14 | do 15 | sleep 10 16 | done 17 | sleep 10 18 | 19 | # launch RPC node 20 | make run-rpc-node-skipbuild & 21 | 22 | sleep 5 23 | 24 | python3 integration_test/scripts/runner.py integration_test/startup/startup_test.yaml 25 | -------------------------------------------------------------------------------- /integration_test/upgrade_module/scripts/proposal_target_height.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Number of seconds passed as an argument 4 | NUMBER_OF_SECONDS=$1 5 | 6 | # Calculate the number of blocks based on 300ms block time 7 | NUMBER_OF_BLOCKS=$((NUMBER_OF_SECONDS * 1000 / 300)) 8 | 9 | # Get the current height and add the calculated number of blocks 10 | HEIGHT=$(seid status | jq -r '.SyncInfo.latest_block_height' | awk -v blocks="$NUMBER_OF_BLOCKS" '{print $1 + blocks}') 11 | 12 | echo $HEIGHT 13 | -------------------------------------------------------------------------------- /integration_test/upgrade_module/scripts/proposal_vote.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PROPOSAL_ID=${1//\'/} # Remove single quotes 4 | PROPOSAL_ID=${PROPOSAL_ID//\"/} # Remove double quotes 5 | 6 | echo "PROPOSAL_ID=$PROPOSAL_ID" >> /tmp/proposal_id 7 | 8 | printf "12345678\n" | seid tx gov vote $PROPOSAL_ID yes --from node_admin --chain-id sei --fees 2000usei -b block -y --output json | jq -r .code 9 | -------------------------------------------------------------------------------- /integration_test/upgrade_module/scripts/proposal_wait_for_pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PROPOSAL_ID=$1 4 | TIMEOUT=300 # total wait time in seconds 5 | INTERVAL=1 # time between checks in seconds 6 | TRIES=$((TIMEOUT / INTERVAL)) # number of tries 7 | 8 | # Loop until the proposal status is PROPOSAL_STATUS_PASSED or we timeout 9 | for ((i=1; i<=TRIES; i++)); do 10 | STATUS=$(seid query gov proposal $PROPOSAL_ID --output json | jq -r ".status") 11 | 12 | if [ "$STATUS" == "PROPOSAL_STATUS_PASSED" ]; then 13 | echo "Proposal $PROPOSAL_ID has passed!" 14 | exit 0 15 | else 16 | echo "Waiting for proposal $PROPOSAL_ID to pass... ($i/$TRIES)" 17 | sleep $INTERVAL 18 | fi 19 | done 20 | 21 | echo "Timeout reached. Exiting." 22 | exit 1 23 | -------------------------------------------------------------------------------- /integration_test/upgrade_module/scripts/seid_downgrade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This downgrades the binary to the currently-set UPGRADE_VERSION_LIST 4 | # UPGRADE_VERSION_LIST is an ENV var that is the default version for upgrade tests 5 | 6 | NODE_ID=${ID:-0} 7 | INVARIANT_CHECK_INTERVAL=${INVARIANT_CHECK_INTERVAL:-0} 8 | LOG_DIR="build/generated/logs" 9 | 10 | # kill the existing service 11 | pkill -f "seid start" 12 | 13 | # start the service with a different UPGRADE_VERSION_LIST 14 | UPGRADE_VERSION_LIST=$UPGRADE_VERSION_LIST seid start --chain-id sei --inv-check-period ${INVARIANT_CHECK_INTERVAL} > "$LOG_DIR/seid-$NODE_ID.log" 2>&1 & 15 | 16 | echo "PASS" 17 | exit 0 18 | -------------------------------------------------------------------------------- /integration_test/upgrade_module/scripts/verify_running.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | max_attempts=60 4 | attempt=0 5 | 6 | # Try for 1 minute to see if the service is running 7 | while [ $attempt -lt $max_attempts ]; do 8 | if pgrep -f "seid start --chain-id sei" > /dev/null; then 9 | echo "PASS" 10 | exit 0 11 | fi 12 | sleep 1 # wait for 1 second before checking again 13 | attempt=$((attempt+1)) 14 | done 15 | 16 | echo "FAIL" 17 | exit 1 18 | -------------------------------------------------------------------------------- /integration_test/upgrade_module/scripts/verify_upgrade_needed_log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This detects a log that drives whether cosmosvisor seamlessly switches to a different binary (if present) 4 | 5 | NODE_ID=${ID:-0} 6 | 7 | TARGET_BLOCK_HEIGHT=${1//\'/} 8 | TARGET_BLOCK_HEIGHT=${TARGET_BLOCK_HEIGHT//\"/} 9 | 10 | if [ -z "$TARGET_BLOCK_HEIGHT" ]; then 11 | echo "Usage: $0 " 12 | exit 1 13 | fi 14 | 15 | # Fetch the version from the parameters 16 | VERSION=$2 17 | if [ -z "$VERSION" ]; then 18 | echo "Usage: $0 " 19 | exit 1 20 | fi 21 | 22 | # Check the logs for the upgrade needed message 23 | if grep -q "UPGRADE \"$VERSION\" NEEDED at height: $TARGET_BLOCK_HEIGHT" "build/generated/logs/seid-$NODE_ID.log"; then 24 | echo "PASS" 25 | exit 0 26 | fi 27 | 28 | echo "FAIL" 29 | exit 1 30 | -------------------------------------------------------------------------------- /loadtest/contracts/evm/.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | out/ 3 | lib/ 4 | -------------------------------------------------------------------------------- /loadtest/contracts/evm/remappings.txt: -------------------------------------------------------------------------------- 1 | @openzeppelin/=lib/openzeppelin-contracts/ 2 | ds-test/=lib/forge-std/lib/ds-test/src/ 3 | erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/ 4 | forge-std/=lib/forge-std/src/ 5 | openzeppelin-contracts/=lib/openzeppelin-contracts/ 6 | -------------------------------------------------------------------------------- /loadtest/contracts/evm/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check if forge is installed by trying to run it and checking if the command exists 4 | if ! command -v forge &> /dev/null 5 | then 6 | echo "forge could not be found, installing Foundry..." 7 | curl -L https://foundry.paradigm.xyz | bash 8 | /root/.foundry/bin/foundryup 9 | fi 10 | 11 | sudo apt-get install jq -y 12 | 13 | # Install OpenZeppelin contracts 14 | forge install OpenZeppelin/openzeppelin-contracts --no-commit &> /dev/null -------------------------------------------------------------------------------- /loadtest/contracts/evm/src/ERC20Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 6 | 7 | contract ERC20Token is ERC20 { 8 | constructor(string memory name, string memory symbol) ERC20(name, symbol) {} 9 | function mint(address to, uint256 amount) public { 10 | _mint(to, amount); 11 | } 12 | } -------------------------------------------------------------------------------- /loadtest/contracts/evm/src/univ2/interfaces/IERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.10; 3 | 4 | interface IERC20 { 5 | function mint(address to, uint256 amount) external; 6 | 7 | function balanceOf(address) external view returns (uint256); 8 | 9 | function transfer(address to, uint256 amount) external returns (bool); 10 | 11 | function transferFrom( 12 | address from, 13 | address to, 14 | uint256 amount 15 | ) external returns (bool); 16 | 17 | function approve(address spender, uint256 amount) external returns (bool); 18 | } 19 | -------------------------------------------------------------------------------- /loadtest/contracts/evm/src/univ2/interfaces/IUniswapV2Factory.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.10; 3 | 4 | interface IUniswapV2Factory { 5 | function pairs(address tokenA, address tokenB) 6 | external 7 | view 8 | returns (address); 9 | 10 | function createPair(address, address) external returns (address); 11 | } 12 | -------------------------------------------------------------------------------- /loadtest/contracts/evm/src/univ2/interfaces/IUniswapV2Pair.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.10; 3 | 4 | interface IUniswapV2Pair { 5 | function initialize(address, address) external; 6 | 7 | function getReserves() 8 | external 9 | view 10 | returns ( 11 | uint112, 12 | uint112, 13 | uint32 14 | ); 15 | 16 | function mint(address) external returns (uint256); 17 | 18 | function burn(address) external returns (uint256, uint256); 19 | 20 | function swap( 21 | uint256, 22 | uint256, 23 | address 24 | ) external; 25 | 26 | function sync() external; 27 | } 28 | -------------------------------------------------------------------------------- /loadtest/contracts/evm/src/univ2/libraries/Math.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.10; 3 | 4 | library Math { 5 | function min(uint256 a, uint256 b) internal pure returns (uint256) { 6 | return a < b ? a : b; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /loadtest/contracts/evm/src/univ2/libraries/UQ112x112.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.10; 3 | 4 | /// @title UQ112x112 5 | /// @author [Uniswap Labs](https://github.com/Uniswap/v2-core/blob/master/contracts/libraries/UQ112x112.sol) 6 | /// @notice Library for handling binary fixed point numbers 7 | library UQ112x112 { 8 | uint224 public constant Q112 = 2**112; 9 | 10 | // encode a uint112 as a UQ112x112 11 | function encode(uint112 y) internal pure returns (uint224 z) { 12 | z = uint224(y) * Q112; // never overflows 13 | } 14 | 15 | // divide a UQ112x112 by a uint112, returning a UQ112x112 16 | function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { 17 | z = x / uint224(y); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /loadtest/contracts/jupiter/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "jupiter" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [dependencies] 11 | cosmwasm-std = { version = "1.0.0" } 12 | cosmwasm-storage = { version = "1.0.0" } 13 | cw-storage-plus = "0.13.2" 14 | serde-json-wasm = "0.4.1" 15 | cw2 = "0.13.2" 16 | cw20 = "0.13.2" 17 | schemars = "0.8.3" 18 | serde = { version = "1.0.127", default-features = false, features = ["derive"] } 19 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 20 | thiserror = { version = "1.0.26" } 21 | base64 = { version = "0.13.0" } 22 | sei-cosmwasm = "0.4.9" 23 | 24 | [dependencies.forward_ref] 25 | version = "1" 26 | 27 | [dev-dependencies] 28 | cosmwasm-schema = { version = "1.0.0" } 29 | -------------------------------------------------------------------------------- /loadtest/contracts/jupiter/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | pub mod state; 4 | -------------------------------------------------------------------------------- /loadtest/contracts/jupiter/src/state.rs: -------------------------------------------------------------------------------- 1 | use cosmwasm_std::{Addr}; 2 | use cw_storage_plus::{Item}; 3 | 4 | pub const MARS_ADDR: Item = Item::new("denoms"); -------------------------------------------------------------------------------- /loadtest/contracts/mars/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mars" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [dependencies] 11 | cosmwasm-std = { version = "1.0.0" } 12 | cosmwasm-storage = { version = "1.0.0" } 13 | cw-storage-plus = "0.13.2" 14 | serde-json-wasm = "0.4.1" 15 | cw2 = "0.13.2" 16 | cw20 = "0.13.2" 17 | schemars = "0.8.3" 18 | serde = { version = "1.0.127", default-features = false, features = ["derive"] } 19 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 20 | thiserror = { version = "1.0.26" } 21 | base64 = { version = "0.13.0" } 22 | sei-cosmwasm = "0.4.9" 23 | 24 | [dependencies.forward_ref] 25 | version = "1" 26 | 27 | [dev-dependencies] 28 | cosmwasm-schema = { version = "1.0.0" } 29 | -------------------------------------------------------------------------------- /loadtest/contracts/mars/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /loadtest/contracts/saturn/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "saturn" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [dependencies] 11 | cosmwasm-std = { version = "1.0.0" } 12 | cosmwasm-storage = { version = "1.0.0" } 13 | cw-storage-plus = "0.13.2" 14 | serde-json-wasm = "0.4.1" 15 | cw2 = "0.13.2" 16 | cw20 = "0.13.2" 17 | schemars = "0.8.3" 18 | serde = { version = "1.0.127", default-features = false, features = ["derive"] } 19 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 20 | thiserror = { version = "1.0.26" } 21 | base64 = { version = "0.13.0" } 22 | sei-cosmwasm = "0.4.9" 23 | 24 | [dependencies.forward_ref] 25 | version = "1" 26 | 27 | [dev-dependencies] 28 | cosmwasm-schema = { version = "1.0.0" } 29 | -------------------------------------------------------------------------------- /loadtest/contracts/saturn/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /loadtest/contracts/sei_tester.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/loadtest/contracts/sei_tester.wasm -------------------------------------------------------------------------------- /loadtest/contracts/venus/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "venus" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [dependencies] 11 | cosmwasm-std = { version = "1.0.0" } 12 | cosmwasm-storage = { version = "1.0.0" } 13 | cw-storage-plus = "0.13.2" 14 | serde-json-wasm = "0.4.1" 15 | cw2 = "0.13.2" 16 | cw20 = "0.13.2" 17 | schemars = "0.8.3" 18 | serde = { version = "1.0.127", default-features = false, features = ["derive"] } 19 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 20 | thiserror = { version = "1.0.26" } 21 | base64 = { version = "0.13.0" } 22 | sei-cosmwasm = "0.4.9" 23 | 24 | [dependencies.forward_ref] 25 | version = "1" 26 | 27 | [dev-dependencies] 28 | cosmwasm-schema = { version = "1.0.0" } 29 | -------------------------------------------------------------------------------- /loadtest/contracts/venus/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /loadtest/scripts/generate_bindings.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd bindings || exit 1 4 | 5 | # Loop through the subdirectories 6 | for dir in */ ; do 7 | # Navigate into the token's directory 8 | cd "$dir" 9 | # Check if abi.json exists in the directory 10 | if [ -f "abi.json" ]; then 11 | # Use abigen to generate the Go binding 12 | # The package name and output file are based on the directory name (token type) 13 | packageName=$(basename "$dir") 14 | abigen --abi="abi.json" --pkg="$packageName" --out="${packageName}.go" 15 | echo "Generated binding for $packageName" 16 | else 17 | echo "abi.json not found in $dir" 18 | fi 19 | # Navigate back to the evm directory 20 | cd .. || exit 1 21 | done 22 | -------------------------------------------------------------------------------- /loadtest/tx.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | typestx "github.com/cosmos/cosmos-sdk/types/tx" 8 | ) 9 | 10 | func SendTx( 11 | ctx context.Context, 12 | txBytes []byte, 13 | mode typestx.BroadcastMode, 14 | loadtestClient LoadTestClient, 15 | ) bool { 16 | grpcRes, err := loadtestClient.GetTxClient().BroadcastTx( 17 | ctx, 18 | &typestx.BroadcastTxRequest{ 19 | Mode: mode, 20 | TxBytes: txBytes, 21 | }, 22 | ) 23 | if grpcRes != nil { 24 | if grpcRes.TxResponse.Code == 0 { 25 | return true 26 | } else { 27 | fmt.Printf("Failed to broadcast tx with response: %v \n", grpcRes) 28 | } 29 | } else if err != nil && ctx.Err() == nil { 30 | fmt.Printf("Failed to broadcast tx: %v \n", err) 31 | } 32 | return false 33 | } 34 | -------------------------------------------------------------------------------- /oracle/.env: -------------------------------------------------------------------------------- 1 | # the chain-id 2 | CHAIN_ID="sei-chain" 3 | 4 | # Cron tab for how frequently prices will be posted (ex: 10 seconds) 5 | CRONTAB="*/10 * * * * *" 6 | 7 | # List of markets the oracle will post prices for, against ust 8 | MARKET_IDS="btc,btc,eth,sol,osmo" 9 | 10 | # RPC of tendermint node 11 | CHAIN_RPC="http://localhost:26657" 12 | 13 | # Mnemonic of wallet 14 | MNEMONIC="important words" 15 | 16 | # Address of above contract 17 | CONTRACT_ADDRESS="contractaddress123" 18 | 19 | GAS_FEE="100stake" 20 | -------------------------------------------------------------------------------- /oracle/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | commonjs: true, 5 | es2021: true, 6 | }, 7 | extends: [ 8 | 'airbnb-base', 9 | ], 10 | parserOptions: { 11 | ecmaVersion: 'latest', 12 | }, 13 | rules: { 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /oracle/deploy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Our first play. This play will run Terraform via the Terraform module 3 | # and build a dynamic inventory from its output 4 | - name: Run Terraform and build inventory dynamically 5 | hosts: localhost 6 | roles: 7 | - terraform 8 | 9 | # This play is only there to make sure that all inventory nodes are available before 10 | # we proceed 11 | - name: Wait for all machines to become ready 12 | hosts: oracle 13 | gather_facts: no 14 | tasks: 15 | - name: Wait for machine to become reachable 16 | wait_for_connection: 17 | sleep: 2 18 | 19 | # We are now ready to perform the actual installation steps. 20 | - name: Start oracle process 21 | hosts: oracle 22 | become: yes 23 | roles: 24 | - configure_oracle 25 | -------------------------------------------------------------------------------- /oracle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@kava-labs/javascript-sdk": "^9.0.0-beta-5", 4 | "@cosmjs/proto-signing": "^0.28.0", 5 | "@cosmjs/stargate": "^0.28.0", 6 | "@cosmjs/cosmwasm-stargate": "^0.28.0", 7 | "axios": "^0.27.2", 8 | "coingecko-api": "^1.0.10", 9 | "dotenv": "^8.2.0", 10 | "log-timestamp": "^0.3.0", 11 | "node-cron": "^2.0.3" 12 | }, 13 | "devDependencies": { 14 | "eslint": "^8.14.0", 15 | "eslint-config-airbnb-base": "^15.0.0", 16 | "eslint-plugin-import": "^2.26.0", 17 | "prettier": "2.0.5" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /oracle/price-feeder/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | .DS_Store 4 | build/ 5 | config.toml -------------------------------------------------------------------------------- /oracle/price-feeder/.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-base:latest 2 | 3 | ENV GO_VERSION=1.18.5 4 | RUN curl -fsSL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar xzs \ 5 | && echo "export GOPATH=$HOME/go\nexport PATH=$HOME/go/bin:$PATH" >> $HOME/.bashrc 6 | -------------------------------------------------------------------------------- /oracle/price-feeder/.gitpod.yml: -------------------------------------------------------------------------------- 1 | # https://www.gitpod.io/docs/config-gitpod-file 2 | image: 3 | file: .gitpod.Dockerfile 4 | -------------------------------------------------------------------------------- /oracle/price-feeder/.tool-versions: -------------------------------------------------------------------------------- 1 | golang 1.18.2 2 | -------------------------------------------------------------------------------- /oracle/price-feeder/dockerfile/commands.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "$PRICE_FEEDER_PASS"; echo "$PRICE_FEEDER_PASS" | \ 3 | /usr/local/bin/price-feeder /root/price-feeder/config.toml -------------------------------------------------------------------------------- /oracle/price-feeder/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/sei-protocol/sei-chain/oracle/price-feeder/cmd" 5 | ) 6 | 7 | func main() { 8 | cmd.Execute() 9 | } 10 | -------------------------------------------------------------------------------- /oracle/price-feeder/oracle/provider/mock_server_test.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gorilla/websocket" 7 | ) 8 | 9 | func TestMockServer(t *testing.T) { 10 | s := NewMockProviderServer() 11 | s.Start() 12 | defer s.Close() 13 | 14 | // Connect to the server 15 | ws, _, err := websocket.DefaultDialer.Dial(s.GetWebsocketURL(), nil) 16 | if err != nil { 17 | t.Fatalf("%v", err) 18 | } 19 | defer ws.Close() 20 | 21 | // Send message to server, read response and check to see if it's what we expect. 22 | for i := 0; i < 10; i++ { 23 | if err := ws.WriteMessage(websocket.TextMessage, []byte("hello")); err != nil { 24 | t.Fatalf("%v", err) 25 | } 26 | _, p, err := ws.ReadMessage() 27 | if err != nil { 28 | t.Fatalf("%v", err) 29 | } 30 | if string(p) != "hello" { 31 | t.Fatalf("bad message") 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /oracle/price-feeder/router/v1/metrics.go: -------------------------------------------------------------------------------- 1 | package v1 2 | 3 | import "github.com/cosmos/cosmos-sdk/telemetry" 4 | 5 | type Metrics interface { 6 | Gather(format string) (telemetry.GatherResponse, error) 7 | } 8 | -------------------------------------------------------------------------------- /oracle/price-feeder/router/v1/oracle.go: -------------------------------------------------------------------------------- 1 | package v1 2 | 3 | import ( 4 | "time" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | ) 8 | 9 | // Oracle defines the Oracle interface contract that the v1 router depends on. 10 | type Oracle interface { 11 | GetLastPriceSyncTimestamp() time.Time 12 | GetPrices() sdk.DecCoins 13 | } 14 | -------------------------------------------------------------------------------- /oracle/price-feeder/tools/tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | // +build tools 3 | 4 | // This file uses the recommended method for tracking developer tools in a Go 5 | // module. 6 | // 7 | // REF: https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module 8 | package tools 9 | 10 | import ( 11 | _ "github.com/golangci/golangci-lint/cmd/golangci-lint" 12 | ) 13 | -------------------------------------------------------------------------------- /oracle/roles/configure_oracle/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install nodejs 3 | apt: 4 | name: nodejs 5 | state: latest 6 | update_cache: yes 7 | 8 | - name: Install npm 9 | apt: 10 | name: npm 11 | state: latest 12 | update_cache: yes 13 | 14 | - name: Install yarn 15 | npm: 16 | name: yarn 17 | global: yes 18 | 19 | - name: Clone repo and checkout latest branch #confirmed 20 | ansible.builtin.git: 21 | repo: "https://{{ lookup('env', 'GIT_USER') }}:{{ lookup('env', 'GIT_ACCESS_TOKEN') }}@github.com/sei-protocol/sei-chain.git" 22 | dest: /home/ubuntu/sei-chain/ 23 | single_branch: yes 24 | version: latest 25 | force: yes 26 | 27 | - name: Start Oracle process 28 | shell: cd /home/ubuntu/sei-chain/oracle; nohup node main.js > /var/log/oracle.log 2>&1 & -------------------------------------------------------------------------------- /parallelization/bank/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bank" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [dependencies] 11 | cosmwasm-std = { version = "1.0.0" } 12 | cosmwasm-storage = { version = "1.0.0" } 13 | cw-storage-plus = "0.13.2" 14 | serde-json-wasm = "0.4.1" 15 | cw2 = "0.13.2" 16 | cw20 = "0.13.2" 17 | schemars = "0.8.3" 18 | serde = { version = "1.0.127", default-features = false, features = ["derive"] } 19 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 20 | thiserror = { version = "1.0.26" } 21 | base64 = { version = "0.13.0" } 22 | 23 | [dependencies.forward_ref] 24 | version = "1" 25 | 26 | [dev-dependencies] 27 | cosmwasm-schema = { version = "1.0.0" } 28 | -------------------------------------------------------------------------------- /parallelization/bank/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /parallelization/bank/src/msg.rs: -------------------------------------------------------------------------------- 1 | use schemars::JsonSchema; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | #[derive(Serialize, Deserialize, JsonSchema)] 5 | pub struct InstantiateMsg {} 6 | 7 | #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] 8 | #[serde(rename_all = "snake_case")] 9 | pub enum ExecuteMsg { 10 | Send { 11 | destination: String, 12 | }, 13 | } -------------------------------------------------------------------------------- /parallelization/staking/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "staking" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [dependencies] 11 | cosmwasm-std = { version = "1.0.0", features = ["staking"] } 12 | cosmwasm-storage = { version = "1.0.0" } 13 | cw-storage-plus = "0.13.2" 14 | serde-json-wasm = "0.4.1" 15 | cw2 = "0.13.2" 16 | cw20 = "0.13.2" 17 | schemars = "0.8.3" 18 | serde = { version = "1.0.127", default-features = false, features = ["derive"] } 19 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 20 | thiserror = { version = "1.0.26" } 21 | base64 = { version = "0.13.0" } 22 | 23 | [dependencies.forward_ref] 24 | version = "1" 25 | 26 | [dev-dependencies] 27 | cosmwasm-schema = { version = "1.0.0" } 28 | -------------------------------------------------------------------------------- /parallelization/staking/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /parallelization/staking/src/msg.rs: -------------------------------------------------------------------------------- 1 | use schemars::JsonSchema; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | #[derive(Serialize, Deserialize, JsonSchema)] 5 | pub struct InstantiateMsg {} 6 | 7 | #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] 8 | #[serde(rename_all = "snake_case")] 9 | pub enum ExecuteMsg { 10 | Delegate { 11 | validator: String, 12 | }, 13 | } -------------------------------------------------------------------------------- /parallelization/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "wasm" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | doctest = false 9 | 10 | [dependencies] 11 | cosmwasm-std = { version = "1.0.0" } 12 | cosmwasm-storage = { version = "1.0.0" } 13 | cw-storage-plus = "0.13.2" 14 | serde-json-wasm = "0.4.1" 15 | cw2 = "0.13.2" 16 | cw20 = "0.13.2" 17 | schemars = "0.8.3" 18 | serde = { version = "1.0.127", default-features = false, features = ["derive"] } 19 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 20 | thiserror = { version = "1.0.26" } 21 | base64 = { version = "0.13.0" } 22 | 23 | [dependencies.forward_ref] 24 | version = "1" 25 | 26 | [dev-dependencies] 27 | cosmwasm-schema = { version = "1.0.0" } 28 | -------------------------------------------------------------------------------- /parallelization/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod contract; 2 | pub mod msg; 3 | -------------------------------------------------------------------------------- /parallelization/wasm/src/msg.rs: -------------------------------------------------------------------------------- 1 | use schemars::JsonSchema; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | #[derive(Serialize, Deserialize, JsonSchema)] 5 | pub struct InstantiateMsg {} 6 | 7 | #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] 8 | #[serde(rename_all = "snake_case")] 9 | pub enum ExecuteMsg { 10 | Send { 11 | bank_address: String, 12 | destination: String, 13 | }, 14 | } 15 | 16 | #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] 17 | #[serde(rename_all = "snake_case")] 18 | pub enum BankExecuteMsg { 19 | Send { 20 | destination: String, 21 | }, 22 | } -------------------------------------------------------------------------------- /precompiles/addr/legacy/v552/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"addr","type":"string"}],"name":"getEvmAddr","outputs":[{"internalType":"address","name":"response","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getSeiAddr","outputs":[{"internalType":"string","name":"response","type":"string"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/addr/legacy/v555/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"addr","type":"string"}],"name":"getEvmAddr","outputs":[{"internalType":"address","name":"response","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getSeiAddr","outputs":[{"internalType":"string","name":"response","type":"string"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/addr/legacy/v562/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"addr","type":"string"}],"name":"getEvmAddr","outputs":[{"internalType":"address","name":"response","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getSeiAddr","outputs":[{"internalType":"string","name":"response","type":"string"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/addr/legacy/v575/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"v","type":"string"},{"internalType":"string","name":"r","type":"string"},{"internalType":"string","name":"s","type":"string"},{"internalType":"string","name":"customMessage","type":"string"}],"name":"associate","outputs":[{"internalType":"string","name":"seiAddr","type":"string"},{"internalType":"address","name":"evmAddr","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getSeiAddr","outputs":[{"internalType":"string","name":"response","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"addr","type":"string"}],"name":"getEvmAddr","outputs":[{"internalType":"address","name":"response","type":"address"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/distribution/legacy/v552/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"withdrawAddr","type":"address"}],"name":"setWithdrawAddress","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"validator","type":"string"}],"name":"withdrawDelegationRewards","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/distribution/legacy/v555/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"withdrawAddr","type":"address"}],"name":"setWithdrawAddress","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"validator","type":"string"}],"name":"withdrawDelegationRewards","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"validators","type":"string[]"}],"name":"withdrawMultipleDelegationRewards","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/distribution/legacy/v562/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"withdrawAddr","type":"address"}],"name":"setWithdrawAddress","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"validator","type":"string"}],"name":"withdrawDelegationRewards","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"validators","type":"string[]"}],"name":"withdrawMultipleDelegationRewards","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/distribution/staking_abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"valAddress","type":"string"}],"name":"delegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"srcAddress","type":"string"},{"internalType":"string","name":"dstAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"valAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"undelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/gov/legacy/v552/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"}],"name":"deposit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"},{"internalType":"int32","name":"option","type":"int32"}],"name":"vote","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/gov/legacy/v555/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"}],"name":"deposit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"},{"internalType":"int32","name":"option","type":"int32"}],"name":"vote","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/gov/legacy/v562/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"}],"name":"deposit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"},{"internalType":"int32","name":"option","type":"int32"}],"name":"vote","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/gov/legacy/v580/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"}],"name":"deposit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"},{"internalType":"int32","name":"option","type":"int32"}],"name":"vote","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/gov/legacy/v605/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"}],"name":"deposit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"},{"internalType":"int32","name":"option","type":"int32"}],"name":"vote","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/gov/legacy/v606/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"}],"name":"deposit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"proposalID","type":"uint64"},{"internalType":"int32","name":"option","type":"int32"}],"name":"vote","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/json/legacy/v552/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytes","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytesList","outputs":[{"internalType":"bytes[]","name":"response","type":"bytes[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsUint256","outputs":[{"internalType":"uint256","name":"response","type":"uint256"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/json/legacy/v555/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytes","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytesList","outputs":[{"internalType":"bytes[]","name":"response","type":"bytes[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsUint256","outputs":[{"internalType":"uint256","name":"response","type":"uint256"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/json/legacy/v562/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytes","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytesList","outputs":[{"internalType":"bytes[]","name":"response","type":"bytes[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsUint256","outputs":[{"internalType":"uint256","name":"response","type":"uint256"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/json/legacy/v603/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytes","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsBytesList","outputs":[{"internalType":"bytes[]","name":"response","type":"bytes[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"},{"internalType":"string","name":"key","type":"string"}],"name":"extractAsUint256","outputs":[{"internalType":"uint256","name":"response","type":"uint256"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /precompiles/p256/P256VERIFY.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | address constant P256VERIFY_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000001011; 5 | 6 | IP256VERIFY constant P256VERIFY_CONTRACT = IP256VERIFY(P256VERIFY_PRECOMPILE_ADDRESS); 7 | 8 | interface IP256VERIFY { 9 | function verify( 10 | bytes memory signature 11 | ) external view returns (bytes memory response); 12 | } 13 | -------------------------------------------------------------------------------- /precompiles/p256/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"view","type":"function"}] 2 | -------------------------------------------------------------------------------- /precompiles/p256/legacy/v606/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"view","type":"function"}] 2 | -------------------------------------------------------------------------------- /precompiles/pointer/Pointer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | address constant POINTER_PRECOMPILE_ADDRESS = 0x000000000000000000000000000000000000100b; 5 | 6 | IPointer constant POINTER_CONTRACT = IPointer(POINTER_PRECOMPILE_ADDRESS); 7 | 8 | interface IPointer { 9 | function addNativePointer( 10 | string memory token 11 | ) external returns (address ret); 12 | 13 | function addCW20Pointer( 14 | string memory cwAddr 15 | ) external returns (address ret); 16 | 17 | function addCW721Pointer( 18 | string memory cwAddr 19 | ) external returns (address ret); 20 | 21 | function addCW1155Pointer( 22 | string memory cwAddr 23 | ) external returns (address ret); 24 | } 25 | -------------------------------------------------------------------------------- /precompiles/pointer/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW1155Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v552/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v555/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v562/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v575/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v580/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v600/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v605/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW1155Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/pointer/legacy/v606/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW1155Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/staking/legacy/v552/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"valAddress","type":"string"}],"name":"delegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"srcAddress","type":"string"},{"internalType":"string","name":"dstAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"valAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"undelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/staking/legacy/v555/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"valAddress","type":"string"}],"name":"delegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"srcAddress","type":"string"},{"internalType":"string","name":"dstAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"valAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"undelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /precompiles/staking/legacy/v562/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"valAddress","type":"string"}],"name":"delegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"srcAddress","type":"string"},{"internalType":"string","name":"dstAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"valAddress","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"undelegate","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /proto/buf.gen.gogo.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | plugins: 3 | - name: gocosmos 4 | out: .. 5 | opt: plugins=grpc,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mcosmos/orm/v1alpha1/orm.proto=github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1 6 | - name: grpc-gateway 7 | out: .. 8 | opt: logtostderr=true,allow_colon_final_segments=true 9 | -------------------------------------------------------------------------------- /proto/buf.lock: -------------------------------------------------------------------------------- 1 | # Generated by buf. DO NOT EDIT. 2 | version: v1 3 | deps: 4 | - remote: buf.build 5 | owner: sei-protocol 6 | repository: cosmos-sdk 7 | commit: 3d29d814d0f9416a83a1db65d5ef4b9b 8 | digest: shake256:a28bddd252a07da38e1aa523a957e8fa837a92531090dce461e5b588716669688df8eb855a8e441f8edac0dfac6b59a16c6b07d8f23f5252af6a5db25684f5c9 9 | - remote: buf.build 10 | owner: sei-protocol 11 | repository: third-party 12 | commit: ec63a6f27ea04039953185599c21efc2 13 | digest: shake256:a4e513745f8b44d28ab1fe93e633424b8dc7f6275bcab228376fbf27b8dafc08360bcae8255c1d65339db5d4f38665273fa844302b6e048f992929dbdc919a5e 14 | -------------------------------------------------------------------------------- /proto/buf.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | name: buf.build/sei-protocol/sei-chain 3 | deps: 4 | - buf.build/sei-protocol/cosmos-sdk 5 | breaking: 6 | use: 7 | - FILE 8 | lint: 9 | use: 10 | - DEFAULT 11 | - COMMENTS 12 | - FILE_LOWER_SNAKE_CASE 13 | except: 14 | - UNARY_RPC 15 | - COMMENT_FIELD 16 | - SERVICE_SUFFIX 17 | - PACKAGE_VERSION_SUFFIX 18 | - RPC_REQUEST_STANDARD_NAME 19 | ignore: 20 | - tendermint 21 | -------------------------------------------------------------------------------- /proto/epoch/genesis.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.epoch; 3 | 4 | import "gogoproto/gogo.proto"; 5 | import "epoch/params.proto"; 6 | import "epoch/epoch.proto"; 7 | // this line is used by starport scaffolding # genesis/proto/import 8 | 9 | option go_package = "github.com/sei-protocol/sei-chain/x/epoch/types"; 10 | 11 | // GenesisState defines the epoch module's genesis state. 12 | message GenesisState { 13 | Params params = 1 [(gogoproto.nullable) = false]; 14 | Epoch epoch = 2; 15 | // this line is used by starport scaffolding # genesis/proto/state 16 | } 17 | -------------------------------------------------------------------------------- /proto/epoch/params.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.epoch; 3 | 4 | import "gogoproto/gogo.proto"; 5 | 6 | option go_package = "github.com/sei-protocol/sei-chain/x/epoch/types"; 7 | 8 | // Params defines the parameters for the module. 9 | message Params { 10 | option (gogoproto.goproto_stringer) = false; 11 | 12 | } -------------------------------------------------------------------------------- /proto/epoch/tx.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.epoch; 3 | 4 | // this line is used by starport scaffolding # proto/tx/import 5 | 6 | option go_package = "github.com/sei-protocol/sei-chain/x/epoch/types"; 7 | 8 | // Msg defines the Msg service. 9 | service Msg { 10 | // this line is used by starport scaffolding # proto/tx/rpc 11 | } 12 | 13 | // this line is used by starport scaffolding # proto/tx/message -------------------------------------------------------------------------------- /proto/evm/config.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.evm; 3 | 4 | import "gogoproto/gogo.proto"; 5 | 6 | option go_package = "github.com/sei-protocol/sei-chain/x/evm/types"; 7 | 8 | /* 9 | * 10 | XXTime fields indicate upgrade timestamps. For example, a ShanghaiTime 11 | of 42198537129 means the chain upgraded to the Shanghai version at timestamp 42198537129. 12 | A value of 0 means the upgrade is included in the genesis of the EVM on Sei. 13 | -1 means upgrade not reached yet. 14 | */ 15 | message ChainConfig { 16 | int64 cancun_time = 1 [ 17 | (gogoproto.moretags) = "yaml:\"cancun_time\"" 18 | ]; 19 | int64 prague_time = 2 [ 20 | (gogoproto.moretags) = "yaml:\"prague_time\"" 21 | ]; 22 | int64 verkle_time = 3 [ 23 | (gogoproto.moretags) = "yaml:\"verkle_time\"" 24 | ]; 25 | } -------------------------------------------------------------------------------- /proto/evm/enums.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.evm; 3 | 4 | option go_package = "github.com/sei-protocol/sei-chain/x/evm/types"; 5 | 6 | enum PointerType { 7 | ERC20 = 0; 8 | ERC721 = 1; 9 | NATIVE = 2; 10 | CW20 = 3; 11 | CW721 = 4; 12 | ERC1155 = 5; 13 | CW1155 = 6; 14 | } -------------------------------------------------------------------------------- /proto/evm/types.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.evm; 3 | 4 | import "gogoproto/gogo.proto"; 5 | 6 | option go_package = "github.com/sei-protocol/sei-chain/x/evm/types"; 7 | 8 | message Whitelist { 9 | repeated string hashes = 1 [ 10 | (gogoproto.moretags) = "yaml:\"hashes\"" 11 | ]; 12 | } 13 | 14 | message DeferredInfo { 15 | uint32 tx_index = 1; 16 | bytes tx_hash = 2; 17 | bytes tx_bloom = 3; 18 | string surplus = 4 [ 19 | (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", 20 | (gogoproto.nullable) = false 21 | ]; 22 | string error = 5; 23 | } -------------------------------------------------------------------------------- /proto/mint/v1beta1/genesis.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.mint; 3 | 4 | import "gogoproto/gogo.proto"; 5 | import "mint/v1beta1/mint.proto"; 6 | 7 | option go_package = "github.com/sei-protocol/sei-chain/x/mint/types"; 8 | 9 | // GenesisState defines the mint module's genesis state. 10 | message GenesisState { 11 | // minter is a space for holding current inflation information. 12 | Minter minter = 1 [(gogoproto.nullable) = false]; 13 | 14 | // params defines all the paramaters of the module. 15 | Params params = 2 [(gogoproto.nullable) = false]; 16 | } 17 | -------------------------------------------------------------------------------- /proto/mint/v1beta1/gov.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.mint; 3 | 4 | import "gogoproto/gogo.proto"; 5 | import "mint/v1beta1/mint.proto"; 6 | 7 | option go_package = "github.com/sei-protocol/sei-chain/x/mint/types"; 8 | 9 | message UpdateMinterProposal { 10 | option (gogoproto.equal) = false; 11 | option (gogoproto.goproto_getters) = false; 12 | option (gogoproto.goproto_stringer) = false; 13 | 14 | string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; 15 | string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; 16 | mint.Minter minter = 3 [ (gogoproto.moretags) = "yaml:\"minter\"" ]; 17 | } 18 | -------------------------------------------------------------------------------- /proto/tokenfactory/authorityMetadata.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.tokenfactory; 3 | 4 | import "gogoproto/gogo.proto"; 5 | import "cosmos/base/v1beta1/coin.proto"; 6 | 7 | option go_package = "github.com/sei-protocol/sei-chain/x/tokenfactory/types"; 8 | 9 | // DenomAuthorityMetadata specifies metadata for addresses that have specific 10 | // capabilities over a token factory denom. Right now there is only one Admin 11 | // permission, but is planned to be extended to the future. 12 | message DenomAuthorityMetadata { 13 | option (gogoproto.equal) = true; 14 | 15 | // Can be empty for no admin, or a valid sei address 16 | string admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; 17 | } 18 | -------------------------------------------------------------------------------- /proto/tokenfactory/params.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package seiprotocol.seichain.tokenfactory; 3 | 4 | option go_package = "github.com/sei-protocol/sei-chain/x/tokenfactory/types"; 5 | 6 | // Params defines the parameters for the tokenfactory module. 7 | message Params { 8 | uint32 denom_allowlist_max_size = 1; 9 | } 10 | -------------------------------------------------------------------------------- /run_constant_load.sh: -------------------------------------------------------------------------------- 1 | /home/ubuntu/sei-chain/build/loadtest 2 | -------------------------------------------------------------------------------- /run_loadtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | iterations=$1 3 | 4 | # This script just runs the load test $iteration times and saves the metrics to a text file 5 | for i in `eval echo {1..$iterations}` 6 | do 7 | /home/ubuntu/sei-chain/build/loadtest 8 | date | tee -a loadtest_results.txt 9 | sleep 5 10 | python3 /home/ubuntu/sei-chain/loadtest/scripts/metrics.py | tee -a loadtest_results.txt 11 | done 12 | 13 | -------------------------------------------------------------------------------- /scripts/snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir $HOME/sei-snapshot 4 | mkdir $HOME/key_backup 5 | # Move priv_validator_state out so it isn't used by anyone else 6 | mv $HOME/.sei/data/priv_validator_state.json $HOME/key_backup 7 | # Create backups 8 | cd $HOME/sei-snapshot 9 | tar -czf data.tar.gz -C $HOME/.sei data/ 10 | tar -czf wasm.tar.gz -C $HOME/.sei wasm/ 11 | echo "Data and Wasm snapshots created in $HOME/sei-snapshot" -------------------------------------------------------------------------------- /scripts/start_faucet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -n OS Password: 4 | read -s password 5 | echo 6 | 7 | curl "https://get.starport.network/faucet!" > /tmp/faucet_install.sh 8 | echo $password | sudo -S bash /tmp/faucet_install.sh 9 | faucet --cli-name ./build/newd --denoms usei 10 | -------------------------------------------------------------------------------- /scripts/update-swagger-ui-statik.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Generate swagger files 4 | ignite generate openapi -y 5 | 6 | # Generate statik.go that embeds the swagger-ui files 7 | statik -src=./docs/swagger-ui -dest=./docs -f -p swagger 8 | 9 | # Update the generated statik.go file to use the namespace "swagger" 10 | sed -i '' -e s/fs.Register\(data\)/fs.RegisterWithNamespace\(\"swagger\",\ data\)/g docs/swagger/statik.go 11 | -------------------------------------------------------------------------------- /store/testutils.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/store/cachekv" 5 | "github.com/cosmos/cosmos-sdk/store/cachemulti" 6 | "github.com/cosmos/cosmos-sdk/store/dbadapter" 7 | storetypes "github.com/cosmos/cosmos-sdk/store/types" 8 | "github.com/cosmos/cosmos-sdk/types" 9 | dbm "github.com/tendermint/tm-db" 10 | ) 11 | 12 | func NewTestKVStore() types.KVStore { 13 | mem := dbadapter.Store{DB: dbm.NewMemDB()} 14 | return cachekv.NewStore(mem, storetypes.NewKVStoreKey("test"), storetypes.DefaultCacheSizeLimit) 15 | } 16 | 17 | func NewTestCacheMultiStore(stores map[types.StoreKey]types.CacheWrapper) types.CacheMultiStore { 18 | return cachemulti.NewStore(dbm.NewMemDB(), stores, map[string]types.StoreKey{}, nil, nil, make(map[types.StoreKey][]storetypes.WriteListener)) 19 | } 20 | -------------------------------------------------------------------------------- /sync/gas.go: -------------------------------------------------------------------------------- 1 | package sync 2 | 3 | import ( 4 | "sync" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | ) 8 | 9 | type GasWrapper struct { 10 | sdk.GasMeter 11 | mu *sync.Mutex 12 | } 13 | 14 | func NewGasWrapper(wrapped sdk.GasMeter) sdk.GasMeter { 15 | return GasWrapper{GasMeter: wrapped, mu: &sync.Mutex{}} 16 | } 17 | 18 | func (g GasWrapper) ConsumeGas(amount sdk.Gas, descriptor string) { 19 | g.mu.Lock() 20 | defer g.mu.Unlock() 21 | 22 | g.GasMeter.ConsumeGas(amount, descriptor) 23 | } 24 | 25 | func (g GasWrapper) RefundGas(amount sdk.Gas, descriptor string) { 26 | g.mu.Lock() 27 | defer g.mu.Unlock() 28 | 29 | g.GasMeter.RefundGas(amount, descriptor) 30 | } 31 | -------------------------------------------------------------------------------- /tests/mars.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/tests/mars.wasm -------------------------------------------------------------------------------- /testutil/fuzzing/cosmos.go: -------------------------------------------------------------------------------- 1 | package fuzzing 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | func FuzzDec(i int64, isNil bool) sdk.Dec { 8 | if isNil { 9 | return sdk.Dec{} 10 | } 11 | return sdk.NewDec(i) 12 | } 13 | 14 | func FuzzCoin(denom string, isNil bool, i int64) sdk.Coin { 15 | if isNil { 16 | return sdk.Coin{Denom: denom, Amount: sdk.Int{}} 17 | } 18 | return sdk.Coin{Denom: denom, Amount: sdk.NewInt(i)} 19 | } 20 | -------------------------------------------------------------------------------- /testutil/processblock/genesisacc.go: -------------------------------------------------------------------------------- 1 | package processblock 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | func (a *App) NewAccount() sdk.AccAddress { 8 | ctx := a.Ctx() 9 | address := sdk.AccAddress(GenerateRandomPubKey().Address()) 10 | a.AccountKeeper.SetAccount(ctx, a.AccountKeeper.NewAccountWithAddress(ctx, address)) 11 | return address 12 | } 13 | 14 | func (a *App) NewSignableAccount(name string) sdk.AccAddress { 15 | ctx := a.Ctx() 16 | address := a.GenerateSignableKey(name) 17 | a.AccountKeeper.SetAccount(ctx, a.AccountKeeper.NewAccountWithAddress(ctx, address)) 18 | return address 19 | } 20 | -------------------------------------------------------------------------------- /testutil/processblock/genesisepoch.go: -------------------------------------------------------------------------------- 1 | package processblock 2 | 3 | import "time" 4 | 5 | func (a *App) FastEpoch() { 6 | epoch := a.EpochKeeper.GetEpoch(a.Ctx()) 7 | epoch.EpochDuration = 5 * time.Second 8 | a.EpochKeeper.SetEpoch(a.Ctx(), epoch) 9 | } 10 | -------------------------------------------------------------------------------- /testutil/processblock/genesismint.go: -------------------------------------------------------------------------------- 1 | package processblock 2 | 3 | import ( 4 | "time" 5 | 6 | minttypes "github.com/sei-protocol/sei-chain/x/mint/types" 7 | ) 8 | 9 | func (a *App) NewMinter(amount uint64) { 10 | today := time.Now() 11 | dayAfterTomorrow := today.Add(48 * time.Hour) 12 | a.MintKeeper.SetMinter(a.Ctx(), minttypes.Minter{ 13 | StartDate: today.Format(minttypes.TokenReleaseDateFormat), 14 | EndDate: dayAfterTomorrow.Format(minttypes.TokenReleaseDateFormat), 15 | Denom: "usei", 16 | TotalMintAmount: amount, 17 | RemainingMintAmount: amount, 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /testutil/processblock/msgs/bank.go: -------------------------------------------------------------------------------- 1 | package msgs 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" 6 | ) 7 | 8 | func Send(from sdk.AccAddress, to sdk.AccAddress, amount int64) *banktypes.MsgSend { 9 | return &banktypes.MsgSend{ 10 | FromAddress: from.String(), 11 | ToAddress: to.String(), 12 | Amount: sdk.NewCoins(sdk.NewCoin("usei", sdk.NewInt(amount))), 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /testutil/processblock/verify/common.go: -------------------------------------------------------------------------------- 1 | package verify 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/cosmos/cosmos-sdk/x/auth/signing" 7 | "github.com/sei-protocol/sei-chain/testutil/processblock" 8 | ) 9 | 10 | type BlockRunnable func() (resultCodes []uint32) 11 | 12 | type Verifier func(*testing.T, *processblock.App, BlockRunnable, []signing.Tx) BlockRunnable 13 | 14 | // inefficient so only for test 15 | func removeMatched[T any](l []T, matcher func(T) bool) []T { 16 | newL := []T{} 17 | for _, i := range l { 18 | if !matcher(i) { 19 | newL = append(newL, i) 20 | } 21 | } 22 | return newL 23 | } 24 | -------------------------------------------------------------------------------- /testutil/processblock/verify/epoch.go: -------------------------------------------------------------------------------- 1 | package verify 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/cosmos/cosmos-sdk/x/auth/signing" 7 | "github.com/sei-protocol/sei-chain/testutil/processblock" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func Epoch(t *testing.T, app *processblock.App, f BlockRunnable, _ []signing.Tx) BlockRunnable { 12 | return func() []uint32 { 13 | oldEpoch := app.EpochKeeper.GetEpoch(app.Ctx()) 14 | res := f() 15 | if app.Ctx().BlockTime().Sub(oldEpoch.CurrentEpochStartTime) > oldEpoch.EpochDuration { 16 | newPoch := app.EpochKeeper.GetEpoch(app.Ctx()) 17 | require.Equal(t, oldEpoch.CurrentEpoch+1, newPoch.CurrentEpoch) 18 | } 19 | return res 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testutil/sample/sample.go: -------------------------------------------------------------------------------- 1 | package sample 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" 5 | sdk "github.com/cosmos/cosmos-sdk/types" 6 | ) 7 | 8 | // AccAddress returns a sample account address 9 | func AccAddress() string { 10 | pk := ed25519.GenPrivKey().PubKey() 11 | addr := pk.Address() 12 | return sdk.AccAddress(addr).String() 13 | } 14 | -------------------------------------------------------------------------------- /tools/cmd.go: -------------------------------------------------------------------------------- 1 | package tools 2 | 3 | import ( 4 | "github.com/spf13/cobra" 5 | 6 | hasher "github.com/sei-protocol/sei-chain/tools/hash_verification/cmd" 7 | migration "github.com/sei-protocol/sei-chain/tools/migration/cmd" 8 | scanner "github.com/sei-protocol/sei-chain/tools/tx-scanner/cmd" 9 | ) 10 | 11 | func ToolCmd() *cobra.Command { 12 | toolsCmd := &cobra.Command{ 13 | Use: "tools", 14 | Short: "A set of useful tools for sei chain", 15 | } 16 | toolsCmd.AddCommand(scanner.ScanCmd()) 17 | toolsCmd.AddCommand(migration.MigrateCmd()) 18 | toolsCmd.AddCommand(migration.VerifyMigrationCmd()) 19 | toolsCmd.AddCommand(migration.GenerateStats()) 20 | toolsCmd.AddCommand(hasher.GenerateIavlHashCmd()) 21 | toolsCmd.AddCommand(hasher.GeneratePebbleHashCmd()) 22 | return toolsCmd 23 | } 24 | -------------------------------------------------------------------------------- /tools/hash_verification/hasher/types.go: -------------------------------------------------------------------------------- 1 | package hasher 2 | 3 | // HashCalculator defines the interface for calculating chained state hash. 4 | type HashCalculator interface { 5 | HashSingle(data []byte) []byte 6 | HashTwo(dataA []byte, dataB []byte) []byte 7 | ComputeHashes() [][]byte 8 | } 9 | -------------------------------------------------------------------------------- /tools/tx-scanner/query/block.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" 7 | "github.com/sei-protocol/sei-chain/tools/tx-scanner/client" 8 | ) 9 | 10 | // GetLatestBlock query the latest block data 11 | func GetLatestBlock() (*tmservice.GetLatestBlockResponse, error) { 12 | request := &tmservice.GetLatestBlockRequest{} 13 | return client.GetTmServiceClient().GetLatestBlock(context.Background(), request) 14 | } 15 | 16 | // GetBlockByHeight query the block data at height 17 | func GetBlockByHeight(height int64) (*tmservice.GetBlockByHeightResponse, error) { 18 | request := &tmservice.GetBlockByHeightRequest{ 19 | Height: height, 20 | } 21 | return client.GetTmServiceClient().GetBlockByHeight(context.Background(), request) 22 | } 23 | -------------------------------------------------------------------------------- /tools/tx-scanner/query/tx.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | txtypes "github.com/cosmos/cosmos-sdk/types/tx" 8 | "github.com/sei-protocol/sei-chain/tools/tx-scanner/client" 9 | ) 10 | 11 | // GetTxsEvent query the detailed transaction data, same as `seid q txs --events` 12 | func GetTxsEvent(blockHeight int64) (*txtypes.GetTxsEventResponse, error) { 13 | request := &txtypes.GetTxsEventRequest{ 14 | Events: []string{fmt.Sprintf("tx.height=%d", blockHeight)}, 15 | } 16 | 17 | return client.GetTxClient().GetTxsEvent(context.Background(), request) 18 | } 19 | 20 | // GetTxByHash query the transaction by TX hash, same as `seid q tx --hash` 21 | func GetTxByHash(txHash string) (*txtypes.GetTxResponse, error) { 22 | request := &txtypes.GetTxRequest{ 23 | Hash: txHash, 24 | } 25 | return client.GetTxClient().GetTx(context.Background(), request) 26 | } 27 | -------------------------------------------------------------------------------- /types/settlement.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "fmt" 4 | 5 | type Settlement struct { 6 | To string 7 | Quantity uint64 8 | Denom string 9 | } 10 | 11 | func (s Settlement) String() string { 12 | return fmt.Sprintf("To %s of %d%s", s.To, s.Quantity, s.Denom) 13 | } 14 | -------------------------------------------------------------------------------- /utils/constants.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "math" 5 | "math/big" 6 | 7 | sdk "github.com/cosmos/cosmos-sdk/types" 8 | ) 9 | 10 | var Big0 = big.NewInt(0) 11 | var Big1 = big.NewInt(1) 12 | var Big2 = big.NewInt(2) 13 | var Big8 = big.NewInt(8) 14 | var Big27 = big.NewInt(27) 15 | var Big35 = big.NewInt(35) 16 | var BigMaxI64 = big.NewInt(math.MaxInt64) 17 | var BigMaxU64 = new(big.Int).SetUint64(math.MaxUint64) 18 | 19 | var Sdk0 = sdk.NewInt(0) 20 | -------------------------------------------------------------------------------- /utils/metadata.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | type ERCMetadata struct { 4 | Name string 5 | Symbol string 6 | Decimals uint8 7 | } 8 | -------------------------------------------------------------------------------- /utils/metrics/README.md: -------------------------------------------------------------------------------- 1 | # Sei Metrics 2 | 3 | This is intended to be an utility library to expose additional metrics that's useful for monitoring a given Sei chain. It buils ontop of the existing [Cosmos SDK telemetry library](https://docs.cosmos.network/master/core/telemetry.html) 4 | 5 | Note: In-memory sink is always attached (when the telemetry is enabled) with 10 second interval and 1 minute retention. This means that metrics will be aggregated over 10 seconds, and metrics will be kept alive for 1 minute. 6 | -------------------------------------------------------------------------------- /utils/metrics/labels.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | const ( 4 | CONCURRENT = "concurrent" 5 | SYNCHRONOUS = "synchronous" 6 | OCC_CONCURRENT = "optimistic_concurrency" 7 | GovMsgInBlock = "gov-msg-in-block" 8 | FailedToBuild = "failed-to-build" 9 | ) 10 | -------------------------------------------------------------------------------- /utils/panic_test.go: -------------------------------------------------------------------------------- 1 | package utils_test 2 | 3 | import ( 4 | "errors" 5 | "testing" 6 | 7 | "github.com/sei-protocol/sei-chain/utils" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestHardFail(t *testing.T) { 12 | hardFailer := func() { 13 | panic(utils.DecorateHardFailError(errors.New("some error"))) 14 | } 15 | panicHandlingFn := func() { 16 | defer utils.PanicHandler(func(_ any) {})() 17 | hardFailer() 18 | } 19 | require.Panics(t, panicHandlingFn) 20 | } 21 | -------------------------------------------------------------------------------- /utils/slice_test.go: -------------------------------------------------------------------------------- 1 | package utils_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/sei-protocol/sei-chain/utils" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestFilterUInt64Slice(t *testing.T) { 11 | s := []uint64{1, 2, 3} 12 | toBeFiltered := 2 13 | filteredS := utils.FilterUInt64Slice(s, uint64(toBeFiltered)) 14 | require.Equal(t, []uint64{1, 3}, filteredS) 15 | } 16 | 17 | func TestMap(t *testing.T) { 18 | s := []int{1, 2, 3} 19 | mapped := utils.Map(s, func(i int) int { return i + 1 }) 20 | require.Equal(t, 3, len(s)) 21 | require.Equal(t, 2, mapped[0]) 22 | require.Equal(t, 3, mapped[1]) 23 | require.Equal(t, 4, mapped[2]) 24 | } 25 | 26 | func TestSliceCopy(t *testing.T) { 27 | slice := []int{1} 28 | copy := utils.SliceCopy(slice) 29 | copy[0] = 2 30 | require.Equal(t, 1, slice[0]) 31 | } 32 | -------------------------------------------------------------------------------- /wasmbinding/README.md: -------------------------------------------------------------------------------- 1 | # CosmWasm support 2 | 3 | This package contains CosmWasm integration points. 4 | 5 | This package provides first class support for: 6 | 7 | - Queries 8 | - OracleExchangeRates 9 | - Messages / Execution 10 | - N/A -------------------------------------------------------------------------------- /wasmbinding/bindings/errors.go: -------------------------------------------------------------------------------- 1 | package bindings 2 | 3 | import ( 4 | sdkErrors "github.com/cosmos/cosmos-sdk/types/errors" 5 | ) 6 | 7 | // Codes for wasm contract errors 8 | var ( 9 | DefaultCodespace = "wasmbinding" 10 | 11 | ErrParsingSeiWasmMsg = sdkErrors.Register(DefaultCodespace, 2, "Error parsing Sei Wasm Message") 12 | ) 13 | -------------------------------------------------------------------------------- /whitepaper/Sei_Giga.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/whitepaper/Sei_Giga.pdf -------------------------------------------------------------------------------- /whitepaper/Sei_Whitepaper.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/whitepaper/Sei_Whitepaper.pdf -------------------------------------------------------------------------------- /x/README.md: -------------------------------------------------------------------------------- 1 | # Sei modules 2 | 3 | Sei implements the following custom modules: 4 | * `dex` - 5 | * `epoch` - 6 | * `oracle` - -------------------------------------------------------------------------------- /x/epoch/client/cli/query_epoch.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cosmos/cosmos-sdk/client" 7 | "github.com/cosmos/cosmos-sdk/client/flags" 8 | "github.com/sei-protocol/sei-chain/x/epoch/types" 9 | "github.com/spf13/cobra" 10 | ) 11 | 12 | func CmdQueryEpoch() *cobra.Command { 13 | cmd := &cobra.Command{ 14 | Use: "epoch", 15 | Short: "gets the current epoch", 16 | Args: cobra.NoArgs, 17 | RunE: func(cmd *cobra.Command, args []string) error { 18 | clientCtx := client.GetClientContextFromCmd(cmd) 19 | 20 | queryClient := types.NewQueryClient(clientCtx) 21 | 22 | res, err := queryClient.Epoch(context.Background(), &types.QueryEpochRequest{}) 23 | if err != nil { 24 | return err 25 | } 26 | 27 | return clientCtx.PrintProto(res) 28 | }, 29 | } 30 | 31 | flags.AddQueryFlagsToCmd(cmd) 32 | 33 | return cmd 34 | } 35 | -------------------------------------------------------------------------------- /x/epoch/client/cli/tx.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | 8 | "github.com/cosmos/cosmos-sdk/client" 9 | "github.com/sei-protocol/sei-chain/x/epoch/types" 10 | ) 11 | 12 | //nolint:unused,deadcode 13 | const ( 14 | flagPacketTimeoutTimestamp = "packet-timeout-timestamp" 15 | listSeparator = "," 16 | ) 17 | 18 | // GetTxCmd returns the transaction commands for this module 19 | func GetTxCmd() *cobra.Command { 20 | cmd := &cobra.Command{ 21 | Use: types.ModuleName, 22 | Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), 23 | DisableFlagParsing: true, 24 | SuggestionsMinimumDistance: 2, 25 | RunE: client.ValidateCmd, 26 | } 27 | 28 | // this line is used by starport scaffolding # 1 29 | 30 | return cmd 31 | } 32 | -------------------------------------------------------------------------------- /x/epoch/client/wasm/bindings/queries.go: -------------------------------------------------------------------------------- 1 | package bindings 2 | 3 | import "github.com/sei-protocol/sei-chain/x/epoch/types" 4 | 5 | type SeiEpochQuery struct { 6 | // queries the current Epoch 7 | Epoch *types.QueryEpochRequest `json:"epoch,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /x/epoch/client/wasm/query.go: -------------------------------------------------------------------------------- 1 | package wasm 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/epoch/keeper" 6 | "github.com/sei-protocol/sei-chain/x/epoch/types" 7 | ) 8 | 9 | type EpochWasmQueryHandler struct { 10 | epochKeeper keeper.Keeper 11 | } 12 | 13 | func NewEpochWasmQueryHandler(keeper *keeper.Keeper) *EpochWasmQueryHandler { 14 | return &EpochWasmQueryHandler{ 15 | epochKeeper: *keeper, 16 | } 17 | } 18 | 19 | func (handler EpochWasmQueryHandler) GetEpoch(ctx sdk.Context, req *types.QueryEpochRequest) (*types.QueryEpochResponse, error) { 20 | c := sdk.WrapSDKContext(ctx) 21 | return handler.epochKeeper.Epoch(c, req) 22 | } 23 | -------------------------------------------------------------------------------- /x/epoch/handler.go: -------------------------------------------------------------------------------- 1 | package epoch 2 | 3 | import ( 4 | "fmt" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" 8 | "github.com/sei-protocol/sei-chain/x/epoch/keeper" 9 | "github.com/sei-protocol/sei-chain/x/epoch/types" 10 | ) 11 | 12 | func NewHandler(_ keeper.Keeper) sdk.Handler { 13 | return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { 14 | _ = ctx.WithEventManager(sdk.NewEventManager()) 15 | errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) 16 | return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /x/epoch/keeper/epoch.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/gogo/protobuf/proto" 6 | "github.com/sei-protocol/sei-chain/x/epoch/types" 7 | ) 8 | 9 | const EpochKey = "epoch" 10 | 11 | func (k Keeper) SetEpoch(ctx sdk.Context, epoch types.Epoch) { 12 | store := ctx.KVStore(k.storeKey) 13 | value, err := proto.Marshal(&epoch) 14 | if err != nil { 15 | panic(err) 16 | } 17 | store.Set([]byte(EpochKey), value) 18 | } 19 | 20 | func (k Keeper) GetEpoch(ctx sdk.Context) (epoch types.Epoch) { 21 | store := ctx.KVStore(k.storeKey) 22 | b := store.Get([]byte(EpochKey)) 23 | k.cdc.MustUnmarshal(b, &epoch) 24 | return epoch 25 | } 26 | -------------------------------------------------------------------------------- /x/epoch/keeper/grpc_query.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "github.com/sei-protocol/sei-chain/x/epoch/types" 5 | ) 6 | 7 | var _ types.QueryServer = Keeper{} 8 | -------------------------------------------------------------------------------- /x/epoch/keeper/grpc_query_epoch.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "context" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | "github.com/sei-protocol/sei-chain/x/epoch/types" 8 | ) 9 | 10 | func (k Keeper) Epoch(c context.Context, _ *types.QueryEpochRequest) (*types.QueryEpochResponse, error) { 11 | ctx := sdk.UnwrapSDKContext(c) 12 | 13 | epoch := k.GetEpoch(ctx) 14 | return &types.QueryEpochResponse{Epoch: epoch}, nil 15 | } 16 | -------------------------------------------------------------------------------- /x/epoch/keeper/grpc_query_epoch_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "testing" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 8 | "github.com/sei-protocol/sei-chain/x/epoch/types" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestEpochQuery(t *testing.T) { 13 | keeper, ctx := testkeeper.EpochKeeper(t) 14 | wctx := sdk.WrapSDKContext(ctx) 15 | epoch := types.DefaultEpoch() 16 | keeper.SetEpoch(ctx, epoch) 17 | 18 | response, err := keeper.Epoch(wctx, &types.QueryEpochRequest{}) 19 | require.NoError(t, err) 20 | require.Equal(t, &types.QueryEpochResponse{Epoch: epoch}, response) 21 | } 22 | -------------------------------------------------------------------------------- /x/epoch/keeper/grpc_query_params.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "context" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | "github.com/sei-protocol/sei-chain/x/epoch/types" 8 | "google.golang.org/grpc/codes" 9 | "google.golang.org/grpc/status" 10 | ) 11 | 12 | func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { 13 | if req == nil { 14 | return nil, status.Error(codes.InvalidArgument, "invalid request") 15 | } 16 | ctx := sdk.UnwrapSDKContext(c) 17 | 18 | return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil 19 | } 20 | -------------------------------------------------------------------------------- /x/epoch/keeper/grpc_query_params_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "testing" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 8 | "github.com/sei-protocol/sei-chain/x/epoch/types" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestParamsQuery(t *testing.T) { 13 | keeper, ctx := testkeeper.EpochKeeper(t) 14 | wctx := sdk.WrapSDKContext(ctx) 15 | params := types.DefaultParams() 16 | keeper.SetParams(ctx, params) 17 | 18 | response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) 19 | require.NoError(t, err) 20 | require.Equal(t, &types.QueryParamsResponse{Params: params}, response) 21 | 22 | _, err = keeper.Params(wctx, nil) 23 | require.ErrorContains(t, err, "invalid request") 24 | } 25 | -------------------------------------------------------------------------------- /x/epoch/keeper/hooks.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/epoch/types" 6 | ) 7 | 8 | func (k Keeper) AfterEpochEnd(ctx sdk.Context, epoch types.Epoch) { 9 | k.hooks.AfterEpochEnd(ctx, epoch) 10 | } 11 | 12 | func (k Keeper) BeforeEpochStart(ctx sdk.Context, epoch types.Epoch) { 13 | k.hooks.BeforeEpochStart(ctx, epoch) 14 | } 15 | -------------------------------------------------------------------------------- /x/epoch/keeper/msg_server.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "github.com/sei-protocol/sei-chain/x/epoch/types" 5 | ) 6 | 7 | type msgServer struct { 8 | Keeper 9 | } 10 | 11 | // NewMsgServerImpl returns an implementation of the MsgServer interface 12 | // for the provided Keeper. 13 | func NewMsgServerImpl(keeper Keeper) types.MsgServer { 14 | return &msgServer{Keeper: keeper} 15 | } 16 | 17 | var _ types.MsgServer = msgServer{} 18 | -------------------------------------------------------------------------------- /x/epoch/keeper/msg_server_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "testing" 5 | 6 | keepertest "github.com/sei-protocol/sei-chain/testutil/keeper" 7 | "github.com/sei-protocol/sei-chain/x/epoch/keeper" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestSetupMsgServer(t *testing.T) { 12 | k, _ := keepertest.EpochKeeper(t) 13 | msg := keeper.NewMsgServerImpl(*k) 14 | require.NotNil(t, msg) 15 | } 16 | -------------------------------------------------------------------------------- /x/epoch/keeper/params.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/epoch/types" 6 | ) 7 | 8 | // GetParams get all parameters as types.Params 9 | func (k Keeper) GetParams(_ sdk.Context) types.Params { 10 | return types.NewParams() 11 | } 12 | 13 | // SetParams set the params 14 | func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { 15 | k.paramstore.SetParamSet(ctx, ¶ms) 16 | } 17 | -------------------------------------------------------------------------------- /x/epoch/keeper/params_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "testing" 5 | 6 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 7 | "github.com/sei-protocol/sei-chain/x/epoch/types" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestGetParams(t *testing.T) { 12 | k, ctx := testkeeper.EpochKeeper(t) 13 | params := types.DefaultParams() 14 | 15 | k.SetParams(ctx, params) 16 | 17 | require.EqualValues(t, params, k.GetParams(ctx)) 18 | } 19 | -------------------------------------------------------------------------------- /x/epoch/simulation/simap.go: -------------------------------------------------------------------------------- 1 | package simulation 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | simtypes "github.com/cosmos/cosmos-sdk/types/simulation" 6 | ) 7 | 8 | // FindAccount find a specific address from an account list 9 | func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { 10 | creator, err := sdk.AccAddressFromBech32(address) 11 | if err != nil { 12 | panic(err) 13 | } 14 | return simtypes.FindAccount(accs, creator) 15 | } 16 | -------------------------------------------------------------------------------- /x/epoch/spec/README.md: -------------------------------------------------------------------------------- 1 | ## Abstract 2 | 3 | The epoch module gives modules the ability to be signaled once ever period. 4 | 5 | TODO: Populate Epoch README Contents below. 6 | 7 | ## Contents 8 | 9 | ## Concepts 10 | 11 | ## State 12 | 13 | ## Messages 14 | 15 | ## Events 16 | 17 | ## Hooks 18 | 19 | ## Parameters 20 | 21 | ## Transactions 22 | 23 | ## Queries 24 | -------------------------------------------------------------------------------- /x/epoch/types/codec.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/codec" 5 | cdctypes "github.com/cosmos/cosmos-sdk/codec/types" 6 | 7 | // this line is used by starport scaffolding # 1 8 | "github.com/cosmos/cosmos-sdk/types/msgservice" 9 | ) 10 | 11 | func RegisterCodec(_ *codec.LegacyAmino) {} 12 | 13 | func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { 14 | msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) 15 | } 16 | 17 | var ( 18 | amino = codec.NewLegacyAmino() 19 | ModuleCdc = codec.NewAminoCodec(amino) 20 | ) 21 | 22 | func init() { 23 | RegisterCodec(amino) 24 | amino.Seal() 25 | } 26 | -------------------------------------------------------------------------------- /x/epoch/types/epoch.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import fmt "fmt" 4 | 5 | // NewEpoch creates a new Epoch instance 6 | func NewEpoch() Epoch { 7 | return Epoch{} 8 | } 9 | 10 | // DefaultParams returns a default set of parameters 11 | func DefaultEpoch() Epoch { 12 | return NewEpoch() 13 | } 14 | 15 | func (e *Epoch) Validate() error { 16 | if e.GetGenesisTime().IsZero() { 17 | return fmt.Errorf("epoch genesis time cannot be zero") 18 | } 19 | 20 | if e.GetEpochDuration().Seconds() == 0 { 21 | return fmt.Errorf("epoch duration cannot be zero") 22 | } 23 | 24 | if e.GetGenesisTime().After(e.GetCurrentEpochStartTime()) { 25 | return fmt.Errorf("epoch genesis time cannot be after epoch start time") 26 | } 27 | 28 | if e.GetCurrentEpochHeight() < 0 { 29 | return fmt.Errorf("epoch current epoch height cannot be negative") 30 | } 31 | 32 | return nil 33 | } 34 | -------------------------------------------------------------------------------- /x/epoch/types/errors.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // DONTCOVER 4 | 5 | import ( 6 | sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" 7 | ) 8 | 9 | // x/epoch module sentinel errors 10 | var ( 11 | ErrParsingSeiEpochQuery = sdkerrors.Register(ModuleName, 2, "Error parsing SeiEpochQuery") 12 | ErrGettingEpoch = sdkerrors.Register(ModuleName, 3, "Error while getting epoch") 13 | ErrEncodingEpoch = sdkerrors.Register(ModuleName, 4, "Error encoding epoch as JSON") 14 | ErrUnknownSeiEpochQuery = sdkerrors.Register(ModuleName, 6, "Error unknown sei epoch query") 15 | ) 16 | -------------------------------------------------------------------------------- /x/epoch/types/events.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | const ( 4 | EventTypeNewEpoch = "new_epoch" 5 | 6 | AttributeEpochNumber = "epoch_number" 7 | AttributeEpochTime = "epoch_time" 8 | AttributeEpochHeight = "epoch_height" 9 | ) 10 | -------------------------------------------------------------------------------- /x/epoch/types/expected_keepers.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/cosmos/cosmos-sdk/x/auth/types" 6 | ) 7 | 8 | // AccountKeeper defines the expected account keeper used for simulations (noalias) 9 | type AccountKeeper interface { 10 | GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI 11 | // Methods imported from account should be defined here 12 | } 13 | 14 | // BankKeeper defines the expected interface needed to retrieve account balances. 15 | type BankKeeper interface { 16 | SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins 17 | // Methods imported from bank should be defined here 18 | } 19 | -------------------------------------------------------------------------------- /x/epoch/types/genesis_test.go: -------------------------------------------------------------------------------- 1 | package types_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/sei-protocol/sei-chain/x/epoch/types" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestGenesisState_Validate(t *testing.T) { 11 | for _, tc := range []struct { 12 | desc string 13 | genState *types.GenesisState 14 | valid bool 15 | }{ 16 | { 17 | desc: "default is valid", 18 | genState: types.DefaultGenesis(), 19 | valid: true, 20 | }, 21 | { 22 | desc: "invalid genesis state", 23 | genState: &types.GenesisState{}, 24 | valid: false, 25 | }, 26 | } { 27 | t.Run(tc.desc, func(t *testing.T) { 28 | err := tc.genState.Validate() 29 | if tc.valid { 30 | require.NoError(t, err) 31 | } else { 32 | require.Error(t, err) 33 | } 34 | }) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /x/epoch/types/keys.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | const ( 4 | // ModuleName defines the module name 5 | ModuleName = "epoch" 6 | 7 | // StoreKey defines the primary module store key 8 | StoreKey = ModuleName 9 | 10 | // RouterKey is the message route for slashing 11 | RouterKey = ModuleName 12 | 13 | // QuerierRoute defines the module's query routing key 14 | QuerierRoute = ModuleName 15 | 16 | // MemStoreKey defines the in-memory store key 17 | MemStoreKey = "mem_epoch" 18 | ) 19 | 20 | func KeyPrefix(p string) []byte { 21 | return []byte(p) 22 | } 23 | -------------------------------------------------------------------------------- /x/epoch/types/types.go: -------------------------------------------------------------------------------- 1 | package types 2 | -------------------------------------------------------------------------------- /x/evm/artifacts/README: -------------------------------------------------------------------------------- 1 | The source files are under contracts/src. The artifacts should be updated whenever the source files change. To update run the following (with NativeSeiTokensERC20 as an example): 2 | - `solc --overwrite @openzeppelin=contracts/lib/openzeppelin-contracts --bin -o x/evm/artifacts/cw721 contracts/src/CW721ERC721Pointer.sol` 3 | - `solc --overwrite @openzeppelin=contracts/lib/openzeppelin-contracts --abi -o x/evm/artifacts/cw721 contracts/src/CW721ERC721Pointer.sol` 4 | - (clean up any artifact that is not CW721ERC721Pointer.bin/abi) 5 | - `abigen --abi=x/evm/artifacts/cw721/CW721ERC721Pointer.abi --pkg=cw721 --out=x/evm/artifacts/cw721/cw721.go` -------------------------------------------------------------------------------- /x/evm/artifacts/erc1155/artifacts.go: -------------------------------------------------------------------------------- 1 | package erc1155 2 | 3 | import "embed" 4 | 5 | const CurrentVersion uint16 = 1 6 | 7 | //go:embed cwerc1155.wasm 8 | var f embed.FS 9 | 10 | var cachedBin []byte 11 | 12 | func GetBin() []byte { 13 | if cachedBin != nil { 14 | return cachedBin 15 | } 16 | bz, err := f.ReadFile("cwerc1155.wasm") 17 | if err != nil { 18 | panic("failed to read ERC1155 wrapper contract wasm") 19 | } 20 | cachedBin = bz 21 | return bz 22 | } 23 | -------------------------------------------------------------------------------- /x/evm/artifacts/erc1155/cwerc1155.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/x/evm/artifacts/erc1155/cwerc1155.wasm -------------------------------------------------------------------------------- /x/evm/artifacts/erc20/artifacts.go: -------------------------------------------------------------------------------- 1 | package erc20 2 | 3 | import "embed" 4 | 5 | const CurrentVersion uint16 = 2 6 | 7 | //go:embed cwerc20.wasm 8 | var f embed.FS 9 | 10 | var cachedBin []byte 11 | 12 | func GetBin() []byte { 13 | if cachedBin != nil { 14 | return cachedBin 15 | } 16 | bz, err := f.ReadFile("cwerc20.wasm") 17 | if err != nil { 18 | panic("failed to read ERC20 wrapper contract wasm") 19 | } 20 | cachedBin = bz 21 | return bz 22 | } 23 | -------------------------------------------------------------------------------- /x/evm/artifacts/erc20/cwerc20.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/x/evm/artifacts/erc20/cwerc20.wasm -------------------------------------------------------------------------------- /x/evm/artifacts/erc721/artifacts.go: -------------------------------------------------------------------------------- 1 | package erc721 2 | 3 | import "embed" 4 | 5 | const CurrentVersion uint16 = 6 6 | 7 | //go:embed cwerc721.wasm 8 | var f embed.FS 9 | 10 | var cachedBin []byte 11 | 12 | func GetBin() []byte { 13 | if cachedBin != nil { 14 | return cachedBin 15 | } 16 | bz, err := f.ReadFile("cwerc721.wasm") 17 | if err != nil { 18 | panic("failed to read ERC721 wrapper contract wasm") 19 | } 20 | cachedBin = bz 21 | return bz 22 | } 23 | -------------------------------------------------------------------------------- /x/evm/artifacts/erc721/cwerc721.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sei-protocol/sei-chain/362d5ffae0e83eeb9a5a78e668e7795ff00d15b9/x/evm/artifacts/erc721/cwerc721.wasm -------------------------------------------------------------------------------- /x/evm/artifacts/utils/utils.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import "encoding/binary" 4 | 5 | func GetVersionBz(version uint16) []byte { 6 | res := make([]byte, 2) 7 | binary.BigEndian.PutUint16(res, version) 8 | return res 9 | } 10 | 11 | func GetCodeIDBz(codeID uint64) []byte { 12 | res := make([]byte, 8) 13 | binary.BigEndian.PutUint64(res, codeID) 14 | return res 15 | } 16 | -------------------------------------------------------------------------------- /x/evm/keeper/balance.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "math/big" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | "github.com/sei-protocol/sei-chain/x/evm/state" 8 | ) 9 | 10 | func (k *Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) *big.Int { 11 | denom := k.GetBaseDenom(ctx) 12 | allUsei := k.BankKeeper().GetBalance(ctx, addr, denom).Amount 13 | lockedUsei := k.BankKeeper().LockedCoins(ctx, addr).AmountOf(denom) // LockedCoins doesn't use iterators 14 | usei := allUsei.Sub(lockedUsei) 15 | wei := k.BankKeeper().GetWeiBalance(ctx, addr) 16 | return usei.Mul(state.SdkUseiToSweiMultiplier).Add(wei).BigInt() 17 | } 18 | -------------------------------------------------------------------------------- /x/evm/keeper/coinbase_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "testing" 5 | 6 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 7 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestGetFeeCollectorAddress(t *testing.T) { 12 | k := &testkeeper.EVMTestApp.EvmKeeper 13 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}) 14 | addr, err := k.GetFeeCollectorAddress(ctx) 15 | require.Nil(t, err) 16 | expected := k.GetEVMAddressOrDefault(ctx, k.AccountKeeper().GetModuleAddress("fee_collector")) 17 | require.Equal(t, expected.Hex(), addr.Hex()) 18 | } 19 | 20 | func TestGetCoinbaseAddress(t *testing.T) { 21 | require.Equal(t, "0x27F7B8B8B5A4e71E8E9aA671f4e4031E3773303F", keeper.GetCoinbaseAddress().Hex()) 22 | } 23 | -------------------------------------------------------------------------------- /x/evm/keeper/genesis_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 8 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestInitGenesis(t *testing.T) { 13 | k := &testkeeper.EVMTestApp.EvmKeeper 14 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}) 15 | // coinbase address must be associated 16 | coinbaseSeiAddr, associated := k.GetSeiAddress(ctx, keeper.GetCoinbaseAddress()) 17 | require.True(t, associated) 18 | require.True(t, bytes.Equal(coinbaseSeiAddr, k.AccountKeeper().GetModuleAddress("fee_collector"))) 19 | } 20 | -------------------------------------------------------------------------------- /x/evm/keeper/nonce_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "testing" 5 | 6 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestNonce(t *testing.T) { 11 | k := &testkeeper.EVMTestApp.EvmKeeper 12 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}) 13 | _, evmAddr := testkeeper.MockAddressPair() 14 | require.Equal(t, uint64(0), k.GetNonce(ctx, evmAddr)) 15 | k.SetNonce(ctx, evmAddr, 1) 16 | require.Equal(t, uint64(1), k.GetNonce(ctx, evmAddr)) 17 | } 18 | -------------------------------------------------------------------------------- /x/evm/keeper/precompile.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/common" 5 | "github.com/sei-protocol/sei-chain/precompiles/bank" 6 | "github.com/sei-protocol/sei-chain/precompiles/gov" 7 | "github.com/sei-protocol/sei-chain/precompiles/staking" 8 | "github.com/sei-protocol/sei-chain/precompiles/wasmd" 9 | ) 10 | 11 | // add any payable precompiles here 12 | // these will suppress transfer events to/from the precompile address 13 | var payablePrecompiles = map[string]struct{}{ 14 | bank.BankAddress: {}, 15 | staking.StakingAddress: {}, 16 | gov.GovAddress: {}, 17 | wasmd.WasmdAddress: {}, 18 | } 19 | 20 | func IsPayablePrecompile(addr *common.Address) bool { 21 | if addr == nil { 22 | return false 23 | } 24 | _, ok := payablePrecompiles[addr.Hex()] 25 | return ok 26 | } 27 | -------------------------------------------------------------------------------- /x/evm/keeper/state_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | 7 | "github.com/ethereum/go-ethereum/common" 8 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestState(t *testing.T) { 13 | k := &testkeeper.EVMTestApp.EvmKeeper 14 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now()) 15 | _, addr := testkeeper.MockAddressPair() 16 | 17 | initialState := k.GetState(ctx, addr, common.HexToHash("0xabc")) 18 | require.Equal(t, common.Hash{}, initialState) 19 | k.SetState(ctx, addr, common.HexToHash("0xabc"), common.HexToHash("0xdef")) 20 | 21 | got := k.GetState(ctx, addr, common.HexToHash("0xabc")) 22 | require.Equal(t, common.HexToHash("0xdef"), got) 23 | } 24 | -------------------------------------------------------------------------------- /x/evm/keeper/tx.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/store/prefix" 5 | sdk "github.com/cosmos/cosmos-sdk/types" 6 | "github.com/sei-protocol/sei-chain/x/evm/types" 7 | ) 8 | 9 | const DefaultTxHashesToRemove = 100 10 | 11 | func (k *Keeper) RemoveFirstNTxHashes(ctx sdk.Context, n int) { 12 | store := prefix.NewStore(ctx.KVStore(k.GetStoreKey()), types.TxHashesPrefix) 13 | iter := store.Iterator(nil, nil) 14 | defer iter.Close() 15 | keysToDelete := make([][]byte, 0, n) 16 | for ; n > 0 && iter.Valid(); iter.Next() { 17 | keysToDelete = append(keysToDelete, iter.Key()) 18 | n-- 19 | } 20 | for _, k := range keysToDelete { 21 | store.Delete(k) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /x/evm/migrations/add_new_param_migration.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 6 | "github.com/sei-protocol/sei-chain/x/evm/types" 7 | ) 8 | 9 | // Note that such migration would nuke any param changes that deviate 10 | // from the defaults. If such changes need to be preserved, a fine-grained 11 | // migration handler should be used instead 12 | func AddNewParamsAndSetAllToDefaults(ctx sdk.Context, k *keeper.Keeper) error { 13 | defaultParams := types.DefaultParams() 14 | k.SetParams(ctx, defaultParams) 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /x/evm/migrations/add_new_param_migration_test.go: -------------------------------------------------------------------------------- 1 | package migrations_test 2 | 3 | import ( 4 | "testing" 5 | 6 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 7 | "github.com/sei-protocol/sei-chain/x/evm/migrations" 8 | "github.com/stretchr/testify/require" 9 | tmtypes "github.com/tendermint/tendermint/proto/tendermint/types" 10 | ) 11 | 12 | func TestAddNewParamsAndSetAllToDefaults(t *testing.T) { 13 | k := testkeeper.EVMTestApp.EvmKeeper 14 | ctx := testkeeper.EVMTestApp.NewContext(false, tmtypes.Header{}) 15 | migrations.AddNewParamsAndSetAllToDefaults(ctx, &k) 16 | require.NotPanics(t, func() { k.GetParams(ctx) }) 17 | } 18 | -------------------------------------------------------------------------------- /x/evm/migrations/migrate_base_fee_off_by_one.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 6 | ) 7 | 8 | func MigrateBaseFeeOffByOne(ctx sdk.Context, k *keeper.Keeper) error { 9 | baseFee := k.GetCurrBaseFeePerGas(ctx) 10 | k.SetNextBaseFeePerGas(ctx, baseFee) 11 | return nil 12 | } 13 | -------------------------------------------------------------------------------- /x/evm/migrations/migrate_base_fee_off_by_one_test.go: -------------------------------------------------------------------------------- 1 | package migrations_test 2 | 3 | import ( 4 | "testing" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 8 | "github.com/sei-protocol/sei-chain/x/evm/migrations" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestMigrateBaseFeeOffByOne(t *testing.T) { 13 | k := testkeeper.EVMTestApp.EvmKeeper 14 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockHeight(8) 15 | bf := sdk.NewDec(100) 16 | k.SetCurrBaseFeePerGas(ctx, bf) 17 | require.Equal(t, k.GetMinimumFeePerGas(ctx), k.GetNextBaseFeePerGas(ctx)) 18 | // do the migration 19 | require.Nil(t, migrations.MigrateBaseFeeOffByOne(ctx, &k)) 20 | require.Equal(t, bf, k.GetNextBaseFeePerGas(ctx)) 21 | require.Equal(t, bf, k.GetCurrBaseFeePerGas(ctx)) 22 | } 23 | -------------------------------------------------------------------------------- /x/evm/migrations/migrate_block_bloom.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 6 | "github.com/sei-protocol/sei-chain/x/evm/types" 7 | ) 8 | 9 | func MigrateBlockBloom(ctx sdk.Context, k *keeper.Keeper) error { 10 | k.SetLegacyBlockBloomCutoffHeight(ctx) 11 | 12 | prefsToDelete := [][]byte{} 13 | k.IterateAll(ctx, types.BlockBloomPrefix, func(key, _ []byte) bool { 14 | if len(key) > 0 { 15 | prefsToDelete = append(prefsToDelete, key) 16 | } 17 | return false 18 | }) 19 | store := k.PrefixStore(ctx, types.BlockBloomPrefix) 20 | for _, pref := range prefsToDelete { 21 | store.Delete(pref) 22 | } 23 | 24 | return nil 25 | } 26 | -------------------------------------------------------------------------------- /x/evm/migrations/migrate_deliver_tx_gas_limit.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 6 | "github.com/sei-protocol/sei-chain/x/evm/types" 7 | ) 8 | 9 | func MigrateDeliverTxHookWasmGasLimitParam(ctx sdk.Context, k *keeper.Keeper) error { 10 | // Fetch the v11 parameters 11 | keeperParams := k.GetParamsIfExists(ctx) 12 | 13 | // Add DeliverTxHookWasmGasLimit to with default value 14 | keeperParams.DeliverTxHookWasmGasLimit = types.DefaultParams().DeliverTxHookWasmGasLimit 15 | 16 | // Set the updated parameters back in the keeper 17 | k.SetParams(ctx, keeperParams) 18 | 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /x/evm/migrations/migrate_eip_1559_max_base_fee.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 6 | "github.com/sei-protocol/sei-chain/x/evm/types" 7 | ) 8 | 9 | func MigrateEip1559MaxFeePerGas(ctx sdk.Context, k *keeper.Keeper) error { 10 | keeperParams := k.GetParamsIfExists(ctx) 11 | keeperParams.MaximumFeePerGas = types.DefaultParams().MaximumFeePerGas 12 | k.SetParams(ctx, keeperParams) 13 | return nil 14 | } 15 | -------------------------------------------------------------------------------- /x/evm/migrations/migrate_eip_1559_params.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 6 | "github.com/sei-protocol/sei-chain/x/evm/types" 7 | ) 8 | 9 | func MigrateEip1559Params(ctx sdk.Context, k *keeper.Keeper) error { 10 | keeperParams := k.GetParamsIfExists(ctx) 11 | keeperParams.MaxDynamicBaseFeeUpwardAdjustment = types.DefaultParams().MaxDynamicBaseFeeUpwardAdjustment 12 | keeperParams.MaxDynamicBaseFeeDownwardAdjustment = types.DefaultParams().MaxDynamicBaseFeeDownwardAdjustment 13 | keeperParams.TargetGasUsedPerBlock = types.DefaultParams().TargetGasUsedPerBlock 14 | keeperParams.MinimumFeePerGas = types.DefaultParams().MinimumFeePerGas 15 | k.SetParams(ctx, keeperParams) 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /x/evm/migrations/migrate_remove_tx_hashes.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/store/prefix" 5 | sdk "github.com/cosmos/cosmos-sdk/types" 6 | "github.com/sei-protocol/sei-chain/x/evm/keeper" 7 | "github.com/sei-protocol/sei-chain/x/evm/types" 8 | ) 9 | 10 | func RemoveTxHashes(ctx sdk.Context, k *keeper.Keeper) error { 11 | store := prefix.NewStore(ctx.KVStore(k.GetStoreKey()), types.TxHashesPrefix) 12 | return store.DeleteAll(nil, nil) 13 | } 14 | -------------------------------------------------------------------------------- /x/evm/pointer_abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW1155Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW20Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cwAddr","type":"string"}],"name":"addCW721Pointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"addNativePointer","outputs":[{"internalType":"address","name":"ret","type":"address"}],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /x/evm/querier/config.go: -------------------------------------------------------------------------------- 1 | package querier 2 | 3 | import ( 4 | servertypes "github.com/cosmos/cosmos-sdk/server/types" 5 | "github.com/spf13/cast" 6 | ) 7 | 8 | type Config struct { 9 | GasLimit uint64 `mapstructure:"evm_query_gas_limit"` 10 | } 11 | 12 | var DefaultConfig = Config{ 13 | GasLimit: 300000, 14 | } 15 | 16 | const ( 17 | flagGasLimit = "evm_query.evm_query_gas_limit" 18 | ) 19 | 20 | func ReadConfig(opts servertypes.AppOptions) (Config, error) { 21 | cfg := DefaultConfig // copy 22 | var err error 23 | if v := opts.Get(flagGasLimit); v != nil { 24 | if cfg.GasLimit, err = cast.ToUint64E(v); err != nil { 25 | return cfg, err 26 | } 27 | } 28 | return cfg, nil 29 | } 30 | -------------------------------------------------------------------------------- /x/evm/state/keys.go: -------------------------------------------------------------------------------- 1 | package state 2 | 3 | /* 4 | * 5 | Transient Module State Keys 6 | */ 7 | var ( 8 | // Represents the sum of all unassociated evm account balances 9 | // If evm module balance is higher than this value at the end of 10 | // the transaction, we need to burn from module balance in order 11 | // for this number to align. 12 | GasRefundKey = []byte{0x01} 13 | LogsKey = []byte{0x02} 14 | ) 15 | 16 | /* 17 | * 18 | Transient Account State Keys 19 | */ 20 | var ( 21 | AccountCreated = []byte{0x01} 22 | AccountDeleted = []byte{0x02} 23 | ) 24 | -------------------------------------------------------------------------------- /x/evm/state/log.go: -------------------------------------------------------------------------------- 1 | package state 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/common" 5 | ethtypes "github.com/ethereum/go-ethereum/core/types" 6 | ) 7 | 8 | type Logs struct { 9 | Ls []*ethtypes.Log `json:"logs"` 10 | } 11 | 12 | func (s *DBImpl) AddLog(l *ethtypes.Log) { 13 | l.Index = uint(len(s.GetAllLogs())) 14 | s.tempStateCurrent.logs = append(s.tempStateCurrent.logs, l) 15 | 16 | if s.logger != nil && s.logger.OnLog != nil { 17 | s.logger.OnLog(l) 18 | } 19 | } 20 | 21 | func (s *DBImpl) GetAllLogs() []*ethtypes.Log { 22 | res := []*ethtypes.Log{} 23 | for _, st := range s.tempStatesHist { 24 | res = append(res, st.logs...) 25 | } 26 | res = append(res, s.tempStateCurrent.logs...) 27 | return res 28 | } 29 | 30 | func (s *DBImpl) GetLogs(common.Hash, uint64, common.Hash) []*ethtypes.Log { 31 | return s.GetAllLogs() 32 | } 33 | -------------------------------------------------------------------------------- /x/evm/state/nonce.go: -------------------------------------------------------------------------------- 1 | package state 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/common" 5 | ) 6 | 7 | func (s *DBImpl) GetNonce(addr common.Address) uint64 { 8 | s.k.PrepareReplayedAddr(s.ctx, addr) 9 | return s.k.GetNonce(s.ctx, addr) 10 | } 11 | 12 | func (s *DBImpl) SetNonce(addr common.Address, nonce uint64) { 13 | s.k.PrepareReplayedAddr(s.ctx, addr) 14 | 15 | if s.logger != nil && s.logger.OnNonceChange != nil { 16 | // The SetCode method could be modified to return the old code/hash directly. 17 | s.logger.OnNonceChange(addr, s.GetNonce(addr), nonce) 18 | } 19 | 20 | s.k.SetNonce(s.ctx, addr, nonce) 21 | } 22 | -------------------------------------------------------------------------------- /x/evm/state/nonce_test.go: -------------------------------------------------------------------------------- 1 | package state_test 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | 7 | "github.com/stretchr/testify/require" 8 | 9 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 10 | "github.com/sei-protocol/sei-chain/x/evm/state" 11 | ) 12 | 13 | func TestNonce(t *testing.T) { 14 | k := &testkeeper.EVMTestApp.EvmKeeper 15 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now()) 16 | stateDB := state.NewDBImpl(ctx, k, false) 17 | _, addr := testkeeper.MockAddressPair() 18 | stateDB.SetNonce(addr, 1) 19 | nonce := stateDB.GetNonce(addr) 20 | require.Equal(t, nonce, uint64(1)) 21 | stateDB.SetNonce(addr, 2) 22 | nonce = stateDB.GetNonce(addr) 23 | require.Equal(t, nonce, uint64(2)) 24 | } 25 | -------------------------------------------------------------------------------- /x/evm/state/refund_test.go: -------------------------------------------------------------------------------- 1 | package state_test 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | 7 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 8 | "github.com/sei-protocol/sei-chain/x/evm/state" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestGasRefund(t *testing.T) { 13 | k := &testkeeper.EVMTestApp.EvmKeeper 14 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now()) 15 | statedb := state.NewDBImpl(ctx, k, false) 16 | 17 | require.Equal(t, uint64(0), statedb.GetRefund()) 18 | statedb.AddRefund(2) 19 | require.Equal(t, uint64(2), statedb.GetRefund()) 20 | statedb.SubRefund(1) 21 | require.Equal(t, uint64(1), statedb.GetRefund()) 22 | require.Panics(t, func() { statedb.SubRefund(2) }) 23 | } 24 | -------------------------------------------------------------------------------- /x/evm/state/transfer.go: -------------------------------------------------------------------------------- 1 | package state 2 | 3 | import ( 4 | "math/big" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | "github.com/ethereum/go-ethereum/core/tracing" 8 | "github.com/ethereum/go-ethereum/core/vm" 9 | ) 10 | 11 | func TransferWithoutEvents(db vm.StateDB, sender, recipient common.Address, amount *big.Int) { 12 | sdb, ok := db.(*DBImpl) 13 | if !ok { 14 | panic("EventlessTransfer only works with DBImpl") 15 | } 16 | sdb.DisableEvents() 17 | defer sdb.EnableEvents() 18 | 19 | sdb.SubBalance(sender, amount, tracing.BalanceChangeTransfer) 20 | sdb.AddBalance(recipient, amount, tracing.BalanceChangeTransfer) 21 | } 22 | -------------------------------------------------------------------------------- /x/evm/state/transfer_test.go: -------------------------------------------------------------------------------- 1 | package state_test 2 | 3 | import ( 4 | "math/big" 5 | "testing" 6 | "time" 7 | 8 | testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" 9 | "github.com/sei-protocol/sei-chain/x/evm/state" 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | func TestEventlessTransfer(t *testing.T) { 14 | k := &testkeeper.EVMTestApp.EvmKeeper 15 | ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now()) 16 | db := state.NewDBImpl(ctx, k, false) 17 | _, fromAddr := testkeeper.MockAddressPair() 18 | _, toAddr := testkeeper.MockAddressPair() 19 | 20 | beforeLen := len(ctx.EventManager().ABCIEvents()) 21 | 22 | state.TransferWithoutEvents(db, fromAddr, toAddr, big.NewInt(100)) 23 | 24 | // should be unchanged 25 | require.Len(t, ctx.EventManager().ABCIEvents(), beforeLen) 26 | } 27 | -------------------------------------------------------------------------------- /x/evm/types/constants.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | const MaxAssociateCustomMessageLength = 64 4 | -------------------------------------------------------------------------------- /x/evm/types/errors.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | type AssociationMissingErr struct { 9 | Address string 10 | } 11 | 12 | func NewAssociationMissingErr(address string) AssociationMissingErr { 13 | return AssociationMissingErr{Address: address} 14 | } 15 | 16 | func (e AssociationMissingErr) Error() string { 17 | return fmt.Sprintf("address %s is not linked", e.Address) 18 | } 19 | 20 | func (e AssociationMissingErr) AddressType() string { 21 | if strings.HasPrefix(e.Address, "0x") { 22 | return "evm" 23 | } 24 | return "sei" 25 | } 26 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/access_list_test.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | ethtypes "github.com/ethereum/go-ethereum/core/types" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestAccessList(t *testing.T) { 12 | require.Nil(t, NewAccessList(nil)) 13 | ethAccessList := mockAccessList() 14 | require.Equal(t, ethAccessList, *NewAccessList(ðAccessList).ToEthAccessList()) 15 | } 16 | 17 | func mockAccessList() ethtypes.AccessList { 18 | return ethtypes.AccessList{ 19 | ethtypes.AccessTuple{ 20 | Address: common.Address{'a'}, 21 | StorageKeys: []common.Hash{{'b'}}, 22 | }, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/access_list_tx_setter.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import sdk "github.com/cosmos/cosmos-sdk/types" 4 | 5 | func (tx *AccessListTx) SetTo(v string) { 6 | tx.To = v 7 | } 8 | 9 | func (tx *AccessListTx) SetAmount(v sdk.Int) { 10 | tx.Amount = &v 11 | } 12 | 13 | func (tx *AccessListTx) SetGasPrice(v sdk.Int) { 14 | tx.GasPrice = &v 15 | } 16 | 17 | func (tx *AccessListTx) SetAccesses(v AccessList) { 18 | tx.Accesses = v 19 | } 20 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/blob_tx_setter.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import sdk "github.com/cosmos/cosmos-sdk/types" 4 | 5 | func (tx *BlobTx) SetTo(v string) { 6 | tx.To = v 7 | } 8 | 9 | func (tx *BlobTx) SetAmount(v sdk.Int) { 10 | tx.Amount = &v 11 | } 12 | 13 | func (tx *BlobTx) SetGasFeeCap(v sdk.Int) { 14 | tx.GasFeeCap = &v 15 | } 16 | 17 | func (tx *BlobTx) SetGasTipCap(v sdk.Int) { 18 | tx.GasTipCap = &v 19 | } 20 | 21 | func (tx *BlobTx) SetAccesses(v AccessList) { 22 | tx.Accesses = v 23 | } 24 | 25 | func (tx *BlobTx) SetBlobFeeCap(v sdk.Int) { 26 | tx.BlobFeeCap = &v 27 | } 28 | 29 | func (tx *BlobTx) SetBlobHashes(v [][]byte) { 30 | tx.BlobHashes = v 31 | } 32 | 33 | func (tx *BlobTx) SetBlobSidecar(v *BlobTxSidecar) { 34 | tx.Sidecar = v 35 | } 36 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/dynamic_fee_tx_setter.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import sdk "github.com/cosmos/cosmos-sdk/types" 4 | 5 | func (tx *DynamicFeeTx) SetTo(v string) { 6 | tx.To = v 7 | } 8 | 9 | func (tx *DynamicFeeTx) SetAmount(v sdk.Int) { 10 | tx.Amount = &v 11 | } 12 | 13 | func (tx *DynamicFeeTx) SetGasFeeCap(v sdk.Int) { 14 | tx.GasFeeCap = &v 15 | } 16 | 17 | func (tx *DynamicFeeTx) SetGasTipCap(v sdk.Int) { 18 | tx.GasTipCap = &v 19 | } 20 | 21 | func (tx *DynamicFeeTx) SetAccesses(v AccessList) { 22 | tx.Accesses = v 23 | } 24 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/int.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import ( 4 | "math/big" 5 | ) 6 | 7 | const maxBitLen = 256 8 | 9 | // IsValidInt256 check the bound of 256 bit number 10 | func IsValidInt256(i *big.Int) bool { 11 | return i == nil || i.BitLen() <= maxBitLen 12 | } 13 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/legacy_tx_setter.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import sdk "github.com/cosmos/cosmos-sdk/types" 4 | 5 | func (tx *LegacyTx) SetTo(v string) { 6 | tx.To = v 7 | } 8 | 9 | func (tx *LegacyTx) SetAmount(v sdk.Int) { 10 | tx.Amount = &v 11 | } 12 | 13 | func (tx *LegacyTx) SetGasPrice(v sdk.Int) { 14 | tx.GasPrice = &v 15 | } 16 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/validations.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | ) 8 | 9 | // address is validate if it is a hex string (case insensitive) 10 | // of length 40. It may optionally have a '0x' or '0X' prefix. 11 | func ValidateAddress(address string) error { 12 | if !common.IsHexAddress(address) { 13 | return fmt.Errorf( 14 | "address '%s' is not a valid ethereum hex address", 15 | address, 16 | ) 17 | } 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /x/evm/types/ethtx/validations_test.go: -------------------------------------------------------------------------------- 1 | package ethtx 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestValidateAddress(t *testing.T) { 10 | require.NoError(t, ValidateAddress("0x1234567890ABCDEF1234567890abcdef12345678")) 11 | require.NoError(t, ValidateAddress("0X1234567890ABCDEF1234567890abcdef12345678")) 12 | require.NoError(t, ValidateAddress("1234567890ABCDEF1234567890abcdef12345678")) 13 | 14 | require.Error(t, ValidateAddress("0x1234567890ABCDEF1234567890abcdef1234567")) 15 | require.Error(t, ValidateAddress("0x1234567890ABCDEF1234567890abcdef123456789")) 16 | require.Error(t, ValidateAddress("1234567890ABCDEF1234567890abcdef1234567G")) 17 | } 18 | -------------------------------------------------------------------------------- /x/evm/types/events.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | const ( 4 | EventTypeAddressAssociated = "address_associated" 5 | EventTypePointerRegistered = "pointer_registered" 6 | EventTypeSigner = "signer" 7 | 8 | AttributeKeySeiAddress = "sei_addr" 9 | AttributeKeyEvmAddress = "evm_addr" 10 | AttributeKeyPointerType = "pointer_type" 11 | AttributeKeyPointee = "pointee" 12 | AttributeKeyPointerAddress = "pointer_address" 13 | AttributeKeyPointerVersion = "pointer_version" 14 | ) 15 | -------------------------------------------------------------------------------- /x/evm/types/genesis.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | func DefaultGenesis() *GenesisState { 4 | return &GenesisState{ 5 | Params: DefaultParams(), 6 | } 7 | } 8 | 9 | func (gs GenesisState) Validate() error { 10 | return gs.Params.Validate() 11 | } 12 | 13 | func ValidateStream(gensisStateCh <-chan GenesisState) error { 14 | passedParamCheck := false 15 | var paramCheckErr error 16 | for genesisState := range gensisStateCh { 17 | if err := genesisState.Validate(); err != nil { 18 | paramCheckErr = err 19 | } else { 20 | passedParamCheck = true 21 | } 22 | } 23 | if !passedParamCheck { 24 | return paramCheckErr 25 | } 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /x/evm/types/gov_test.go: -------------------------------------------------------------------------------- 1 | package types_test 2 | 3 | import ( 4 | "math" 5 | "testing" 6 | 7 | "github.com/sei-protocol/sei-chain/x/evm/types" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestAddERCNativePointerProposalV2(t *testing.T) { 12 | p := types.AddERCNativePointerProposalV2{ 13 | Title: "title", 14 | Description: "desc", 15 | Token: "test", 16 | Name: "TEST", 17 | Symbol: "Test", 18 | Decimals: 6, 19 | } 20 | require.Equal(t, "title", p.GetTitle()) 21 | require.Equal(t, "desc", p.GetDescription()) 22 | require.Equal(t, "evm", p.ProposalRoute()) 23 | require.Equal(t, "AddERCNativePointerV2", p.ProposalType()) 24 | p.Decimals = math.MaxUint32 25 | require.NotNil(t, p.ValidateBasic()) 26 | p.Decimals = 6 27 | require.Nil(t, p.ValidateBasic()) 28 | require.NotEmpty(t, p.String()) 29 | } 30 | -------------------------------------------------------------------------------- /x/evm/types/logs.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ethtypes "github.com/ethereum/go-ethereum/core/types" 4 | 5 | func NewLogsFromEth(ethlogs []*ethtypes.Log) []*Log { 6 | logs := make([]*Log, 0, len(ethlogs)) 7 | for _, ethlog := range ethlogs { 8 | logs = append(logs, newLogFromEth(ethlog)) 9 | } 10 | return logs 11 | } 12 | 13 | func newLogFromEth(log *ethtypes.Log) *Log { 14 | topics := make([]string, len(log.Topics)) 15 | for i, topic := range log.Topics { 16 | topics[i] = topic.String() 17 | } 18 | 19 | return &Log{ 20 | Address: log.Address.String(), 21 | Topics: topics, 22 | Data: log.Data, 23 | Index: uint32(log.Index), 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /x/evm/types/message_internal_evm_call.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | var ( 8 | _ sdk.Msg = &MsgInternalEVMCall{} 9 | ) 10 | 11 | func NewMessageInternalEVMCall(from sdk.AccAddress, to string, value *sdk.Int, data []byte) *MsgInternalEVMCall { 12 | return &MsgInternalEVMCall{ 13 | Sender: from.String(), 14 | To: to, 15 | Value: value, 16 | Data: data, 17 | } 18 | } 19 | 20 | func (msg *MsgInternalEVMCall) GetSigners() []sdk.AccAddress { 21 | senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) 22 | if err != nil { 23 | return []sdk.AccAddress{} 24 | } 25 | return []sdk.AccAddress{senderAddr} 26 | } 27 | 28 | func (msg *MsgInternalEVMCall) ValidateBasic() error { 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /x/evm/types/whitelist.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | func (w *Whitelist) IsHashInWhiteList(h common.Hash) bool { 6 | for _, s := range w.Hashes { 7 | if s == h.Hex() { 8 | return true 9 | } 10 | } 11 | return false 12 | } 13 | -------------------------------------------------------------------------------- /x/mint/gov.go: -------------------------------------------------------------------------------- 1 | package mint 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/mint/keeper" 6 | "github.com/sei-protocol/sei-chain/x/mint/types" 7 | ) 8 | 9 | func HandleUpdateMinterProposal(ctx sdk.Context, k *keeper.Keeper, p *types.UpdateMinterProposal) error { 10 | err := types.ValidateMinter(*p.Minter) 11 | if err != nil { 12 | return err 13 | } 14 | k.SetMinter(ctx, *p.Minter) 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /x/mint/keeper/genesis.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/mint/types" 6 | ) 7 | 8 | // InitGenesis new mint genesis. 9 | func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { 10 | k.SetMinter(ctx, data.Minter) 11 | k.SetParams(ctx, data.Params) 12 | } 13 | 14 | // ExportGenesis returns a GenesisState for a given context and keeper. 15 | func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { 16 | minter := k.GetMinter(ctx) 17 | params := k.GetParams(ctx) 18 | return types.NewGenesisState(minter, params) 19 | } 20 | -------------------------------------------------------------------------------- /x/mint/keeper/integration_test.go: -------------------------------------------------------------------------------- 1 | package keeper_test 2 | 3 | import ( 4 | "github.com/sei-protocol/sei-chain/app" 5 | tmproto "github.com/tendermint/tendermint/proto/tendermint/types" 6 | 7 | sdk "github.com/cosmos/cosmos-sdk/types" 8 | "github.com/sei-protocol/sei-chain/x/mint/types" 9 | ) 10 | 11 | // returns context and an app with updated mint keeper 12 | func createTestApp(isCheckTx bool) (*app.App, sdk.Context) { 13 | app := app.Setup(isCheckTx, false) 14 | 15 | ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) 16 | app.MintKeeper.SetParams(ctx, types.DefaultParams()) 17 | app.MintKeeper.SetMinter(ctx, types.DefaultInitialMinter()) 18 | 19 | return app, ctx 20 | } 21 | -------------------------------------------------------------------------------- /x/mint/simulation/decoder.go: -------------------------------------------------------------------------------- 1 | package simulation 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | 7 | "github.com/cosmos/cosmos-sdk/codec" 8 | "github.com/cosmos/cosmos-sdk/types/kv" 9 | "github.com/sei-protocol/sei-chain/x/mint/types" 10 | ) 11 | 12 | // NewDecodeStore returns a decoder function closure that unmarshals the KVPair's 13 | // Value to the corresponding mint type. 14 | func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { 15 | return func(kvA, kvB kv.Pair) string { 16 | switch { 17 | case bytes.Equal(kvA.Key, types.MinterKey): 18 | var minterA, minterB types.Minter 19 | cdc.MustUnmarshal(kvA.Value, &minterA) 20 | cdc.MustUnmarshal(kvB.Value, &minterB) 21 | return fmt.Sprintf("%v\n%v", minterA, minterB) 22 | default: 23 | panic(fmt.Sprintf("invalid mint key %X", kvA.Key)) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /x/mint/types/codec.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/codec" 5 | cdctypes "github.com/cosmos/cosmos-sdk/codec/types" 6 | cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" 7 | govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" 8 | ) 9 | 10 | var ( 11 | amino = codec.NewLegacyAmino() 12 | ModuleCdc = codec.NewAminoCodec(amino) 13 | ) 14 | 15 | func init() { 16 | RegisterCodec(amino) 17 | cryptocodec.RegisterCrypto(amino) 18 | amino.Seal() 19 | } 20 | 21 | func RegisterCodec(cdc *codec.LegacyAmino) { 22 | cdc.RegisterConcrete(&UpdateMinterProposal{}, "mint/UpdateMinter", nil) 23 | } 24 | 25 | func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { 26 | registry.RegisterImplementations((*govtypes.Content)(nil), 27 | &UpdateMinterProposal{}, 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /x/mint/types/events.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // Minting module event types 4 | const ( 5 | EventTypeMint = ModuleName 6 | 7 | AttribtueMintDate = "mint_date" 8 | AttributeMintEpoch = "mint_epoch" 9 | ) 10 | -------------------------------------------------------------------------------- /x/mint/types/genesis.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // NewGenesisState creates a new GenesisState object. 4 | func NewGenesisState(minter Minter, params Params) *GenesisState { 5 | return &GenesisState{ 6 | Minter: minter, 7 | Params: params, 8 | } 9 | } 10 | 11 | // DefaultGenesisState creates a default GenesisState object. 12 | func DefaultGenesisState() *GenesisState { 13 | return &GenesisState{ 14 | Minter: DefaultInitialMinter(), 15 | Params: DefaultParams(), 16 | } 17 | } 18 | 19 | // ValidateGenesis validates the provided genesis state to ensure the 20 | // expected invariants holds. 21 | func ValidateGenesis(data GenesisState) error { 22 | if err := data.Params.Validate(); err != nil { 23 | return err 24 | } 25 | 26 | return ValidateMinter(data.Minter) 27 | } 28 | -------------------------------------------------------------------------------- /x/mint/types/hooks.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | type MintHooks interface { 8 | AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) 9 | } 10 | 11 | var _ MintHooks = MultiMintHooks{} 12 | 13 | // combine multiple mint hooks, all hook functions are run in array sequence. 14 | type MultiMintHooks []MintHooks 15 | 16 | func NewMultiMintHooks(hooks ...MintHooks) MultiMintHooks { 17 | return hooks 18 | } 19 | 20 | func (h MultiMintHooks) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { 21 | for i := range h { 22 | h[i].AfterDistributeMintedCoin(ctx, mintedCoin) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /x/mint/types/keys.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // MinterKey is the key to use for the keeper store. 4 | var MinterKey = []byte{0x00} 5 | 6 | const ( 7 | // module name 8 | ModuleName = "mint" 9 | 10 | // StoreKey is the default store key for mint 11 | StoreKey = ModuleName 12 | 13 | RouterKey = ModuleName 14 | 15 | MemStoreKey = "mem_mint" 16 | 17 | // QuerierRoute is the querier route for the minting store. 18 | QuerierRoute = StoreKey 19 | 20 | // Query endpoints supported by the minting querier 21 | QueryParameters = "parameters" 22 | QueryMinter = "minter" 23 | 24 | // Format used for scheduling token releases 25 | /*#nosec G101 Not a hard coded credential*/ 26 | TokenReleaseDateFormat = "2006-01-02" 27 | ) 28 | -------------------------------------------------------------------------------- /x/oracle/client/rest/rest.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import ( 4 | "github.com/cosmos/cosmos-sdk/client" 5 | clientrest "github.com/cosmos/cosmos-sdk/client/rest" 6 | 7 | "github.com/gorilla/mux" 8 | ) 9 | 10 | const ( 11 | RestDenom = "denom" 12 | RestVoter = "voter" 13 | RestLookbackSeconds = "lookback_seconds" 14 | ) 15 | 16 | // RegisterRoutes registers oracle-related REST handlers to a router 17 | func RegisterRoutes(clientCtx client.Context, rtr *mux.Router) { 18 | r := clientrest.WithHTTPDeprecationHeaders(rtr) 19 | 20 | registerQueryRoutes(clientCtx, r) 21 | registerTxHandlers(clientCtx, r) 22 | } 23 | -------------------------------------------------------------------------------- /x/oracle/client/wasm/bindings/queries.go: -------------------------------------------------------------------------------- 1 | package bindings 2 | 3 | import "github.com/sei-protocol/sei-chain/x/oracle/types" 4 | 5 | type SeiOracleQuery struct { 6 | // queries the oracle exchange rates 7 | ExchangeRates *types.QueryExchangeRatesRequest `json:"exchange_rates,omitempty"` 8 | // queries the oracle TWAPs 9 | OracleTwaps *types.QueryTwapsRequest `json:"oracle_twaps,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /x/oracle/exported/alias.go: -------------------------------------------------------------------------------- 1 | // DONTCOVER 2 | package exported 3 | 4 | import "github.com/sei-protocol/sei-chain/x/oracle/types" 5 | 6 | type ( 7 | MsgAggregateExchangeRateVote = types.MsgAggregateExchangeRateVote 8 | ) 9 | -------------------------------------------------------------------------------- /x/oracle/keeper/vote_target.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/sei-protocol/sei-chain/x/oracle/types" 6 | ) 7 | 8 | func (k Keeper) IsVoteTarget(ctx sdk.Context, denom string) bool { 9 | _, err := k.GetVoteTarget(ctx, denom) 10 | return err == nil 11 | } 12 | 13 | func (k Keeper) GetVoteTargets(ctx sdk.Context) (voteTargets []string) { 14 | k.IterateVoteTargets(ctx, func(denom string, denomInfo types.Denom) bool { 15 | voteTargets = append(voteTargets, denom) 16 | return false 17 | }) 18 | 19 | return voteTargets 20 | } 21 | -------------------------------------------------------------------------------- /x/oracle/spec/01_concepts.md: -------------------------------------------------------------------------------- 1 | 4 | 5 | # Concepts 6 | 7 | ## Voting Procedure 8 | 9 | ## Reward Band 10 | ## Slashing 11 | 12 | ## Abstaining from Voting 13 | ## Messages 14 | 15 | -------------------------------------------------------------------------------- /x/oracle/spec/06_params.md: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | # Parameters 7 | 8 | The market module contains the following parameters: 9 | 10 | | Key | Type | Example | 11 | |--------------------------|--------------|------------------------| 12 | | voteperiod | string (int) | "5" | 13 | | votethreshold | string (dec) | "0.500000000000000000" | 14 | | rewardband | string (dec) | "0.020000000000000000" | 15 | | rewarddistributionwindow | string (int) | "5256000" | 16 | | whitelist | []DenomList | [{"name": "ukrw"}] | 17 | | slashfraction | string (dec) | "0.001000000000000000" | 18 | | slashwindow | string (int) | "100800" | 19 | | minvalidperwindow | string (int) | "0.050000000000000000" | -------------------------------------------------------------------------------- /x/oracle/types/denom.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "strings" 5 | 6 | "gopkg.in/yaml.v2" 7 | ) 8 | 9 | // String implements fmt.Stringer interface 10 | func (d Denom) String() string { 11 | out, _ := yaml.Marshal(d) 12 | return string(out) 13 | } 14 | 15 | // Equal implements equal interface 16 | func (d Denom) Equal(d1 *Denom) bool { 17 | return d.Name == d1.Name 18 | } 19 | 20 | // DenomList is array of Denom 21 | type DenomList []Denom 22 | 23 | func (dl DenomList) Contains(denom string) bool { 24 | for _, d := range dl { 25 | if d.Name == denom { 26 | return true 27 | } 28 | } 29 | return false 30 | } 31 | 32 | // String implements fmt.Stringer interface 33 | func (dl DenomList) String() (out string) { 34 | for _, d := range dl { 35 | out += d.String() + "\n" 36 | } 37 | return strings.TrimSpace(out) 38 | } 39 | -------------------------------------------------------------------------------- /x/oracle/types/events.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | // Oracle module event types 4 | const ( 5 | EventTypeExchangeRateUpdate = "exchange_rate_update" 6 | EventTypeVote = "vote" 7 | EventTypeFeedDelegate = "feed_delegate" 8 | EventTypeAggregateVote = "aggregate_vote" 9 | EventTypeEndSlashWindow = "end_slash_window" 10 | 11 | AttributeKeyDenom = "denom" 12 | AttributeKeyVoter = "voter" 13 | AttributeKeyExchangeRate = "exchange_rate" 14 | AttributeKeyExchangeRates = "exchange_rates" 15 | AttributeKeyOperator = "operator" 16 | AttributeKeyFeeder = "feeder" 17 | AttributeKeyMissCount = "miss_count" 18 | AttributeKeyAbstainCount = "abstain_count" 19 | AttributeKeyWinCount = "win_count" 20 | AttributeKeySuccessCount = "success_count" 21 | 22 | AttributeValueCategory = ModuleName 23 | ) 24 | -------------------------------------------------------------------------------- /x/oracle/types/genesis_test.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestGenesisValidation(t *testing.T) { 10 | genState := DefaultGenesisState() 11 | require.NoError(t, ValidateGenesis(genState)) 12 | 13 | genState.Params.VotePeriod = 0 14 | require.Error(t, ValidateGenesis(genState)) 15 | } 16 | -------------------------------------------------------------------------------- /x/oracle/types/vote_test.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestParseExchangeRateTuples(t *testing.T) { 10 | valid := "123.0usei,123.123ukrw" 11 | _, err := ParseExchangeRateTuples(valid) 12 | require.NoError(t, err) 13 | 14 | duplicatedDenom := "100.0usei,123.123ukrw,121233.123ukrw" 15 | _, err = ParseExchangeRateTuples(duplicatedDenom) 16 | require.Error(t, err) 17 | 18 | invalidCoins := "123.123" 19 | _, err = ParseExchangeRateTuples(invalidCoins) 20 | require.Error(t, err) 21 | 22 | invalidCoinsWithValid := "123.0usei,123.1" 23 | _, err = ParseExchangeRateTuples(invalidCoinsWithValid) 24 | require.Error(t, err) 25 | 26 | abstainCoinsWithValid := "0.0usei,123.1ukrw" 27 | _, err = ParseExchangeRateTuples(abstainCoinsWithValid) 28 | require.NoError(t, err) 29 | } 30 | -------------------------------------------------------------------------------- /x/oracle/utils/assets.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | const ( 4 | MicroUsdcDenom = "uusdc" 5 | MicroSeiDenom = "usei" 6 | MicroAtomDenom = "uatom" 7 | MicroEthDenom = "ueth" 8 | 9 | MicroUnit = int64(1e6) 10 | ) 11 | -------------------------------------------------------------------------------- /x/oracle/utils/period.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | const ( 8 | BlocksPerMinute = uint64(75) 9 | BlocksPerHour = BlocksPerMinute * 60 10 | BlocksPerDay = BlocksPerHour * 24 11 | BlocksPerWeek = BlocksPerDay * 7 12 | BlocksPerMonth = BlocksPerDay * 30 13 | BlocksPerYear = BlocksPerDay * 365 14 | ) 15 | 16 | func IsPeriodLastBlock(ctx sdk.Context, blocksPerPeriod uint64) bool { 17 | return ((uint64)(ctx.BlockHeight())+1)%blocksPerPeriod == 0 18 | } 19 | -------------------------------------------------------------------------------- /x/store/handler.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | func GetCachedContext(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore) { 8 | ms := ctx.MultiStore() 9 | msCache := ms.CacheMultiStore() 10 | return ctx.WithMultiStore(msCache), msCache 11 | } 12 | -------------------------------------------------------------------------------- /x/tokenfactory/client/wasm/bindings/queries.go: -------------------------------------------------------------------------------- 1 | package bindings 2 | 3 | import "github.com/sei-protocol/sei-chain/x/tokenfactory/types" 4 | 5 | type SeiTokenFactoryQuery struct { 6 | // queries the tokenfactory authority metadata 7 | DenomAuthorityMetadata *types.QueryDenomAuthorityMetadataRequest `json:"denom_authority_metadata,omitempty"` 8 | // queries the tokenfactory denoms from a creator 9 | DenomsFromCreator *types.QueryDenomsFromCreatorRequest `json:"denoms_from_creator,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /x/tokenfactory/handler.go: -------------------------------------------------------------------------------- 1 | package tokenfactory 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" 6 | govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" 7 | 8 | "github.com/sei-protocol/sei-chain/x/tokenfactory/keeper" 9 | ) 10 | 11 | func NewProposalHandler(_ keeper.Keeper) govtypes.Handler { 12 | return func(ctx sdk.Context, content govtypes.Content) error { 13 | return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized tokenfactory proposal content type") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /x/tokenfactory/keeper/creators.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, denom string) { 8 | store := k.GetCreatorPrefixStore(ctx, creator) 9 | store.Set([]byte(denom), []byte(denom)) 10 | } 11 | 12 | func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string) []string { 13 | store := k.GetCreatorPrefixStore(ctx, creator) 14 | 15 | iterator := store.Iterator(nil, nil) 16 | defer iterator.Close() 17 | 18 | denoms := []string{} 19 | for ; iterator.Valid(); iterator.Next() { 20 | denoms = append(denoms, string(iterator.Key())) 21 | } 22 | return denoms 23 | } 24 | 25 | func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) sdk.Iterator { 26 | return k.GetCreatorsPrefixStore(ctx).Iterator(nil, nil) 27 | } 28 | -------------------------------------------------------------------------------- /x/tokenfactory/keeper/params.go: -------------------------------------------------------------------------------- 1 | package keeper 2 | 3 | import ( 4 | "github.com/sei-protocol/sei-chain/x/tokenfactory/types" 5 | 6 | sdk "github.com/cosmos/cosmos-sdk/types" 7 | ) 8 | 9 | // GetParams returns the total set params. 10 | func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { 11 | k.paramSpace.GetParamSet(ctx, ¶ms) 12 | return params 13 | } 14 | 15 | // SetParams sets the total set of params. 16 | func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { 17 | k.paramSpace.SetParamSet(ctx, ¶ms) 18 | } 19 | -------------------------------------------------------------------------------- /x/tokenfactory/types/authorityMetadata.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | ) 6 | 7 | func (metadata DenomAuthorityMetadata) Validate() error { 8 | if metadata.Admin != "" { 9 | _, err := sdk.AccAddressFromBech32(metadata.Admin) 10 | if err != nil { 11 | return err 12 | } 13 | } 14 | return nil 15 | } 16 | -------------------------------------------------------------------------------- /x/tokenfactory/types/events.go: -------------------------------------------------------------------------------- 1 | /*#nosec G101 */ 2 | package types 3 | 4 | // event types 5 | // nolint 6 | const ( 7 | AttributeAmount = "amount" 8 | AttributeCreator = "creator" 9 | AttributeSubdenom = "subdenom" 10 | //nolint:gosec 11 | AttributeNewTokenDenom = "new_token_denom" 12 | AttributeUpdatedTokenDenom = "updated_token_denom" 13 | AttributeMintToAddress = "mint_to_address" 14 | AttributeBurnFromAddress = "burn_from_address" 15 | AttributeTransferFromAddress = "transfer_from_address" 16 | AttributeTransferToAddress = "transfer_to_address" 17 | AttributeDenom = "denom" 18 | AttributeNewAdmin = "new_admin" 19 | AttributeDenomMetadata = "denom_metadata" 20 | AttributeAllowList = "denom_allow_list" 21 | ) 22 | --------------------------------------------------------------------------------