diff --git a/Cargo.toml b/Cargo.toml index 8c0c58c45c078..e5166ca26eb05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,250 +2,250 @@ resolver = "2" members = [ - "api", - "api/openapi-spec-generator", - "api/test-context", - "api/types", - "aptos-move/aptos-abstract-gas-usage", - "aptos-move/aptos-aggregator", - "aptos-move/aptos-gas-algebra", - "aptos-move/aptos-gas-meter", - "aptos-move/aptos-gas-profiling", - "aptos-move/aptos-gas-schedule", - "aptos-move/aptos-gas-schedule-updator", - "aptos-move/aptos-memory-usage-tracker", - "aptos-move/aptos-native-interface", - "aptos-move/aptos-release-builder", - "aptos-move/aptos-resource-viewer", - "aptos-move/aptos-sdk-builder", - "aptos-move/aptos-transaction-benchmarks", - "aptos-move/aptos-transactional-test-harness", - "aptos-move/aptos-validator-interface", - "aptos-move/aptos-vm", - "aptos-move/aptos-vm-logging", - "aptos-move/aptos-vm-profiling", - "aptos-move/aptos-vm-types", - "aptos-move/block-executor", - "aptos-move/e2e-benchmark", - "aptos-move/e2e-move-tests", - "aptos-move/e2e-tests", - "aptos-move/e2e-testsuite", - "aptos-move/framework", - "aptos-move/framework/cached-packages", - "aptos-move/framework/table-natives", - "aptos-move/move-examples", - "aptos-move/mvhashmap", - "aptos-move/package-builder", - "aptos-move/vm-genesis", - "aptos-move/writeset-transaction-generator", - "aptos-node", - "aptos-utils", - "config", - "config/global-constants", - "consensus", - "consensus/consensus-types", - "consensus/safety-rules", - "crates/aptos", - "crates/aptos-admin-service", - "crates/aptos-api-tester", - "crates/aptos-bcs-utils", - "crates/aptos-bitvec", - "crates/aptos-build-info", - "crates/aptos-collections", - "crates/aptos-compression", - "crates/aptos-crypto", - "crates/aptos-crypto-derive", - "crates/aptos-debugger", - "crates/aptos-dkg", - "crates/aptos-drop-helper", - "crates/aptos-enum-conversion-derive", - "crates/aptos-faucet/cli", - "crates/aptos-faucet/core", - "crates/aptos-faucet/metrics-server", - "crates/aptos-faucet/service", - "crates/aptos-genesis", - "crates/aptos-github-client", - "crates/aptos-id-generator", - "crates/aptos-infallible", - "crates/aptos-inspection-service", - "crates/aptos-jwk-consensus", - "crates/aptos-keygen", - "crates/aptos-ledger", - "crates/aptos-log-derive", - "crates/aptos-logger", - "crates/aptos-metrics-core", - "aptos-move/aptos-debugger", - "crates/aptos-network-checker", - "crates/aptos-node-identity", - "crates/aptos-openapi", - "crates/aptos-profiler", - "crates/aptos-proptest-helpers", - "crates/aptos-push-metrics", - "crates/aptos-rate-limiter", - "crates/aptos-rest-client", - "crates/aptos-retrier", - "crates/aptos-rosetta", - "crates/aptos-rosetta-cli", - "crates/aptos-runtimes", - "crates/aptos-speculative-state-helper", - "crates/aptos-system-utils", - "crates/aptos-telemetry", - "crates/aptos-telemetry-service", - "crates/aptos-temppath", - "crates/aptos-time-service", - "crates/aptos-warp-webserver", - "crates/bounded-executor", - "crates/channel", - "crates/crash-handler", - "crates/fallible", - "crates/indexer", - "crates/jwk-utils", - "crates/node-resource-metrics", - "crates/num-variants", - "crates/proxy", - "crates/reliable-broadcast", - "crates/short-hex-str", - "crates/transaction-emitter", - "crates/transaction-emitter-lib", - "crates/transaction-generator-lib", - "crates/validator-transaction-pool", - "devtools/aptos-cargo-cli", - "dkg", - "ecosystem/indexer-grpc/indexer-grpc-cache-worker", - "ecosystem/indexer-grpc/indexer-grpc-data-service", - "ecosystem/indexer-grpc/indexer-grpc-file-store", - "ecosystem/indexer-grpc/indexer-grpc-fullnode", - "ecosystem/indexer-grpc/indexer-grpc-in-memory-cache-benchmark", - "ecosystem/indexer-grpc/indexer-grpc-integration-tests", - "ecosystem/indexer-grpc/indexer-grpc-server-framework", - "ecosystem/indexer-grpc/indexer-grpc-table-info", - "ecosystem/indexer-grpc/indexer-grpc-utils", - "ecosystem/indexer-grpc/transaction-filter", - "ecosystem/node-checker", - "ecosystem/node-checker/fn-check-client", - "execution/block-partitioner", - "execution/executor", - "execution/executor-benchmark", - "execution/executor-service", - "execution/executor-test-helpers", - "execution/executor-types", - "experimental/execution/ptx-executor", - "experimental/runtimes", - "experimental/storage/layered-map", - "keyless/circuit", - "keyless/common", - "keyless/pepper/common", - "keyless/pepper/example-client-rust", - "keyless/pepper/service", - "mempool", - "network/benchmark", - "network/builder", - "network/discovery", - "network/framework", - "network/memsocket", - "network/netcore", - "peer-monitoring-service/client", - "peer-monitoring-service/server", - "peer-monitoring-service/types", - "protos/rust", - "sdk", - "secure/net", - "secure/storage", - "secure/storage/vault", - "state-sync/aptos-data-client", - "state-sync/data-streaming-service", - "state-sync/inter-component/consensus-notifications", - "state-sync/inter-component/event-notifications", - "state-sync/inter-component/mempool-notifications", - "state-sync/inter-component/storage-service-notifications", - "state-sync/state-sync-driver", - "state-sync/storage-service/client", - "state-sync/storage-service/server", - "state-sync/storage-service/types", - "storage/accumulator", - "storage/aptosdb", - "storage/backup/backup-cli", - "storage/backup/backup-service", - "storage/db-tool", - "storage/executable-store", - "storage/indexer", - "storage/indexer_schemas", - "storage/jellyfish-merkle", - "storage/rocksdb-options", - "storage/schemadb", - "storage/scratchpad", - "storage/storage-interface", - "testsuite/dos/http_test", - "testsuite/dos/listener", - "testsuite/dos/sender", - "testsuite/forge", - "testsuite/forge-cli", - "testsuite/fuzzer", - "testsuite/fuzzer/fuzz", - "testsuite/module-publish", - "testsuite/smoke-test", - "testsuite/testcases", - "third_party/move/evm/exec-utils", - "third_party/move/evm/extract-ethereum-abi", - # third_party/move - "third_party/move/extensions/async/move-async-vm", - "third_party/move/extensions/move-table-extension", - "third_party/move/move-binary-format", - "third_party/move/move-binary-format/serializer-tests", - "third_party/move/move-borrow-graph", - "third_party/move/move-bytecode-spec", - "third_party/move/move-bytecode-verifier", - "third_party/move/move-bytecode-verifier/bytecode-verifier-tests", - "third_party/move/move-bytecode-verifier/fuzz", - "third_party/move/move-bytecode-verifier/invalid-mutations", - "third_party/move/move-bytecode-verifier/transactional-tests", - "third_party/move/move-command-line-common", - "third_party/move/move-compiler", - "third_party/move/move-compiler-v2", - "third_party/move/move-compiler-v2/tools/testdiff", - "third_party/move/move-compiler-v2/transactional-tests", - "third_party/move/move-compiler/transactional-tests", - "third_party/move/move-core/types", - "third_party/move/move-examples", - "third_party/move/move-ir-compiler", - "third_party/move/move-ir-compiler/move-bytecode-source-map", - "third_party/move/move-ir-compiler/move-ir-to-bytecode", - "third_party/move/move-ir-compiler/move-ir-to-bytecode/syntax", - "third_party/move/move-ir-compiler/transactional-tests", - "third_party/move/move-ir/types", - "third_party/move/move-model", - "third_party/move/move-model/bytecode", - "third_party/move/move-model/bytecode-test-utils", - "third_party/move/move-prover", - "third_party/move/move-prover/boogie-backend", - "third_party/move/move-prover/bytecode-pipeline", - "third_party/move/move-prover/lab", - "third_party/move/move-prover/move-abigen", - "third_party/move/move-prover/move-docgen", - "third_party/move/move-prover/move-errmapgen", - "third_party/move/move-prover/test-utils", - "third_party/move/move-symbol-pool", - "third_party/move/move-vm/integration-tests", - "third_party/move/move-vm/paranoid-tests", - "third_party/move/move-vm/runtime", - "third_party/move/move-vm/test-utils", - "third_party/move/move-vm/transactional-tests", - "third_party/move/move-vm/types", - "third_party/move/testing-infra/module-generation", - "third_party/move/testing-infra/test-generation", - "third_party/move/testing-infra/transactional-test-runner", - "third_party/move/tools/move-bytecode-utils", - "third_party/move/tools/move-bytecode-viewer", - "third_party/move/tools/move-cli", - "third_party/move/tools/move-coverage", - "third_party/move/tools/move-disassembler", - "third_party/move/tools/move-explain", - "third_party/move/tools/move-package", - "third_party/move/tools/move-resource-viewer", - "third_party/move/tools/move-unit-test", - "tools/calc-dep-sizes", - "types", - "vm-validator", + "api", + "api/openapi-spec-generator", + "api/test-context", + "api/types", + "aptos-move/aptos-abstract-gas-usage", + "aptos-move/aptos-aggregator", + "aptos-move/aptos-gas-algebra", + "aptos-move/aptos-gas-meter", + "aptos-move/aptos-gas-profiling", + "aptos-move/aptos-gas-schedule", + "aptos-move/aptos-gas-schedule-updator", + "aptos-move/aptos-memory-usage-tracker", + "aptos-move/aptos-native-interface", + "aptos-move/aptos-release-builder", + "aptos-move/aptos-resource-viewer", + "aptos-move/aptos-sdk-builder", + "aptos-move/aptos-transaction-benchmarks", + "aptos-move/aptos-transactional-test-harness", + "aptos-move/aptos-validator-interface", + "aptos-move/aptos-vm", + "aptos-move/aptos-vm-logging", + "aptos-move/aptos-vm-profiling", + "aptos-move/aptos-vm-types", + "aptos-move/block-executor", + "aptos-move/e2e-benchmark", + "aptos-move/e2e-move-tests", + "aptos-move/e2e-tests", + "aptos-move/e2e-testsuite", + "aptos-move/framework", + "aptos-move/framework/cached-packages", + "aptos-move/framework/table-natives", + "aptos-move/move-examples", + "aptos-move/mvhashmap", + "aptos-move/package-builder", + "aptos-move/vm-genesis", + "aptos-move/writeset-transaction-generator", + "aptos-node", + "aptos-utils", + "config", + "config/global-constants", + "consensus", + "consensus/consensus-types", + "consensus/safety-rules", + "crates/aptos", + "crates/aptos-admin-service", + "crates/aptos-api-tester", + "crates/aptos-bcs-utils", + "crates/aptos-bitvec", + "crates/aptos-build-info", + "crates/aptos-collections", + "crates/aptos-compression", + "crates/aptos-crypto", + "crates/aptos-crypto-derive", + "crates/aptos-debugger", + "crates/aptos-dkg", + "crates/aptos-drop-helper", + "crates/aptos-enum-conversion-derive", + "crates/aptos-faucet/cli", + "crates/aptos-faucet/core", + "crates/aptos-faucet/metrics-server", + "crates/aptos-faucet/service", + "crates/aptos-genesis", + "crates/aptos-github-client", + "crates/aptos-id-generator", + "crates/aptos-infallible", + "crates/aptos-inspection-service", + "crates/aptos-jwk-consensus", + "crates/aptos-keygen", + "crates/aptos-ledger", + "crates/aptos-log-derive", + "crates/aptos-logger", + "crates/aptos-metrics-core", + "aptos-move/aptos-debugger", + "crates/aptos-network-checker", + "crates/aptos-node-identity", + "crates/aptos-openapi", + "crates/aptos-profiler", + "crates/aptos-proptest-helpers", + "crates/aptos-push-metrics", + "crates/aptos-rate-limiter", + "crates/aptos-rest-client", + "crates/aptos-retrier", + "crates/aptos-rosetta", + "crates/aptos-rosetta-cli", + "crates/aptos-runtimes", + "crates/aptos-speculative-state-helper", + "crates/aptos-system-utils", + "crates/aptos-telemetry", + "crates/aptos-telemetry-service", + "crates/aptos-temppath", + "crates/aptos-time-service", + "crates/aptos-warp-webserver", + "crates/bounded-executor", + "crates/channel", + "crates/crash-handler", + "crates/fallible", + "crates/indexer", + "crates/jwk-utils", + "crates/node-resource-metrics", + "crates/num-variants", + "crates/proxy", + "crates/reliable-broadcast", + "crates/short-hex-str", + "crates/transaction-emitter", + "crates/transaction-emitter-lib", + "crates/transaction-generator-lib", + "crates/validator-transaction-pool", + "devtools/aptos-cargo-cli", + "dkg", + "ecosystem/indexer-grpc/indexer-grpc-cache-worker", + "ecosystem/indexer-grpc/indexer-grpc-data-service", + "ecosystem/indexer-grpc/indexer-grpc-file-store", + "ecosystem/indexer-grpc/indexer-grpc-fullnode", + "ecosystem/indexer-grpc/indexer-grpc-in-memory-cache-benchmark", + "ecosystem/indexer-grpc/indexer-grpc-integration-tests", + "ecosystem/indexer-grpc/indexer-grpc-server-framework", + "ecosystem/indexer-grpc/indexer-grpc-table-info", + "ecosystem/indexer-grpc/indexer-grpc-utils", + "ecosystem/indexer-grpc/transaction-filter", + "ecosystem/node-checker", + "ecosystem/node-checker/fn-check-client", + "execution/block-partitioner", + "execution/executor", + "execution/executor-benchmark", + "execution/executor-service", + "execution/executor-test-helpers", + "execution/executor-types", + "experimental/execution/ptx-executor", + "experimental/runtimes", + "experimental/storage/layered-map", + "keyless/circuit", + "keyless/common", + "keyless/pepper/common", + "keyless/pepper/example-client-rust", + "keyless/pepper/service", + "mempool", + "network/benchmark", + "network/builder", + "network/discovery", + "network/framework", + "network/memsocket", + "network/netcore", + "peer-monitoring-service/client", + "peer-monitoring-service/server", + "peer-monitoring-service/types", + "protos/rust", + "sdk", + "secure/net", + "secure/storage", + "secure/storage/vault", + "state-sync/aptos-data-client", + "state-sync/data-streaming-service", + "state-sync/inter-component/consensus-notifications", + "state-sync/inter-component/event-notifications", + "state-sync/inter-component/mempool-notifications", + "state-sync/inter-component/storage-service-notifications", + "state-sync/state-sync-driver", + "state-sync/storage-service/client", + "state-sync/storage-service/server", + "state-sync/storage-service/types", + "storage/accumulator", + "storage/aptosdb", + "storage/backup/backup-cli", + "storage/backup/backup-service", + "storage/db-tool", + "storage/executable-store", + "storage/indexer", + "storage/indexer_schemas", + "storage/jellyfish-merkle", + "storage/rocksdb-options", + "storage/schemadb", + "storage/scratchpad", + "storage/storage-interface", + "testsuite/dos/http_test", + "testsuite/dos/listener", + "testsuite/dos/sender", + "testsuite/forge", + "testsuite/forge-cli", + "testsuite/fuzzer", + "testsuite/fuzzer/fuzz", + "testsuite/module-publish", + "testsuite/smoke-test", + "testsuite/testcases", + "third_party/move/evm/exec-utils", + "third_party/move/evm/extract-ethereum-abi", + # third_party/move + "third_party/move/extensions/async/move-async-vm", + "third_party/move/extensions/move-table-extension", + "third_party/move/move-binary-format", + "third_party/move/move-binary-format/serializer-tests", + "third_party/move/move-borrow-graph", + "third_party/move/move-bytecode-spec", + "third_party/move/move-bytecode-verifier", + "third_party/move/move-bytecode-verifier/bytecode-verifier-tests", + "third_party/move/move-bytecode-verifier/fuzz", + "third_party/move/move-bytecode-verifier/invalid-mutations", + "third_party/move/move-bytecode-verifier/transactional-tests", + "third_party/move/move-command-line-common", + "third_party/move/move-compiler", + "third_party/move/move-compiler-v2", + "third_party/move/move-compiler-v2/tools/testdiff", + "third_party/move/move-compiler-v2/transactional-tests", + "third_party/move/move-compiler/transactional-tests", + "third_party/move/move-core/types", + "third_party/move/move-examples", + "third_party/move/move-ir-compiler", + "third_party/move/move-ir-compiler/move-bytecode-source-map", + "third_party/move/move-ir-compiler/move-ir-to-bytecode", + "third_party/move/move-ir-compiler/move-ir-to-bytecode/syntax", + "third_party/move/move-ir-compiler/transactional-tests", + "third_party/move/move-ir/types", + "third_party/move/move-model", + "third_party/move/move-model/bytecode", + "third_party/move/move-model/bytecode-test-utils", + "third_party/move/move-prover", + "third_party/move/move-prover/boogie-backend", + "third_party/move/move-prover/bytecode-pipeline", + "third_party/move/move-prover/lab", + "third_party/move/move-prover/move-abigen", + "third_party/move/move-prover/move-docgen", + "third_party/move/move-prover/move-errmapgen", + "third_party/move/move-prover/test-utils", + "third_party/move/move-symbol-pool", + "third_party/move/move-vm/integration-tests", + "third_party/move/move-vm/paranoid-tests", + "third_party/move/move-vm/runtime", + "third_party/move/move-vm/test-utils", + "third_party/move/move-vm/transactional-tests", + "third_party/move/move-vm/types", + "third_party/move/testing-infra/module-generation", + "third_party/move/testing-infra/test-generation", + "third_party/move/testing-infra/transactional-test-runner", + "third_party/move/tools/move-bytecode-utils", + "third_party/move/tools/move-bytecode-viewer", + "third_party/move/tools/move-cli", + "third_party/move/tools/move-coverage", + "third_party/move/tools/move-disassembler", + "third_party/move/tools/move-explain", + "third_party/move/tools/move-package", + "third_party/move/tools/move-resource-viewer", + "third_party/move/tools/move-unit-test", + "tools/calc-dep-sizes", + "types", + "vm-validator", ] # NOTE: default-members is the complete list of binaries that form the "production Aptos codebase". These members should @@ -254,14 +254,14 @@ members = [ # # For more, see the "Conditional compilation for tests" section in documentation/coding_guidelines.md. default-members = [ - "consensus/safety-rules", - "crates/aptos-faucet/service", - "crates/aptos-keygen", - "crates/aptos-rate-limiter", - "crates/transaction-emitter", - "aptos-move/framework", - "storage/backup/backup-cli", - "ecosystem/node-checker", + "consensus/safety-rules", + "crates/aptos-faucet/service", + "crates/aptos-keygen", + "crates/aptos-rate-limiter", + "crates/transaction-emitter", + "aptos-move/framework", + "storage/backup/backup-cli", + "ecosystem/node-checker", ] # All workspace members should inherit these keys @@ -427,7 +427,7 @@ aptos-telemetry-service = { path = "crates/aptos-telemetry-service" } aptos-temppath = { path = "crates/aptos-temppath" } aptos-testcases = { path = "testsuite/testcases" } aptos-time-service = { path = "crates/aptos-time-service", features = [ - "async", + "async", ] } aptos-transaction-emitter-lib = { path = "crates/transaction-emitter-lib" } aptos-transaction-generator-lib = { path = "crates/transaction-generator-lib" } @@ -445,6 +445,7 @@ aptos-vm-validator = { path = "vm-validator" } aptos-warp-webserver = { path = "crates/aptos-warp-webserver" } aptos-writeset-generator = { path = "aptos-move/writeset-transaction-generator" } aptos-cargo-cli = { path = "devtools/aptos-cargo-cli" } +e2e-move-tests = { path = "aptos-move/e2e-move-tests" } # External crate dependencies. # Please do not add any test features here: they should be declared by the individual crate. @@ -534,10 +535,10 @@ determinator = "0.12.0" derive_more = "0.99.11" diesel = "2.2.3" diesel-async = { version = "0.5", features = [ - "async-connection-wrapper", - "postgres", - "bb8", - "tokio", + "async-connection-wrapper", + "postgres", + "bb8", + "tokio", ] } diesel_migrations = { version = "2.2", features = ["postgres"] } difference = "2.0.0" @@ -600,8 +601,8 @@ internment = { version = "0.5.0", features = ["arc"] } ipnet = "2.5.0" itertools = "0.12" jemallocator = { version = "0.5.0", features = [ - "profiling", - "unprefixed_malloc_on_supported_platforms", + "profiling", + "unprefixed_malloc_on_supported_platforms", ] } jemalloc-sys = "0.5.4" json-patch = "0.2.6" @@ -679,18 +680,18 @@ rand_core = "0.5.1" random_word = "0.3.0" rayon = "1.5.2" redis = { version = "0.22.3", features = [ - "tokio-comp", - "script", - "connection-manager", + "tokio-comp", + "script", + "connection-manager", ] } redis-test = { version = "0.1.1", features = ["aio"] } ref-cast = "1.0.6" regex = "1.9.3" reqwest = { version = "0.11.11", features = [ - "blocking", - "cookies", - "json", - "stream", + "blocking", + "cookies", + "json", + "stream", ] } reqwest-middleware = "0.2.0" reqwest-retry = "0.2.1" @@ -714,8 +715,8 @@ serde = { version = "1.0.193", features = ["derive", "rc"] } serde-big-array = "0.5.1" serde_bytes = "0.11.6" serde_json = { version = "1.0.81", features = [ - "preserve_order", - "arbitrary_precision", + "preserve_order", + "arbitrary_precision", ] } # Note: arbitrary_precision is required to parse u256 in JSON serde_repr = "0.1" serde_merge = "0.1.3" @@ -761,12 +762,12 @@ tokio-test = "0.4.1" tokio-util = { version = "0.7.2", features = ["compat", "codec"] } toml = "0.8" tonic = { version = "0.11.0", features = [ - "tls-roots", - "transport", - "prost", - "gzip", - "codegen", - "zstd", + "tls-roots", + "transport", + "prost", + "gzip", + "codegen", + "zstd", ] } tonic-reflection = "0.11.0" triomphe = "0.1.9" @@ -775,8 +776,8 @@ typed-arena = "2.0.2" typenum = "1.17.0" uint = "0.9.4" ureq = { version = "1.5.4", features = [ - "json", - "native-tls", + "json", + "native-tls", ], default_features = false } url = { version = "2.4.0", features = ["serde"] } uuid = { version = "1.0.0", features = ["v4", "serde"] } @@ -822,11 +823,11 @@ move-symbol-pool = { path = "third_party/move/move-symbol-pool" } move-table-extension = { path = "third_party/move/extensions/move-table-extension" } move-transactional-test-runner = { path = "third_party/move/testing-infra/transactional-test-runner" } move-unit-test = { path = "third_party/move/tools/move-unit-test", features = [ - "table-extension", + "table-extension", ] } move-vm-runtime = { path = "third_party/move/move-vm/runtime" } move-vm-test-utils = { path = "third_party/move/move-vm/test-utils", features = [ - "table-extension", + "table-extension", ] } move-vm-types = { path = "third_party/move/move-vm/types" } diff --git a/aptos-move/e2e-move-tests/src/aptos_governance.rs b/aptos-move/e2e-move-tests/src/aptos_governance.rs index a9f491cde4536..5e791e9178b03 100644 --- a/aptos-move/e2e-move-tests/src/aptos_governance.rs +++ b/aptos-move/e2e-move-tests/src/aptos_governance.rs @@ -67,6 +67,19 @@ pub fn partial_vote( ) } +pub fn vote( + harness: &mut MoveHarness, + account: &Account, + stake_pool: AccountAddress, + proposal_id: u64, + should_pass: bool, +) -> TransactionStatus { + harness.run_transaction_payload( + account, + aptos_stdlib::aptos_governance_vote(stake_pool, proposal_id, should_pass), + ) +} + pub fn get_remaining_voting_power( harness: &mut MoveHarness, stake_pool: AccountAddress, @@ -74,10 +87,14 @@ pub fn get_remaining_voting_power( ) -> u64 { let fun = MemberId::from_str("0x1::aptos_governance::get_remaining_voting_power").unwrap(); let res = harness - .execute_view_function(fun, vec![], vec![ - bcs::to_bytes(&stake_pool).unwrap(), - bcs::to_bytes(&proposal_id).unwrap(), - ]) + .execute_view_function( + fun, + vec![], + vec![ + bcs::to_bytes(&stake_pool).unwrap(), + bcs::to_bytes(&proposal_id).unwrap(), + ], + ) .values .unwrap(); bcs::from_bytes::(&res[0]).unwrap() diff --git a/aptos-move/e2e-move-tests/src/lib.rs b/aptos-move/e2e-move-tests/src/lib.rs index b545f14251980..d1b6f56602d84 100644 --- a/aptos-move/e2e-move-tests/src/lib.rs +++ b/aptos-move/e2e-move-tests/src/lib.rs @@ -42,10 +42,7 @@ impl PackageHooks for AptosPackageHooks { } } -pub(crate) fn build_package( - package_path: PathBuf, - options: BuildOptions, -) -> anyhow::Result { +pub fn build_package(package_path: PathBuf, options: BuildOptions) -> anyhow::Result { let mut options = options; if get_move_compiler_v2_from_env() { options.compiler_version = Some(CompilerVersion::V2_0); diff --git a/aptos-move/e2e-move-tests/src/tests/mod.rs b/aptos-move/e2e-move-tests/src/tests/mod.rs index 91783db3605f8..5c2deb91e1f88 100644 --- a/aptos-move/e2e-move-tests/src/tests/mod.rs +++ b/aptos-move/e2e-move-tests/src/tests/mod.rs @@ -10,7 +10,7 @@ mod aggregator_v2_runtime_checks; mod attributes; mod chain_id; mod code_publishing; -mod common; +pub mod common; mod constructor_args; mod dependencies; mod error_map; diff --git a/aptos-move/framework/aptos-framework/doc/atomic_bridge.md b/aptos-move/framework/aptos-framework/doc/atomic_bridge.md index 2c36f8755ac1a..0ae26c38c1584 100644 --- a/aptos-move/framework/aptos-framework/doc/atomic_bridge.md +++ b/aptos-move/framework/aptos-framework/doc/atomic_bridge.md @@ -1,183 +1,36 @@ - + -# Module `0x1::atomic_bridge_store` +# Module `0x1::atomic_bridge` -- [Struct `AddressPair`](#0x1_atomic_bridge_store_AddressPair) -- [Resource `SmartTableWrapper`](#0x1_atomic_bridge_store_SmartTableWrapper) -- [Struct `BridgeTransferDetails`](#0x1_atomic_bridge_store_BridgeTransferDetails) -- [Resource `Nonce`](#0x1_atomic_bridge_store_Nonce) +- [Resource `AptosCoinBurnCapability`](#0x1_atomic_bridge_AptosCoinBurnCapability) +- [Resource `AptosCoinMintCapability`](#0x1_atomic_bridge_AptosCoinMintCapability) +- [Resource `AptosFABurnCapabilities`](#0x1_atomic_bridge_AptosFABurnCapabilities) +- [Resource `AptosFAMintCapabilities`](#0x1_atomic_bridge_AptosFAMintCapabilities) - [Constants](#@Constants_0) -- [Function `initialize`](#0x1_atomic_bridge_store_initialize) -- [Function `now`](#0x1_atomic_bridge_store_now) -- [Function `create_time_lock`](#0x1_atomic_bridge_store_create_time_lock) -- [Function `create_details`](#0x1_atomic_bridge_store_create_details) -- [Function `add`](#0x1_atomic_bridge_store_add) -- [Function `assert_min_time_lock`](#0x1_atomic_bridge_store_assert_min_time_lock) -- [Function `assert_pending`](#0x1_atomic_bridge_store_assert_pending) -- [Function `assert_valid_hash_lock`](#0x1_atomic_bridge_store_assert_valid_hash_lock) -- [Function `assert_valid_bridge_transfer_id`](#0x1_atomic_bridge_store_assert_valid_bridge_transfer_id) -- [Function `create_hashlock`](#0x1_atomic_bridge_store_create_hashlock) -- [Function `assert_correct_hash_lock`](#0x1_atomic_bridge_store_assert_correct_hash_lock) -- [Function `assert_timed_out_lock`](#0x1_atomic_bridge_store_assert_timed_out_lock) -- [Function `assert_within_timelock`](#0x1_atomic_bridge_store_assert_within_timelock) -- [Function `complete`](#0x1_atomic_bridge_store_complete) -- [Function `cancel`](#0x1_atomic_bridge_store_cancel) -- [Function `complete_details`](#0x1_atomic_bridge_store_complete_details) -- [Function `complete_transfer`](#0x1_atomic_bridge_store_complete_transfer) -- [Function `cancel_details`](#0x1_atomic_bridge_store_cancel_details) -- [Function `cancel_transfer`](#0x1_atomic_bridge_store_cancel_transfer) -- [Function `bridge_transfer_id`](#0x1_atomic_bridge_store_bridge_transfer_id) -- [Function `get_bridge_transfer_details_initiator`](#0x1_atomic_bridge_store_get_bridge_transfer_details_initiator) -- [Function `get_bridge_transfer_details_counterparty`](#0x1_atomic_bridge_store_get_bridge_transfer_details_counterparty) -- [Function `get_bridge_transfer_details`](#0x1_atomic_bridge_store_get_bridge_transfer_details) -- [Specification](#@Specification_1) - - [Function `initialize`](#@Specification_1_initialize) - - [Function `create_time_lock`](#@Specification_1_create_time_lock) - - [Function `create_details`](#@Specification_1_create_details) - - [Function `add`](#@Specification_1_add) - - [Function `create_hashlock`](#@Specification_1_create_hashlock) - - [Function `complete`](#@Specification_1_complete) - - [Function `cancel`](#@Specification_1_cancel) - - [Function `complete_details`](#@Specification_1_complete_details) - - [Function `complete_transfer`](#@Specification_1_complete_transfer) - - [Function `cancel_details`](#@Specification_1_cancel_details) - - -
use 0x1::aptos_hash;
-use 0x1::bcs;
-use 0x1::ethereum;
-use 0x1::features;
-use 0x1::smart_table;
-use 0x1::system_addresses;
-use 0x1::timestamp;
-use 0x1::vector;
-
- - - - - -## Struct `AddressPair` - - - -
struct AddressPair<Initiator: store, Recipient: store> has copy, store
-
- - - -
-Fields - - -
-
-initiator: Initiator -
-
- -
-
-recipient: Recipient -
-
- -
-
- - -
- - - -## Resource `SmartTableWrapper` - -A smart table wrapper - - -
struct SmartTableWrapper<K, V> has store, key
-
- - - -
-Fields - - -
-
-inner: smart_table::SmartTable<K, V> -
-
- -
-
- - -
- - - -## Struct `BridgeTransferDetails` - -Details on the transfer +- [Function `initialize`](#0x1_atomic_bridge_initialize) +- [Function `store_aptos_coin_burn_cap`](#0x1_atomic_bridge_store_aptos_coin_burn_cap) +- [Function `store_aptos_coin_mint_cap`](#0x1_atomic_bridge_store_aptos_coin_mint_cap) +- [Function `mint`](#0x1_atomic_bridge_mint) +- [Function `burn`](#0x1_atomic_bridge_burn) -
struct BridgeTransferDetails<Initiator: store, Recipient: store> has copy, store
+
use 0x1::aptos_coin;
+use 0x1::coin;
+use 0x1::fungible_asset;
 
-
-Fields - - -
-
-addresses: atomic_bridge_store::AddressPair<Initiator, Recipient> -
-
- -
-
-amount: u64 -
-
- -
-
-hash_lock: vector<u8> -
-
- -
-
-time_lock: u64 -
-
- -
-
-state: u8 -
-
- -
-
- - -
- - + -## Resource `Nonce` +## Resource `AptosCoinBurnCapability` -
struct Nonce has key
+
struct AptosCoinBurnCapability has key
 
@@ -188,7 +41,7 @@ Details on the transfer
-inner: u64 +burn_cap: coin::BurnCapability<aptos_coin::AptosCoin>
@@ -198,413 +51,120 @@ Details on the transfer - - -## Constants - - - - - - -
const MAX_U64: u64 = 18446744073709551615;
-
- - - - - - - -
const EATOMIC_BRIDGE_NOT_ENABLED: u64 = 9;
-
- - - - - - - -
const CANCELLED_TRANSACTION: u8 = 3;
-
- - - - - - - -
const COMPLETED_TRANSACTION: u8 = 2;
-
- - - - - - - -
const EEXPIRED: u64 = 3;
-
- - - - - - - -
const EINVALID_BRIDGE_TRANSFER_ID: u64 = 8;
-
- - - - - - - -
const EINVALID_HASH_LOCK: u64 = 5;
-
- - - - - -Error codes - - -
const EINVALID_PRE_IMAGE: u64 = 1;
-
- - - - - - - -
const EINVALID_TIME_LOCK: u64 = 6;
-
- - - - - - - -
const ENOT_EXPIRED: u64 = 4;
-
- - - - - - - -
const ENOT_PENDING_TRANSACTION: u64 = 2;
-
- - - - - - - -
const EZERO_AMOUNT: u64 = 7;
-
- - - - - -Minimum time lock of 1 second - - -
const MIN_TIME_LOCK: u64 = 1;
-
- - - - - -Transaction states - - -
const PENDING_TRANSACTION: u8 = 1;
-
- - - - - -## Function `initialize` - -Initializes the initiators and counterparties tables and nonce. - -@param aptos_framework The signer for Aptos framework. - - -
public fun initialize(aptos_framework: &signer)
-
- - - -
-Implementation - - -
public fun initialize(aptos_framework: &signer) {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    move_to(aptos_framework, Nonce {
-        inner: 0,
-    });
-
-    let initiators = SmartTableWrapper<vector<u8>, BridgeTransferDetails<address, EthereumAddress>> {
-        inner: smart_table::new(),
-    };
-
-    move_to(aptos_framework, initiators);
-
-    let counterparties = SmartTableWrapper<vector<u8>, BridgeTransferDetails<EthereumAddress, address>> {
-        inner: smart_table::new(),
-    };
-
-    move_to(aptos_framework, counterparties);
-}
-
- - - -
- - - -## Function `now` - -Returns the current time in seconds. - -@return Current timestamp in seconds. - - -
fun now(): u64
-
- - - -
-Implementation - - -
fun now() : u64 {
-    timestamp::now_seconds()
-}
-
- - - -
- - - -## Function `create_time_lock` - -Creates a time lock by adding a duration to the current time. - -@param lock The duration to lock. -@return The calculated time lock. -@abort If lock is not above MIN_TIME_LOCK - - -
public(friend) fun create_time_lock(time_lock: u64): u64
-
- - - -
-Implementation - - -
public(friend) fun create_time_lock(time_lock: u64) : u64 {
-    assert_min_time_lock(time_lock);
-    now() + time_lock
-}
-
- - - -
- - - -## Function `create_details` - -Creates bridge transfer details with validation. - -@param initiator The initiating party of the transfer. -@param recipient The receiving party of the transfer. -@param amount The amount to be transferred. -@param hash_lock The hash lock for the transfer. -@param time_lock The time lock for the transfer. -@return A BridgeTransferDetails object. -@abort If the amount is zero or locks are invalid. - - -
public(friend) fun create_details<Initiator: store, Recipient: store>(initiator: Initiator, recipient: Recipient, amount: u64, hash_lock: vector<u8>, time_lock: u64): atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>
-
- - - -
-Implementation - - -
public(friend) fun create_details<Initiator: store, Recipient: store>(initiator: Initiator, recipient: Recipient, amount: u64, hash_lock: vector<u8>, time_lock: u64)
-    : BridgeTransferDetails<Initiator, Recipient> {
-    assert!(amount > 0, EZERO_AMOUNT);
-    assert_valid_hash_lock(&hash_lock);
-    time_lock = create_time_lock(time_lock);
-
-    BridgeTransferDetails {
-        addresses: AddressPair {
-            initiator,
-            recipient
-        },
-        amount,
-        hash_lock,
-        time_lock,
-        state: PENDING_TRANSACTION,
-    }
-}
-
- - - -
- - - -## Function `add` + -Record details of a transfer +## Resource `AptosCoinMintCapability` -@param bridge_transfer_id Bridge transfer ID. -@param details The bridge transfer details -
public(friend) fun add<Initiator: store, Recipient: store>(bridge_transfer_id: vector<u8>, details: atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
struct AptosCoinMintCapability has key
 
-Implementation - +Fields -
public(friend) fun add<Initiator: store, Recipient: store>(bridge_transfer_id: vector<u8>, details: BridgeTransferDetails<Initiator, Recipient>) acquires SmartTableWrapper {
-    assert!(features::abort_atomic_bridge_enabled(), EATOMIC_BRIDGE_NOT_ENABLED);
 
-    assert_valid_bridge_transfer_id(&bridge_transfer_id);
-    let table = borrow_global_mut<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework);
-    smart_table::add(&mut table.inner, bridge_transfer_id, details);
-}
-
+
+
+mint_cap: coin::MintCapability<aptos_coin::AptosCoin> +
+
+
+
- - -## Function `assert_min_time_lock` + -Asserts that the time lock is valid. +## Resource `AptosFABurnCapabilities` -@param time_lock -@abort If the time lock is invalid. -
fun assert_min_time_lock(time_lock: u64)
+
struct AptosFABurnCapabilities has key
 
-Implementation +Fields -
fun assert_min_time_lock(time_lock: u64) {
-    assert!(time_lock >= MIN_TIME_LOCK, EINVALID_TIME_LOCK);
-}
-
+
+
+burn_ref: fungible_asset::BurnRef +
+
+
+
- - -## Function `assert_pending` + -Asserts that the details state is pending. +## Resource `AptosFAMintCapabilities` -@param details The bridge transfer details to check. -@abort If the state is not pending. -
fun assert_pending<Initiator: store, Recipient: store>(details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
struct AptosFAMintCapabilities has key
 
-Implementation +Fields -
fun assert_pending<Initiator: store, Recipient: store>(details: &BridgeTransferDetails<Initiator, Recipient>) {
-    assert!(details.state == PENDING_TRANSACTION, ENOT_PENDING_TRANSACTION)
-}
-
+
+
+burn_ref: fungible_asset::MintRef +
+
+
+
- + -## Function `assert_valid_hash_lock` +## Constants -Asserts that the hash lock is valid. -@param hash_lock The hash lock to validate. -@abort If the hash lock is invalid. + -
fun assert_valid_hash_lock(hash_lock: &vector<u8>)
+
+
const EATOMIC_BRIDGE_NOT_ENABLED: u64 = 1;
 
-
-Implementation + -
fun assert_valid_hash_lock(hash_lock: &vector<u8>) {
-    assert!(vector::length(hash_lock) == 32, EINVALID_HASH_LOCK);
-}
-
+
const EATOMIC_BRIDGE_DISABLED: u64 = 198461;
+
-
- + -## Function `assert_valid_bridge_transfer_id` +## Function `initialize` -Asserts that the bridge transfer ID is valid. +Initializes the atomic bridge by setting up necessary configurations. -@param bridge_transfer_id The bridge transfer ID to validate. -@abort If the ID is invalid. +@param aptos_framework The signer representing the Aptos framework. -
public(friend) fun assert_valid_bridge_transfer_id(bridge_transfer_id: &vector<u8>)
+
public fun initialize(_aptos_framework: &signer)
 
@@ -613,8 +173,8 @@ Asserts that the bridge transfer ID is valid. Implementation -
public(friend) fun assert_valid_bridge_transfer_id(bridge_transfer_id: &vector<u8>) {
-    assert!(vector::length(bridge_transfer_id) == 32, EINVALID_BRIDGE_TRANSFER_ID);
+
public fun initialize(_aptos_framework: &signer) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -622,17 +182,17 @@ Asserts that the bridge transfer ID is valid. - + -## Function `create_hashlock` +## Function `store_aptos_coin_burn_cap` -Creates a hash lock from a pre-image. +Stores the burn capability for AptosCoin, converting to a fungible asset reference if the feature is enabled. -@param pre_image The pre-image to hash. -@return The generated hash lock. +@param aptos_framework The signer representing the Aptos framework. +@param burn_cap The burn capability for AptosCoin. -
public(friend) fun create_hashlock(pre_image: vector<u8>): vector<u8>
+
public fun store_aptos_coin_burn_cap(_aptos_framework: &signer, _burn_cap: coin::BurnCapability<aptos_coin::AptosCoin>)
 
@@ -641,9 +201,8 @@ Creates a hash lock from a pre-image. Implementation -
public(friend) fun create_hashlock(pre_image: vector<u8>) : vector<u8> {
-    assert!(vector::length(&pre_image) > 0, EINVALID_PRE_IMAGE);
-    keccak256(pre_image)
+
public fun store_aptos_coin_burn_cap(_aptos_framework: &signer, _burn_cap: BurnCapability<AptosCoin>) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -651,18 +210,17 @@ Creates a hash lock from a pre-image. - + -## Function `assert_correct_hash_lock` +## Function `store_aptos_coin_mint_cap` -Asserts that the hash lock matches the expected value. +Stores the mint capability for AptosCoin. -@param details The bridge transfer details. -@param hash_lock The hash lock to compare. -@abort If the hash lock is incorrect. +@param aptos_framework The signer representing the Aptos framework. +@param mint_cap The mint capability for AptosCoin. -
fun assert_correct_hash_lock<Initiator: store, Recipient: store>(details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>, hash_lock: vector<u8>)
+
public fun store_aptos_coin_mint_cap(_aptos_framework: &signer, _mint_cap: coin::MintCapability<aptos_coin::AptosCoin>)
 
@@ -671,8 +229,8 @@ Asserts that the hash lock matches the expected value. Implementation -
fun assert_correct_hash_lock<Initiator: store, Recipient: store>(details: &BridgeTransferDetails<Initiator, Recipient>, hash_lock: vector<u8>) {
-    assert!(&hash_lock == &details.hash_lock, EINVALID_PRE_IMAGE);
+
public fun store_aptos_coin_mint_cap(_aptos_framework: &signer, _mint_cap: MintCapability<AptosCoin>) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -680,17 +238,18 @@ Asserts that the hash lock matches the expected value. - + -## Function `assert_timed_out_lock` +## Function `mint` -Asserts that the time lock has expired. +Mints a specified amount of AptosCoin to a recipient's address. -@param details The bridge transfer details. -@abort If the time lock has not expired. +@param recipient The address of the recipient to mint coins to. +@param amount The amount of AptosCoin to mint. +@abort If the mint capability is not available. -
fun assert_timed_out_lock<Initiator: store, Recipient: store>(details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
public(friend) fun mint(_recipient: address, _amount: u64)
 
@@ -699,8 +258,8 @@ Asserts that the time lock has expired. Implementation -
fun assert_timed_out_lock<Initiator: store, Recipient: store>(details: &BridgeTransferDetails<Initiator, Recipient>) {
-    assert!(now() > details.time_lock, ENOT_EXPIRED);
+
public(friend) fun mint(_recipient: address, _amount: u64) {
+   abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -708,17 +267,18 @@ Asserts that the time lock has expired. - + -## Function `assert_within_timelock` +## Function `burn` -Asserts we are still within the timelock. +Burns a specified amount of AptosCoin from an address. -@param details The bridge transfer details. -@abort If the time lock has expired. +@param from The address from which to burn AptosCoin. +@param amount The amount of AptosCoin to burn. +@abort If the burn capability is not available. -
fun assert_within_timelock<Initiator: store, Recipient: store>(details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
public(friend) fun burn(_from: address, _amount: u64)
 
@@ -727,8 +287,8 @@ Asserts we are still within the timelock. Implementation -
fun assert_within_timelock<Initiator: store, Recipient: store>(details: &BridgeTransferDetails<Initiator, Recipient>) {
-    assert!(!(now() > details.time_lock), EEXPIRED);
+
public(friend) fun burn(_from: address, _amount: u64) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -736,824 +296,741 @@ Asserts we are still within the timelock. - - -## Function `complete` - -Completes the bridge transfer. -@param details The bridge transfer details to complete. + -
fun complete<Initiator: store, Recipient: store>(details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
-
+# Module `0x1::atomic_bridge_store` -
-Implementation +- [Struct `AddressPair`](#0x1_atomic_bridge_store_AddressPair) +- [Resource `SmartTableWrapper`](#0x1_atomic_bridge_store_SmartTableWrapper) +- [Struct `BridgeTransferDetails`](#0x1_atomic_bridge_store_BridgeTransferDetails) +- [Resource `Nonce`](#0x1_atomic_bridge_store_Nonce) +- [Constants](#@Constants_0) +- [Function `initialize`](#0x1_atomic_bridge_store_initialize) +- [Function `now`](#0x1_atomic_bridge_store_now) +- [Function `create_time_lock`](#0x1_atomic_bridge_store_create_time_lock) +- [Function `create_details`](#0x1_atomic_bridge_store_create_details) +- [Function `add`](#0x1_atomic_bridge_store_add) +- [Function `assert_min_time_lock`](#0x1_atomic_bridge_store_assert_min_time_lock) +- [Function `assert_pending`](#0x1_atomic_bridge_store_assert_pending) +- [Function `assert_valid_hash_lock`](#0x1_atomic_bridge_store_assert_valid_hash_lock) +- [Function `assert_valid_bridge_transfer_id`](#0x1_atomic_bridge_store_assert_valid_bridge_transfer_id) +- [Function `create_hashlock`](#0x1_atomic_bridge_store_create_hashlock) +- [Function `assert_correct_hash_lock`](#0x1_atomic_bridge_store_assert_correct_hash_lock) +- [Function `assert_timed_out_lock`](#0x1_atomic_bridge_store_assert_timed_out_lock) +- [Function `assert_within_timelock`](#0x1_atomic_bridge_store_assert_within_timelock) +- [Function `complete`](#0x1_atomic_bridge_store_complete) +- [Function `cancel`](#0x1_atomic_bridge_store_cancel) +- [Function `complete_details`](#0x1_atomic_bridge_store_complete_details) +- [Function `complete_transfer`](#0x1_atomic_bridge_store_complete_transfer) +- [Function `cancel_details`](#0x1_atomic_bridge_store_cancel_details) +- [Function `cancel_transfer`](#0x1_atomic_bridge_store_cancel_transfer) +- [Function `bridge_transfer_id`](#0x1_atomic_bridge_store_bridge_transfer_id) +- [Function `get_bridge_transfer_details_initiator`](#0x1_atomic_bridge_store_get_bridge_transfer_details_initiator) +- [Function `get_bridge_transfer_details_counterparty`](#0x1_atomic_bridge_store_get_bridge_transfer_details_counterparty) +- [Function `get_bridge_transfer_details`](#0x1_atomic_bridge_store_get_bridge_transfer_details) -
fun complete<Initiator: store, Recipient: store>(details: &mut BridgeTransferDetails<Initiator, Recipient>) {
-    details.state = COMPLETED_TRANSACTION;
-}
+
use 0x1::ethereum;
+use 0x1::smart_table;
+use 0x1::timestamp;
 
-
- - - -## Function `cancel` + -Cancels the bridge transfer. +## Struct `AddressPair` -@param details The bridge transfer details to cancel. -
fun cancel<Initiator: store, Recipient: store>(details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
struct AddressPair<Initiator: store, Recipient: store> has copy, store
 
-Implementation +Fields -
fun cancel<Initiator: store, Recipient: store>(details: &mut BridgeTransferDetails<Initiator, Recipient>) {
-    details.state = CANCELLED_TRANSACTION;
-}
-
+
+
+initiator: Initiator +
+
+ +
+
+recipient: Recipient +
+
+
+
- - -## Function `complete_details` + -Validates and completes a bridge transfer by confirming the hash lock and state. +## Resource `SmartTableWrapper` -@param hash_lock The hash lock used to validate the transfer. -@param details The mutable reference to the bridge transfer details to be completed. -@return A tuple containing the recipient and the amount of the transfer. -@abort If the hash lock is invalid, the transfer is not pending, or the hash lock does not match. +A smart table wrapper -
fun complete_details<Initiator: store, Recipient: copy, store>(hash_lock: vector<u8>, details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): (Recipient, u64)
+
struct SmartTableWrapper<K, V> has store, key
 
-Implementation - - -
fun complete_details<Initiator: store, Recipient: store + copy>(hash_lock: vector<u8>, details: &mut BridgeTransferDetails<Initiator, Recipient>) : (Recipient, u64) {
-    assert_valid_hash_lock(&hash_lock);
-    assert_pending(details);
-    assert_correct_hash_lock(details, hash_lock);
-    assert_within_timelock(details);
+Fields
 
-    complete(details);
 
-    (details.addresses.recipient, details.amount)
-}
-
+
+
+inner: smart_table::SmartTable<K, V> +
+
+
+
- - -## Function `complete_transfer` + -Completes a bridge transfer by validating the hash lock and updating the transfer state. +## Struct `BridgeTransferDetails` -@param bridge_transfer_id The ID of the bridge transfer to complete. -@param hash_lock The hash lock used to validate the transfer. -@return A tuple containing the recipient of the transfer and the amount transferred. -@abort If the bridge transfer details are not found or if the completion checks in complete_details fail. +Details on the transfer -
public(friend) fun complete_transfer<Initiator: store, Recipient: copy, store>(bridge_transfer_id: vector<u8>, hash_lock: vector<u8>): (Recipient, u64)
+
struct BridgeTransferDetails<Initiator: store, Recipient: store> has copy, store
 
-Implementation +Fields -
public(friend) fun complete_transfer<Initiator: store, Recipient: copy + store>(bridge_transfer_id: vector<u8>, hash_lock: vector<u8>) : (Recipient, u64) acquires SmartTableWrapper {
-    assert!(features::abort_atomic_bridge_enabled(), EATOMIC_BRIDGE_NOT_ENABLED);
+
+
+addresses: atomic_bridge_store::AddressPair<Initiator, Recipient> +
+
+ +
+
+amount: u64 +
+
- let table = borrow_global_mut<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework); +
+
+hash_lock: vector<u8> +
+
- let details = smart_table::borrow_mut( - &mut table.inner, - bridge_transfer_id); +
+
+time_lock: u64 +
+
- complete_details<Initiator, Recipient>(hash_lock, details) -} -
+
+
+state: u8 +
+
+
+
- - -## Function `cancel_details` + -Cancels a pending bridge transfer if the time lock has expired. +## Resource `Nonce` -@param details A mutable reference to the bridge transfer details to be canceled. -@return A tuple containing the initiator of the transfer and the amount to be refunded. -@abort If the transfer is not in a pending state or the time lock has not expired. -
fun cancel_details<Initiator: copy, store, Recipient: store>(details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): (Initiator, u64)
+
struct Nonce has key
 
-Implementation - - -
fun cancel_details<Initiator: store + copy, Recipient: store>(details: &mut BridgeTransferDetails<Initiator, Recipient>) : (Initiator, u64) {
-    assert_pending(details);
-    assert_timed_out_lock(details);
+Fields
 
-    cancel(details);
 
-    (details.addresses.initiator, details.amount)
-}
-
+
+
+inner: u64 +
+
+
+
- - -## Function `cancel_transfer` + -Cancels a bridge transfer if it is pending and the time lock has expired. +## Constants -@param bridge_transfer_id The ID of the bridge transfer to cancel. -@return A tuple containing the initiator of the transfer and the amount to be refunded. -@abort If the bridge transfer details are not found or if the cancellation conditions in cancel_details fail. + -
public(friend) fun cancel_transfer<Initiator: copy, store, Recipient: store>(bridge_transfer_id: vector<u8>): (Initiator, u64)
-
+
const MAX_U64: u64 = 18446744073709551615;
+
-
-Implementation -
public(friend) fun cancel_transfer<Initiator: store + copy, Recipient: store>(bridge_transfer_id: vector<u8>) : (Initiator, u64) acquires SmartTableWrapper {
-    assert!(features::abort_atomic_bridge_enabled(), EATOMIC_BRIDGE_NOT_ENABLED);
+
 
-    let table = borrow_global_mut<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework);
 
-    let details = smart_table::borrow_mut(
-        &mut table.inner,
-        bridge_transfer_id);
 
-    cancel_details<Initiator, Recipient>(details)
-}
+
const EATOMIC_BRIDGE_NOT_ENABLED: u64 = 9;
 
-
- - - -## Function `bridge_transfer_id` - -Generates a unique bridge transfer ID based on transfer details and nonce. + -@param details The bridge transfer details. -@return The generated bridge transfer ID. -
public(friend) fun bridge_transfer_id<Initiator: store, Recipient: store>(details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): vector<u8>
+
const EATOMIC_BRIDGE_DISABLED: u64 = 198461;
 
-
-Implementation + -
public(friend) fun bridge_transfer_id<Initiator: store, Recipient: store>(details: &BridgeTransferDetails<Initiator, Recipient>) : vector<u8> acquires Nonce {
-    let nonce = borrow_global_mut<Nonce>(@aptos_framework);
-    let combined_bytes = vector::empty<u8>();
-    vector::append(&mut combined_bytes, bcs::to_bytes(&details.addresses.initiator));
-    vector::append(&mut combined_bytes, bcs::to_bytes(&details.addresses.recipient));
-    vector::append(&mut combined_bytes, details.hash_lock);
-    if (nonce.inner == MAX_U64) {
-        nonce.inner = 0;  // Wrap around to 0 if at maximum value
-    } else {
-        nonce.inner = nonce.inner + 1;  // Safe to increment without overflow
-    };
-    vector::append(&mut combined_bytes, bcs::to_bytes(&nonce.inner));
-
-    keccak256(combined_bytes)
-}
+
+
const CANCELLED_TRANSACTION: u8 = 3;
 
-
+ - -## Function `get_bridge_transfer_details_initiator` -Gets initiator bridge transfer details given a bridge transfer ID +
const COMPLETED_TRANSACTION: u8 = 2;
+
-@param bridge_transfer_id A 32-byte vector of unsigned 8-bit integers. -@return A BridgeTransferDetails struct. -@abort If there is no transfer in the atomic bridge store. -
#[view]
-public fun get_bridge_transfer_details_initiator(bridge_transfer_id: vector<u8>): atomic_bridge_store::BridgeTransferDetails<address, ethereum::EthereumAddress>
-
+ -
-Implementation +
const EEXPIRED: u64 = 3;
+
-
public fun get_bridge_transfer_details_initiator(
-    bridge_transfer_id: vector<u8>
-): BridgeTransferDetails<address, EthereumAddress> acquires SmartTableWrapper {
-    get_bridge_transfer_details(bridge_transfer_id)
-}
-
+ -
- +
const EINVALID_BRIDGE_TRANSFER_ID: u64 = 8;
+
-## Function `get_bridge_transfer_details_counterparty` -Gets counterparty bridge transfer details given a bridge transfer ID -@param bridge_transfer_id A 32-byte vector of unsigned 8-bit integers. -@return A BridgeTransferDetails struct. -@abort If there is no transfer in the atomic bridge store. + -
#[view]
-public fun get_bridge_transfer_details_counterparty(bridge_transfer_id: vector<u8>): atomic_bridge_store::BridgeTransferDetails<ethereum::EthereumAddress, address>
-
+
const EINVALID_HASH_LOCK: u64 = 5;
+
-
-Implementation + -
public fun get_bridge_transfer_details_counterparty(
-    bridge_transfer_id: vector<u8>
-): BridgeTransferDetails<EthereumAddress, address> acquires SmartTableWrapper {
-    get_bridge_transfer_details(bridge_transfer_id)
-}
-
+Error codes +
const EINVALID_PRE_IMAGE: u64 = 1;
+
-
- -## Function `get_bridge_transfer_details` + -
fun get_bridge_transfer_details<Initiator: copy, store, Recipient: copy, store>(bridge_transfer_id: vector<u8>): atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>
+
const EINVALID_TIME_LOCK: u64 = 6;
 
-
-Implementation - + -
fun get_bridge_transfer_details<Initiator: store + copy, Recipient: store + copy>(bridge_transfer_id: vector<u8>
-): BridgeTransferDetails<Initiator, Recipient> acquires SmartTableWrapper {
-    let table = borrow_global<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework);
 
-    let details_ref = smart_table::borrow(
-        &table.inner,
-        bridge_transfer_id
-    );
 
-    *details_ref
-}
+
const ENOT_EXPIRED: u64 = 4;
 
-
- - - -## Specification + - -### Function `initialize` +
const ENOT_PENDING_TRANSACTION: u64 = 2;
+
-
public fun initialize(aptos_framework: &signer)
-
+ -
let addr = signer::address_of(aptos_framework);
-ensures exists<Nonce>(addr);
-ensures exists<SmartTableWrapper<vector<u8>, BridgeTransferDetails<address, EthereumAddress>>>(addr);
-ensures exists<SmartTableWrapper<vector<u8>, BridgeTransferDetails<EthereumAddress, address>>>(addr);
+
const EZERO_AMOUNT: u64 = 7;
 
+ - +Minimum time lock of 1 second -
schema TimeLockAbortsIf {
-    time_lock: u64;
-    aborts_if time_lock < MIN_TIME_LOCK;
-    aborts_if !exists<CurrentTimeMicroseconds>(@aptos_framework);
-    aborts_if time_lock > MAX_U64 - timestamp::spec_now_seconds();
-}
+
const MIN_TIME_LOCK: u64 = 1;
 
- + -### Function `create_time_lock` +Transaction states -
public(friend) fun create_time_lock(time_lock: u64): u64
+
const PENDING_TRANSACTION: u8 = 1;
 
+ -
include TimeLockAbortsIf;
-ensures result == timestamp::spec_now_seconds() + time_lock;
-
+## Function `initialize` +Initializes the initiators and counterparties tables and nonce. -If the sum of now() and lock does not overflow, the result is the sum of now() and lock. +@param aptos_framework The signer for Aptos framework. -
ensures (timestamp::spec_now_seconds() + time_lock <= 0xFFFFFFFFFFFFFFFF) ==> result == timestamp::spec_now_seconds() + time_lock;
+
public fun initialize(_aptos_framework: &signer)
 
- - -### Function `create_details` +
+Implementation -
public(friend) fun create_details<Initiator: store, Recipient: store>(initiator: Initiator, recipient: Recipient, amount: u64, hash_lock: vector<u8>, time_lock: u64): atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>
+
public fun initialize(_aptos_framework: &signer) {
+   abort EATOMIC_BRIDGE_DISABLED
+}
 
+
-
include TimeLockAbortsIf;
-aborts_if amount == 0;
-aborts_if len(hash_lock) != 32;
-ensures result == BridgeTransferDetails<Initiator, Recipient> {
-        addresses: AddressPair<Initiator, Recipient> {
-        initiator,
-        recipient
-    },
-    amount,
-    hash_lock,
-    time_lock: timestamp::spec_now_seconds() + time_lock,
-    state: PENDING_TRANSACTION,
-};
-
- + +## Function `now` +Returns the current time in seconds. - +@return Current timestamp in seconds. -
schema AddAbortsIf<T> {
-    bridge_transfer_id: vector<u8>;
-    table: SmartTable<vector<u8>, T>;
-    aborts_if len(bridge_transfer_id) != 32;
-    aborts_if smart_table::spec_contains(table, bridge_transfer_id);
-    aborts_if !features::spec_is_enabled(features::ATOMIC_BRIDGE);
-}
+
fun now(): u64
 
- - -### Function `add` +
+Implementation -
public(friend) fun add<Initiator: store, Recipient: store>(bridge_transfer_id: vector<u8>, details: atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
fun now() : u64 {
+    timestamp::now_seconds()
+}
 
+
-
let table = global<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework).inner;
-include AddAbortsIf<BridgeTransferDetails<Initiator, Recipient>>;
-aborts_if !exists<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework);
-aborts_if smart_table::spec_contains(table, bridge_transfer_id);
-ensures smart_table::spec_contains(global<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework).inner, bridge_transfer_id);
-ensures smart_table::spec_len(global<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework).inner) ==
-    old(smart_table::spec_len(global<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework).inner)) + 1;
-
- + +## Function `create_time_lock` +Creates a time lock by adding a duration to the current time. - +@param lock The duration to lock. +@return The calculated time lock. +@abort If lock is not above MIN_TIME_LOCK -
schema HashLockAbortsIf {
-    hash_lock: vector<u8>;
-    aborts_if len(hash_lock) != 32;
-}
+
public(friend) fun create_time_lock(_time_lock: u64): u64
 
- - +
+Implementation -
schema BridgetTransferDetailsAbortsIf<Initiator, Recipient> {
-    hash_lock: vector<u8>;
-    details: BridgeTransferDetails<Initiator, Recipient>;
-    include HashLockAbortsIf;
-    aborts_if timestamp::spec_now_seconds() > details.time_lock;
-    aborts_if !exists<CurrentTimeMicroseconds>(@aptos_framework);
-    aborts_if details.state != PENDING_TRANSACTION;
-    aborts_if details.hash_lock != hash_lock;
+
public(friend) fun create_time_lock(_time_lock: u64) : u64 {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
- - -### Function `create_hashlock` +
+ -
public(friend) fun create_hashlock(pre_image: vector<u8>): vector<u8>
-
+## Function `create_details` +Creates bridge transfer details with validation. +@param initiator The initiating party of the transfer. +@param recipient The receiving party of the transfer. +@param amount The amount to be transferred. +@param hash_lock The hash lock for the transfer. +@param time_lock The time lock for the transfer. +@return A BridgeTransferDetails object. +@abort If the amount is zero or locks are invalid. -
aborts_if len(pre_image) == 0;
+
public(friend) fun create_details<Initiator: store, Recipient: store>(_initiator: Initiator, _recipient: Recipient, _amount: u64, _hash_lock: vector<u8>, _time_lock: u64): atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>
 
- - -### Function `complete` +
+Implementation -
fun complete<Initiator: store, Recipient: store>(details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
public(friend) fun create_details<Initiator: store, Recipient: store>(_initiator: Initiator, _recipient: Recipient, _amount: u64, _hash_lock: vector<u8>, _time_lock: u64)
+    : BridgeTransferDetails<Initiator, Recipient> {
+    abort EATOMIC_BRIDGE_DISABLED
+}
 
+
-
requires details.state == PENDING_TRANSACTION;
-ensures details.state == COMPLETED_TRANSACTION;
-
- + +## Function `add` - +Record details of a transfer -### Function `cancel` +@param bridge_transfer_id Bridge transfer ID. +@param details The bridge transfer details -
fun cancel<Initiator: store, Recipient: store>(details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
public(friend) fun add<Initiator: store, Recipient: store>(_bridge_transfer_id: vector<u8>, _details: atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
 
+
+Implementation -
requires details.state == PENDING_TRANSACTION;
-ensures details.state == CANCELLED_TRANSACTION;
-
+
public(friend) fun add<Initiator: store, Recipient: store>(_bridge_transfer_id: vector<u8>, _details: BridgeTransferDetails<Initiator, Recipient>) {
+    abort EATOMIC_BRIDGE_DISABLED
+}
+
- -### Function `complete_details` +
+ -
fun complete_details<Initiator: store, Recipient: copy, store>(hash_lock: vector<u8>, details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): (Recipient, u64)
-
+## Function `assert_min_time_lock` +Asserts that the time lock is valid. +@param time_lock +@abort If the time lock is invalid. -
include BridgetTransferDetailsAbortsIf<Initiator, Recipient>;
+
fun assert_min_time_lock(_time_lock: u64)
 
- - -### Function `complete_transfer` +
+Implementation -
public(friend) fun complete_transfer<Initiator: store, Recipient: copy, store>(bridge_transfer_id: vector<u8>, hash_lock: vector<u8>): (Recipient, u64)
+
fun assert_min_time_lock(_time_lock: u64) {
+    assert!(_time_lock >= MIN_TIME_LOCK, EINVALID_TIME_LOCK);
+}
 
+
-
let table = global<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework).inner;
-aborts_if !features::spec_is_enabled(features::ATOMIC_BRIDGE);
-aborts_if !exists<SmartTableWrapper<vector<u8>, BridgeTransferDetails<Initiator, Recipient>>>(@aptos_framework);
-aborts_if !smart_table::spec_contains(table, bridge_transfer_id);
-let details = smart_table::spec_get(table, bridge_transfer_id);
-include BridgetTransferDetailsAbortsIf<Initiator, Recipient>;
-
- + +## Function `assert_pending` +Asserts that the details state is pending. - +@param details The bridge transfer details to check. +@abort If the state is not pending. -
schema AbortBridgetTransferDetailsAbortsIf<Initiator, Recipient> {
-    details: BridgeTransferDetails<Initiator, Recipient>;
-    aborts_if details.state != PENDING_TRANSACTION;
-    aborts_if !(timestamp::spec_now_seconds() > details.time_lock);
-    aborts_if !exists<CurrentTimeMicroseconds>(@aptos_framework);
-    ensures details.state == CANCELLED_TRANSACTION;
-}
+
fun assert_pending<Initiator: store, Recipient: store>(_details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
 
- - -### Function `cancel_details` +
+Implementation -
fun cancel_details<Initiator: copy, store, Recipient: store>(details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): (Initiator, u64)
+
fun assert_pending<Initiator: store, Recipient: store>(_details: &BridgeTransferDetails<Initiator, Recipient>) {
+    assert!(_details.state == PENDING_TRANSACTION, ENOT_PENDING_TRANSACTION)
+}
 
+
-
include AbortBridgetTransferDetailsAbortsIf<Initiator, Recipient>;
-
+ +## Function `assert_valid_hash_lock` +Asserts that the hash lock is valid. - +@param hash_lock The hash lock to validate. +@abort If the hash lock is invalid. -# Module `0x1::atomic_bridge_configuration` +
fun assert_valid_hash_lock(_hash_lock: &vector<u8>)
+
-- [Resource `BridgeConfig`](#0x1_atomic_bridge_configuration_BridgeConfig) -- [Struct `BridgeConfigOperatorUpdated`](#0x1_atomic_bridge_configuration_BridgeConfigOperatorUpdated) -- [Struct `InitiatorTimeLockUpdated`](#0x1_atomic_bridge_configuration_InitiatorTimeLockUpdated) -- [Struct `CounterpartyTimeLockUpdated`](#0x1_atomic_bridge_configuration_CounterpartyTimeLockUpdated) -- [Constants](#@Constants_0) -- [Function `initialize`](#0x1_atomic_bridge_configuration_initialize) -- [Function `update_bridge_operator`](#0x1_atomic_bridge_configuration_update_bridge_operator) -- [Function `set_initiator_time_lock_duration`](#0x1_atomic_bridge_configuration_set_initiator_time_lock_duration) -- [Function `set_counterparty_time_lock_duration`](#0x1_atomic_bridge_configuration_set_counterparty_time_lock_duration) -- [Function `initiator_timelock_duration`](#0x1_atomic_bridge_configuration_initiator_timelock_duration) -- [Function `counterparty_timelock_duration`](#0x1_atomic_bridge_configuration_counterparty_timelock_duration) -- [Function `bridge_operator`](#0x1_atomic_bridge_configuration_bridge_operator) -- [Function `assert_is_caller_operator`](#0x1_atomic_bridge_configuration_assert_is_caller_operator) -- [Specification](#@Specification_1) - - [Function `initialize`](#@Specification_1_initialize) - - [Function `update_bridge_operator`](#@Specification_1_update_bridge_operator) +
+Implementation -
use 0x1::event;
-use 0x1::signer;
-use 0x1::system_addresses;
+
+
fun assert_valid_hash_lock(_hash_lock: &vector<u8>) {
+    assert!(vector::length(_hash_lock) == 32, EINVALID_HASH_LOCK);
+}
 
- +
-## Resource `BridgeConfig` + + +## Function `assert_valid_bridge_transfer_id` + +Asserts that the bridge transfer ID is valid. +@param bridge_transfer_id The bridge transfer ID to validate. +@abort If the ID is invalid. -
struct BridgeConfig has key
+
public(friend) fun assert_valid_bridge_transfer_id(_bridge_transfer_id: &vector<u8>)
 
-Fields - - -
-
-bridge_operator: address -
-
+Implementation -
-
-initiator_time_lock: u64 -
-
-
-
-counterparty_time_lock: u64 -
-
+
public(friend) fun assert_valid_bridge_transfer_id(_bridge_transfer_id: &vector<u8>) {
+    assert!(vector::length(_bridge_transfer_id) == 32, EINVALID_BRIDGE_TRANSFER_ID);
+}
+
-
-
- + -## Struct `BridgeConfigOperatorUpdated` +## Function `create_hashlock` -Event emitted when the bridge operator is updated. +Creates a hash lock from a pre-image. +@param pre_image The pre-image to hash. +@return The generated hash lock. -
#[event]
-struct BridgeConfigOperatorUpdated has drop, store
+
+
public(friend) fun create_hashlock(_pre_image: vector<u8>): vector<u8>
 
-Fields - +Implementation -
-
-old_operator: address -
-
-
-
-new_operator: address -
-
+
public(friend) fun create_hashlock(_pre_image: vector<u8>) : vector<u8> {
+    abort EATOMIC_BRIDGE_DISABLED
+}
+
-
-
- + -## Struct `InitiatorTimeLockUpdated` +## Function `assert_correct_hash_lock` -Event emitted when the initiator time lock has been updated. +Asserts that the hash lock matches the expected value. + +@param details The bridge transfer details. +@param hash_lock The hash lock to compare. +@abort If the hash lock is incorrect. -
#[event]
-struct InitiatorTimeLockUpdated has drop, store
+
fun assert_correct_hash_lock<Initiator: store, Recipient: store>(_details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>, _hash_lock: vector<u8>)
 
-Fields +Implementation -
-
-time_lock: u64 -
-
+
fun assert_correct_hash_lock<Initiator: store, Recipient: store>(_details: &BridgeTransferDetails<Initiator, Recipient>, _hash_lock: vector<u8>) {
+    assert!(&_hash_lock == &_details.hash_lock, EINVALID_PRE_IMAGE);
+}
+
-
-
- + -## Struct `CounterpartyTimeLockUpdated` +## Function `assert_timed_out_lock` -Event emitted when the initiator time lock has been updated. +Asserts that the time lock has expired. +@param details The bridge transfer details. +@abort If the time lock has not expired. -
#[event]
-struct CounterpartyTimeLockUpdated has drop, store
+
+
fun assert_timed_out_lock<Initiator: store, Recipient: store>(_details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
 
-Fields +Implementation -
-
-time_lock: u64 -
-
+
fun assert_timed_out_lock<Initiator: store, Recipient: store>(_details: &BridgeTransferDetails<Initiator, Recipient>) {
+    assert!(now() > _details.time_lock, ENOT_EXPIRED);
+}
+
-
-
- + -## Constants +## Function `assert_within_timelock` +Asserts we are still within the timelock. - +@param details The bridge transfer details. +@abort If the time lock has expired. -Counterparty time lock duration is 24 hours in seconds + +
fun assert_within_timelock<Initiator: store, Recipient: store>(_details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
-
const COUNTERPARTY_TIME_LOCK_DUARTION: u64 = 86400;
+
+
+Implementation + + +
fun assert_within_timelock<Initiator: store, Recipient: store>(_details: &BridgeTransferDetails<Initiator, Recipient>) {
+    assert!(!(now() > _details.time_lock), EEXPIRED);
+}
 
- +
-Error code for invalid bridge operator + +## Function `complete` -
const EINVALID_BRIDGE_OPERATOR: u64 = 1;
-
+Completes the bridge transfer. +@param details The bridge transfer details to complete. - +
fun complete<Initiator: store, Recipient: store>(_details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
+
-Initiator time lock duration is 48 hours in seconds -
const INITIATOR_TIME_LOCK_DUARTION: u64 = 172800;
+
+Implementation + + +
fun complete<Initiator: store, Recipient: store>(_details: &mut BridgeTransferDetails<Initiator, Recipient>) {
+    _details.state = COMPLETED_TRANSACTION;
+}
 
- +
-## Function `initialize` + -Initializes the bridge configuration with Aptos framework as the bridge operator. +## Function `cancel` -@param aptos_framework The signer representing the Aptos framework. +Cancels the bridge transfer. + +@param details The bridge transfer details to cancel. -
public fun initialize(aptos_framework: &signer)
+
fun cancel<Initiator: store, Recipient: store>(_details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>)
 
@@ -1562,14 +1039,8 @@ Initializes the bridge configuration with Aptos framework as the bridge operator Implementation -
public fun initialize(aptos_framework: &signer) {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    let bridge_config = BridgeConfig {
-        bridge_operator: signer::address_of(aptos_framework),
-        initiator_time_lock: INITIATOR_TIME_LOCK_DUARTION,
-        counterparty_time_lock: COUNTERPARTY_TIME_LOCK_DUARTION,
-    };
-    move_to(aptos_framework, bridge_config);
+
fun cancel<Initiator: store, Recipient: store>(_details: &mut BridgeTransferDetails<Initiator, Recipient>) {
+    _details.state = CANCELLED_TRANSACTION;
 }
 
@@ -1577,18 +1048,19 @@ Initializes the bridge configuration with Aptos framework as the bridge operator - + -## Function `update_bridge_operator` +## Function `complete_details` -Updates the bridge operator, requiring governance validation. +Validates and completes a bridge transfer by confirming the hash lock and state. -@param aptos_framework The signer representing the Aptos framework. -@param new_operator The new address to be set as the bridge operator. -@abort If the current operator is the same as the new operator. +@param hash_lock The hash lock used to validate the transfer. +@param details The mutable reference to the bridge transfer details to be completed. +@return A tuple containing the recipient and the amount of the transfer. +@abort If the hash lock is invalid, the transfer is not pending, or the hash lock does not match. -
public fun update_bridge_operator(aptos_framework: &signer, new_operator: address)
+
fun complete_details<Initiator: store, Recipient: copy, store>(_hash_lock: vector<u8>, _details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): (Recipient, u64)
 
@@ -1597,21 +1069,15 @@ Updates the bridge operator, requiring governance validation. Implementation -
public fun update_bridge_operator(aptos_framework: &signer, new_operator: address
-)   acquires BridgeConfig {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    let bridge_config = borrow_global_mut<BridgeConfig>(@aptos_framework);
-    let old_operator = bridge_config.bridge_operator;
-    assert!(old_operator != new_operator, EINVALID_BRIDGE_OPERATOR);
+
fun complete_details<Initiator: store, Recipient: store + copy>(_hash_lock: vector<u8>, _details: &mut BridgeTransferDetails<Initiator, Recipient>) : (Recipient, u64) {
+    assert_valid_hash_lock(&_hash_lock);
+    assert_pending(_details);
+    assert_correct_hash_lock(_details, _hash_lock);
+    assert_within_timelock(_details);
 
-    bridge_config.bridge_operator = new_operator;
+    complete(_details);
 
-    event::emit(
-        BridgeConfigOperatorUpdated {
-            old_operator,
-            new_operator,
-        },
-    );
+    (_details.addresses.recipient, _details.amount)
 }
 
@@ -1619,13 +1085,19 @@ Updates the bridge operator, requiring governance validation. - + -## Function `set_initiator_time_lock_duration` +## Function `complete_transfer` + +Completes a bridge transfer by validating the hash lock and updating the transfer state. +@param bridge_transfer_id The ID of the bridge transfer to complete. +@param hash_lock The hash lock used to validate the transfer. +@return A tuple containing the recipient of the transfer and the amount transferred. +@abort If the bridge transfer details are not found or if the completion checks in complete_details fail. -
public fun set_initiator_time_lock_duration(aptos_framework: &signer, time_lock: u64)
+
public(friend) fun complete_transfer<Initiator: store, Recipient: copy, store>(_bridge_transfer_id: vector<u8>, _hash_lock: vector<u8>): (Recipient, u64)
 
@@ -1634,16 +1106,8 @@ Updates the bridge operator, requiring governance validation. Implementation -
public fun set_initiator_time_lock_duration(aptos_framework: &signer, time_lock: u64
-) acquires BridgeConfig {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    borrow_global_mut<BridgeConfig>(@aptos_framework).initiator_time_lock = time_lock;
-
-    event::emit(
-        InitiatorTimeLockUpdated {
-            time_lock
-        },
-    );
+
public(friend) fun complete_transfer<Initiator: store, Recipient: copy + store>(_bridge_transfer_id: vector<u8>, _hash_lock: vector<u8>) : (Recipient, u64) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -1651,13 +1115,18 @@ Updates the bridge operator, requiring governance validation. - + -## Function `set_counterparty_time_lock_duration` +## Function `cancel_details` + +Cancels a pending bridge transfer if the time lock has expired. +@param details A mutable reference to the bridge transfer details to be canceled. +@return A tuple containing the initiator of the transfer and the amount to be refunded. +@abort If the transfer is not in a pending state or the time lock has not expired. -
public fun set_counterparty_time_lock_duration(aptos_framework: &signer, time_lock: u64)
+
fun cancel_details<Initiator: copy, store, Recipient: store>(_details: &mut atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): (Initiator, u64)
 
@@ -1666,16 +1135,13 @@ Updates the bridge operator, requiring governance validation. Implementation -
public fun set_counterparty_time_lock_duration(aptos_framework: &signer, time_lock: u64
-) acquires BridgeConfig {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    borrow_global_mut<BridgeConfig>(@aptos_framework).counterparty_time_lock = time_lock;
+
fun cancel_details<Initiator: store + copy, Recipient: store>(_details: &mut BridgeTransferDetails<Initiator, Recipient>) : (Initiator, u64) {
+    assert_pending(_details);
+    assert_timed_out_lock(_details);
+
+    cancel(_details);
 
-    event::emit(
-        CounterpartyTimeLockUpdated {
-            time_lock
-        },
-    );
+    (_details.addresses.initiator, _details.amount)
 }
 
@@ -1683,14 +1149,18 @@ Updates the bridge operator, requiring governance validation. - + -## Function `initiator_timelock_duration` +## Function `cancel_transfer` +Cancels a bridge transfer if it is pending and the time lock has expired. + +@param bridge_transfer_id The ID of the bridge transfer to cancel. +@return A tuple containing the initiator of the transfer and the amount to be refunded. +@abort If the bridge transfer details are not found or if the cancellation conditions in cancel_details fail. -
#[view]
-public fun initiator_timelock_duration(): u64
+
public(friend) fun cancel_transfer<Initiator: copy, store, Recipient: store>(_bridge_transfer_id: vector<u8>): (Initiator, u64)
 
@@ -1699,8 +1169,8 @@ Updates the bridge operator, requiring governance validation. Implementation -
public fun initiator_timelock_duration() : u64 acquires BridgeConfig {
-    borrow_global<BridgeConfig>(@aptos_framework).initiator_time_lock
+
public(friend) fun cancel_transfer<Initiator: store + copy, Recipient: store>(_bridge_transfer_id: vector<u8>) : (Initiator, u64) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -1708,14 +1178,17 @@ Updates the bridge operator, requiring governance validation. - + -## Function `counterparty_timelock_duration` +## Function `bridge_transfer_id` +Generates a unique bridge transfer ID based on transfer details and nonce. +@param details The bridge transfer details. +@return The generated bridge transfer ID. -
#[view]
-public fun counterparty_timelock_duration(): u64
+
+
public(friend) fun bridge_transfer_id<Initiator: store, Recipient: store>(_details: &atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>): vector<u8>
 
@@ -1724,8 +1197,8 @@ Updates the bridge operator, requiring governance validation. Implementation -
public fun counterparty_timelock_duration() : u64 acquires BridgeConfig {
-    borrow_global<BridgeConfig>(@aptos_framework).counterparty_time_lock
+
public(friend) fun bridge_transfer_id<Initiator: store, Recipient: store>(_details: &BridgeTransferDetails<Initiator, Recipient>) : vector<u8> {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -1733,17 +1206,19 @@ Updates the bridge operator, requiring governance validation. - + -## Function `bridge_operator` +## Function `get_bridge_transfer_details_initiator` -Retrieves the address of the current bridge operator. +Gets initiator bridge transfer details given a bridge transfer ID -@return The address of the current bridge operator. +@param bridge_transfer_id A 32-byte vector of unsigned 8-bit integers. +@return A BridgeTransferDetails struct. +@abort If there is no transfer in the atomic bridge store.
#[view]
-public fun bridge_operator(): address
+public fun get_bridge_transfer_details_initiator(_bridge_transfer_id: vector<u8>): atomic_bridge_store::BridgeTransferDetails<address, ethereum::EthereumAddress>
 
@@ -1752,8 +1227,10 @@ Retrieves the address of the current bridge operator. Implementation -
public fun bridge_operator(): address acquires BridgeConfig {
-    borrow_global_mut<BridgeConfig>(@aptos_framework).bridge_operator
+
public fun get_bridge_transfer_details_initiator(
+    _bridge_transfer_id: vector<u8>
+): BridgeTransferDetails<address, EthereumAddress> {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -1761,17 +1238,19 @@ Retrieves the address of the current bridge operator. - + -## Function `assert_is_caller_operator` +## Function `get_bridge_transfer_details_counterparty` -Asserts that the caller is the current bridge operator. +Gets counterparty bridge transfer details given a bridge transfer ID -@param caller The signer whose authority is being checked. -@abort If the caller is not the current bridge operator. +@param bridge_transfer_id A 32-byte vector of unsigned 8-bit integers. +@return A BridgeTransferDetails struct. +@abort If there is no transfer in the atomic bridge store. -
public(friend) fun assert_is_caller_operator(caller: &signer)
+
#[view]
+public fun get_bridge_transfer_details_counterparty(_bridge_transfer_id: vector<u8>): atomic_bridge_store::BridgeTransferDetails<ethereum::EthereumAddress, address>
 
@@ -1780,9 +1259,10 @@ Asserts that the caller is the current bridge operator. Implementation -
public(friend) fun assert_is_caller_operator(caller: &signer
-) acquires BridgeConfig {
-    assert!(borrow_global<BridgeConfig>(@aptos_framework).bridge_operator == signer::address_of(caller), EINVALID_BRIDGE_OPERATOR);
+
public fun get_bridge_transfer_details_counterparty(
+    _bridge_transfer_id: vector<u8>
+): BridgeTransferDetails<EthereumAddress, address> {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -1790,84 +1270,106 @@ Asserts that the caller is the current bridge operator. - + + +## Function `get_bridge_transfer_details` + -## Specification + +
fun get_bridge_transfer_details<Initiator: copy, store, Recipient: copy, store>(_bridge_transfer_id: vector<u8>): atomic_bridge_store::BridgeTransferDetails<Initiator, Recipient>
+
- -### Function `initialize` +
+Implementation -
public fun initialize(aptos_framework: &signer)
+
fun get_bridge_transfer_details<Initiator: store + copy, Recipient: store + copy>(_bridge_transfer_id: vector<u8>
+): BridgeTransferDetails<Initiator, Recipient> {
+    abort EATOMIC_BRIDGE_DISABLED
+}
 
+
+ -
aborts_if !system_addresses::is_aptos_framework_address(signer::address_of(aptos_framework));
-aborts_if exists<BridgeConfig>(signer::address_of(aptos_framework));
-ensures global<BridgeConfig>(signer::address_of(aptos_framework)).bridge_operator == signer::address_of(aptos_framework);
-
+ + +# Module `0x1::atomic_bridge_configuration` + + + +- [Resource `BridgeConfig`](#0x1_atomic_bridge_configuration_BridgeConfig) +- [Struct `BridgeConfigOperatorUpdated`](#0x1_atomic_bridge_configuration_BridgeConfigOperatorUpdated) +- [Struct `InitiatorTimeLockUpdated`](#0x1_atomic_bridge_configuration_InitiatorTimeLockUpdated) +- [Struct `CounterpartyTimeLockUpdated`](#0x1_atomic_bridge_configuration_CounterpartyTimeLockUpdated) +- [Constants](#@Constants_0) +- [Function `initialize`](#0x1_atomic_bridge_configuration_initialize) +- [Function `update_bridge_operator`](#0x1_atomic_bridge_configuration_update_bridge_operator) +- [Function `set_initiator_time_lock_duration`](#0x1_atomic_bridge_configuration_set_initiator_time_lock_duration) +- [Function `set_counterparty_time_lock_duration`](#0x1_atomic_bridge_configuration_set_counterparty_time_lock_duration) +- [Function `initiator_timelock_duration`](#0x1_atomic_bridge_configuration_initiator_timelock_duration) +- [Function `counterparty_timelock_duration`](#0x1_atomic_bridge_configuration_counterparty_timelock_duration) +- [Function `bridge_operator`](#0x1_atomic_bridge_configuration_bridge_operator) +- [Function `assert_is_caller_operator`](#0x1_atomic_bridge_configuration_assert_is_caller_operator) - +
-### Function `update_bridge_operator` -
public fun update_bridge_operator(aptos_framework: &signer, new_operator: address)
-
+ +## Resource `BridgeConfig` -
aborts_if !system_addresses::is_aptos_framework_address(signer::address_of(aptos_framework));
-aborts_if !exists<BridgeConfig>(signer::address_of(aptos_framework));
-aborts_if global<BridgeConfig>(signer::address_of(aptos_framework)).bridge_operator == new_operator;
-ensures global<BridgeConfig>(signer::address_of(aptos_framework)).bridge_operator == new_operator;
+
struct BridgeConfig has key
 
- - -# Module `0x1::atomic_bridge` +
+Fields +
+
+bridge_operator: address +
+
-- [Resource `AptosCoinBurnCapability`](#0x1_atomic_bridge_AptosCoinBurnCapability) -- [Resource `AptosCoinMintCapability`](#0x1_atomic_bridge_AptosCoinMintCapability) -- [Resource `AptosFABurnCapabilities`](#0x1_atomic_bridge_AptosFABurnCapabilities) -- [Resource `AptosFAMintCapabilities`](#0x1_atomic_bridge_AptosFAMintCapabilities) -- [Constants](#@Constants_0) -- [Function `initialize`](#0x1_atomic_bridge_initialize) -- [Function `store_aptos_coin_burn_cap`](#0x1_atomic_bridge_store_aptos_coin_burn_cap) -- [Function `store_aptos_coin_mint_cap`](#0x1_atomic_bridge_store_aptos_coin_mint_cap) -- [Function `mint`](#0x1_atomic_bridge_mint) -- [Function `burn`](#0x1_atomic_bridge_burn) +
+
+initiator_time_lock: u64 +
+
+
+
+counterparty_time_lock: u64 +
+
-
use 0x1::aptos_coin;
-use 0x1::atomic_bridge_configuration;
-use 0x1::atomic_bridge_store;
-use 0x1::coin;
-use 0x1::features;
-use 0x1::fungible_asset;
-use 0x1::system_addresses;
-
+
+
+
- + -## Resource `AptosCoinBurnCapability` +## Struct `BridgeConfigOperatorUpdated` +Event emitted when the bridge operator is updated. -
struct AptosCoinBurnCapability has key
+
#[event]
+struct BridgeConfigOperatorUpdated has drop, store
 
@@ -1878,7 +1380,13 @@ Asserts that the caller is the current bridge operator.
-burn_cap: coin::BurnCapability<aptos_coin::AptosCoin> +old_operator: address +
+
+ +
+
+new_operator: address
@@ -1888,13 +1396,15 @@ Asserts that the caller is the current bridge operator. - + -## Resource `AptosCoinMintCapability` +## Struct `InitiatorTimeLockUpdated` +Event emitted when the initiator time lock has been updated. -
struct AptosCoinMintCapability has key
+
#[event]
+struct InitiatorTimeLockUpdated has drop, store
 
@@ -1905,7 +1415,7 @@ Asserts that the caller is the current bridge operator.
-mint_cap: coin::MintCapability<aptos_coin::AptosCoin> +time_lock: u64
@@ -1915,13 +1425,15 @@ Asserts that the caller is the current bridge operator. - + -## Resource `AptosFABurnCapabilities` +## Struct `CounterpartyTimeLockUpdated` +Event emitted when the initiator time lock has been updated. -
struct AptosFABurnCapabilities has key
+
#[event]
+struct CounterpartyTimeLockUpdated has drop, store
 
@@ -1932,7 +1444,7 @@ Asserts that the caller is the current bridge operator.
-burn_ref: fungible_asset::BurnRef +time_lock: u64
@@ -1942,57 +1454,61 @@ Asserts that the caller is the current bridge operator. - + -## Resource `AptosFAMintCapabilities` +## Constants + -
struct AptosFAMintCapabilities has key
+Error code for atomic bridge disabled
+
+
+
const EATOMIC_BRIDGE_DISABLED: u64 = 2;
 
-
-Fields + +Counterparty time lock duration is 24 hours in seconds -
-
-burn_ref: fungible_asset::MintRef -
-
-
-
+
const COUNTERPARTY_TIME_LOCK_DUARTION: u64 = 86400;
+
-
- + -## Constants +Error code for invalid bridge operator - +
const EINVALID_BRIDGE_OPERATOR: u64 = 1;
+
-
const EATOMIC_BRIDGE_NOT_ENABLED: u64 = 1;
+
+
+Initiator time lock duration is 48 hours in seconds
+
+
+
const INITIATOR_TIME_LOCK_DUARTION: u64 = 172800;
 
- + ## Function `initialize` -Initializes the atomic bridge by setting up necessary configurations. +Initializes the bridge configuration with Aptos framework as the bridge operator. @param aptos_framework The signer representing the Aptos framework. -
public fun initialize(aptos_framework: &signer)
+
public fun initialize(_aptos_framework: &signer)
 
@@ -2001,9 +1517,8 @@ Initializes the atomic bridge by setting up necessary configurations. Implementation -
public fun initialize(aptos_framework: &signer) {
-    atomic_bridge_configuration::initialize(aptos_framework);
-    atomic_bridge_store::initialize(aptos_framework);
+
public fun initialize(_aptos_framework: &signer) {
+   abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2011,17 +1526,18 @@ Initializes the atomic bridge by setting up necessary configurations. - + -## Function `store_aptos_coin_burn_cap` +## Function `update_bridge_operator` -Stores the burn capability for AptosCoin, converting to a fungible asset reference if the feature is enabled. +Updates the bridge operator, requiring governance validation. @param aptos_framework The signer representing the Aptos framework. -@param burn_cap The burn capability for AptosCoin. +@param new_operator The new address to be set as the bridge operator. +@abort If the current operator is the same as the new operator. -
public fun store_aptos_coin_burn_cap(aptos_framework: &signer, burn_cap: coin::BurnCapability<aptos_coin::AptosCoin>)
+
public fun update_bridge_operator(_aptos_framework: &signer, _new_operator: address)
 
@@ -2030,14 +1546,9 @@ Stores the burn capability for AptosCoin, converting to a fungible asset referen Implementation -
public fun store_aptos_coin_burn_cap(aptos_framework: &signer, burn_cap: BurnCapability<AptosCoin>) {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    if (features::operations_default_to_fa_apt_store_enabled()) {
-        let burn_ref = coin::convert_and_take_paired_burn_ref(burn_cap);
-        move_to(aptos_framework, AptosFABurnCapabilities { burn_ref });
-    } else {
-        move_to(aptos_framework, AptosCoinBurnCapability { burn_cap })
-    }
+
public fun update_bridge_operator(_aptos_framework: &signer, _new_operator: address
+) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2045,17 +1556,13 @@ Stores the burn capability for AptosCoin, converting to a fungible asset referen - - -## Function `store_aptos_coin_mint_cap` + -Stores the mint capability for AptosCoin. +## Function `set_initiator_time_lock_duration` -@param aptos_framework The signer representing the Aptos framework. -@param mint_cap The mint capability for AptosCoin. -
public fun store_aptos_coin_mint_cap(aptos_framework: &signer, mint_cap: coin::MintCapability<aptos_coin::AptosCoin>)
+
public fun set_initiator_time_lock_duration(_aptos_framework: &signer, _time_lock: u64)
 
@@ -2064,9 +1571,9 @@ Stores the mint capability for AptosCoin. Implementation -
public fun store_aptos_coin_mint_cap(aptos_framework: &signer, mint_cap: MintCapability<AptosCoin>) {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    move_to(aptos_framework, AptosCoinMintCapability { mint_cap })
+
public fun set_initiator_time_lock_duration(_aptos_framework: &signer, _time_lock: u64
+) {
+   abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2074,18 +1581,39 @@ Stores the mint capability for AptosCoin. - + -## Function `mint` +## Function `set_counterparty_time_lock_duration` -Mints a specified amount of AptosCoin to a recipient's address. -@param recipient The address of the recipient to mint coins to. -@param amount The amount of AptosCoin to mint. -@abort If the mint capability is not available. + +
public fun set_counterparty_time_lock_duration(_aptos_framework: &signer, _time_lock: u64)
+
+ + + +
+Implementation + + +
public fun set_counterparty_time_lock_duration(_aptos_framework: &signer, _time_lock: u64
+) {
+    abort EATOMIC_BRIDGE_DISABLED
+}
+
+ + + +
+ + + +## Function `initiator_timelock_duration` + -
public(friend) fun mint(recipient: address, amount: u64)
+
#[view]
+public fun initiator_timelock_duration(): u64
 
@@ -2094,13 +1622,33 @@ Mints a specified amount of AptosCoin to a recipient's address. Implementation -
public(friend) fun mint(recipient: address, amount: u64) acquires AptosCoinMintCapability {
-    assert!(features::abort_atomic_bridge_enabled(), EATOMIC_BRIDGE_NOT_ENABLED);
+
public fun initiator_timelock_duration() : u64 {
+    abort EATOMIC_BRIDGE_DISABLED
+}
+
+ + + + + + + +## Function `counterparty_timelock_duration` + + - coin::deposit(recipient, coin::mint( - amount, - &borrow_global<AptosCoinMintCapability>(@aptos_framework).mint_cap - )); +
#[view]
+public fun counterparty_timelock_duration(): u64
+
+ + + +
+Implementation + + +
public fun counterparty_timelock_duration() : u64 {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2108,18 +1656,17 @@ Mints a specified amount of AptosCoin to a recipient's address.
- + -## Function `burn` +## Function `bridge_operator` -Burns a specified amount of AptosCoin from an address. +Retrieves the address of the current bridge operator. -@param from The address from which to burn AptosCoin. -@param amount The amount of AptosCoin to burn. -@abort If the burn capability is not available. +@return The address of the current bridge operator. -
public(friend) fun burn(from: address, amount: u64)
+
#[view]
+public fun bridge_operator(): address
 
@@ -2128,14 +1675,37 @@ Burns a specified amount of AptosCoin from an address. Implementation -
public(friend) fun burn(from: address, amount: u64) acquires AptosCoinBurnCapability {
-    assert!(features::abort_atomic_bridge_enabled(), EATOMIC_BRIDGE_NOT_ENABLED);
+
public fun bridge_operator(): address {
+    abort EATOMIC_BRIDGE_DISABLED
+}
+
+ + + + + + + +## Function `assert_is_caller_operator` + +Asserts that the caller is the current bridge operator. + +@param caller The signer whose authority is being checked. +@abort If the caller is not the current bridge operator. + + +
public(friend) fun assert_is_caller_operator(_caller: &signer)
+
+ + + +
+Implementation + - coin::burn_from( - from, - amount, - &borrow_global<AptosCoinBurnCapability>(@aptos_framework).burn_cap, - ); +
public(friend) fun assert_is_caller_operator(_caller: &signer
+) {
+   abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2155,6 +1725,7 @@ Burns a specified amount of AptosCoin from an address. - [Struct `BridgeTransferCompletedEvent`](#0x1_atomic_bridge_counterparty_BridgeTransferCompletedEvent) - [Struct `BridgeTransferCancelledEvent`](#0x1_atomic_bridge_counterparty_BridgeTransferCancelledEvent) - [Resource `BridgeCounterpartyEvents`](#0x1_atomic_bridge_counterparty_BridgeCounterpartyEvents) +- [Constants](#@Constants_0) - [Function `initialize`](#0x1_atomic_bridge_counterparty_initialize) - [Function `lock_bridge_transfer_assets`](#0x1_atomic_bridge_counterparty_lock_bridge_transfer_assets) - [Function `complete_bridge_transfer`](#0x1_atomic_bridge_counterparty_complete_bridge_transfer) @@ -2162,10 +1733,6 @@ Burns a specified amount of AptosCoin from an address.
use 0x1::account;
-use 0x1::atomic_bridge;
-use 0x1::atomic_bridge_configuration;
-use 0x1::atomic_bridge_store;
-use 0x1::ethereum;
 use 0x1::event;
 
@@ -2334,6 +1901,20 @@ This struct will store the event handles for bridge events.
+ + +## Constants + + + + + + +
const EATOMIC_BRIDGE_DISABLED: u64 = 198461;
+
+ + + ## Function `initialize` @@ -2379,7 +1960,7 @@ Locks assets for a bridge transfer by the initiator. @abort If the caller is not the bridge operator. -
public entry fun lock_bridge_transfer_assets(caller: &signer, initiator: vector<u8>, bridge_transfer_id: vector<u8>, hash_lock: vector<u8>, recipient: address, amount: u64)
+
public entry fun lock_bridge_transfer_assets(_caller: &signer, _initiator: vector<u8>, _bridge_transfer_id: vector<u8>, _hash_lock: vector<u8>, _recipient: address, _amount: u64)
 
@@ -2389,40 +1970,14 @@ Locks assets for a bridge transfer by the initiator.
public entry fun lock_bridge_transfer_assets (
-    caller: &signer,
-    initiator: vector<u8>,
-    bridge_transfer_id: vector<u8>,
-    hash_lock: vector<u8>,
-    recipient: address,
-    amount: u64
-) acquires BridgeCounterpartyEvents {
-    atomic_bridge_configuration::assert_is_caller_operator(caller);
-    let ethereum_address = ethereum::ethereum_address_no_eip55(initiator);
-    let time_lock = atomic_bridge_configuration::counterparty_timelock_duration();
-    let details = atomic_bridge_store::create_details(
-        ethereum_address,
-        recipient,
-        amount,
-        hash_lock,
-        time_lock
-    );
-
-    // bridge_store::add_counterparty(bridge_transfer_id, details);
-    atomic_bridge_store::add(bridge_transfer_id, details);
-
-    let bridge_events = borrow_global_mut<BridgeCounterpartyEvents>(@aptos_framework);
-
-    event::emit_event(
-        &mut bridge_events.bridge_transfer_locked_events,
-        BridgeTransferLockedEvent {
-            bridge_transfer_id,
-            initiator,
-            recipient,
-            amount,
-            hash_lock,
-            time_lock,
-        },
-    );
+    _caller: &signer,
+    _initiator: vector<u8>,
+    _bridge_transfer_id: vector<u8>,
+    _hash_lock: vector<u8>,
+    _recipient: address,
+    _amount: u64
+) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2441,7 +1996,7 @@ Completes a bridge transfer by revealing the pre-image. @abort If the caller is not the bridge operator or the hash lock validation fails. -
public entry fun complete_bridge_transfer(bridge_transfer_id: vector<u8>, pre_image: vector<u8>)
+
public entry fun complete_bridge_transfer(_bridge_transfer_id: vector<u8>, _pre_image: vector<u8>)
 
@@ -2451,25 +2006,10 @@ Completes a bridge transfer by revealing the pre-image.
public entry fun complete_bridge_transfer (
-    bridge_transfer_id: vector<u8>,
-    pre_image: vector<u8>,
-) acquires BridgeCounterpartyEvents {
-    let (recipient, amount) = atomic_bridge_store::complete_transfer<EthereumAddress, address>(
-        bridge_transfer_id,
-        create_hashlock(pre_image)
-    );
-
-    // Mint, fails silently
-    atomic_bridge::mint(recipient, amount);
-
-    let bridge_counterparty_events = borrow_global_mut<BridgeCounterpartyEvents>(@aptos_framework);
-    event::emit_event(
-        &mut bridge_counterparty_events.bridge_transfer_completed_events,
-        BridgeTransferCompletedEvent {
-            bridge_transfer_id,
-            pre_image,
-        },
-    );
+    _bridge_transfer_id: vector<u8>,
+    _pre_image: vector<u8>,
+) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2488,7 +2028,7 @@ Aborts a bridge transfer if the time lock has expired. @abort If the caller is not the bridge operator or if the time lock has not expired. -
public entry fun abort_bridge_transfer(caller: &signer, bridge_transfer_id: vector<u8>)
+
public entry fun abort_bridge_transfer(_caller: &signer, _bridge_transfer_id: vector<u8>)
 
@@ -2498,20 +2038,10 @@ Aborts a bridge transfer if the time lock has expired.
public entry fun abort_bridge_transfer (
-    caller: &signer,
-    bridge_transfer_id: vector<u8>
-) acquires BridgeCounterpartyEvents {
-    atomic_bridge_configuration::assert_is_caller_operator(caller);
-
-    atomic_bridge_store::cancel_transfer<EthereumAddress, address>(bridge_transfer_id);
-
-    let bridge_counterparty_events = borrow_global_mut<BridgeCounterpartyEvents>(@aptos_framework);
-    event::emit_event(
-        &mut bridge_counterparty_events.bridge_transfer_cancelled_events,
-        BridgeTransferCancelledEvent {
-            bridge_transfer_id,
-        },
-    );
+    _caller: &signer,
+    _bridge_transfer_id: vector<u8>
+) {
+   abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2531,19 +2061,14 @@ Aborts a bridge transfer if the time lock has expired. - [Struct `BridgeTransferCompletedEvent`](#0x1_atomic_bridge_initiator_BridgeTransferCompletedEvent) - [Struct `BridgeTransferRefundedEvent`](#0x1_atomic_bridge_initiator_BridgeTransferRefundedEvent) - [Resource `BridgeInitiatorEvents`](#0x1_atomic_bridge_initiator_BridgeInitiatorEvents) +- [Constants](#@Constants_0) - [Function `initialize`](#0x1_atomic_bridge_initiator_initialize) - [Function `initiate_bridge_transfer`](#0x1_atomic_bridge_initiator_initiate_bridge_transfer) - [Function `complete_bridge_transfer`](#0x1_atomic_bridge_initiator_complete_bridge_transfer) - [Function `refund_bridge_transfer`](#0x1_atomic_bridge_initiator_refund_bridge_transfer) -
use 0x1::account;
-use 0x1::atomic_bridge;
-use 0x1::atomic_bridge_configuration;
-use 0x1::atomic_bridge_store;
-use 0x1::ethereum;
-use 0x1::event;
-use 0x1::signer;
+
use 0x1::event;
 
@@ -2708,6 +2233,20 @@ This struct will store the event handles for bridge events. + + +## Constants + + + + + + +
const EATOMIC_BRIDGE_DISABLED: u64 = 198461;
+
+ + + ## Function `initialize` @@ -2715,7 +2254,7 @@ This struct will store the event handles for bridge events. Initializes the module and stores the EventHandles in the resource. -
public fun initialize(aptos_framework: &signer)
+
public fun initialize(_aptos_framework: &signer)
 
@@ -2724,12 +2263,8 @@ Initializes the module and stores the EventHandles in the resource. Implementation -
public fun initialize(aptos_framework: &signer) {
-    move_to(aptos_framework, BridgeInitiatorEvents {
-        bridge_transfer_initiated_events: account::new_event_handle<BridgeTransferInitiatedEvent>(aptos_framework),
-        bridge_transfer_completed_events: account::new_event_handle<BridgeTransferCompletedEvent>(aptos_framework),
-        bridge_transfer_refunded_events: account::new_event_handle<BridgeTransferRefundedEvent>(aptos_framework),
-    });
+
public fun initialize(_aptos_framework: &signer) {
+
 }
 
@@ -2746,7 +2281,7 @@ Anyone can initiate a bridge transfer from the source chain The amount is burnt from the initiator -
public entry fun initiate_bridge_transfer(initiator: &signer, recipient: vector<u8>, hash_lock: vector<u8>, amount: u64)
+
public entry fun initiate_bridge_transfer(_initiator: &signer, _recipient: vector<u8>, _hash_lock: vector<u8>, _amount: u64)
 
@@ -2756,39 +2291,12 @@ The amount is burnt from the initiator
public entry fun initiate_bridge_transfer(
-    initiator: &signer,
-    recipient: vector<u8>,
-    hash_lock: vector<u8>,
-    amount: u64
-) acquires BridgeInitiatorEvents {
-    let ethereum_address = ethereum::ethereum_address_no_eip55(recipient);
-    let initiator_address = signer::address_of(initiator);
-    let time_lock = atomic_bridge_configuration::initiator_timelock_duration();
-
-    let details =
-        atomic_bridge_store::create_details(
-            initiator_address,
-            ethereum_address, amount,
-            hash_lock,
-            time_lock
-        );
-
-    let bridge_transfer_id = bridge_transfer_id(&details);
-    atomic_bridge_store::add(bridge_transfer_id, details);
-    atomic_bridge::burn(initiator_address, amount);
-
-    let bridge_initiator_events = borrow_global_mut<BridgeInitiatorEvents>(@aptos_framework);
-    event::emit_event(
-        &mut bridge_initiator_events.bridge_transfer_initiated_events,
-        BridgeTransferInitiatedEvent {
-            bridge_transfer_id,
-            initiator: initiator_address,
-            recipient,
-            amount,
-            hash_lock,
-            time_lock
-        },
-    );
+    _initiator: &signer,
+    _recipient: vector<u8>,
+    _hash_lock: vector<u8>,
+    _amount: u64
+) {
+    abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2803,7 +2311,7 @@ The amount is burnt from the initiator Bridge operator can complete the transfer -
public entry fun complete_bridge_transfer(caller: &signer, bridge_transfer_id: vector<u8>, pre_image: vector<u8>)
+
public entry fun complete_bridge_transfer(_caller: &signer, _bridge_transfer_id: vector<u8>, _pre_image: vector<u8>)
 
@@ -2813,21 +2321,11 @@ Bridge operator can complete the transfer
public entry fun complete_bridge_transfer (
-    caller: &signer,
-    bridge_transfer_id: vector<u8>,
-    pre_image: vector<u8>,
-) acquires BridgeInitiatorEvents {
-    assert_is_caller_operator(caller);
-    let (_, _) = atomic_bridge_store::complete_transfer<address, EthereumAddress>(bridge_transfer_id, create_hashlock(pre_image));
-
-    let bridge_initiator_events = borrow_global_mut<BridgeInitiatorEvents>(@aptos_framework);
-    event::emit_event(
-        &mut bridge_initiator_events.bridge_transfer_completed_events,
-        BridgeTransferCompletedEvent {
-            bridge_transfer_id,
-            pre_image,
-        },
-    );
+    _caller: &signer,
+    _bridge_transfer_id: vector<u8>,
+    _pre_image: vector<u8>,
+) {
+   abort EATOMIC_BRIDGE_DISABLED
 }
 
@@ -2842,7 +2340,7 @@ Bridge operator can complete the transfer Anyone can refund the transfer on the source chain once time lock has passed -
public entry fun refund_bridge_transfer(_caller: &signer, bridge_transfer_id: vector<u8>)
+
public entry fun refund_bridge_transfer(_caller: &signer, _bridge_transfer_id: vector<u8>)
 
@@ -2853,18 +2351,9 @@ Anyone can refund the transfer on the source chain once time lock has passed
public entry fun refund_bridge_transfer (
     _caller: &signer,
-    bridge_transfer_id: vector<u8>,
-) acquires BridgeInitiatorEvents {
-    let (receiver, amount) = atomic_bridge_store::cancel_transfer<address, EthereumAddress>(bridge_transfer_id);
-    atomic_bridge::mint(receiver, amount);
-
-    let bridge_initiator_events = borrow_global_mut<BridgeInitiatorEvents>(@aptos_framework);
-    event::emit_event(
-        &mut bridge_initiator_events.bridge_transfer_refunded_events,
-        BridgeTransferRefundedEvent {
-            bridge_transfer_id,
-        },
-    );
+    _bridge_transfer_id: vector<u8>,
+) {
+   abort EATOMIC_BRIDGE_DISABLED
 }
 
diff --git a/aptos-move/framework/aptos-framework/doc/native_bridge.md b/aptos-move/framework/aptos-framework/doc/native_bridge.md index bc7c86d56ef71..49295ee9ff0ba 100644 --- a/aptos-move/framework/aptos-framework/doc/native_bridge.md +++ b/aptos-move/framework/aptos-framework/doc/native_bridge.md @@ -59,20 +59,12 @@ - [Function `test_normalize_u64_to_32_bytes_helper`](#0x1_native_bridge_test_normalize_u64_to_32_bytes_helper) -
use 0x1::account;
-use 0x1::aptos_coin;
-use 0x1::aptos_hash;
-use 0x1::bcs;
+
use 0x1::aptos_coin;
 use 0x1::coin;
 use 0x1::ethereum;
 use 0x1::event;
-use 0x1::features;
 use 0x1::fungible_asset;
-use 0x1::signer;
 use 0x1::smart_table;
-use 0x1::system_addresses;
-use 0x1::timestamp;
-use 0x1::vector;
 
@@ -804,7 +796,7 @@ Details on the outbound transfer Initializes the module and stores the EventHandles in the resource. -
public fun initialize(aptos_framework: &signer)
+
public fun initialize(_aptos_framework: &signer)
 
@@ -813,59 +805,8 @@ Initializes the module and stores the EventHandles in the resource. Implementation -
public fun initialize(aptos_framework: &signer) {
-    system_addresses::assert_aptos_framework(aptos_framework);
+
public fun initialize(_aptos_framework: &signer) {
 
-    let bridge_config = BridgeConfig {
-        bridge_relayer: signer::address_of(aptos_framework),
-        insurance_fund: signer::address_of(aptos_framework),
-        insurance_budget_divider: 4,
-        bridge_fee: 40_000_000_000,
-    };
-    move_to(aptos_framework, bridge_config);
-
-    // Ensure the nonce is not already initialized
-    assert!(
-        !exists<Nonce>(signer::address_of(aptos_framework)),
-        2
-    );
-
-    // Create the Nonce resource with an initial value of 0
-    move_to<Nonce>(aptos_framework, Nonce {
-        value: 0
-    });
-
-
-    move_to(aptos_framework, BridgeEvents {
-        bridge_transfer_initiated_events: account::new_event_handle<BridgeTransferInitiatedEvent>(aptos_framework),
-        bridge_transfer_completed_events: account::new_event_handle<BridgeTransferCompletedEvent>(aptos_framework),
-    });
-    system_addresses::assert_aptos_framework(aptos_framework);
-
-    let outbound_rate_limit_budget = OutboundRateLimitBudget {
-        day: smart_table::new(),
-    };
-
-    move_to(aptos_framework, outbound_rate_limit_budget);
-
-
-    let inbound_rate_limit_budget = InboundRateLimitBudget {
-        day: smart_table::new(),
-    };
-
-    move_to(aptos_framework, inbound_rate_limit_budget);
-
-    let nonces_to_details = SmartTableWrapper<u64, OutboundTransfer> {
-        inner: smart_table::new(),
-    };
-
-    move_to(aptos_framework, nonces_to_details);
-
-    let ids_to_inbound_nonces = SmartTableWrapper<vector<u8>, u64> {
-        inner: smart_table::new(),
-    };
-
-    move_to(aptos_framework, ids_to_inbound_nonces);
 }
 
@@ -888,7 +829,7 @@ How BCS works: https://github.com/zefchain/bcs?tab=readme-ov-file#booleans-and-i [0x00, 0x00, ..., 0x00, 0x12, 0x34, 0x56, 0x78, 0xab, 0xcd, 0xef, 0x00] -
public(friend) fun normalize_u64_to_32_bytes(value: &u64): vector<u8>
+
public(friend) fun normalize_u64_to_32_bytes(_value: &u64): vector<u8>
 
@@ -897,11 +838,8 @@ How BCS works: https://github.com/zefchain/bcs?tab=readme-ov-file#booleans-and-i Implementation -
public(friend) fun normalize_u64_to_32_bytes(value: &u64): vector<u8> {
-    let r = bcs::to_bytes(&(*value as u256));
-    // BCS returns the bytes in reverse order, so we reverse the result.
-    vector::reverse(&mut r);
-    r
+
public(friend) fun normalize_u64_to_32_bytes(_value: &u64): vector<u8> {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -918,7 +856,7 @@ Checks if a bridge transfer ID is associated with an inbound nonce. @return true if the ID is associated with an existing inbound nonce, false otherwise. -
public(friend) fun is_inbound_nonce_set(bridge_transfer_id: vector<u8>): bool
+
public(friend) fun is_inbound_nonce_set(_bridge_transfer_id: vector<u8>): bool
 
@@ -927,9 +865,8 @@ Checks if a bridge transfer ID is associated with an inbound nonce. Implementation -
public(friend) fun is_inbound_nonce_set(bridge_transfer_id: vector<u8>): bool acquires SmartTableWrapper {
-    let table = borrow_global<SmartTableWrapper<vector<u8>, u64>>(@aptos_framework);
-    smart_table::contains(&table.inner, bridge_transfer_id)
+
public(friend) fun is_inbound_nonce_set(_bridge_transfer_id: vector<u8>): bool {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -951,7 +888,7 @@ Creates bridge transfer details with validation. @abort If the amount is zero or locks are invalid. -
public(friend) fun create_details(initiator: address, recipient: ethereum::EthereumAddress, amount: u64, nonce: u64): native_bridge::OutboundTransfer
+
public(friend) fun create_details(_initiator: address, _recipient: ethereum::EthereumAddress, _amount: u64, _nonce: u64): native_bridge::OutboundTransfer
 
@@ -960,24 +897,9 @@ Creates bridge transfer details with validation. Implementation -
public(friend) fun create_details(initiator: address, recipient: EthereumAddress, amount: u64, nonce: u64)
+
public(friend) fun create_details(_initiator: address, _recipient: EthereumAddress, _amount: u64, _nonce: u64)
     : OutboundTransfer {
-    assert!(amount > 0, EZERO_AMOUNT);
-
-    // Create a bridge transfer ID algorithmically
-    let combined_bytes = vector::empty<u8>();
-    vector::append(&mut combined_bytes, bcs::to_bytes(&initiator));
-    vector::append(&mut combined_bytes, bcs::to_bytes(&recipient));
-    vector::append(&mut combined_bytes, bcs::to_bytes(&amount));
-    vector::append(&mut combined_bytes, bcs::to_bytes(&nonce));
-    let bridge_transfer_id = keccak256(combined_bytes);
-
-    OutboundTransfer {
-        bridge_transfer_id,
-        initiator,
-        recipient,
-        amount,
-    }
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -995,7 +917,7 @@ Record details of an initiated transfer for quick lookup of details, mapping bri @param details The bridge transfer details -
public(friend) fun add(nonce: u64, details: native_bridge::OutboundTransfer)
+
public(friend) fun add(_nonce: u64, _details: native_bridge::OutboundTransfer)
 
@@ -1004,11 +926,8 @@ Record details of an initiated transfer for quick lookup of details, mapping bri Implementation -
public(friend) fun add(nonce: u64, details: OutboundTransfer) acquires SmartTableWrapper {
-    assert!(features::abort_native_bridge_enabled(), ENATIVE_BRIDGE_NOT_ENABLED);
-
-    let table = borrow_global_mut<SmartTableWrapper<u64, OutboundTransfer>>(@aptos_framework);
-    smart_table::add(&mut table.inner, nonce, details);
+
public(friend) fun add(_nonce: u64, _details: OutboundTransfer)  {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1026,7 +945,7 @@ Record details of a completed transfer, mapping bridge transfer ID to inbound no @param details The bridge transfer details -
public(friend) fun set_bridge_transfer_id_to_inbound_nonce(bridge_transfer_id: vector<u8>, inbound_nonce: u64)
+
public(friend) fun set_bridge_transfer_id_to_inbound_nonce(_bridge_transfer_id: vector<u8>, _inbound_nonce: u64)
 
@@ -1035,12 +954,8 @@ Record details of a completed transfer, mapping bridge transfer ID to inbound no Implementation -
public(friend) fun set_bridge_transfer_id_to_inbound_nonce(bridge_transfer_id: vector<u8>, inbound_nonce: u64) acquires SmartTableWrapper {
-    assert!(features::abort_native_bridge_enabled(), ENATIVE_BRIDGE_NOT_ENABLED);
-
-    assert_valid_bridge_transfer_id(&bridge_transfer_id);
-    let table = borrow_global_mut<SmartTableWrapper<vector<u8>, u64>>(@aptos_framework);
-    smart_table::add(&mut table.inner, bridge_transfer_id, inbound_nonce);
+
public(friend) fun set_bridge_transfer_id_to_inbound_nonce(_bridge_transfer_id: vector<u8>, _inbound_nonce: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1058,7 +973,7 @@ Asserts that the bridge transfer ID is valid. @abort If the ID is invalid. -
public(friend) fun assert_valid_bridge_transfer_id(bridge_transfer_id: &vector<u8>)
+
public(friend) fun assert_valid_bridge_transfer_id(_bridge_transfer_id: &vector<u8>)
 
@@ -1067,8 +982,8 @@ Asserts that the bridge transfer ID is valid. Implementation -
public(friend) fun assert_valid_bridge_transfer_id(bridge_transfer_id: &vector<u8>) {
-    assert!(vector::length(bridge_transfer_id) == 32, EINVALID_BRIDGE_TRANSFER_ID);
+
public(friend) fun assert_valid_bridge_transfer_id(_bridge_transfer_id: &vector<u8>) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1086,7 +1001,7 @@ Generates a unique outbound bridge transfer ID based on transfer details and non @return The generated bridge transfer ID. -
public(friend) fun bridge_transfer_id(initiator: address, recipient: ethereum::EthereumAddress, amount: u64, nonce: u64): vector<u8>
+
public(friend) fun bridge_transfer_id(_initiator: address, _recipient: ethereum::EthereumAddress, _amount: u64, _nonce: u64): vector<u8>
 
@@ -1095,19 +1010,8 @@ Generates a unique outbound bridge transfer ID based on transfer details and non Implementation -
public(friend) fun bridge_transfer_id(initiator: address, recipient: EthereumAddress, amount: u64, nonce: u64) : vector<u8> {
-    // Serialize each param
-    let initiator_bytes = bcs::to_bytes<address>(&initiator);
-    let recipient_bytes = ethereum::get_inner_ethereum_address(recipient);
-    let amount_bytes = normalize_u64_to_32_bytes(&amount);
-    let nonce_bytes = normalize_u64_to_32_bytes(&nonce);
-    //Contatenate then hash and return bridge transfer ID
-    let combined_bytes = vector::empty<u8>();
-    vector::append(&mut combined_bytes, initiator_bytes);
-    vector::append(&mut combined_bytes, recipient_bytes);
-    vector::append(&mut combined_bytes, amount_bytes);
-    vector::append(&mut combined_bytes, nonce_bytes);
-    keccak256(combined_bytes)
+
public(friend) fun bridge_transfer_id(_initiator: address, _recipient: EthereumAddress, _amount: u64, _nonce: u64) : vector<u8> {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1134,8 +1038,8 @@ Retrieves the address of the current bridge relayer. Implementation -
public fun bridge_relayer(): address acquires BridgeConfig {
-    borrow_global_mut<BridgeConfig>(@aptos_framework).bridge_relayer
+
public fun bridge_relayer(): address {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1162,8 +1066,8 @@ Retrieves the address of the current insurance fund. Implementation -
public fun insurance_fund(): address acquires BridgeConfig {
-    borrow_global_mut<BridgeConfig>(@aptos_framework).insurance_fund
+
public fun insurance_fund(): address {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1190,8 +1094,8 @@ Retrieves the current insurance budget divider. Implementation -
public fun insurance_budget_divider(): u64 acquires BridgeConfig {
-    borrow_global_mut<BridgeConfig>(@aptos_framework).insurance_budget_divider
+
public fun insurance_budget_divider(): u64 {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1218,8 +1122,8 @@ Retrieves the current bridge fee. Implementation -
public fun bridge_fee(): u64 acquires BridgeConfig {
-    borrow_global_mut<BridgeConfig>(@aptos_framework).bridge_fee
+
public fun bridge_fee(): u64 {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1238,7 +1142,7 @@ Gets the bridge transfer details (get_bridge_transfer_details_from_nonce(nonce: u64): native_bridge::OutboundTransfer +public fun get_bridge_transfer_details_from_nonce(_nonce: u64): native_bridge::OutboundTransfer
@@ -1247,14 +1151,8 @@ Gets the bridge transfer details (get_bridge_transfer_details_from_nonce(nonce: u64): OutboundTransfer acquires SmartTableWrapper { - let table = borrow_global<SmartTableWrapper<u64, OutboundTransfer>>(@aptos_framework); - - // Check if the nonce exists in the table - assert!(smart_table::contains(&table.inner, nonce), ENONCE_NOT_FOUND); - - // If it exists, return the associated `OutboundTransfer` details - *smart_table::borrow(&table.inner, nonce) +
public fun get_bridge_transfer_details_from_nonce(_nonce: u64): OutboundTransfer {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1273,7 +1171,7 @@ Gets inbound nonce from bridge_transfer_id
#[view]
-public fun get_inbound_nonce_from_bridge_transfer_id(bridge_transfer_id: vector<u8>): u64
+public fun get_inbound_nonce_from_bridge_transfer_id(_bridge_transfer_id: vector<u8>): u64
 
@@ -1282,14 +1180,8 @@ Gets inbound nonce from bridge_transfer_id Implementation -
public fun get_inbound_nonce_from_bridge_transfer_id(bridge_transfer_id: vector<u8>): u64 acquires SmartTableWrapper {
-    let table = borrow_global<SmartTableWrapper<vector<u8>, u64>>(@aptos_framework);
-
-     // Check if the nonce exists in the table
-    assert!(smart_table::contains(&table.inner, bridge_transfer_id), ENONCE_NOT_FOUND);
-
-    // If it exists, return the associated nonce
-    *smart_table::borrow(&table.inner, bridge_transfer_id)
+
public fun get_inbound_nonce_from_bridge_transfer_id(_bridge_transfer_id: vector<u8>): u64 {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1313,10 +1205,8 @@ Increment and get the current nonce Implementation -
fun increment_and_get_nonce(): u64 acquires Nonce {
-    let nonce_ref = borrow_global_mut<Nonce>(@aptos_framework);
-    nonce_ref.value = nonce_ref.value + 1;
-    nonce_ref.value
+
fun increment_and_get_nonce(): u64 {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1334,7 +1224,7 @@ Stores the burn capability for AptosCoin, converting to a fungible asset referen @param burn_cap The burn capability for AptosCoin. -
public fun store_aptos_coin_burn_cap(aptos_framework: &signer, burn_cap: coin::BurnCapability<aptos_coin::AptosCoin>)
+
public fun store_aptos_coin_burn_cap(_aptos_framework: &signer, _burn_cap: coin::BurnCapability<aptos_coin::AptosCoin>)
 
@@ -1343,14 +1233,8 @@ Stores the burn capability for AptosCoin, converting to a fungible asset referen Implementation -
public fun store_aptos_coin_burn_cap(aptos_framework: &signer, burn_cap: BurnCapability<AptosCoin>) {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    if (features::operations_default_to_fa_apt_store_enabled()) {
-        let burn_ref = coin::convert_and_take_paired_burn_ref(burn_cap);
-        move_to(aptos_framework, AptosFABurnCapabilities { burn_ref });
-    } else {
-        move_to(aptos_framework, AptosCoinBurnCapability { burn_cap })
-    }
+
public fun store_aptos_coin_burn_cap(_aptos_framework: &signer, _burn_cap: BurnCapability<AptosCoin>) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1368,7 +1252,7 @@ Stores the mint capability for AptosCoin. @param mint_cap The mint capability for AptosCoin. -
public fun store_aptos_coin_mint_cap(aptos_framework: &signer, mint_cap: coin::MintCapability<aptos_coin::AptosCoin>)
+
public fun store_aptos_coin_mint_cap(_aptos_framework: &signer, _mint_cap: coin::MintCapability<aptos_coin::AptosCoin>)
 
@@ -1377,9 +1261,8 @@ Stores the mint capability for AptosCoin. Implementation -
public fun store_aptos_coin_mint_cap(aptos_framework: &signer, mint_cap: MintCapability<AptosCoin>) {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    move_to(aptos_framework, AptosCoinMintCapability { mint_cap })
+
public fun store_aptos_coin_mint_cap(_aptos_framework: &signer, _mint_cap: MintCapability<AptosCoin>) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1398,7 +1281,7 @@ Mints a specified amount of AptosCoin to a recipient's address. @param amount The amount of AptosCoin to mint. -
public fun mint_to(aptos_framework: &signer, recipient: address, amount: u64)
+
public fun mint_to(_aptos_framework: &signer, _recipient: address, _amount: u64)
 
@@ -1407,9 +1290,8 @@ Mints a specified amount of AptosCoin to a recipient's address. Implementation -
public fun mint_to(aptos_framework: &signer, recipient: address, amount: u64) acquires AptosCoinMintCapability {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    mint_internal(recipient, amount);
+
public fun mint_to(_aptos_framework: &signer, _recipient: address, _amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1428,7 +1310,7 @@ Mints a specified amount of AptosCoin to a recipient's address. @abort If the mint capability is not available. -
public(friend) fun mint(recipient: address, amount: u64)
+
public(friend) fun mint(_recipient: address, _amount: u64)
 
@@ -1437,10 +1319,8 @@ Mints a specified amount of AptosCoin to a recipient's address. Implementation -
public(friend) fun mint(recipient: address, amount: u64) acquires AptosCoinMintCapability {
-    assert!(features::abort_native_bridge_enabled(), ENATIVE_BRIDGE_NOT_ENABLED);
-
-    mint_internal(recipient, amount);
+
public(friend) fun mint(_recipient: address, _amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1458,7 +1338,7 @@ Mints a specified amount of AptosCoin to a recipient's address. @param amount The amount of AptosCoin to mint. -
fun mint_internal(recipient: address, amount: u64)
+
fun mint_internal(_recipient: address, _amount: u64)
 
@@ -1467,11 +1347,8 @@ Mints a specified amount of AptosCoin to a recipient's address. Implementation -
fun mint_internal(recipient: address, amount: u64) acquires AptosCoinMintCapability {
-    coin::deposit(recipient, coin::mint(
-        amount,
-        &borrow_global<AptosCoinMintCapability>(@aptos_framework).mint_cap
-    ));
+
fun mint_internal(_recipient: address, _amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1491,7 +1368,7 @@ Burns a specified amount of AptosCoin from an address. @abort If the burn capability is not available. -
public fun burn_from(aptos_framework: &signer, from: address, amount: u64)
+
public fun burn_from(_aptos_framework: &signer, _from: address, _amount: u64)
 
@@ -1500,9 +1377,8 @@ Burns a specified amount of AptosCoin from an address. Implementation -
public fun burn_from(aptos_framework: &signer, from: address, amount: u64) acquires AptosCoinBurnCapability {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    burn_internal(from, amount);
+
public fun burn_from(_aptos_framework: &signer, _from: address, _amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1521,7 +1397,7 @@ Burns a specified amount of AptosCoin from an address. @abort If the burn capability is not available. -
public(friend) fun burn(from: address, amount: u64)
+
public(friend) fun burn(_from: address, _amount: u64)
 
@@ -1530,10 +1406,8 @@ Burns a specified amount of AptosCoin from an address. Implementation -
public(friend) fun burn(from: address, amount: u64) acquires AptosCoinBurnCapability {
-    assert!(features::abort_native_bridge_enabled(), ENATIVE_BRIDGE_NOT_ENABLED);
-
-    burn_internal(from, amount);
+
public(friend) fun burn(_from: address, _amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1551,7 +1425,7 @@ Burns a specified amount of AptosCoin from an address. @param amount The amount of AptosCoin to burn. -
fun burn_internal(from: address, amount: u64)
+
fun burn_internal(_from: address, _amount: u64)
 
@@ -1560,12 +1434,8 @@ Burns a specified amount of AptosCoin from an address. Implementation -
fun burn_internal(from: address, amount: u64) acquires AptosCoinBurnCapability {
-    coin::burn_from(
-        from,
-        amount,
-        &borrow_global<AptosCoinBurnCapability>(@aptos_framework).burn_cap,
-    );
+
fun burn_internal(_from: address, _amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1585,7 +1455,7 @@ The amount is burnt from the initiator and the module-level nonce is incremented @param amount The amount of assets to be locked. -
public entry fun initiate_bridge_transfer(initiator: &signer, recipient: vector<u8>, amount: u64)
+
public entry fun initiate_bridge_transfer(_initiator: &signer, _recipient: vector<u8>, _amount: u64)
 
@@ -1595,55 +1465,11 @@ The amount is burnt from the initiator and the module-level nonce is incremented
public entry fun initiate_bridge_transfer(
-    initiator: &signer,
-    recipient: vector<u8>,
-    amount: u64
-) acquires BridgeEvents, Nonce, AptosCoinBurnCapability, AptosCoinMintCapability, SmartTableWrapper, OutboundRateLimitBudget, BridgeConfig {
-    let initiator_address = signer::address_of(initiator);
-    let ethereum_address = ethereum::ethereum_address_20_bytes(recipient);
-
-    // Ensure the amount is enough for the bridge fee and charge for it
-    let new_amount = charge_bridge_fee(amount);
-
-    assert_outbound_rate_limit_budget_not_exceeded(new_amount);
-
-    // Increment and retrieve the nonce
-    let nonce = increment_and_get_nonce();
-
-    // Create bridge transfer details
-    let details = create_details(
-        initiator_address,
-        ethereum_address,
-        new_amount,
-        nonce
-    );
-
-    let bridge_transfer_id = bridge_transfer_id(
-        initiator_address,
-        ethereum_address,
-        new_amount,
-        nonce
-    );
-
-    // Add the transfer details to storage
-    add(nonce, details);
-
-    // Burn the amount from the initiator
-    burn_internal(initiator_address, amount);
-
-    let bridge_events = borrow_global_mut<BridgeEvents>(@aptos_framework);
-
-    // Emit an event with nonce
-    event::emit_event(
-         &mut bridge_events.bridge_transfer_initiated_events,
-        BridgeTransferInitiatedEvent {
-            bridge_transfer_id,
-            initiator: initiator_address,
-            recipient,
-            amount: new_amount,
-            nonce,
-        }
-    );
+    _initiator: &signer,
+    _recipient: vector<u8>,
+    _amount: u64
+) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1666,7 +1492,7 @@ Completes a bridge transfer on the destination chain. @abort If the caller is not the bridge relayer or the transfer has already been processed. -
public entry fun complete_bridge_transfer(caller: &signer, bridge_transfer_id: vector<u8>, initiator: vector<u8>, recipient: address, amount: u64, nonce: u64)
+
public entry fun complete_bridge_transfer(_caller: &signer, _bridge_transfer_id: vector<u8>, _initiator: vector<u8>, _recipient: address, _amount: u64, _nonce: u64)
 
@@ -1676,53 +1502,14 @@ Completes a bridge transfer on the destination chain.
public entry fun complete_bridge_transfer(
-    caller: &signer,
-    bridge_transfer_id: vector<u8>,
-    initiator: vector<u8>,
-    recipient: address,
-    amount: u64,
-    nonce: u64
-) acquires BridgeEvents, AptosCoinMintCapability, SmartTableWrapper, InboundRateLimitBudget, BridgeConfig {
-    // Ensure the caller is the bridge relayer
-    assert_is_caller_relayer(caller);
-    assert_inbound_rate_limit_budget_not_exceeded(amount);
-
-    // Check if the bridge transfer ID is already associated with an inbound nonce
-    let inbound_nonce_exists = is_inbound_nonce_set(bridge_transfer_id);
-    assert!(!inbound_nonce_exists, ETRANSFER_ALREADY_PROCESSED);
-    assert!(nonce > 0, EINVALID_NONCE);
-
-    // Validate the bridge_transfer_id by reconstructing the hash
-    let recipient_bytes = bcs::to_bytes(&recipient);
-    let amount_bytes = normalize_u64_to_32_bytes(&amount);
-    let nonce_bytes = normalize_u64_to_32_bytes(&nonce);
-
-    let combined_bytes = vector::empty<u8>();
-    vector::append(&mut combined_bytes, initiator);
-    vector::append(&mut combined_bytes, recipient_bytes);
-    vector::append(&mut combined_bytes, amount_bytes);
-    vector::append(&mut combined_bytes, nonce_bytes);
-
-    assert!(keccak256(combined_bytes) == bridge_transfer_id, EINVALID_BRIDGE_TRANSFER_ID);
-
-    // Record the transfer as completed by associating the bridge_transfer_id with the inbound nonce
-    set_bridge_transfer_id_to_inbound_nonce(bridge_transfer_id, nonce);
-
-    // Mint to the recipient
-    mint_internal(recipient, amount);
-
-    // Emit the event
-    let bridge_events = borrow_global_mut<BridgeEvents>(@aptos_framework);
-    event::emit_event(
-        &mut bridge_events.bridge_transfer_completed_events,
-        BridgeTransferCompletedEvent {
-            bridge_transfer_id,
-            initiator,
-            recipient,
-            amount,
-            nonce,
-        },
-    );
+    _caller: &signer,
+    _bridge_transfer_id: vector<u8>,
+    _initiator: vector<u8>,
+    _recipient: address,
+    _amount: u64,
+    _nonce: u64
+)  {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1741,7 +1528,7 @@ Charge bridge fee to the initiate bridge transfer. @return The new amount after deducting the bridge fee. -
fun charge_bridge_fee(amount: u64): u64
+
fun charge_bridge_fee(_amount: u64): u64
 
@@ -1750,13 +1537,8 @@ Charge bridge fee to the initiate bridge transfer. Implementation -
fun charge_bridge_fee(amount: u64) : u64 acquires AptosCoinMintCapability, BridgeConfig {
-    let bridge_fee = bridge_fee();
-    let bridge_relayer = bridge_relayer();
-    assert!(amount > bridge_fee, EINVALID_AMOUNT);
-    let new_amount = amount - bridge_fee;
-    mint_internal(bridge_relayer, bridge_fee);
-    new_amount
+
fun charge_bridge_fee(_amount: u64): u64 {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1775,7 +1557,7 @@ Updates the bridge relayer, requiring governance validation. @abort If the current relayer is the same as the new relayer. -
public fun update_bridge_relayer(aptos_framework: &signer, new_relayer: address)
+
public fun update_bridge_relayer(_aptos_framework: &signer, _new_relayer: address)
 
@@ -1784,21 +1566,8 @@ Updates the bridge relayer, requiring governance validation. Implementation -
public fun update_bridge_relayer(aptos_framework: &signer, new_relayer: address
-)   acquires BridgeConfig {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    let bridge_config = borrow_global_mut<BridgeConfig>(@aptos_framework);
-    let old_relayer = bridge_config.bridge_relayer;
-    assert!(old_relayer != new_relayer, EINVALID_BRIDGE_RELAYER);
-
-    bridge_config.bridge_relayer = new_relayer;
-
-    event::emit(
-        BridgeConfigRelayerUpdated {
-            old_relayer,
-            new_relayer,
-        },
-    );
+
public fun update_bridge_relayer(_aptos_framework: &signer, _new_relayer: address) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1817,7 +1586,7 @@ Updates the bridge fee, requiring relayer validation. @abort If the new bridge fee is the same as the old bridge fee. -
public entry fun update_bridge_fee(relayer: &signer, new_bridge_fee: u64)
+
public entry fun update_bridge_fee(_relayer: &signer, _new_bridge_fee: u64)
 
@@ -1826,20 +1595,8 @@ Updates the bridge fee, requiring relayer validation. Implementation -
public entry fun update_bridge_fee(relayer: &signer, new_bridge_fee: u64
-) acquires BridgeConfig {
-    assert_is_caller_relayer(relayer);
-    let bridge_config = borrow_global_mut<BridgeConfig>(@aptos_framework);
-    let old_bridge_fee = bridge_config.bridge_fee;
-    assert!(old_bridge_fee != new_bridge_fee, ESAME_FEE);
-    bridge_config.bridge_fee = new_bridge_fee;
-
-    event::emit(
-        BridgeFeeChangedEvent {
-            old_bridge_fee,
-            new_bridge_fee,
-        },
-    );
+
public entry fun update_bridge_fee(_relayer: &signer, _new_bridge_fee: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1858,7 +1615,7 @@ Updates the insurance fund, requiring governance validation. @abort If the new insurance fund is the same as the old insurance fund. -
public entry fun update_insurance_fund(aptos_framework: &signer, new_insurance_fund: address)
+
public entry fun update_insurance_fund(_aptos_framework: &signer, _new_insurance_fund: address)
 
@@ -1867,20 +1624,8 @@ Updates the insurance fund, requiring governance validation. Implementation -
public entry fun update_insurance_fund(aptos_framework: &signer, new_insurance_fund: address
-) acquires BridgeConfig {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    let bridge_config = borrow_global_mut<BridgeConfig>(@aptos_framework);
-    let old_insurance_fund = bridge_config.insurance_fund;
-    assert!(old_insurance_fund != new_insurance_fund, EINVALID_VALUE);
-    bridge_config.insurance_fund = new_insurance_fund;
-
-    event::emit(
-        BridgeInsuranceFundChangedEvent {
-            old_insurance_fund,
-            new_insurance_fund,
-        },
-    );
+
public entry fun update_insurance_fund(_aptos_framework: &signer, _new_insurance_fund: address) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1899,7 +1644,7 @@ Updates the insurance budget divider, requiring governance validation. @abort If the new insurance budget divider is the same as the old insurance budget divider. -
public entry fun update_insurance_budget_divider(aptos_framework: &signer, new_insurance_budget_divider: u64)
+
public entry fun update_insurance_budget_divider(_aptos_framework: &signer, _new_insurance_budget_divider: u64)
 
@@ -1908,25 +1653,8 @@ Updates the insurance budget divider, requiring governance validation. Implementation -
public entry fun update_insurance_budget_divider(aptos_framework: &signer, new_insurance_budget_divider: u64
-) acquires BridgeConfig {
-    system_addresses::assert_aptos_framework(aptos_framework);
-    // Ensure the new insurance budget divider is greater than 1 and different from the old one
-    // Assumes symmetric Insurance Funds on both L1 and L2
-    assert!(new_insurance_budget_divider > 1, EINVALID_VALUE);
-
-    let bridge_config = borrow_global_mut<BridgeConfig>(@aptos_framework);
-    let old_insurance_budget_divider = bridge_config.insurance_budget_divider;
-    assert!(old_insurance_budget_divider != new_insurance_budget_divider, EINVALID_VALUE);
-
-    bridge_config.insurance_budget_divider = new_insurance_budget_divider;
-
-    event::emit(
-        BridgeInsuranceBudgetDividerChangedEvent {
-            old_insurance_budget_divider,
-            new_insurance_budget_divider,
-        },
-    );
+
public entry fun update_insurance_budget_divider(_aptos_framework: &signer, _new_insurance_budget_divider: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1944,7 +1672,7 @@ Asserts that the caller is the current bridge relayer. @abort If the caller is not the current bridge relayer. -
public(friend) fun assert_is_caller_relayer(caller: &signer)
+
public(friend) fun assert_is_caller_relayer(_caller: &signer)
 
@@ -1953,9 +1681,8 @@ Asserts that the caller is the current bridge relayer. Implementation -
public(friend) fun assert_is_caller_relayer(caller: &signer
-) acquires BridgeConfig {
-    assert!(borrow_global<BridgeConfig>(@aptos_framework).bridge_relayer == signer::address_of(caller), EINVALID_BRIDGE_RELAYER);
+
public(friend) fun assert_is_caller_relayer(_caller: &signer) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -1972,7 +1699,7 @@ Asserts that the rate limit budget is not exceeded. @param amount The amount to be transferred. -
fun assert_outbound_rate_limit_budget_not_exceeded(amount: u64)
+
fun assert_outbound_rate_limit_budget_not_exceeded(_amount: u64)
 
@@ -1981,16 +1708,8 @@ Asserts that the rate limit budget is not exceeded. Implementation -
fun assert_outbound_rate_limit_budget_not_exceeded(amount: u64) acquires OutboundRateLimitBudget, BridgeConfig {
-    let insurance_fund = borrow_global<BridgeConfig>(@aptos_framework).insurance_fund;
-    let insurance_budget_divider = borrow_global<BridgeConfig>(@aptos_framework).insurance_budget_divider;
-    let table = borrow_global_mut<OutboundRateLimitBudget>(@aptos_framework);
-
-    let day = timestamp::now_seconds() / 86400;
-    let current_budget = smart_table::borrow_mut_with_default(&mut table.day, day, 0);
-    smart_table::upsert(&mut table.day, day, *current_budget + amount);
-    let rate_limit = coin::balance<AptosCoin>(insurance_fund) / insurance_budget_divider;
-    assert!(*smart_table::borrow(&table.day, day) < rate_limit, ERATE_LIMIT_EXCEEDED);
+
fun assert_outbound_rate_limit_budget_not_exceeded(_amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -2007,7 +1726,7 @@ Asserts that the rate limit budget is not exceeded. @param amount The amount to be transferred. -
fun assert_inbound_rate_limit_budget_not_exceeded(amount: u64)
+
fun assert_inbound_rate_limit_budget_not_exceeded(_amount: u64)
 
@@ -2016,16 +1735,8 @@ Asserts that the rate limit budget is not exceeded. Implementation -
fun assert_inbound_rate_limit_budget_not_exceeded(amount: u64) acquires InboundRateLimitBudget, BridgeConfig {
-    let insurance_fund = borrow_global<BridgeConfig>(@aptos_framework).insurance_fund;
-    let insurance_budget_divider = borrow_global<BridgeConfig>(@aptos_framework).insurance_budget_divider;
-    let table = borrow_global_mut<InboundRateLimitBudget>(@aptos_framework);
-
-    let day = timestamp::now_seconds() / 86400;
-    let current_budget = smart_table::borrow_mut_with_default(&mut table.day, day, 0);
-    smart_table::upsert(&mut table.day, day, *current_budget + amount);
-    let rate_limit = coin::balance<AptosCoin>(insurance_fund) / insurance_budget_divider;
-    assert!(*smart_table::borrow(&table.day, day) < rate_limit, ERATE_LIMIT_EXCEEDED);
+
fun assert_inbound_rate_limit_budget_not_exceeded(_amount: u64) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
@@ -2040,7 +1751,7 @@ Asserts that the rate limit budget is not exceeded. Test serialization of u64 to 32 bytes -
fun test_normalize_u64_to_32_bytes_helper(x: u64, expected: vector<u8>)
+
fun test_normalize_u64_to_32_bytes_helper(_x: u64, _expected: vector<u8>)
 
@@ -2049,10 +1760,8 @@ Test serialization of u64 to 32 bytes Implementation -
fun test_normalize_u64_to_32_bytes_helper(x: u64, expected: vector<u8>) {
-    let r = normalize_u64_to_32_bytes(&x);
-    assert!(vector::length(&r) == 32, 0);
-    assert!(r == expected, 0);
+
fun test_normalize_u64_to_32_bytes_helper(_x: u64, _expected: vector<u8>) {
+    abort ENATIVE_BRIDGE_NOT_ENABLED
 }
 
diff --git a/aptos-move/framework/cached-packages/src/aptos_framework_sdk_builder.rs b/aptos-move/framework/cached-packages/src/aptos_framework_sdk_builder.rs index 4fc3a0b4fa1c4..cdb47a1e73427 100644 --- a/aptos-move/framework/cached-packages/src/aptos_framework_sdk_builder.rs +++ b/aptos-move/framework/cached-packages/src/aptos_framework_sdk_builder.rs @@ -286,22 +286,22 @@ pub enum EntryFunctionCall { /// @param bridge_transfer_id The unique identifier for the bridge transfer. /// @abort If the caller is not the bridge operator or if the time lock has not expired. AtomicBridgeCounterpartyAbortBridgeTransfer { - bridge_transfer_id: Vec, + _bridge_transfer_id: Vec, }, /// Bridge operator can complete the transfer AtomicBridgeInitiatorCompleteBridgeTransfer { - bridge_transfer_id: Vec, - pre_image: Vec, + _bridge_transfer_id: Vec, + _pre_image: Vec, }, /// Initiate a bridge transfer of ETH from Movement to the base layer /// Anyone can initiate a bridge transfer from the source chain /// The amount is burnt from the initiator AtomicBridgeInitiatorInitiateBridgeTransfer { - recipient: Vec, - hash_lock: Vec, - amount: u64, + _recipient: Vec, + _hash_lock: Vec, + _amount: u64, }, /// Locks assets for a bridge transfer by the initiator. @@ -315,16 +315,16 @@ pub enum EntryFunctionCall { /// @param amount The amount of assets to be locked. /// @abort If the caller is not the bridge operator. AtomicBridgeCounterpartyLockBridgeTransferAssets { - initiator: Vec, - bridge_transfer_id: Vec, - hash_lock: Vec, - recipient: AccountAddress, - amount: u64, + _initiator: Vec, + _bridge_transfer_id: Vec, + _hash_lock: Vec, + _recipient: AccountAddress, + _amount: u64, }, /// Anyone can refund the transfer on the source chain once time lock has passed AtomicBridgeInitiatorRefundBridgeTransfer { - bridge_transfer_id: Vec, + _bridge_transfer_id: Vec, }, /// Same as `publish_package` but as an entry function which can be called as a transaction. Because @@ -724,11 +724,11 @@ pub enum EntryFunctionCall { /// @param nonce The unique nonce for the transfer. /// @abort If the caller is not the bridge relayer or the transfer has already been processed. NativeBridgeCompleteBridgeTransfer { - bridge_transfer_id: Vec, - initiator: Vec, - recipient: AccountAddress, - amount: u64, - nonce: u64, + _bridge_transfer_id: Vec, + _initiator: Vec, + _recipient: AccountAddress, + _amount: u64, + _nonce: u64, }, /// Initiate a bridge transfer of MOVE from Movement to Ethereum @@ -738,8 +738,8 @@ pub enum EntryFunctionCall { /// @param recipient The address of the recipient on the Aptos blockchain. /// @param amount The amount of assets to be locked. NativeBridgeInitiateBridgeTransfer { - recipient: Vec, - amount: u64, + _recipient: Vec, + _amount: u64, }, /// Updates the bridge fee, requiring relayer validation. @@ -748,7 +748,7 @@ pub enum EntryFunctionCall { /// @param new_bridge_fee The new bridge fee to be set. /// @abort If the new bridge fee is the same as the old bridge fee. NativeBridgeUpdateBridgeFee { - new_bridge_fee: u64, + _new_bridge_fee: u64, }, /// Updates the insurance budget divider, requiring governance validation. @@ -757,7 +757,7 @@ pub enum EntryFunctionCall { /// @param new_insurance_budget_divider The new insurance budget divider to be set. /// @abort If the new insurance budget divider is the same as the old insurance budget divider. NativeBridgeUpdateInsuranceBudgetDivider { - new_insurance_budget_divider: u64, + _new_insurance_budget_divider: u64, }, /// Updates the insurance fund, requiring governance validation. @@ -766,7 +766,7 @@ pub enum EntryFunctionCall { /// @param new_insurance_fund The new insurance fund to be set. /// @abort If the new insurance fund is the same as the old insurance fund. NativeBridgeUpdateInsuranceFund { - new_insurance_fund: AccountAddress, + _new_insurance_fund: AccountAddress, }, /// Entry function that can be used to transfer, if allow_ungated_transfer is set true. @@ -1268,34 +1268,34 @@ impl EntryFunctionCall { proposal_id, should_pass, } => aptos_governance_vote(stake_pool, proposal_id, should_pass), - AtomicBridgeCounterpartyAbortBridgeTransfer { bridge_transfer_id } => { - atomic_bridge_counterparty_abort_bridge_transfer(bridge_transfer_id) - }, + AtomicBridgeCounterpartyAbortBridgeTransfer { + _bridge_transfer_id, + } => atomic_bridge_counterparty_abort_bridge_transfer(_bridge_transfer_id), AtomicBridgeInitiatorCompleteBridgeTransfer { - bridge_transfer_id, - pre_image, - } => atomic_bridge_initiator_complete_bridge_transfer(bridge_transfer_id, pre_image), + _bridge_transfer_id, + _pre_image, + } => atomic_bridge_initiator_complete_bridge_transfer(_bridge_transfer_id, _pre_image), AtomicBridgeInitiatorInitiateBridgeTransfer { - recipient, - hash_lock, - amount, - } => atomic_bridge_initiator_initiate_bridge_transfer(recipient, hash_lock, amount), + _recipient, + _hash_lock, + _amount, + } => atomic_bridge_initiator_initiate_bridge_transfer(_recipient, _hash_lock, _amount), AtomicBridgeCounterpartyLockBridgeTransferAssets { - initiator, - bridge_transfer_id, - hash_lock, - recipient, - amount, + _initiator, + _bridge_transfer_id, + _hash_lock, + _recipient, + _amount, } => atomic_bridge_counterparty_lock_bridge_transfer_assets( - initiator, - bridge_transfer_id, - hash_lock, - recipient, - amount, + _initiator, + _bridge_transfer_id, + _hash_lock, + _recipient, + _amount, ), - AtomicBridgeInitiatorRefundBridgeTransfer { bridge_transfer_id } => { - atomic_bridge_initiator_refund_bridge_transfer(bridge_transfer_id) - }, + AtomicBridgeInitiatorRefundBridgeTransfer { + _bridge_transfer_id, + } => atomic_bridge_initiator_refund_bridge_transfer(_bridge_transfer_id), CodePublishPackageTxn { metadata_serialized, code, @@ -1553,30 +1553,31 @@ impl EntryFunctionCall { approved, } => multisig_account_vote_transanction(multisig_account, sequence_number, approved), NativeBridgeCompleteBridgeTransfer { - bridge_transfer_id, - initiator, - recipient, - amount, - nonce, + _bridge_transfer_id, + _initiator, + _recipient, + _amount, + _nonce, } => native_bridge_complete_bridge_transfer( - bridge_transfer_id, - initiator, - recipient, - amount, - nonce, + _bridge_transfer_id, + _initiator, + _recipient, + _amount, + _nonce, ), - NativeBridgeInitiateBridgeTransfer { recipient, amount } => { - native_bridge_initiate_bridge_transfer(recipient, amount) - }, - NativeBridgeUpdateBridgeFee { new_bridge_fee } => { - native_bridge_update_bridge_fee(new_bridge_fee) + NativeBridgeInitiateBridgeTransfer { + _recipient, + _amount, + } => native_bridge_initiate_bridge_transfer(_recipient, _amount), + NativeBridgeUpdateBridgeFee { _new_bridge_fee } => { + native_bridge_update_bridge_fee(_new_bridge_fee) }, NativeBridgeUpdateInsuranceBudgetDivider { - new_insurance_budget_divider, - } => native_bridge_update_insurance_budget_divider(new_insurance_budget_divider), - NativeBridgeUpdateInsuranceFund { new_insurance_fund } => { - native_bridge_update_insurance_fund(new_insurance_fund) - }, + _new_insurance_budget_divider, + } => native_bridge_update_insurance_budget_divider(_new_insurance_budget_divider), + NativeBridgeUpdateInsuranceFund { + _new_insurance_fund, + } => native_bridge_update_insurance_fund(_new_insurance_fund), ObjectTransferCall { object, to } => object_transfer_call(object, to), ObjectCodeDeploymentPublish { metadata_serialized, @@ -2461,7 +2462,7 @@ pub fn aptos_governance_vote( /// @param bridge_transfer_id The unique identifier for the bridge transfer. /// @abort If the caller is not the bridge operator or if the time lock has not expired. pub fn atomic_bridge_counterparty_abort_bridge_transfer( - bridge_transfer_id: Vec, + _bridge_transfer_id: Vec, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -2473,14 +2474,14 @@ pub fn atomic_bridge_counterparty_abort_bridge_transfer( ), ident_str!("abort_bridge_transfer").to_owned(), vec![], - vec![bcs::to_bytes(&bridge_transfer_id).unwrap()], + vec![bcs::to_bytes(&_bridge_transfer_id).unwrap()], )) } /// Bridge operator can complete the transfer pub fn atomic_bridge_initiator_complete_bridge_transfer( - bridge_transfer_id: Vec, - pre_image: Vec, + _bridge_transfer_id: Vec, + _pre_image: Vec, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -2493,8 +2494,8 @@ pub fn atomic_bridge_initiator_complete_bridge_transfer( ident_str!("complete_bridge_transfer").to_owned(), vec![], vec![ - bcs::to_bytes(&bridge_transfer_id).unwrap(), - bcs::to_bytes(&pre_image).unwrap(), + bcs::to_bytes(&_bridge_transfer_id).unwrap(), + bcs::to_bytes(&_pre_image).unwrap(), ], )) } @@ -2503,9 +2504,9 @@ pub fn atomic_bridge_initiator_complete_bridge_transfer( /// Anyone can initiate a bridge transfer from the source chain /// The amount is burnt from the initiator pub fn atomic_bridge_initiator_initiate_bridge_transfer( - recipient: Vec, - hash_lock: Vec, - amount: u64, + _recipient: Vec, + _hash_lock: Vec, + _amount: u64, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -2518,9 +2519,9 @@ pub fn atomic_bridge_initiator_initiate_bridge_transfer( ident_str!("initiate_bridge_transfer").to_owned(), vec![], vec![ - bcs::to_bytes(&recipient).unwrap(), - bcs::to_bytes(&hash_lock).unwrap(), - bcs::to_bytes(&amount).unwrap(), + bcs::to_bytes(&_recipient).unwrap(), + bcs::to_bytes(&_hash_lock).unwrap(), + bcs::to_bytes(&_amount).unwrap(), ], )) } @@ -2536,11 +2537,11 @@ pub fn atomic_bridge_initiator_initiate_bridge_transfer( /// @param amount The amount of assets to be locked. /// @abort If the caller is not the bridge operator. pub fn atomic_bridge_counterparty_lock_bridge_transfer_assets( - initiator: Vec, - bridge_transfer_id: Vec, - hash_lock: Vec, - recipient: AccountAddress, - amount: u64, + _initiator: Vec, + _bridge_transfer_id: Vec, + _hash_lock: Vec, + _recipient: AccountAddress, + _amount: u64, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -2553,18 +2554,18 @@ pub fn atomic_bridge_counterparty_lock_bridge_transfer_assets( ident_str!("lock_bridge_transfer_assets").to_owned(), vec![], vec![ - bcs::to_bytes(&initiator).unwrap(), - bcs::to_bytes(&bridge_transfer_id).unwrap(), - bcs::to_bytes(&hash_lock).unwrap(), - bcs::to_bytes(&recipient).unwrap(), - bcs::to_bytes(&amount).unwrap(), + bcs::to_bytes(&_initiator).unwrap(), + bcs::to_bytes(&_bridge_transfer_id).unwrap(), + bcs::to_bytes(&_hash_lock).unwrap(), + bcs::to_bytes(&_recipient).unwrap(), + bcs::to_bytes(&_amount).unwrap(), ], )) } /// Anyone can refund the transfer on the source chain once time lock has passed pub fn atomic_bridge_initiator_refund_bridge_transfer( - bridge_transfer_id: Vec, + _bridge_transfer_id: Vec, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -2576,7 +2577,7 @@ pub fn atomic_bridge_initiator_refund_bridge_transfer( ), ident_str!("refund_bridge_transfer").to_owned(), vec![], - vec![bcs::to_bytes(&bridge_transfer_id).unwrap()], + vec![bcs::to_bytes(&_bridge_transfer_id).unwrap()], )) } @@ -3744,11 +3745,11 @@ pub fn multisig_account_vote_transanction( /// @param nonce The unique nonce for the transfer. /// @abort If the caller is not the bridge relayer or the transfer has already been processed. pub fn native_bridge_complete_bridge_transfer( - bridge_transfer_id: Vec, - initiator: Vec, - recipient: AccountAddress, - amount: u64, - nonce: u64, + _bridge_transfer_id: Vec, + _initiator: Vec, + _recipient: AccountAddress, + _amount: u64, + _nonce: u64, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -3761,11 +3762,11 @@ pub fn native_bridge_complete_bridge_transfer( ident_str!("complete_bridge_transfer").to_owned(), vec![], vec![ - bcs::to_bytes(&bridge_transfer_id).unwrap(), - bcs::to_bytes(&initiator).unwrap(), - bcs::to_bytes(&recipient).unwrap(), - bcs::to_bytes(&amount).unwrap(), - bcs::to_bytes(&nonce).unwrap(), + bcs::to_bytes(&_bridge_transfer_id).unwrap(), + bcs::to_bytes(&_initiator).unwrap(), + bcs::to_bytes(&_recipient).unwrap(), + bcs::to_bytes(&_amount).unwrap(), + bcs::to_bytes(&_nonce).unwrap(), ], )) } @@ -3777,8 +3778,8 @@ pub fn native_bridge_complete_bridge_transfer( /// @param recipient The address of the recipient on the Aptos blockchain. /// @param amount The amount of assets to be locked. pub fn native_bridge_initiate_bridge_transfer( - recipient: Vec, - amount: u64, + _recipient: Vec, + _amount: u64, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -3791,8 +3792,8 @@ pub fn native_bridge_initiate_bridge_transfer( ident_str!("initiate_bridge_transfer").to_owned(), vec![], vec![ - bcs::to_bytes(&recipient).unwrap(), - bcs::to_bytes(&amount).unwrap(), + bcs::to_bytes(&_recipient).unwrap(), + bcs::to_bytes(&_amount).unwrap(), ], )) } @@ -3802,7 +3803,7 @@ pub fn native_bridge_initiate_bridge_transfer( /// @param relayer The signer representing the Relayer. /// @param new_bridge_fee The new bridge fee to be set. /// @abort If the new bridge fee is the same as the old bridge fee. -pub fn native_bridge_update_bridge_fee(new_bridge_fee: u64) -> TransactionPayload { +pub fn native_bridge_update_bridge_fee(_new_bridge_fee: u64) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( AccountAddress::new([ @@ -3813,7 +3814,7 @@ pub fn native_bridge_update_bridge_fee(new_bridge_fee: u64) -> TransactionPayloa ), ident_str!("update_bridge_fee").to_owned(), vec![], - vec![bcs::to_bytes(&new_bridge_fee).unwrap()], + vec![bcs::to_bytes(&_new_bridge_fee).unwrap()], )) } @@ -3823,7 +3824,7 @@ pub fn native_bridge_update_bridge_fee(new_bridge_fee: u64) -> TransactionPayloa /// @param new_insurance_budget_divider The new insurance budget divider to be set. /// @abort If the new insurance budget divider is the same as the old insurance budget divider. pub fn native_bridge_update_insurance_budget_divider( - new_insurance_budget_divider: u64, + _new_insurance_budget_divider: u64, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -3835,7 +3836,7 @@ pub fn native_bridge_update_insurance_budget_divider( ), ident_str!("update_insurance_budget_divider").to_owned(), vec![], - vec![bcs::to_bytes(&new_insurance_budget_divider).unwrap()], + vec![bcs::to_bytes(&_new_insurance_budget_divider).unwrap()], )) } @@ -3845,7 +3846,7 @@ pub fn native_bridge_update_insurance_budget_divider( /// @param new_insurance_fund The new insurance fund to be set. /// @abort If the new insurance fund is the same as the old insurance fund. pub fn native_bridge_update_insurance_fund( - new_insurance_fund: AccountAddress, + _new_insurance_fund: AccountAddress, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( @@ -3857,7 +3858,7 @@ pub fn native_bridge_update_insurance_fund( ), ident_str!("update_insurance_fund").to_owned(), vec![], - vec![bcs::to_bytes(&new_insurance_fund).unwrap()], + vec![bcs::to_bytes(&_new_insurance_fund).unwrap()], )) } @@ -5390,7 +5391,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::AtomicBridgeCounterpartyAbortBridgeTransfer { - bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, + _bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, }, ) } else { @@ -5404,8 +5405,8 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::AtomicBridgeInitiatorCompleteBridgeTransfer { - bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, - pre_image: bcs::from_bytes(script.args().get(1)?).ok()?, + _bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, + _pre_image: bcs::from_bytes(script.args().get(1)?).ok()?, }, ) } else { @@ -5419,9 +5420,9 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::AtomicBridgeInitiatorInitiateBridgeTransfer { - recipient: bcs::from_bytes(script.args().get(0)?).ok()?, - hash_lock: bcs::from_bytes(script.args().get(1)?).ok()?, - amount: bcs::from_bytes(script.args().get(2)?).ok()?, + _recipient: bcs::from_bytes(script.args().get(0)?).ok()?, + _hash_lock: bcs::from_bytes(script.args().get(1)?).ok()?, + _amount: bcs::from_bytes(script.args().get(2)?).ok()?, }, ) } else { @@ -5435,11 +5436,11 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::AtomicBridgeCounterpartyLockBridgeTransferAssets { - initiator: bcs::from_bytes(script.args().get(0)?).ok()?, - bridge_transfer_id: bcs::from_bytes(script.args().get(1)?).ok()?, - hash_lock: bcs::from_bytes(script.args().get(2)?).ok()?, - recipient: bcs::from_bytes(script.args().get(3)?).ok()?, - amount: bcs::from_bytes(script.args().get(4)?).ok()?, + _initiator: bcs::from_bytes(script.args().get(0)?).ok()?, + _bridge_transfer_id: bcs::from_bytes(script.args().get(1)?).ok()?, + _hash_lock: bcs::from_bytes(script.args().get(2)?).ok()?, + _recipient: bcs::from_bytes(script.args().get(3)?).ok()?, + _amount: bcs::from_bytes(script.args().get(4)?).ok()?, }, ) } else { @@ -5453,7 +5454,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::AtomicBridgeInitiatorRefundBridgeTransfer { - bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, + _bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, }, ) } else { @@ -6147,11 +6148,11 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::NativeBridgeCompleteBridgeTransfer { - bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, - initiator: bcs::from_bytes(script.args().get(1)?).ok()?, - recipient: bcs::from_bytes(script.args().get(2)?).ok()?, - amount: bcs::from_bytes(script.args().get(3)?).ok()?, - nonce: bcs::from_bytes(script.args().get(4)?).ok()?, + _bridge_transfer_id: bcs::from_bytes(script.args().get(0)?).ok()?, + _initiator: bcs::from_bytes(script.args().get(1)?).ok()?, + _recipient: bcs::from_bytes(script.args().get(2)?).ok()?, + _amount: bcs::from_bytes(script.args().get(3)?).ok()?, + _nonce: bcs::from_bytes(script.args().get(4)?).ok()?, }) } else { None @@ -6163,8 +6164,8 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::NativeBridgeInitiateBridgeTransfer { - recipient: bcs::from_bytes(script.args().get(0)?).ok()?, - amount: bcs::from_bytes(script.args().get(1)?).ok()?, + _recipient: bcs::from_bytes(script.args().get(0)?).ok()?, + _amount: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { None @@ -6176,7 +6177,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::NativeBridgeUpdateBridgeFee { - new_bridge_fee: bcs::from_bytes(script.args().get(0)?).ok()?, + _new_bridge_fee: bcs::from_bytes(script.args().get(0)?).ok()?, }) } else { None @@ -6189,7 +6190,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::NativeBridgeUpdateInsuranceBudgetDivider { - new_insurance_budget_divider: bcs::from_bytes(script.args().get(0)?).ok()?, + _new_insurance_budget_divider: bcs::from_bytes(script.args().get(0)?).ok()?, }, ) } else { @@ -6202,7 +6203,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::NativeBridgeUpdateInsuranceFund { - new_insurance_fund: bcs::from_bytes(script.args().get(0)?).ok()?, + _new_insurance_fund: bcs::from_bytes(script.args().get(0)?).ok()?, }) } else { None