diff --git a/.gitmodules b/.gitmodules index 6a2a13a79..6beb01e37 100644 --- a/.gitmodules +++ b/.gitmodules @@ -76,3 +76,6 @@ [submodule "protocol-units/bridge/contracts/lib/BokkyPooBahsDateTimeLibrary"] path = protocol-units/bridge/contracts/lib/BokkyPooBahsDateTimeLibrary url = https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary +[submodule "protocol-units/settlement/mcr/contracts/lib/v2-periphery"] + path = protocol-units/settlement/mcr/contracts/lib/v2-periphery + url = https://github.com/Uniswap/v2-periphery diff --git a/Cargo.lock b/Cargo.lock index 13e5cf302..7a506c691 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11756,6 +11756,7 @@ dependencies = [ "aptos-protos 1.3.0 (git+https://github.com/movementlabsxyz/aptos-core?rev=b3617c1f7f272832369cf235e5826858c3f7a512)", "aptos-sdk", "aptos-types", + "aptos-vm-genesis", "async-trait", "bcs 0.1.6 (git+https://github.com/movementlabsxyz/bcs.git?rev=bc16d2d39cabafaabd76173dd1b04b2aa170cf0c)", "buildtime-helpers", diff --git a/Cargo.toml b/Cargo.toml index f495d87ce..d45b17224 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -163,44 +163,41 @@ borsh = { version = "0.10" } # todo: internalize jmt and bump ### We use a forked version so that we can override dependency versions. This is required ### to be avoid dependency conflicts with other Sovereign Labs crates. -aptos-api = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-api-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-bitvec = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-block-executor = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-cached-packages = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-config = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-consensus-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-crypto = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512", features = [ +aptos-api = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-api-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-bitvec = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-block-executor = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-cached-packages = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-config = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-consensus-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-crypto = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005", features = [ "cloneable-private-keys", ] } -aptos-db = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-executor = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-executor-test-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-executor-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-faucet-core = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-framework = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-language-e2e-tests = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-mempool = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-proptest-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-sdk = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-state-view = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-storage-interface = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-temppath = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-vm = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-vm-genesis = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-vm-logging = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-vm-validator = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-logger = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-vm-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-indexer = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-indexer-grpc-fullnode = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-indexer-grpc-table-info = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-protos = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-release-builder = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -aptos-gas-schedule = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -move-package = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } -movement = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "b3617c1f7f272832369cf235e5826858c3f7a512" } +aptos-db = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-executor = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-executor-test-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-executor-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-faucet-core = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-framework = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-language-e2e-tests = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-mempool = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-proptest-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-sdk = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-state-view = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-storage-interface = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-temppath = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-vm = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-vm-genesis = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-vm-logging = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-vm-validator = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-logger = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-vm-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-indexer = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-indexer-grpc-fullnode = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-indexer-grpc-table-info = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } +aptos-protos = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "30f7c26d27b6a6b9cf7f815aa86082e777a8f005" } + # Indexer processor = { git = "https://github.com/movementlabsxyz/aptos-indexer-processors", rev = "77a36245400250e7d8a854360194288d078681bc" } diff --git a/networks/movement/movement-client/Cargo.toml b/networks/movement/movement-client/Cargo.toml index 9ae37616e..a6a9d4d3c 100644 --- a/networks/movement/movement-client/Cargo.toml +++ b/networks/movement/movement-client/Cargo.toml @@ -39,11 +39,16 @@ path = "src/bin/e2e/whitelist.rs" name = "movement-tests-e2e-ggp-gas-fee" path = "src/bin/e2e/ggp_gas_fee.rs" +[[bin]] +name = "movement-tests-e2e-mint-burn" +path = "src/bin/e2e/mint_burn.rs" + [[bin]] name = "movement-tests-e2e-transfer" path = "src/bin/e2e/transfer.rs" [dependencies] +aptos-vm-genesis = { workspace = true} aptos-sdk = { workspace = true } aptos-types = { workspace = true } anyhow = { workspace = true } diff --git a/networks/movement/movement-client/src/bin/e2e/mint_burn.rs b/networks/movement/movement-client/src/bin/e2e/mint_burn.rs new file mode 100644 index 000000000..79b276562 --- /dev/null +++ b/networks/movement/movement-client/src/bin/e2e/mint_burn.rs @@ -0,0 +1,354 @@ +#![allow(unused_imports)] + +use anyhow::{Chain, Context}; +use aptos_sdk::{ + crypto::{ed25519::ed25519_keys::Ed25519PublicKey, multi_ed25519::MultiEd25519PublicKey}, + move_types::{ + identifier::Identifier, + language_storage::{ModuleId, StructTag, TypeTag}, + }, + rest_client::{ + aptos_api_types::{ + Address, EntryFunctionId, IdentifierWrapper, MoveModule, MoveModuleId, MoveStructTag, + MoveType, ViewRequest, + }, + Account, Response, + }, + transaction_builder::TransactionBuilder, + types::{ + account_address::AccountAddress, + chain_id::ChainId, + transaction::{EntryFunction, Script, TransactionArgument}, + AccountKey, LocalAccount, + }, +}; +use aptos_types::{ + account_config::aptos_test_root_address, test_helpers::transaction_test_helpers, + transaction::TransactionPayload, +}; +use buildtime_helpers::cargo::cargo_workspace; +use movement_client::{ + coin_client::CoinClient, + crypto::ValidCryptoMaterialStringExt, + rest_client::{Client, FaucetClient}, +}; +use once_cell::sync::Lazy; +use rayon::vec; +use std::{ + env, fs, + path::PathBuf, + process::Command, + str::FromStr, + time::{SystemTime, UNIX_EPOCH}, +}; +use tracing; +use url::Url; + +static SUZUKA_CONFIG: Lazy = Lazy::new(|| { + let dot_movement = dot_movement::DotMovement::try_from_env().unwrap(); + let config = dot_movement.try_get_config_from_json::().unwrap(); + config +}); + +static NODE_URL: Lazy = Lazy::new(|| { + let node_connection_address = SUZUKA_CONFIG + .execution_config + .maptos_config + .client + .maptos_rest_connection_hostname + .clone(); + let node_connection_port = SUZUKA_CONFIG + .execution_config + .maptos_config + .client + .maptos_rest_connection_port + .clone(); + let node_connection_url = + format!("http://{}:{}", node_connection_address, node_connection_port); + Url::from_str(node_connection_url.as_str()).unwrap() +}); + +static FAUCET_URL: Lazy = Lazy::new(|| { + let faucet_listen_address = SUZUKA_CONFIG + .execution_config + .maptos_config + .client + .maptos_faucet_rest_connection_hostname + .clone(); + let faucet_listen_port = SUZUKA_CONFIG + .execution_config + .maptos_config + .client + .maptos_faucet_rest_connection_port + .clone(); + let faucet_listen_url = format!("http://{}:{}", faucet_listen_address, faucet_listen_port); + Url::from_str(faucet_listen_url.as_str()).unwrap() +}); + +#[tokio::main] +async fn main() -> Result<(), anyhow::Error> { + let rest_client = Client::new(NODE_URL.clone()); + let faucet_client = FaucetClient::new(FAUCET_URL.clone(), NODE_URL.clone()); + let coin_client = CoinClient::new(&rest_client); + let dead_address = AccountAddress::from_str( + "000000000000000000000000000000000000000000000000000000000000dead", + )?; + let associate_address = AccountAddress::from_str( + "0x000000000000000000000000000000000000000000000000000000000a550c18", + )?; + + let chain_id = rest_client + .get_index() + .await + .context("failed to get chain ID")? + .inner() + .chain_id; + + let mut core_resources_account = LocalAccount::from_private_key( + SUZUKA_CONFIG + .execution_config + .maptos_config + .chain + .maptos_private_key + .to_encoded_string()? + .as_str(), + 0, + )?; + tracing::info!( + "resource account keypairs: {:?}, {:?}", + core_resources_account.private_key(), + core_resources_account.public_key() + ); + tracing::info!("Core Resources Account address: {}", core_resources_account.address()); + + tracing::info!("Created core resources account"); + + // core_resources_account is already funded with u64 max value + // Create dead account + let create_dead_transaction = + transaction_test_helpers::get_test_signed_transaction_with_chain_id( + associate_address, + core_resources_account.sequence_number(), + &core_resources_account.private_key(), + core_resources_account.public_key().clone(), + Some(TransactionPayload::EntryFunction(EntryFunction::new( + ModuleId::new( + AccountAddress::from_hex_literal("0x1")?, + Identifier::new("aptos_account")?, + ), + Identifier::new("create_account")?, + vec![], + vec![bcs::to_bytes(&dead_address)?], + ))), + SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + 60, + 100, + None, + ChainId::new(chain_id), + ); + + rest_client + .submit_and_wait(&create_dead_transaction) + .await + .context("Failed to create dead account")?; + + core_resources_account.increment_sequence_number(); + + faucet_client.fund(core_resources_account.address(), 1_000_000).await?; + core_resources_account.increment_sequence_number(); + faucet_client.fund(dead_address, 1).await?; + core_resources_account.increment_sequence_number(); + + // Retrieve and log balances + let dead_balance = coin_client + .get_account_balance(&dead_address) + .await + .context("Failed to retrieve dead account balance")?; + let core_balance = coin_client + .get_account_balance(&core_resources_account.address()) + .await + .context("Failed to retrieve core resources account balance")?; + + tracing::info!( + "Core account balance: {}, Dead account balance: {}", + core_balance, + dead_balance + ); + + Command::new("movement") + .args(["move", "compile", "--package-dir", "protocol-units/bridge/move-modules"]) + .status() + .expect("Failed to execute `movement compile` command"); + + let root: PathBuf = cargo_workspace()?; + let additional_path = + "protocol-units/bridge/move-modules/build/bridge-modules/bytecode_scripts/"; + let combined_path = root.join(additional_path); + + let enable_bridge_code = fs::read(combined_path.join("enable_bridge_feature.mv"))?; + let enable_bridge_script_payload = + TransactionPayload::Script(Script::new(enable_bridge_code, vec![], vec![])); + + let enable_bridge_script_transaction = + transaction_test_helpers::get_test_signed_transaction_with_chain_id( + associate_address, + core_resources_account.sequence_number(), + &core_resources_account.private_key(), + core_resources_account.public_key().clone(), + Some(enable_bridge_script_payload), + SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + 60, + 100, + None, + ChainId::new(chain_id), + ); + + rest_client + .submit_and_wait(&enable_bridge_script_transaction) + .await + .context("Failed to enable bridge script transaction")?; + + core_resources_account.increment_sequence_number(); + + let store_mint_burn_caps_code = fs::read(combined_path.join("store_mint_burn_caps.mv"))?; + let store_mint_burn_caps_script_payload = + TransactionPayload::Script(Script::new(store_mint_burn_caps_code, vec![], vec![])); + + let store_mint_burn_caps_script_transaction = + transaction_test_helpers::get_test_signed_transaction_with_chain_id( + associate_address, + core_resources_account.sequence_number(), + &core_resources_account.private_key(), + core_resources_account.public_key().clone(), + Some(store_mint_burn_caps_script_payload), + SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + 60, + 100, + None, + ChainId::new(chain_id), + ); + + rest_client + .submit_and_wait(&store_mint_burn_caps_script_transaction) + .await + .context("Failed to store_mint_burn_caps script transaction")?; + core_resources_account.increment_sequence_number(); + + tracing::info!("Bridge feature enabled and mint burn caps stored"); + + let burn_dead_code = fs::read(combined_path.join("burn_from.mv"))?; + let burn_dead_args = + vec![TransactionArgument::Address(dead_address), TransactionArgument::U64(1)]; + let burn_dead_script_payload = + TransactionPayload::Script(Script::new(burn_dead_code, vec![], burn_dead_args)); + let burn_dead_script_transaction = + transaction_test_helpers::get_test_signed_transaction_with_chain_id( + associate_address, + core_resources_account.sequence_number(), + &core_resources_account.private_key(), + core_resources_account.public_key().clone(), + Some(burn_dead_script_payload), + SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + 60, + 100, + None, + ChainId::new(chain_id), + ); + + rest_client + .submit_and_wait(&burn_dead_script_transaction) + .await + .context("Failed to execute burn dead balance script transaction")?; + + core_resources_account.increment_sequence_number(); + + let desired_core_balance = 1; + + let amount_to_burn = core_balance - desired_core_balance; + + let burn_core_code = fs::read( + "protocol-units/bridge/move-modules/build/bridge-modules/bytecode_scripts/burn_from.mv", + )?; + let burn_core_args = vec![ + TransactionArgument::Address(core_resources_account.address()), + TransactionArgument::U64(amount_to_burn), + ]; + let burn_core_script_payload = + TransactionPayload::Script(Script::new(burn_core_code, vec![], burn_core_args)); + let burn_core_script_transaction = + transaction_test_helpers::get_test_signed_transaction_with_chain_id( + associate_address, + core_resources_account.sequence_number(), + &core_resources_account.private_key(), + core_resources_account.public_key().clone(), + Some(burn_core_script_payload), + SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + 60, + 100, + None, + ChainId::new(chain_id), + ); + + rest_client + .submit_and_wait(&burn_core_script_transaction) + .await + .context("Failed to execute burn dead balance script transaction")?; + + core_resources_account.increment_sequence_number(); + + tracing::info!("Script burn transactions successfully executed."); + + assert!( + coin_client + .get_account_balance(&dead_address) + .await + .context("Failed to retrieve dead address new balance")? + == 0, + "Dead address balance was not burned" + ); + + assert!( + coin_client + .get_account_balance(&core_resources_account.address()) + .await + .context("Failed to retrieve core resources account new balance")? + == desired_core_balance, + "Core resources account balance was not burned" + ); + + let amount_to_mint = 1; + + let mint_core_code = fs::read( + "protocol-units/bridge/move-modules/build/bridge-modules/bytecode_scripts/mint_to.mv", + )?; + let mint_core_args = vec![ + TransactionArgument::Address(core_resources_account.address()), + TransactionArgument::U64(amount_to_mint), + ]; + let mint_core_script_payload = + TransactionPayload::Script(Script::new(mint_core_code, vec![], mint_core_args)); + + let mint_core_script_transaction = transaction_test_helpers::get_test_signed_transaction_with_chain_id( + associate_address, + core_resources_account.sequence_number(), + &core_resources_account.private_key(), + core_resources_account.public_key().clone(), + Some(mint_core_script_payload), + SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + 60, + 100, + None, + ChainId::new(chain_id), + ); + + rest_client + .submit_and_wait(&mint_core_script_transaction) + .await + .context("Failed to execute mint core balance script transaction")?; + + assert!( + coin_client + .get_account_balance(&core_resources_account.address()) + .await + .context("Failed to retrieve core resources account new balance")? + == desired_core_balance + amount_to_mint, + "Core resources account balance was not minted" + ); + + + Ok(()) +} diff --git a/process-compose/movement-full-node/process-compose.test-mint-burn.yml b/process-compose/movement-full-node/process-compose.test-mint-burn.yml new file mode 100644 index 000000000..0066c1035 --- /dev/null +++ b/process-compose/movement-full-node/process-compose.test-mint-burn.yml @@ -0,0 +1,23 @@ +version: "3" + +environment: + +processes: + + setup: + environment: + - APTOS_ACCOUNT_WHITELIST=$DOT_MOVEMENT_PATH/default_signer_address_whitelist + - MAPTOS_PRIVATE_KEY=random + + movement-faucet: + command : | + movement-faucet-service run-simple --do-not-delegate + + test-mint-burn: + command: | + cargo run --bin movement-tests-e2e-mint-burn + depends_on: + movement-full-node: + condition: process_healthy + movement-faucet: + condition: process_healthy \ No newline at end of file diff --git a/protocol-units/bridge/move-modules/scripts/burn_from.move b/protocol-units/bridge/move-modules/scripts/burn_from.move new file mode 100644 index 000000000..8af795bf0 --- /dev/null +++ b/protocol-units/bridge/move-modules/scripts/burn_from.move @@ -0,0 +1,9 @@ +script { + use aptos_framework::aptos_governance; + use aptos_framework::native_bridge; + + fun burn_from(core_resources: &signer, account: address, amount: u64) { + let framework_signer = aptos_governance::get_signer_testnet_only(core_resources, @0x1); + native_bridge::burn_from(&framework_signer, account, amount); + } +} diff --git a/protocol-units/bridge/move-modules/scripts/mint_to.move b/protocol-units/bridge/move-modules/scripts/mint_to.move new file mode 100644 index 000000000..299aab15a --- /dev/null +++ b/protocol-units/bridge/move-modules/scripts/mint_to.move @@ -0,0 +1,9 @@ +script { + use aptos_framework::aptos_governance; + use aptos_framework::native_bridge; + + fun mint_to(core_resources: &signer, account: address, amount: u64) { + let framework_signer = aptos_governance::get_signer_testnet_only(core_resources, @0x1); + native_bridge::mint_to(&framework_signer, account, amount); + } +} diff --git a/protocol-units/settlement/mcr/contracts/lib/v2-periphery b/protocol-units/settlement/mcr/contracts/lib/v2-periphery new file mode 160000 index 000000000..0335e8f7e --- /dev/null +++ b/protocol-units/settlement/mcr/contracts/lib/v2-periphery @@ -0,0 +1 @@ +Subproject commit 0335e8f7e1bd1e8d8329fd300aea2ef2f36dd19f