diff --git a/.github/workflows/pr-workflow.yml b/.github/workflows/pr-workflow.yml index 53b4564d641..7c4c4dff833 100644 --- a/.github/workflows/pr-workflow.yml +++ b/.github/workflows/pr-workflow.yml @@ -120,11 +120,6 @@ jobs: **/*.nix **/*.sol **/*.toml - code/cvm/evm/lib/forge-std - code/cvm/evm/lib/openzeppelin-contracts - code/cvm/evm/lib/protobuf3-solidity-lib - code/cvm/evm/lib/yui-ibc-solidity - code/cvm/evm/lib/solidity-bytes-utils flake/eth-pos-devnet - run: echo ${{ steps.lfs-warning.outputs.lfsFiles }} @@ -228,62 +223,6 @@ jobs: - id: ok run: echo "ok=true" >> "$GITHUB_OUTPUT" - build-cosmos-cosmwasm: - outputs: - ok: ${{ steps.ok.outputs.ok }} - name: build-cosmos-cosmwasm - needs: - - privilege-check - runs-on: - - x86_64-linux-32C-128GB-2TB - concurrency: - group: ${{ inputs.github_workflow }}-build-cosmos-cosmwasm-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - steps: - - name: Set up Cachix - uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309 - with: - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - name: composable - installCommand: "true" - skipAddingSubstituter: true - - uses: actions/checkout@v3 - with: - lfs: true - ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }} - persist-credentials: false - - name: Build all packages - uses: "./.github/templates/watch-exec" - with: - command: nix -- build .#cvm-mount - - id: ok - run: echo "ok=true" >> "$GITHUB_OUTPUT" - - build-evm: - outputs: - ok: ${{ steps.ok.outputs.ok }} - name: build-evm - needs: - - privilege-check - runs-on: ubuntu-latest - concurrency: - group: ${{ inputs.github_workflow }}-build-evm-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - steps: - - uses: nixbuild/nix-quick-install-action@v24 - - uses: actions/checkout@v3 - with: - lfs: true - ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }} - persist-credentials: false - - uses: nixbuild/nixbuild-action@v19 - with: - nixbuild_token: ${{ secrets.NIXBUILD_TOKEN }} - generate_summary_for: "job" - - run: nix build .#evm-cvm-gateway --no-update-lock-file --accept-flake-config --extra-experimental-features "flakes nix-command" - - id: ok - run: echo "ok=true" >> "$GITHUB_OUTPUT" - build-all-ci-packages: name: build-all-ci-packages outputs: @@ -479,7 +418,6 @@ jobs: - build-all-docs-packages - build-all-misc-packages - build-all-production-deps - - build-cosmos-cosmwasm - dependency-review - nix-flake-check - devnet-integration-tests @@ -493,12 +431,11 @@ jobs: echo "build-all-ci-packages" ${{ needs.build-all-ci-packages.outputs.ok }} echo "build-all-rust-qa-packages" ${{ needs.build-all-rust-qa-packages.outputs.ok }} echo "devnet-integration-tests" ${{ needs.devnet-integration-tests.outputs.ok }} - echo "build-cosmos-cosmwasm" ${{ needs.build-cosmos-cosmwasm.outputs.ok }} - - if: ${{ needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-production-deps.outputs.ok == 'true' && needs.build-all-misc-packages.outputs.ok == 'true' && needs.build-all-docs-packages.outputs.ok == 'true' && needs.build-all-ci-packages.outputs.ok == 'true' && needs.build-all-rust-qa-packages.outputs.ok == 'true' && needs.devnet-integration-tests.outputs.ok == 'true' && needs.build-cosmos-cosmwasm.outputs.ok == 'true' }} + - if: ${{ needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-production-deps.outputs.ok == 'true' && needs.build-all-misc-packages.outputs.ok == 'true' && needs.build-all-docs-packages.outputs.ok == 'true' && needs.build-all-ci-packages.outputs.ok == 'true' && needs.build-all-rust-qa-packages.outputs.ok == 'true' && needs.devnet-integration-tests.outputs.ok == 'true' }} run: | echo "All dependencies built well" exit 0 - - if: ${{ !(needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-production-deps.outputs.ok == 'true' && needs.build-all-misc-packages.outputs.ok == 'true' && needs.build-all-docs-packages.outputs.ok == 'true' && needs.build-all-ci-packages.outputs.ok == 'true' && needs.build-all-rust-qa-packages.outputs.ok == 'true' && needs.devnet-integration-tests.outputs.ok == 'true' && needs.build-cosmos-cosmwasm.outputs.ok == 'true') }} + - if: ${{ !(needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-production-deps.outputs.ok == 'true' && needs.build-all-misc-packages.outputs.ok == 'true' && needs.build-all-docs-packages.outputs.ok == 'true' && needs.build-all-ci-packages.outputs.ok == 'true' && needs.build-all-rust-qa-packages.outputs.ok == 'true' && needs.devnet-integration-tests.outputs.ok == 'true' ) }} run: | echo "Some of dependencies (see jobs graph, needs attributes, and output of this job) failed" exit 42 diff --git a/.gitmodules b/.gitmodules index c4e9df45edd..243a2a1e662 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,3 @@ -[submodule "code/cvm/evm/lib/openzeppelin-contracts"] - path = code/cvm/evm/lib/openzeppelin-contracts - url = https://github.com/OpenZeppelin/openzeppelin-contracts -[submodule "code/cvm/evm/lib/protobuf3-solidity-lib"] - path = code/cvm/evm/lib/protobuf3-solidity-lib - url = https://github.com/lazyledger/protobuf3-solidity-lib -[submodule "code/cvm/evm/lib/forge-std"] - path = code/cvm/evm/lib/forge-std - url = https://github.com/foundry-rs/forge-std [submodule "flake/eth-pos-devnet"] path = flake/eth-pos-devnet url = https://github.com/OffchainLabs/eth-pos-devnet.git -[submodule "code/cvm/evm/lib/solidity-bytes-utils"] - path = code/cvm/evm/lib/solidity-bytes-utils - url = https://github.com/GNSPS/solidity-bytes-utils -[submodule "code/cvm/evm/lib/yui-ibc-solidity"] - path = code/cvm/evm/lib/yui-ibc-solidity - url = https://github.com/hyperledger-labs/yui-ibc-solidity diff --git a/code/Cargo.lock b/code/Cargo.lock index e8a30c924f5..2659013a603 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -3274,49 +3274,6 @@ dependencies = [ "thiserror-core", ] -[[package]] -name = "cw-xc-executor" -version = "0.2.0" -dependencies = [ - "cosmwasm-schema 1.2.5", - "cosmwasm-std", - "cw-storage-plus", - "cw-utils", - "cw2", - "cw20", - "hex", - "num", - "prost", - "schemars", - "serde", - "serde-cw-value", - "serde-json-wasm", - "serde_json", - "thiserror-core", - "xc-core", -] - -[[package]] -name = "cw-xc-gateway" -version = "0.1.0" -dependencies = [ - "bech32", - "cosmwasm-std", - "cw-storage-plus", - "cw-utils", - "cw-xc-executor", - "cw2", - "cw20", - "enumn", - "ibc 0.43.1", - "prost", - "schemars", - "serde", - "serde-json-wasm", - "thiserror-core", - "xc-core", -] - [[package]] name = "cw2" version = "1.0.1" diff --git a/code/Cargo.toml b/code/Cargo.toml index f14f5059e58..6745d889f6c 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -52,8 +52,6 @@ members = [ "utils/collator-sidecar", "utils/common", "utils/price-feed", - "cvm/cosmwasm/contracts/gateway", - "cvm/cosmwasm/contracts/executor", "cvm/lib/core/", ] resolver = "2" @@ -148,7 +146,6 @@ democracy = { package = "pallet-democracy", git = "https://github.com/paritytech executive = { package = "frame-executive", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } indices = { package = "pallet-indices", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } - sc-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } sc-consensus-beefy-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } sp-beefy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } diff --git a/code/composable-nodes.nix b/code/composable-nodes.nix index d358d966b29..b0513ac85b5 100644 --- a/code/composable-nodes.nix +++ b/code/composable-nodes.nix @@ -29,10 +29,12 @@ cargoArtifacts = self'.packages.common-deps; cargoBuildCommand = "cargo build --release --package ${name}"; cargoExtraArgs = "--features=builtin-wasm"; - CW_XC_GATEWAY_WASM_PATH = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; - CW_XC_EXECUTOR_WASM_PATH = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; + CW_CVM_GATEWAY_WASM_PATH = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; + CW_CVM_EXECUTOR_WASM_PATH = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; CW_20_BASE_WASM_PATH = self'.packages.cw20_base; PICASSO_RUNTIME = "${picasso-runtime}/lib/runtime.optimized.wasm"; COMPOSABLE_RUNTIME = diff --git a/code/cvm/.gitignore b/code/cvm/.gitignore deleted file mode 100644 index a4795015e19..00000000000 --- a/code/cvm/.gitignore +++ /dev/null @@ -1 +0,0 @@ -schema/** \ No newline at end of file diff --git a/code/cvm/cosmwasm/contracts/executor/Cargo.toml b/code/cvm/cosmwasm/contracts/executor/Cargo.toml deleted file mode 100644 index f8d2da537c0..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/Cargo.toml +++ /dev/null @@ -1,35 +0,0 @@ -[package] -authors = ["Composable Developers"] -description = "CVM Executor contract" -edition = "2021" -name = "cw-xc-executor" -repository = "https://github.com/ComposableFi/composable" -version = "0.2.0" - -[lib] -crate-type = ["cdylib", "rlib"] - -[features] -library = [] -std = ["xc-core/std", "dep:cosmwasm-schema", "dep:serde_json"] -default = ["std"] - -[dependencies] -serde_json = { workspace = true, optional = true } -cosmwasm-std = { workspace = true } -cw-storage-plus = { workspace = true } -cosmwasm-schema = { workspace = true, optional = true } -cw-utils = { workspace = true } -cw2 = { workspace = true } -cw20 = { workspace = true } -num = { workspace = true } -hex = { workspace = true, default-features = false, features = ["alloc"] } -schemars = { workspace = true } -serde = { workspace = true } -serde-json-wasm = { workspace = true } -serde-cw-value = { workspace = true } -thiserror = { workspace = true } -prost = { workspace = true, features = ["prost-derive"] } -xc-core = { path = "../../../lib/core", features = [ - "cosmwasm", -], default-features = false } diff --git a/code/cvm/cosmwasm/contracts/executor/README.md b/code/cvm/cosmwasm/contracts/executor/README.md deleted file mode 100644 index 45db14096a3..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# CVM Executor - -Receives and stores user funds. -Fully owned by user. -Delegates cross chain execution to gateway. - -Instantiated as many instances of the CVM interpreter contract. On some chains, we can use probabilistically generated sub_accounts, but for most, we instantiate a contract instance. - -## Events - -Note that these events will be yield from the router in production. - -### Instantiate contract -```json -{ - "type": "wasm-xcvm.executor.instantiated", - "attributes": [ - { - "key": "data", - "value": "{BASE64_ENCODED_DATA}" - } - ] -} -``` - -- **BASE64_ENCODED_DATA**: base64 encoded `(network_id, user_id)` pair. - -### Execute contract -```json -{ - "type": "wasm-xcvm.executor.executed", - "attributes": [ - { - "key": "program", - "value": "{XCVM_PROGRAM_TAG}" - } - ] -} -``` - -- **XCVM_PROGRAM_TAG**: Tag of the executed XCVM program - -### Execute spawn instruction - -```json -{ - "type": "wasm-xcvm.executor.spawn", - "attributes": [ - { - "key": "origin_network_id", - "value": "{ORIGIN_NETWORK_ID}" - }, - { - "key": "origin_user_id", - "value": "{ORIGIN_USER_ID}" - }, - { - "key": "program", - "value": "{XCVM_PROGRAM}" - } - ] -} -``` - -- **ORIGIN_NETWORK_ID**: Network id of the origin. Eg. Picasso, Ethereum -- **ORIGIN_USER_ID**: Chain agnostic user identifier of the origin. Eg. contract_address in Juno -- **XCVM_PROGRAM**: Json-encoded xcvm program. Note that although it is json-encoded, it is put as a string because of the restrictions of cosmwasm. - -## Usage - -The XCVM interpreter contract interprets the XCVM programs. Available instructions are: - - -### Call -Which is used to call a contract. See that the encoded payload must be in a format: -``` -{ - "address": "contract-addr", - "payload": "json-encoded ExecuteMsg struct" -} -``` - -### Transfer -Queries `gateway`, gets the contract address and then executes that contract to do the transfer. - -### Spawn -Emits `spawn` event with the given parameters. - -## Compile - -```sh -RUSTFLAGS='-C link-arg=-s' cargo b --package=xcvm-interpreter --target=wasm32-unknown-unknown --profile="cosmwasm-contracts" -``` - -* `-C link-arg=-s` is used for stripping the binary which reduces the binary size drastically. -* `--profile="cosmwasm-contracts"` must be used for cosmwasm contracts. \ No newline at end of file diff --git a/code/cvm/cosmwasm/contracts/executor/clippy.toml b/code/cvm/cosmwasm/contracts/executor/clippy.toml deleted file mode 100644 index 0848662095f..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/clippy.toml +++ /dev/null @@ -1,9 +0,0 @@ -disallowed-types = [ - # { path = "usize", reason = "variable size" }, # cannot on now, because serde, even if there is no usize in type - { path = "f64", resdason = "harware dependant" }, - { path = "f32", reason = "harware dependant" }, - { path = "num_traits::float::*", reason = "harware dependant" }, - { path = "serde_json::to_string", reason = "use serde_json_wasm::* and serde_cw_value::*" }, -] - -disallowed-methods = ["std::time::Duration::as_secs_f64"] diff --git a/code/cvm/cosmwasm/contracts/executor/src/authenticate.rs b/code/cvm/cosmwasm/contracts/executor/src/authenticate.rs deleted file mode 100644 index 412d7293e09..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/authenticate.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::{ - error::{ContractError, Result}, - state::OWNERS, -}; -use cosmwasm_std::{Addr, Deps}; - -/// Authenticated token, MUST be private and kept in this module. -/// MUST ONLY be instantiated by [`ensure_owner`]. -pub struct Authenticated(()); - -/// Ensure that the caller is either the current interpreter or listed in the owners of the -/// interpreter. -/// Any operation executing against the interpreter must pass this check. -pub fn ensure_owner(deps: Deps, self_addr: &Addr, sender: Addr) -> Result { - if sender == self_addr || OWNERS.has(deps.storage, sender) { - Ok(Authenticated(())) - } else { - Err(ContractError::NotAuthorized) - } -} diff --git a/code/cvm/cosmwasm/contracts/executor/src/bin/interpreter.rs b/code/cvm/cosmwasm/contracts/executor/src/bin/interpreter.rs deleted file mode 100644 index f982fc3a2d0..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/bin/interpreter.rs +++ /dev/null @@ -1,27 +0,0 @@ -#[cfg(feature = "std")] -#[allow(clippy::disallowed_methods)] -fn main() { - use cosmwasm_schema::write_api; - use cw_xc_executor::msg::*; - - write_api! { - instantiate: InstantiateMsg, - query: QueryMsg, - execute: ExecuteMsg, - } - let events = schemars::gen::SchemaGenerator::default() - .into_root_schema_for::(); - - // same as in above macro - let mut out_dir = std::env::current_dir().unwrap(); - out_dir.push("schema"); - - use ::std::fs::write; - - let path = out_dir.join(concat!("events", ".json")); - - write(&path, serde_json::to_string_pretty(&events).unwrap()).unwrap(); -} - -#[cfg(not(feature = "std"))] -fn main() {} diff --git a/code/cvm/cosmwasm/contracts/executor/src/contract.rs b/code/cvm/cosmwasm/contracts/executor/src/contract.rs deleted file mode 100644 index 1d031a84da4..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/contract.rs +++ /dev/null @@ -1,538 +0,0 @@ -use crate::{ - authenticate::{ensure_owner, Authenticated}, - error::{ContractError, Result}, - events::*, - msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg, Step}, - state::{self, Config, CONFIG, IP_REGISTER, OWNERS, RESULT_REGISTER, TIP_REGISTER}, -}; -use alloc::borrow::Cow; -#[cfg(not(feature = "library"))] -use cosmwasm_std::entry_point; -use cosmwasm_std::{ - ensure, ensure_eq, to_binary, wasm_execute, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, - DepsMut, Env, MessageInfo, QueryRequest, Reply, Response, StdError, StdResult, SubMsg, - SubMsgResult, WasmQuery, -}; -use cw2::set_contract_version; -use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg}; -use cw_utils::ensure_from_older_version; -use num::Zero; -use xc_core::{ - apply_bindings, - gateway::{AssetReference, BridgeExecuteProgramMsg, BridgeForwardMsg}, - service::dex::{ - osmosis_std::types::osmosis::poolmanager::v1beta1::SwapAmountInRoute, ExchangeId, - }, - shared, Amount, BindingValue, Destination, Funds, Instruction, NetworkId, Register, -}; - -const CONTRACT_NAME: &str = "cvm-executor"; -const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); - -const CALL_ID: u64 = 1; -const SELF_CALL_ID: u64 = 2; -const EXCHANGE_ID: u64 = 3; - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn instantiate(deps: DepsMut, _env: Env, info: MessageInfo, msg: InstantiateMsg) -> Result { - set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - let gateway_address = xc_core::gateway::Gateway::addr_validate(deps.api, &msg.gateway_address)?; - let config = Config { gateway_address, interpreter_origin: msg.interpreter_origin }; - CONFIG.save(deps.storage, &config)?; - OWNERS.save(deps.storage, info.sender, &())?; - Ok(Response::new().add_event(CvmInterpreterInstantiated::new(&config.interpreter_origin))) -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> Result { - // Only owners can execute entrypoints of the interpreter - let token = ensure_owner(deps.as_ref(), &env.contract.address, info.sender.clone())?; - match msg { - ExecuteMsg::Execute { tip, program } => initiate_execution(token, deps, env, tip, program), - - ExecuteMsg::ExecuteStep { step } => { - ensure!(env.contract.address == info.sender, ContractError::NotSelf); - handle_execute_step(token, deps, env, step) - }, - - ExecuteMsg::AddOwners { owners } => add_owners(token, deps, owners), - - ExecuteMsg::RemoveOwners { owners } => Ok(remove_owners(token, deps, owners)), - - ExecuteMsg::SetErr { reason } => handle_set_error(token, deps, reason, env), - } -} - -fn handle_set_error(_: Authenticated, deps: DepsMut, reason: String, _env: Env) -> Result { - RESULT_REGISTER.save(deps.storage, &Err(reason.clone()))?; - let event = CvmInterpreterCrosschainFailed::new(reason); - Ok(Response::default().add_event(event)) -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> Result { - let _ = ensure_from_older_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - - // Already only callable by the admin of the contract, so no need to `ensure_owner` - let token = ensure_owner(deps.as_ref(), &env.contract.address, env.contract.address.clone())?; - let _ = add_owners(token, deps, msg.owners)?; - Ok(Response::default()) -} - -/// Initiate an execution by adding a `ExecuteStep` callback. This is used to be able to prepare an -/// execution by resetting the necessary registers as well as being able to catch any failures and -/// store it in the `RESULT_REGISTER`. -/// The [`RELAYER_REGISTER`] is updated to hold the current relayer address. Note that the -/// [`RELAYER_REGISTER`] always contains a value, and the value is equal to the last relayer that -/// executed a program if any. -fn initiate_execution( - _: Authenticated, - deps: DepsMut, - env: Env, - tip: Addr, - program: shared::XcProgram, -) -> Result { - // Reset instruction pointer to zero. - IP_REGISTER.save(deps.storage, &0)?; - Ok(Response::default() - .add_event(CvmInterpreterExecutionStarted::new()) - .add_submessage(SubMsg::reply_on_error( - wasm_execute( - env.contract.address, - &ExecuteMsg::ExecuteStep { step: Step { tip, instruction_pointer: 0, program } }, - Default::default(), - )?, - SELF_CALL_ID, - ))) -} - -/// Add owners who can execute entrypoints other than `ExecuteStep` -fn add_owners(_: Authenticated, deps: DepsMut, owners: Vec) -> Result { - for owner in owners.iter() { - OWNERS.save(deps.storage, owner.clone(), &())?; - } - Ok(Response::default().add_event(CvmInterpreterOwnerAdded::new(owners))) -} - -/// Remove a set of owners from the current owners list. -/// Beware that emptying the set of owners result in a tombstoned interpreter. -fn remove_owners(_: Authenticated, deps: DepsMut, owners: Vec) -> Response { - for owner in owners.iter() { - OWNERS.remove(deps.storage, owner.clone()); - } - Response::default().add_event(CvmInterpreterOwnerRemoved::new(owners)) -} - -/// Execute an CVM program. -/// The function will execute the program instructions one by one. -/// If the program contains a [`CVMInstruction::Call`], the execution is suspended and resumed -/// after having executed the call. -/// The [`IP_REGISTER`] is updated accordingly. -/// A final `executed` event is yield whenever a program come to completion (all it's instructions -/// has been executed). -/// If some step fails, its result is recorded in the [`RESULT_REGISTER`] and the execution is -/// halted. Default behavior not to abort transaction. -pub fn handle_execute_step( - _: Authenticated, - mut deps: DepsMut, - env: Env, - Step { tip, instruction_pointer, mut program }: Step, -) -> Result { - Ok(if let Some(instruction) = program.instructions.pop_front() { - deps.api.debug(&format!("cvm::executor::execute:: {:?}", &instruction)); - let response = match instruction { - Instruction::Transfer { to, assets } => - interpret_transfer(&mut deps, &env, &tip, to, assets), - Instruction::Call { bindings, encoded } => - interpret_call(deps.as_ref(), &env, bindings, encoded, instruction_pointer, &tip), - Instruction::Spawn { network_id, salt, assets, program } => - interpret_spawn(&mut deps, &env, network_id, salt, assets, program), - Instruction::Exchange { exchange_id, give, want } => - interpret_exchange(&mut deps, give, want, exchange_id, env.contract.address.clone()), - }?; - // Save the intermediate IP so that if the execution fails, we can recover at which - // instruction it happened. - IP_REGISTER.update::<_, ContractError>(deps.storage, |x| Ok(x + 1))?; - response.add_message(wasm_execute( - env.contract.address, - &ExecuteMsg::ExecuteStep { - step: Step { tip, instruction_pointer: instruction_pointer + 1, program }, - }, - Default::default(), - )?) - } else { - // We subtract because of the extra loop to reach the empty instructions case. - IP_REGISTER.save(deps.storage, &instruction_pointer.saturating_sub(1))?; - TIP_REGISTER.save(deps.storage, &tip)?; - Response::default().add_event(CvmInterpreterStepExecuted::new(&program.tag)) - }) -} - -fn interpret_exchange( - deps: &mut DepsMut, - give: Funds, - want: Funds, - exchange_id: ExchangeId, - sender: Addr, -) -> Result { - let Config { gateway_address, .. } = CONFIG.load(deps.storage)?; - let exchange: xc_core::service::dex::ExchangeItem = gateway_address - .get_exchange_by_id(deps.querier, exchange_id) - .map_err(ContractError::ExchangeNotFound)?; - - use prost::Message; - use xc_core::service::dex::{ - osmosis_std::types::osmosis::poolmanager::v1beta1::MsgSwapExactAmountIn, ExchangeType::*, - }; - ensure_eq!(give.0.len(), 1, ContractError::OnlySingleAssetExchangeIsSupportedByPool); - ensure_eq!(want.0.len(), 1, ContractError::OnlySingleAssetExchangeIsSupportedByPool); - - let give = give.0[0].clone(); - let want = want.0[0].clone(); - - let asset = gateway_address - .get_asset_by_id(deps.querier, give.0) - .map_err(ContractError::AssetNotFound)?; - - let amount: Coin = deps.querier.query_balance(&sender, asset.denom())?; - let amount = give.1.apply(amount.amount.u128())?; - let give: xc_core::cosmos::Coin = - xc_core::cosmos::Coin { denom: asset.denom(), amount: amount.to_string() }; - - let asset = gateway_address - .get_asset_by_id(deps.querier, want.0) - .map_err(ContractError::AssetNotFound)?; - - if want.1.is_absolute() && want.1.is_ratio() { - return Err(ContractError::CannotDefineBothSlippageAndLimitAtSameTime) - } - - let want = if want.1.is_absolute() { - xc_core::cosmos::Coin { denom: asset.denom(), amount: want.1.intercept.to_string() } - } else { - // use https://github.com/osmosis-labs/osmosis/blob/main/cosmwasm/contracts/swaprouter/src/msg.rs to allow slippage - xc_core::cosmos::Coin { denom: asset.denom(), amount: "1".to_string() } - }; - - let response = match exchange.exchange { - OsmosisCrossChainSwap { pool_id, .. } => { - let msg = MsgSwapExactAmountIn { - routes: vec![SwapAmountInRoute { pool_id, token_out_denom: want.denom }], - sender: sender.to_string(), - token_in: Some(give), - token_out_min_amount: want.amount, - }; - deps.api.debug(&format!("cvm::executor::execute::exchange {:?}", &msg)); - let msg = CosmosMsg::Stargate { - type_url: MsgSwapExactAmountIn::PROTO_MESSAGE_URL.to_string(), - value: Binary::from(msg.encode_to_vec()), - }; - let msg = SubMsg::reply_always(msg, EXCHANGE_ID); - Response::default() - .add_submessage(msg) - .add_attribute("exchange_id", exchange_id.to_string()) - }, - }; - Ok(response.add_event(CvmInterpreterExchangeStarted::new(exchange_id))) -} - -/// Interpret the `Call` instruction -/// * `encoded`: JSON-encoded `LateCall` as bytes -/// -/// Late-bindings are actually done in this function. If our CVM SDK is not used, -/// make sure that indices in the `LateCall` is sorted in an ascending order. -pub fn interpret_call( - deps: Deps, - env: &Env, - bindings: Vec<(u32, BindingValue)>, - mut payload: Vec, - instruction_pointer: u16, - tip: &Addr, -) -> Result { - if !bindings.is_empty() { - let resolver = BindingResolver::new(&deps, env, instruction_pointer, tip)?; - let p = core::mem::take(&mut payload); - payload = apply_bindings(p, &bindings, |binding| resolver.resolve(binding))?; - } - // we hacky using json, but we always know ABI encoding dependng on chain we - // run on send to - let cosmos_msg: CosmosMsg = serde_json_wasm::from_slice::< - xc_core::cosmwasm::FlatCosmosMsg, - >(&payload) - .map_err(|_| ContractError::InvalidCallPayload)? - .try_into() - .map_err(|_| ContractError::DataSerializationError)?; - Ok(Response::default() - .add_event(CvmInterpreterInstructionCallInitiated::new()) - .add_submessage(SubMsg::reply_on_success(cosmos_msg, CALL_ID))) -} - -/// Resolver for `BindingValue`s. -struct BindingResolver<'a> { - deps: &'a Deps<'a>, - env: &'a Env, - instruction_pointer: u16, - tip: &'a Addr, - gateway: xc_core::gateway::Gateway, -} - -impl<'a> BindingResolver<'a> { - /// Creates a new binding resolver. - /// - /// Fetches gateway configuration from storage thus it may fail with storage - /// read error. - fn new(deps: &'a Deps, env: &'a Env, instruction_pointer: u16, tip: &'a Addr) -> Result { - let Config { gateway_address: gateway, .. } = CONFIG.load(deps.storage)?; - Ok(Self { deps, env, instruction_pointer, tip, gateway }) - } - - /// Resolves a single binding returning it’s value. - fn resolve(&'a self, binding: &BindingValue) -> Result> { - match binding { - BindingValue::Register(reg) => self.resolve_register(*reg), - BindingValue::Asset(asset_id) => self.resolve_asset(*asset_id), - BindingValue::AssetAmount(asset_id, balance) => - self.resolve_asset_amount(*asset_id, balance), - } - } - - fn resolve_register(&'a self, reg: Register) -> Result> { - Ok(match reg { - Register::Carry(_) => Err(ContractError::NotImplemented)?, - Register::Ip => Cow::Owned(self.instruction_pointer.to_string().into_bytes()), - Register::Tip => Cow::Owned(self.tip.to_string().into_bytes()), - Register::This => Cow::Borrowed(self.env.contract.address.as_bytes()), - Register::Result => Cow::Owned( - serde_json_wasm::to_vec(&RESULT_REGISTER.load(self.deps.storage)?) - .map_err(|_| ContractError::DataSerializationError)?, - ), - }) - } - - fn resolve_asset(&'a self, asset_id: xc_core::AssetId) -> Result> { - let reference = self.gateway.get_asset_by_id(self.deps.querier, asset_id)?; - let value = match reference.local { - AssetReference::Cw20 { contract } => contract.into_string(), - AssetReference::Native { denom } => denom, - AssetReference::Erc20 { contract } => contract.to_string(), - }; - Ok(Cow::Owned(value.into())) - } - - fn resolve_asset_amount( - &'a self, - asset_id: xc_core::AssetId, - balance: &Amount, - ) -> Result> { - let reference = self.gateway.get_asset_by_id(self.deps.querier, asset_id)?; - let amount = match reference.local { - AssetReference::Cw20 { contract } => apply_amount_to_cw20_balance( - *self.deps, - balance, - &contract, - &self.env.contract.address, - )?, - AssetReference::Native { denom } => { - let coin = - self.deps.querier.query_balance(self.env.contract.address.clone(), denom)?; - balance.apply(coin.amount.into()).map_err(|_| ContractError::ArithmeticError)? - }, - AssetReference::Erc20 { .. } => Err(ContractError::AssetUnsupportedOnThisNetwork)?, - }; - Ok(Cow::Owned(amount.to_string().into_bytes())) - } -} - -pub fn interpret_spawn( - deps: &mut DepsMut, - env: &Env, - network_id: NetworkId, - salt: Vec, - assets: Funds, - program: shared::XcProgram, -) -> Result { - let Config { interpreter_origin, gateway_address: gateway, .. } = CONFIG.load(deps.storage)?; - - let mut normalized_funds = Funds::default(); - - let mut response = Response::default(); - for (asset_id, balance) in assets.0 { - let reference = gateway.get_asset_by_id(deps.querier, asset_id)?; - let transfer_amount = match &reference.local { - AssetReference::Native { denom } => { - let coin = - deps.querier.query_balance(env.contract.address.clone(), denom.clone())?; - balance.apply(coin.amount.into()).map_err(|_| ContractError::ArithmeticError) - }, - AssetReference::Cw20 { contract } => apply_amount_to_cw20_balance( - deps.as_ref(), - &balance, - contract, - &env.contract.address, - ), - AssetReference::Erc20 { .. } => Err(ContractError::AssetUnsupportedOnThisNetwork)?, - }?; - - if !transfer_amount.is_zero() { - let asset_id: u128 = asset_id.into(); - normalized_funds.0.push((asset_id.into(), transfer_amount.into())); - response = match reference.local { - AssetReference::Native { denom } => response.add_message(BankMsg::Send { - to_address: gateway.address().into(), - amount: vec![Coin { denom, amount: transfer_amount.into() }], - }), - AssetReference::Cw20 { contract } => - response.add_message(Cw20Contract(contract).call(Cw20ExecuteMsg::Transfer { - recipient: gateway.address().into(), - amount: transfer_amount.into(), - })?), - AssetReference::Erc20 { .. } => Err(ContractError::AssetUnsupportedOnThisNetwork)?, - }; - } - } - - let execute_program = - BridgeExecuteProgramMsg { salt, program, assets: normalized_funds, tip: None }; - Ok(response - .add_message(gateway.execute(BridgeForwardMsg { - executor_origin: interpreter_origin.clone(), - msg: execute_program, - to: network_id, - })?) - .add_event(CvmInterpreterInstructionSpawned::new( - interpreter_origin.user_origin.network_id, - interpreter_origin.user_origin.user_id, - network_id, - ))) -} - -pub fn interpret_transfer( - deps: &mut DepsMut, - env: &Env, - tip: &Addr, - to: Destination, - assets: Funds, -) -> Result { - let Config { gateway_address: gateway, .. } = CONFIG.load(deps.storage)?; - deps.api.debug(&format!("cvm::executor::transfer:: to {:?}", &to)); - let recipient = match to { - Destination::Account(account) => account.encode_cosmwasm(deps.api)?, - Destination::Tip => tip.into(), - }; - - let mut response = Response::default(); - for (asset_id, balance) in assets.0 { - let reference = gateway.get_asset_by_id(deps.querier, asset_id)?; - response = match reference.local { - AssetReference::Native { denom } => { - let mut coin = deps.querier.query_balance(env.contract.address.clone(), denom)?; - coin.amount = balance.apply(coin.amount.into())?.into(); - response.add_message(BankMsg::Send { - to_address: recipient.clone(), - amount: vec![coin], - }) - }, - AssetReference::Cw20 { contract } => { - let contract = Cw20Contract(contract.clone()); - let transfer_amount = apply_amount_to_cw20_balance( - deps.as_ref(), - &balance, - &contract.0, - &env.contract.address, - )?; - response.add_message(contract.call(Cw20ExecuteMsg::Transfer { - recipient: recipient.clone(), - amount: transfer_amount.into(), - })?) - }, - AssetReference::Erc20 { .. } => Err(ContractError::AssetUnsupportedOnThisNetwork)?, - }; - } - - Ok(response.add_event(CvmInterpreterTransferred::new())) -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { - match msg { - QueryMsg::Register(Register::Ip) => Ok(to_binary(&IP_REGISTER.load(deps.storage)?)?), - QueryMsg::Register(Register::Result) => - Ok(to_binary(&RESULT_REGISTER.load(deps.storage)?)?), - QueryMsg::Register(Register::This) => Ok(to_binary(&env.contract.address)?), - QueryMsg::Register(Register::Carry(_)) => - Err(StdError::generic_err("Carry register is not implemented yet")), - QueryMsg::Register(Register::Tip) => Ok(to_binary(&TIP_REGISTER.load(deps.storage)?)?), - QueryMsg::State() => Ok(state::read(deps.storage)?.try_into()?), - } -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> StdResult { - match msg.id { - CALL_ID => handle_call_result(deps, msg), - SELF_CALL_ID => handle_self_call_result(deps, msg), - EXCHANGE_ID => handle_exchange_result(deps, msg), - id => Err(StdError::generic_err(format!("Unknown reply id: {}", id))), - } -} - -fn handle_self_call_result(deps: DepsMut, msg: Reply) -> StdResult { - match msg.result.into_result() { - Ok(_) => Err(StdError::generic_err("Returned OK from a reply that is called with `reply_on_error`. This should never happen")), - Err(e) => { - // Save the result that is returned from the sub-interpreter - // this way, only the `RESULT_REGISTER` is persisted. All - // other state changes are reverted. - RESULT_REGISTER.save(deps.storage, &Err(e.clone()))?; - let ip = IP_REGISTER.load(deps.storage)?.to_string(); - let event = CvmInterpreterSelfFailed::new(e); - Ok(Response::default().add_event(event).add_attribute("ip", ip)) - } - } -} - -fn handle_call_result(deps: DepsMut, msg: Reply) -> StdResult { - let response = msg.result.into_result().map_err(StdError::generic_err)?; - RESULT_REGISTER.save(deps.storage, &Ok(response))?; - Ok(Response::default()) -} - -fn handle_exchange_result(deps: DepsMut, msg: Reply) -> StdResult { - deps.api.debug(&format!("cvm::executor::exchanged {:?}", &msg)); - let response = match &msg.result { - SubMsgResult::Ok(ok) => { - let exchange_id: ExchangeId = ok - .events - .iter() - .find(|x| x.ty == "cvm.executor.exchange.started") - .and_then(|x| x.attributes.iter().find(|x| x.key == "exchange_id")) - .map(|x| x.value.parse().unwrap()) - .unwrap_or(ExchangeId::default()); - Response::new().add_event(CvmInterpreterExchangeSucceeded::new(exchange_id)) - }, - SubMsgResult::Err(err) => - Response::new().add_event(CvmInterpreterExchangeFailed::new(err.clone())), - }; - RESULT_REGISTER.save(deps.storage, &msg.result.into_result())?; - Ok(response) -} - -/// Calculates and returns the actual balance to process -/// -/// * `balance`: Balance to be transformed into the actual balance -/// * `contract`: Address of the corresponding cw20 contract -/// * `self_address`: This interpreter's address -fn apply_amount_to_cw20_balance + Clone>( - deps: Deps, - balance: &Amount, - contract: A, - self_address: A, -) -> Result { - let balance_response = - deps.querier.query::(&QueryRequest::Wasm(WasmQuery::Smart { - contract_addr: contract.clone().into(), - msg: to_binary(&Cw20QueryMsg::Balance { address: self_address.into() })?, - }))?; - - balance.apply(balance_response.balance.into()).map_err(ContractError::from) -} diff --git a/code/cvm/cosmwasm/contracts/executor/src/error.rs b/code/cvm/cosmwasm/contracts/executor/src/error.rs deleted file mode 100644 index 33423241536..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/error.rs +++ /dev/null @@ -1,83 +0,0 @@ -use cosmwasm_std::{Response, StdError}; -use thiserror::Error; -use xc_core::LateBindingError; - -pub type Result = core::result::Result; - -impl From for ContractError { - fn from(_: xc_core::ArithmeticError) -> Self { - ContractError::InvalidProgram - } -} - -impl From> for ContractError { - fn from(e: LateBindingError) -> Self { - match e { - LateBindingError::InvalidBinding => ContractError::InvalidBindings, - LateBindingError::App(e) => e, - } - } -} - -#[derive(Error, Debug)] -pub enum ContractError { - #[error("{0}")] - Std(#[from] StdError), - - #[error("Invalid call payload")] - InvalidCallPayload, - - #[error("Data cannot be serialized")] - DataSerializationError, - - #[error("Program is invalid")] - InvalidProgram, - - #[error("A program tag must be a correct utf8 encoded string")] - InvalidProgramTag, - - #[error("Bindings are invalid")] - InvalidBindings, - - #[error("Caller is not authorised to take the action")] - NotAuthorized, - - #[error("Only the contract is authorized for this action")] - NotSelf, - - #[error("Instruction {0} is not supported")] - InstructionNotSupported(String), - - #[error("Address is invalid")] - InvalidAddress, - - #[error("Unsupported")] - Unsupported, - - #[error("An error occured while doing arithmetic operations")] - ArithmeticError, - - #[error("Not implemented")] - NotImplemented, - - #[error("The asset is not yet supported")] - UnsupportedAsset, - - #[error("Only single asset exchange is supported by pool")] - OnlySingleAssetExchangeIsSupportedByPool, - - /// for the case when specific pool does not supports slippage - #[error("Exchange does not support slippage")] - ExchangeDoesNotSupportSlippage, - - #[error("Cannot define both slippage and limit at same time")] - CannotDefineBothSlippageAndLimitAtSameTime, - - #[error("Asset not found: {0}")] - AssetNotFound(StdError), - #[error("Exchange not found: {0}")] - ExchangeNotFound(StdError), - - #[error("Asset unsupported on this network")] - AssetUnsupportedOnThisNetwork, -} diff --git a/code/cvm/cosmwasm/contracts/executor/src/events.rs b/code/cvm/cosmwasm/contracts/executor/src/events.rs deleted file mode 100644 index 8221759a461..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/events.rs +++ /dev/null @@ -1,229 +0,0 @@ -use cosmwasm_std::{Addr, Event}; -use serde::{Deserialize, Serialize}; -use xc_core::{service::dex::ExchangeId, shared, InterpreterOrigin, NetworkId, UserId}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.exchange.succeeded")] -pub struct CvmInterpreterExchangeSucceeded { - pub exchange_id: ExchangeId, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.exchange.started")] -pub struct CvmInterpreterExchangeStarted { - pub exchange_id: ExchangeId, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.execution.started")] -pub struct CvmInterpreterExecutionStarted {} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.instantiated")] -pub struct CvmInterpreterInstantiated { - pub interpreter_origin: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.transferred")] -pub struct CvmInterpreterTransferred {} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.owner.added")] -pub struct CvmInterpreterOwnerAdded { - pub owner: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.owner.removed")] -pub struct CvmInterpreterOwnerRemoved { - pub owner: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.execution.failed")] -pub struct CvmInterpreterExchangeFailed { - pub reason: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.instruction.spawned")] -pub struct CvmInterpreterInstructionSpawned { - pub origin_network_id: NetworkId, - pub origin_user_id: UserId, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.self.failed")] -pub struct CvmInterpreterSelfFailed { - pub reason: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.crosschain.failed")] -pub struct CvmInterpreterCrosschainFailed { - pub reason: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.instruction.call.initiated")] -pub struct CvmInterpreterInstructionCallInitiated {} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename = "cvm.executor.step.executed")] -pub struct CvmInterpreterStepExecuted { - #[serde(serialize_with = "hex::serialize", deserialize_with = "hex::deserialize")] - #[cfg_attr(feature = "std", schemars(schema_with = "String::json_schema"))] - #[serde(skip_serializing_if = "Vec::is_empty", default)] - pub tag: Vec, -} - -/// used to generate schema, so that each events schema is available in one place -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -pub enum CvmInterpreter { - StepExecuted(CvmInterpreterStepExecuted), - SelfFailed(CvmInterpreterSelfFailed), - ExchangeStarted(CvmInterpreterExchangeStarted), - InstructionCallInitiated(CvmInterpreterInstructionCallInitiated), - InstructionSpawned(CvmInterpreterInstructionSpawned), - ExchangeFailed(CvmInterpreterExchangeFailed), - OwnerRemoved(CvmInterpreterOwnerRemoved), - OwnerAdded(CvmInterpreterOwnerAdded), - ExecutionStarted(CvmInterpreterExecutionStarted), - Transferred(CvmInterpreterTransferred), - Instantiated(CvmInterpreterInstantiated), - Exchanged(CvmInterpreterExchangeSucceeded), - CrosschainFailed(CvmInterpreterCrosschainFailed), -} - -// beneath is something to be generate by macro -// https://github.com/CosmWasm/cosmwasm/discussions/1871 - -impl CvmInterpreterCrosschainFailed { - pub fn new(reason: String) -> Event { - Event::new("cvm.executor.crosschain.failed").add_attribute("reason", reason) - } -} - -impl CvmInterpreterStepExecuted { - pub fn new(tag: &[u8]) -> Event { - let mut event = Event::new("cvm.executor.step.executed"); - if !tag.is_empty() { - event = event.add_attribute("tag", hex::encode(tag)); - } - event - } -} - -impl CvmInterpreterSelfFailed { - pub fn new(reason: String) -> Event { - Event::new("cvm.executor.self.failed").add_attribute("reason", reason) - } -} - -impl CvmInterpreterExchangeStarted { - pub fn new(exchange_id: ExchangeId) -> Event { - Event::new("cvm.executor.exchange.started") - .add_attribute("exchange_id", exchange_id.to_string()) - } -} - -impl CvmInterpreterInstructionCallInitiated { - pub fn new() -> Event { - Event::new("cvm.executor.instruction.call.initiated") - } -} - -impl CvmInterpreterInstructionSpawned { - pub fn new( - origin_network_id: NetworkId, - origin_user_id: UserId, - network_id: NetworkId, - ) -> Event { - Event::new("cvm.executor.instruction.spawned") - .add_attribute( - "origin_network_id", - serde_json_wasm::to_string(&origin_network_id) - .expect("network id is controlled by us and it is always serde"), - ) - .add_attribute( - "origin_user_id", - serde_json_wasm::to_string(&origin_user_id) - .expect("user id is controlled by us and it is always serde"), - ) - .add_attribute( - "network_id", - serde_json_wasm::to_string(&network_id) - .expect("network id is controlled by us and it is always serde"), - ) - } -} - -impl CvmInterpreterExchangeFailed { - pub fn new(reason: String) -> Event { - Event::new("cvm.executor.exchange.failed").add_attribute("reason", reason) - } -} - -impl CvmInterpreterOwnerRemoved { - pub fn new(owners: Vec) -> Event { - let mut e = Event::new("cvm.executor.owner.removed"); - for owner in owners { - e = e.add_attribute("owner", owner.to_string()) - } - e - } -} - -impl CvmInterpreterOwnerAdded { - pub fn new(owners: Vec) -> Event { - let mut e = Event::new("cvm.executor.owner.added"); - for owner in owners { - e = e.add_attribute("owner", owner.to_string()) - } - e - } -} - -impl CvmInterpreterExecutionStarted { - pub fn new() -> Event { - Event::new("cvm.executor.execution.started") - } -} - -impl CvmInterpreterTransferred { - pub fn new() -> Event { - Event::new("cvm.executor.transferred") - } -} - -impl CvmInterpreterInstantiated { - pub const NAME: &str = "cvm.executor.instantiated"; - pub const INTERPRETER_ORIGIN: &str = "interpreter_origin"; - pub fn new(interpreter_origin: &InterpreterOrigin) -> Event { - Event::new(Self::NAME).add_attribute( - Self::INTERPRETER_ORIGIN, - shared::encode_base64(interpreter_origin).expect("origin is managed by"), - ) - } -} - -impl CvmInterpreterExchangeSucceeded { - pub fn new(exchange_id: ExchangeId) -> Event { - Event::new("cvm.executor.exchanged").add_attribute("exchange_id", exchange_id.to_string()) - } -} diff --git a/code/cvm/cosmwasm/contracts/executor/src/lib.rs b/code/cvm/cosmwasm/contracts/executor/src/lib.rs deleted file mode 100644 index 7685cbbac57..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/lib.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![cfg_attr(not(test), deny(clippy::disallowed_methods, clippy::disallowed_types,))] -extern crate alloc; - -pub mod authenticate; -pub mod contract; -pub mod error; -pub mod events; -pub mod msg; -mod prelude; -pub mod state; diff --git a/code/cvm/cosmwasm/contracts/executor/src/msg.rs b/code/cvm/cosmwasm/contracts/executor/src/msg.rs deleted file mode 100644 index 727370cf35c..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/msg.rs +++ /dev/null @@ -1,82 +0,0 @@ -use crate::{prelude::*, state, state::State}; -use xc_core::{shared::*, InterpreterOrigin, Register}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub struct Step { - /// Tip party facilitated bridging and execution. - pub tip: Addr, - /// The current instruction pointer in the program. - /// Note that the [`Step::program`] instructions are poped when executed, we can't rely on this - /// instruction pointer to index into the instructions. In fact, this pointer tells us how many - /// instructions we already consumed. - pub instruction_pointer: u16, - /// The next instructions to execute (actual program). - pub program: XcProgram, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub struct InstantiateMsg { - /// Address of the gateway. - pub gateway_address: String, - /// The interpreter origin. - pub interpreter_origin: InterpreterOrigin, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub enum ExecuteMsg { - /// Execute an CVM program - Execute { tip: Addr, program: XcProgram }, - /// This is only meant to be used by the interpreter itself, otherwise it will return an error - /// The existence of this message is to allow the execution of the `Call` instruction. Once we - /// hit a call, the program queue the call and queue itself after it to ensure that the side - /// effect of the call has been executed. - ExecuteStep { step: Step }, - /// Add owners of this contract - AddOwners { owners: Vec }, - /// Remove owners from the contract - RemoveOwners { owners: Vec }, - /// spawn is cross chain, so sometimes errors are came from other blocks - /// so gateway can set that error on interpreter - SetErr { reason: String }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub struct MigrateMsg { - /// Owners to be added to the list of owners which acts more like a recovery in case all of the - /// owners are erased accidentally - pub owners: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema, QueryResponses))] -#[serde(rename_all = "snake_case")] -pub enum QueryMsg { - /// Get a specific register - #[cfg_attr(feature = "std", returns(QueryStateResponse))] - Register(Register), - /// dumps the whole state of interpreter - #[cfg_attr(feature = "std", returns(QueryStateResponse))] - State(), -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub struct QueryStateResponse { - pub state: state::State, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[serde(rename_all = "snake_case")] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -pub struct QueryExchangeResponse { - pub state: State, -} diff --git a/code/cvm/cosmwasm/contracts/executor/src/prelude.rs b/code/cvm/cosmwasm/contracts/executor/src/prelude.rs deleted file mode 100644 index 789c0d6de04..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/prelude.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub use alloc::{string::String, vec::Vec}; -pub use cosmwasm_std::Addr; -pub use serde::{Deserialize, Serialize}; - -#[cfg(feature = "std")] -pub use cosmwasm_schema::{cw_serde, QueryResponses}; - -#[cfg(feature = "std")] -pub use schemars::JsonSchema; diff --git a/code/cvm/cosmwasm/contracts/executor/src/state.rs b/code/cvm/cosmwasm/contracts/executor/src/state.rs deleted file mode 100644 index c1f4f0968ac..00000000000 --- a/code/cvm/cosmwasm/contracts/executor/src/state.rs +++ /dev/null @@ -1,57 +0,0 @@ -use cosmwasm_std::{to_binary, Addr, Binary, Order, StdError, StdResult, Storage, SubMsgResponse}; -use cw_storage_plus::{Item, Map}; -use serde::{Deserialize, Serialize}; -use xc_core::InterpreterOrigin; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -pub struct Config { - pub gateway_address: xc_core::gateway::Gateway, - pub interpreter_origin: InterpreterOrigin, -} - -/// The interpreter configuration. -pub const CONFIG: Item = Item::new("config"); - -/// List of owners able to execute programs on our behalf. Be aware that only `trusted` address must -/// be added. -pub const OWNERS: Map = Map::new("owners"); - -/// This register hold the latest program instruction (index) executed. -pub const IP_REGISTER: Item = Item::new("ip_register"); - -/// This register contains the latest executed instruction result for the program. -/// It can be either a success `SubMsgResponse` or an error message (in this case changes of message -/// were not applied). -pub const RESULT_REGISTER: Item> = Item::new("result_register"); - -pub const TIP_REGISTER: Item = Item::new("tip_register"); - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -pub struct State { - pub result_register: Result, - pub ip_register: u16, - pub owners: Vec, - pub config: Config, -} - -impl TryInto for State { - type Error = StdError; - - fn try_into(self) -> StdResult { - to_binary(&self) - } -} - -pub(crate) fn read(storage: &dyn Storage) -> StdResult { - Ok(State { - result_register: RESULT_REGISTER.load(storage)?, - ip_register: IP_REGISTER.load(storage).unwrap_or(0), - owners: OWNERS - .range(storage, None, None, Order::Ascending) - .map(|e| e.map(|(k, _)| k)) - .collect::>>()?, - config: CONFIG.load(storage)?, - }) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/Cargo.toml b/code/cvm/cosmwasm/contracts/gateway/Cargo.toml deleted file mode 100644 index fefe06793c4..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/Cargo.toml +++ /dev/null @@ -1,40 +0,0 @@ -[package] -authors = ["Composable Developers"] -description = "CVM Gateway contract" -edition = "2021" -name = "cw-xc-gateway" -repository = "https://github.com/ComposableFi/composable" -version = "0.1.0" - -[lib] -crate-type = ["cdylib", "rlib"] - -[lints] -workspace = true - -[features] -library = [] -std = ["cw-xc-executor/std", "xc-core/std"] -default = ["std"] - -[dependencies] -enumn = { version = "0.1.12" } -bech32-no_std = { workspace = true, features = ["strict"] } -cosmwasm-std = { workspace = true, features = ["ibc3", "stargate"] } -cw-storage-plus = { workspace = true } -cw-utils = { workspace = true } -cw2 = { workspace = true } -cw20 = { workspace = true } -ibc-rs-scale = { workspace = true, features = ["parity-scale-codec", "serde"] } -schemars = { workspace = true } -serde = { workspace = true } -serde-json-wasm = { workspace = true } -thiserror = { workspace = true } - -cw-xc-executor = { path = "../executor", features = [ - "library", -], default-features = false } -xc-core = { path = "../../../lib/core", features = [ - "cosmwasm", -], default-features = false } -prost = { workspace = true, default-features = false } diff --git a/code/cvm/cosmwasm/contracts/gateway/README.md b/code/cvm/cosmwasm/contracts/gateway/README.md deleted file mode 100644 index 2c7b6922e9b..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# CVM Gateway Contract - -The CVM Gateway Contract is acting as bridge registry and default IBC bridge. - -Hides custom entry points and messaging under unified security, routing, assets handling and execution interface. - -Is Entrypoint and exit for Programs. -Book keeps per-chain state. Holds the address mappings for cross-chain accounts and instantiates new interpreters. \ No newline at end of file diff --git a/code/cvm/cosmwasm/contracts/gateway/clippy.toml b/code/cvm/cosmwasm/contracts/gateway/clippy.toml deleted file mode 100644 index 575ee6fee93..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/clippy.toml +++ /dev/null @@ -1,9 +0,0 @@ -disallowed-types = [ - # { path = "usize", reason = "variable size" }, # cannot on now, because serde, even if there is no usize in type - { path = "f64", resdason = "harware dependant" }, - { path = "f32", reason = "harware dependant" }, - { path = "num_traits::float::*", reason = "harware dependant" }, - { path = "serde_json::*", reason = "use serde_json_wasm::*" }, -] - -disallowed-methods = ["std::time::Duration::as_secs_f64"] diff --git a/code/cvm/cosmwasm/contracts/gateway/src/assets.rs b/code/cvm/cosmwasm/contracts/gateway/src/assets.rs deleted file mode 100644 index 5c7ca15c9a1..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/assets.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::{ - auth, - batch::BatchResponse, - error::{ContractError, Result}, - events::make_event, - prelude::*, - state::{ - self, - assets::{ASSETS, LOCAL_ASSETS}, - }, -}; -use cosmwasm_std::{Deps, DepsMut}; -use xc_core::{AssetId, NetworkId}; - -/// Adds a new asset to the registry; errors out if asset already exists. -pub(crate) fn force_asset(_: auth::Admin, deps: DepsMut, msg: AssetItem) -> Result { - let config = crate::state::load(deps.storage)?; - ASSETS.save(deps.storage, msg.asset_id, &msg)?; - if msg.network_id == config.network_id { - LOCAL_ASSETS.save(deps.storage, msg.local.clone(), &msg)?; - } - Ok(BatchResponse::new().add_event( - make_event("assets.forced") - .add_attribute("asset_id", msg.asset_id.to_string()) - .add_attribute("denom", msg.denom()), - )) -} - -/// Fetches information about given asset. -pub(crate) fn get_asset_by_id(deps: Deps, asset_id: AssetId) -> Result { - ASSETS.may_load(deps.storage, asset_id)?.ok_or(ContractError::AssetNotFound) -} - -/// Fetches information about given asset by its local reference. -pub(crate) fn get_local_asset_by_reference( - deps: Deps, - reference: AssetReference, -) -> Result { - LOCAL_ASSETS - .may_load(deps.storage, reference)? - .ok_or(ContractError::AssetNotFound) -} - -/// Removes an existing asset from the registry; errors out if asset doesn’t -/// exist. -pub(crate) fn force_remove_asset( - _: auth::Auth, - deps: DepsMut<'_>, - asset_id: AssetId, -) -> std::result::Result { - let config = crate::state::load(deps.storage)?; - let asset = ASSETS.load(deps.storage, asset_id)?; - ASSETS.remove(deps.storage, asset_id); - if asset.network_id == config.network_id { - LOCAL_ASSETS.remove(deps.storage, asset.local); - } - Ok(BatchResponse::new() - .add_event(make_event("assets.removed").add_attribute("asset_id", asset_id.to_string()))) -} - -pub(crate) fn force_asset_to_network_map( - _: auth::Admin, - deps: DepsMut, - this_asset: AssetId, - other_network: NetworkId, - other_asset: AssetId, -) -> Result { - state::assets::NETWORK_ASSET.save(deps.storage, (this_asset, other_network), &other_asset)?; - Ok(BatchResponse::new().add_event( - make_event("assets.forced_asset_to_network_map") - .add_attribute("this_asset", this_asset.to_string()) - .add_attribute("other_asset", other_asset.to_string()), - )) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/auth.rs b/code/cvm/cosmwasm/contracts/gateway/src/auth.rs deleted file mode 100644 index 443963969a5..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/auth.rs +++ /dev/null @@ -1,125 +0,0 @@ -//! Module with authorisation checks. -use crate::{ - error::{ContractError, Result}, - msg, network, state, -}; -use cosmwasm_std::{Deps, Env, MessageInfo}; -use xc_core::{gateway::OtherNetworkItem, NetworkId}; - -/// Authorisation token indicating call is authorised according to policy -/// `T`. -/// -/// Intended usage of this object is to have functions which require certain -/// authorisation level to take `Auth` as an argument where `T` indicates -/// the authorisation level. Then, caller has to use `Auth::::authorise` -/// method to construct such object and be able to call the function. The -/// `authorise` method will verify caller’s authorisation level. -/// -/// For convenience, type aliases are provided for the different -/// authorisation levels: [`Contract`], [`Interpreter`] and [`Admin`]. -#[derive(Clone, Copy)] -pub(crate) struct Auth(core::marker::PhantomData); - -/// Authorisation token for messages which can only be sent from the -/// contract itself. -pub(crate) type Contract = Auth; - -/// Authorisation token for messages which come from an interpreter. -pub(crate) type Executor = Auth; - -/// Authorisation token for messages which come from contract’s admin. -pub(crate) type Admin = Auth; - -pub(crate) type WasmHook = Auth; - -impl Auth { - pub(crate) fn authorise(env: &Env, info: &MessageInfo) -> Result { - Self::new(info.sender == env.contract.address) - } -} - -impl Auth { - pub(crate) fn authorise( - deps: Deps, - env: &Env, - info: &MessageInfo, - network_id: NetworkId, - ) -> Result { - let this = network::load_this(deps.storage)?; - let this_to_other: OtherNetworkItem = state::NETWORK_TO_NETWORK - .load(deps.storage, (this.network_id, network_id)) - .map_err(|_| { - ContractError::NoConnectionInformationFromThisToOtherNetwork( - this.network_id, - network_id, - ) - })?; - let prefix = this - .accounts - .map(|x| match x { - msg::Prefix::SS58(prefix) => prefix.to_string(), - msg::Prefix::Bech(prefix) => prefix, - msg::Prefix::EthEvm => "".to_string(), - }) - .unwrap_or_default(); - let sender = state::NETWORK - .load(deps.storage, network_id)? - .gateway - .ok_or(ContractError::GatewayForNetworkNotFound(network_id))?; - - let sender = match sender { - msg::GatewayId::CosmWasm { contract, .. } => contract.to_string(), - msg::GatewayId::Evm { contract, .. } => contract.to_string(), - }; - - let channel = this_to_other.ics_20.ok_or(ContractError::ICS20NotFound)?.source; - let hash_of_channel_and_sender = - xc_core::transport::ibc::ics20::hook::derive_intermediate_sender( - &channel, &sender, &prefix, - )?; - deps.api.debug(&format!( - "cvm::gateway:auth:: {0} {1}", - &hash_of_channel_and_sender, &info.sender - )); - Self::new(hash_of_channel_and_sender == info.sender || info.sender == env.contract.address) - } -} - -impl Auth { - pub(crate) fn authorise( - deps: Deps, - info: &MessageInfo, - interpreter_origin: xc_core::InterpreterOrigin, - ) -> Result { - let interpreter_address = state::interpreter::get_by_origin(deps, interpreter_origin) - .map(|int| int.address) - .ok(); - Self::new(Some(&info.sender) == interpreter_address.as_ref()) - } -} - -impl Auth { - pub(crate) fn authorise(deps: Deps, info: &MessageInfo) -> Result { - let this = state::load(deps.storage)?; - Self::new(info.sender == this.admin) - } -} - -impl Auth { - fn new(authorised: bool) -> Result { - if authorised { - Ok(Self(Default::default())) - } else { - Err(ContractError::NotAuthorized) - } - } -} - -pub(crate) mod policy { - #[derive(Clone, Copy)] - pub(crate) enum Contract {} - pub(crate) enum Interpreter {} - #[derive(Clone, Copy)] - pub(crate) enum Admin {} - pub(crate) enum WasmHook {} -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/batch.rs b/code/cvm/cosmwasm/contracts/gateway/src/batch.rs deleted file mode 100644 index 49567d1120b..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/batch.rs +++ /dev/null @@ -1,41 +0,0 @@ -use cosmwasm_std::{CosmosMsg, Event, Response, SubMsg}; - -#[derive(Debug, Clone, Default)] -pub struct BatchResponse { - pub messages: Vec, - pub events: Vec, -} - -impl BatchResponse { - pub fn new() -> Self { - <_>::default() - } - pub fn add_message(mut self, msg: impl Into) -> Self { - self.messages.push(SubMsg::new(msg)); - self - } - - pub fn add_submessage(mut self, msg: SubMsg) -> Self { - self.messages.push(msg); - self - } - - pub fn add_event(mut self, event: Event) -> Self { - self.events.push(event); - self - } - - pub fn merge(&mut self, mut other: Self) { - self.messages.append(&mut other.messages); - self.events.append(&mut other.events); - } -} - -impl From for Response { - fn from(resp: BatchResponse) -> Self { - let mut result = Self::new(); - result.messages = resp.messages; - result.events = resp.events; - result - } -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/contract/execute.rs b/code/cvm/cosmwasm/contracts/gateway/src/contract/execute.rs deleted file mode 100644 index 9f155e99a4b..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/contract/execute.rs +++ /dev/null @@ -1,299 +0,0 @@ -use crate::{ - assets, auth, - batch::BatchResponse, - error::{ContractError, Result}, - events::make_event, - exchange, interpreter, msg, - network::{self, load_this}, - prelude::*, - state, -}; - -use cosmwasm_std::{ - entry_point, wasm_execute, Addr, BankMsg, Coin, CosmosMsg, Deps, DepsMut, Env, MessageInfo, - Response, -}; -use cw20::{Cw20Contract, Cw20ExecuteMsg}; - -use xc_core::{ - gateway::{BridgeExecuteProgramMsg, ConfigSubMsg}, - CallOrigin, Funds, InterpreterOrigin, -}; - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: msg::ExecuteMsg) -> Result { - use msg::ExecuteMsg; - let sender = &info.sender; - let canonical_sender = deps.api.addr_canonicalize(sender.as_str())?; - deps.api.debug(&format!( - "cvm::gateway::execute sender on chain {}, sender cross chain {}", - sender, - &serde_json_wasm::to_string(&canonical_sender)? - )); - match msg { - ExecuteMsg::Config(msg) => { - let auth = auth::Admin::authorise(deps.as_ref(), &info)?; - handle_config_msg(auth, deps, msg, &env).map(Into::into) - }, - - msg::ExecuteMsg::ExecuteProgram(execute_program) => - handle_execute_program(deps, env, info, execute_program), - - msg::ExecuteMsg::ExecuteProgramPrivileged { call_origin, execute_program } => { - let auth = auth::Contract::authorise(&env, &info)?; - handle_execute_program_privilleged(auth, deps, env, call_origin, execute_program) - }, - - msg::ExecuteMsg::BridgeForward(msg) => { - let auth = - auth::Executor::authorise(deps.as_ref(), &info, msg.executor_origin.clone())?; - - if !msg.msg.assets.0.is_empty() { - super::ibc::ics20::handle_bridge_forward(auth, deps, info, msg, env.block) - } else { - super::ibc::ics27::handle_bridge_forward_no_assets(auth, deps, info, msg, env.block) - } - }, - msg::ExecuteMsg::MessageHook(msg) => { - deps.api.debug(&format!("cvm::gateway::execute::message_hook {:?}", msg)); - - let auth = auth::WasmHook::authorise(deps.as_ref(), &env, &info, msg.from_network_id)?; - - super::ibc::ics20::ics20_message_hook(auth, deps.as_ref(), msg, env, info) - }, - msg::ExecuteMsg::Shortcut(msg) => handle_shortcut(deps, env, info, msg), - } -} - -fn handle_config_msg( - auth: auth::Admin, - mut deps: DepsMut, - msg: ConfigSubMsg, - env: &Env, -) -> Result { - deps.api.debug(serde_json_wasm::to_string(&msg)?.as_str()); - match msg { - ConfigSubMsg::ForceNetworkToNetwork(msg) => - network::force_network_to_network(auth, deps, msg), - ConfigSubMsg::ForceAsset(msg) => assets::force_asset(auth, deps, msg), - ConfigSubMsg::ForceExchange(msg) => exchange::force_exchange(auth, deps, msg), - ConfigSubMsg::ForceRemoveAsset { asset_id } => - assets::force_remove_asset(auth, deps, asset_id), - ConfigSubMsg::ForceAssetToNetworkMap { this_asset, other_network, other_asset } => - assets::force_asset_to_network_map(auth, deps, this_asset, other_network, other_asset), - ConfigSubMsg::ForceNetwork(msg) => network::force_network(auth, deps, msg), - ConfigSubMsg::ForceInstantiate { user_origin, salt } => interpreter::force_instantiate( - auth, - env.contract.address.clone(), - deps, - user_origin, - salt, - ), - ConfigSubMsg::Force(msgs) => { - let mut aggregated = BatchResponse::new(); - for msg in msgs { - let response = handle_config_msg(auth, deps.branch(), msg, env)?; - aggregated.merge(response); - } - Ok(aggregated) - }, - } -} - -fn handle_shortcut( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - _msg: msg::ShortcutSubMsg, -) -> Result { - // seems it would be hard each time to form big json to smoke test transfer, so will store some - // routes and generate program on chain for testing - Err(ContractError::NotImplemented) -} - -/// Transfers assets from user. -/// In case of bank assets, transfers directly, -/// In case of cw20 asset transfers using messages. -/// If assets are non, default 100% of bank transferred assets or delegated via CW20. -fn transfer_from_user( - deps: &DepsMut, - self_address: Addr, - user: Addr, - host_funds: Vec, - program_funds: Option>>, -) -> Result<(Vec, Funds>)> { - deps.api - .debug(serde_json_wasm::to_string(&(&program_funds, &host_funds))?.as_str()); - - if let Some(program_funds) = program_funds { - let mut transfers = Vec::with_capacity(program_funds.0.len()); - for (asset_id, program_amount) in program_funds.0.iter() { - match assets::get_asset_by_id(deps.as_ref(), *asset_id)?.local { - msg::AssetReference::Native { denom } => { - let Coin { amount: host_amount, .. } = host_funds - .iter() - .find(|c| c.denom == denom) - .ok_or(ContractError::ProgramFundsDenomMappingToHostNotFound)?; - if *program_amount != u128::from(*host_amount) { - return Err(ContractError::ProgramAmountNotEqualToHostAmount)? - } - }, - msg::AssetReference::Cw20 { contract } => - transfers.push(Cw20Contract(contract).call(Cw20ExecuteMsg::TransferFrom { - owner: user.to_string(), - recipient: self_address.to_string(), - amount: (*program_amount).into(), - })?), - msg::AssetReference::Erc20 { .. } => - Err(ContractError::RuntimeUnsupportedOnNetwork)?, - } - } - Ok((transfers, program_funds)) - } else { - let mut program_funds: Funds> = <_>::default(); - for coin in host_funds { - let asset = assets::get_local_asset_by_reference( - deps.as_ref(), - AssetReference::Native { denom: coin.denom }, - )?; - - program_funds.0.push((asset.asset_id, coin.amount.into())); - } - // we cannot do same trick with CW20 as need to know CW20 address (and it has to support - // Allowance query). - // so it is implement CW20 receiver interface like Michal did for wallet - Ok((vec![], program_funds)) - } -} - -/// Handles request to execute an [`CVMProgram`]. -/// -/// This is the entry point for executing a program from a user. Handling -pub(crate) fn handle_execute_program( - deps: DepsMut, - env: Env, - info: MessageInfo, - execute_program: msg::ExecuteProgramMsg, -) -> Result { - let tip = execute_program.tip.unwrap_or(env.contract.address.to_string()); - let this = msg::Gateway::new(env.contract.address); - let call_origin = CallOrigin::Local { user: info.sender.clone() }; - let (transfers, assets) = - transfer_from_user(&deps, this.address(), info.sender, info.funds, execute_program.assets)?; - let execute_program = BridgeExecuteProgramMsg { - salt: execute_program.salt, - program: execute_program.program, - assets, - tip: Some(tip), - }; - let msg = msg::ExecuteMsg::ExecuteProgramPrivileged { call_origin, execute_program }; - let msg = this.execute(msg)?; - Ok(Response::default().add_messages(transfers).add_message(msg)) -} - -/// Handle a request to execute a [`CVMProgram`]. -/// Only the gateway is allowed to dispatch such operation. -/// The gateway must ensure that the `CallOrigin` is valid as the router does not do further -/// checking on it. -pub(crate) fn handle_execute_program_privilleged( - _: auth::Contract, - deps: DepsMut, - env: Env, - call_origin: CallOrigin, - msg::BridgeExecuteProgramMsg { salt, program, assets, tip }: msg::BridgeExecuteProgramMsg, -) -> Result { - let config = load_this(deps.storage)?; - let interpreter_origin = - InterpreterOrigin { user_origin: call_origin.user(config.network_id), salt: salt.clone() }; - let interpreter = - state::interpreter::get_by_origin(deps.as_ref(), interpreter_origin.clone()).ok(); - if let Some(state::interpreter::Interpreter { address, .. }) = interpreter { - deps.api.debug("cvm:: reusing existing interpreter and adding funds"); - let response = send_funds_to_interpreter(deps.as_ref(), address.clone(), assets)?; - let wasm_msg = wasm_execute( - address.clone(), - &cw_xc_executor::msg::ExecuteMsg::Execute { - tip: tip - .map(|x| deps.api.addr_validate(&x)) - .ok_or(ContractError::AccountInProgramIsNotMappableToThisChain)? - .unwrap_or(env.contract.address), - program, - }, - vec![], - )?; - Ok(response - .add_event( - make_event("route.execute").add_attribute("interpreter", address.into_string()), - ) - .add_message(wasm_msg)) - } else { - // First, add a callback to instantiate an interpreter (which we later get the result - // and save it) - let interpreter_code_id = match config.gateway.expect("expected setup") { - msg::GatewayId::CosmWasm { interpreter_code_id, .. } => interpreter_code_id, - msg::GatewayId::Evm { .. } => - Err(ContractError::BadlyConfiguredRouteBecauseThisChainCanSendOnlyFromCosmwasm)?, - }; - deps.api.debug("instantiating interpreter"); - let this = msg::Gateway::new(env.contract.address); - - let interpreter_instantiate_submessage = crate::interpreter::instantiate( - deps.as_ref(), - this.address(), - interpreter_code_id, - &interpreter_origin, - salt, - )?; - - // Secondly, call itself again with the same parameters, so that this functions goes - // into `Ok` state and properly executes the interpreter - let execute_program = xc_core::gateway::BridgeExecuteProgramMsg { - salt: interpreter_origin.salt, - program, - assets, - tip, - }; - let msg = msg::ExecuteMsg::ExecuteProgramPrivileged { call_origin, execute_program }; - let self_call_message = this.execute(msg)?; - - Ok(Response::new() - .add_event(make_event("route.create")) - .add_submessage(interpreter_instantiate_submessage) - .add_message(self_call_message)) - } -} - -/// Transfer funds attached to a [`CVMProgram`] before dispatching the program to the interpreter. -fn send_funds_to_interpreter( - deps: Deps, - interpreter_address: Addr, - funds: Funds>, -) -> Result { - let mut response = Response::new(); - let interpreter_address = interpreter_address.into_string(); - for (asset_id, amount) in funds.0 { - // Ignore zero amounts - if amount == 0 { - continue - } - deps.api.debug("cvm::gateway:: sending funds"); - - let msg = match assets::get_asset_by_id(deps, asset_id)?.local { - msg::AssetReference::Native { denom } => BankMsg::Send { - to_address: interpreter_address.clone(), - amount: vec![Coin::new(amount.into(), denom)], - } - .into(), - msg::AssetReference::Cw20 { contract } => { - let contract = Cw20Contract(contract); - contract.call(Cw20ExecuteMsg::Transfer { - recipient: interpreter_address.clone(), - amount: amount.into(), - })? - }, - msg::AssetReference::Erc20 { .. } => Err(ContractError::RuntimeUnsupportedOnNetwork)?, - }; - response = response.add_message(msg); - } - Ok(response) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/ics20.rs b/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/ics20.rs deleted file mode 100644 index e114dc0cca6..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/ics20.rs +++ /dev/null @@ -1,259 +0,0 @@ -//! Helps connecting identifiers into networks. -//! Allows to map asset identifiers, contracts, networks, channels, denominations from, to and on -//! each chain via contract storage, precompiles, host extensions. -//! handles PFM and IBC wasm hooks -use crate::{contract::ReplyId, network, prelude::*}; -use cosmwasm_std::{ - ensure_eq, wasm_execute, Binary, BlockInfo, Coin, Deps, DepsMut, Env, MessageInfo, Response, - Storage, SubMsg, -}; -use xc_core::{ - gateway::{AssetItem, ExecuteMsg, ExecuteProgramMsg, GatewayId}, - shared::{XcFunds, XcPacket, XcProgram}, - transport::ibc::{to_cosmwasm_message, IbcIcs20ProgramRoute, XcMessageData}, - AssetId, CallOrigin, -}; - -use crate::{ - auth, - error::{ContractError, Result}, - events::make_event, - network::load_this, - state, -}; - -// 1. if there is know short cat multi hop path it is used up to point in cannot be used anymore (in -// this case CVM Executor call is propagated) 2. if there is no solved multiprop route, only single -// hope route checked amid 2 networks and if can do shortcut 3. else full CVM Executor call is -// propagated -pub(crate) fn handle_bridge_forward( - _: auth::Executor, - deps: DepsMut, - info: MessageInfo, - msg: xc_core::gateway::BridgeForwardMsg, - block: BlockInfo, -) -> Result { - deps.api.debug(&format!( - "cvm::gateway::bridge::forward::ibc::ics20::memo {}", - &serde_json_wasm::to_string(&msg)? - )); - - ensure_eq!(msg.msg.assets.0.len(), 1, ContractError::ProgramCannotBeHandledByDestination); - let (local_asset, amount) = msg.msg.assets.0.get(0).expect("proved above"); - - let (msg, event) = if let Ok(transfer_shortcut) = - ibc_ics_20_transfer_shortcut(deps.as_ref(), &msg) - { - let mut _event = make_event("bridge") - .add_attribute("to_network_id", msg.to.to_string()) - .add_attribute("shortcut", "ics20-transfer"); - - unimplemented!("add tracking lock for funds return usual cosmos message to transfer as defined in {:?}", transfer_shortcut); - } else { - let route: IbcIcs20ProgramRoute = get_this_route(deps.storage, msg.to, *local_asset)?; - state::tracking::bridge_lock(deps.storage, (msg.clone(), route.clone()))?; - - let asset = msg - .msg - .assets - .0 - .first() - .map(|(_, amount)| (route.on_remote_asset, *amount)) - .expect("not empty"); - - let packet = XcPacket { - interpreter: String::from(info.sender).into_bytes(), - user_origin: msg.executor_origin.user_origin.clone(), - salt: msg.msg.salt, - program: msg.msg.program, - assets: vec![asset].into(), - }; - - deps.api.debug(&format!( - "cvm::gateway::ibc::ics20 route {}", - &serde_json_wasm::to_string(&route)? - )); - - let mut event = make_event("bridge") - .add_attribute("to_network_id", msg.to.to_string()) - .add_attribute( - "assets", - serde_json_wasm::to_string(&packet.assets) - .map_err(|_| ContractError::FailedToSerialize)?, - ) - .add_attribute( - "program", - serde_json_wasm::to_string(&packet.program) - .map_err(|_| ContractError::FailedToSerialize)?, - ); - - if !packet.salt.is_empty() { - let salt_attr = Binary::from(packet.salt.as_slice()).to_string(); - event = event.add_attribute("salt", salt_attr); - } - - let coin = Coin::new(amount.0, route.local_native_denom.clone()); - - match route.gateway_to_send_to.clone() { - GatewayId::CosmWasm { contract, .. } => { - let msg = to_cosmwasm_message( - deps.as_ref(), - deps.api, - coin, - route, - packet, - block, - contract, - )?; - (msg, event) - }, - GatewayId::Evm { .. } => Err(ContractError::NotImplemented)?, - } - }; - - Ok(Response::default() - .add_event(event) - .add_submessage(SubMsg::reply_on_success(msg, ReplyId::TransportSent.into()))) -} - -/// When target network supports native cross chain operation of Transfer, -/// and program as simple as just Transfer, -/// can use instance of this structure to route pure funds transfer -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub struct IbcIcs20TransferShortcutRoute { - pub source: ChannelId, - pub denom: String, - pub sending: xc_core::transport::ibc::IbcIcs20Sender, -} - -/// this method return route in case program can be just transfer -pub fn ibc_ics_20_transfer_shortcut( - deps: Deps, - msg: &xc_core::gateway::BridgeForwardMsg, -) -> Result { - let storage = deps.storage; - let this = load_this(storage)?; - let other = network::load_other(storage, msg.to)?; - let this_asset_id = msg.msg.assets.0[0].0; - let asset: AssetItem = state::assets::ASSETS - .load(storage, this_asset_id) - .map_err(|_| ContractError::AssetNotFoundById(this_asset_id))?; - if let Some(ics20) = other.connection.ics_20 { - if let Some(shortcut) = other.connection.use_shortcut { - if shortcut { - return Ok(IbcIcs20TransferShortcutRoute { - source: ics20.source, - denom: asset.local.denom(), - sending: this - .ibc - .expect("ibc") - .channels - .expect("channels") - .ics20 - .expect("ics20") - .sender, - }) - } - } - } - Err(ContractError::ICS20NotFound) -} - -/// given target network and this network assets identifier, -/// find channels, target denomination and gateway on other network -/// so can form and sent ICS20 PFM Wasm terminated packet -/// starts on this network only -pub fn get_this_route( - storage: &dyn Storage, - to: xc_core::NetworkId, - this_asset_id: AssetId, -) -> Result { - let this = load_this(storage)?; - let other = network::load_other(storage, to)?; - let asset: AssetItem = state::assets::ASSETS - .load(storage, this_asset_id) - .map_err(|_| ContractError::AssetNotFoundById(this_asset_id))?; - let to_asset: AssetId = state::assets::NETWORK_ASSET - .load(storage, (this_asset_id, to)) - .map_err(|_| ContractError::AssetCannotBeTransferredToNetwork(this_asset_id, to))?; - let gateway_to_send_to = other.network.gateway.ok_or(ContractError::UnsupportedNetwork)?; - - let sender_gateway = match this.gateway.expect("we execute here") { - GatewayId::CosmWasm { contract, .. } => contract, - GatewayId::Evm { .. } => - Err(ContractError::BadlyConfiguredRouteBecauseThisChainCanSendOnlyFromCosmwasm)?, - }; - - let channel = other.connection.ics_20.ok_or(ContractError::ICS20NotFound)?.source; - - Ok(IbcIcs20ProgramRoute { - from_network: this.network_id, - local_native_denom: asset.local.denom(), - channel_to_send_over: channel, - gateway_to_send_to, - sender_gateway, - counterparty_timeout: other.connection.counterparty_timeout, - ibc_ics_20_sender: this - .ibc - .ok_or(ContractError::ICS20NotFound)? - .channels - .ok_or(ContractError::ICS20NotFound)? - .ics20 - .ok_or(ContractError::ICS20NotFound)? - .sender, - on_remote_asset: to_asset, - }) -} - -pub(crate) fn ics20_message_hook( - _: auth::WasmHook, - deps: Deps, - msg: XcMessageData, - env: Env, - info: MessageInfo, -) -> Result { - let packet: XcPacket = msg.packet; - ensure_anonymous(&packet.program)?; - deps.api.debug(&format!( - "cvm::gateway::ibc::ics20:: received assets {:?}, packet assets {:?}", - &info.funds, &packet.assets - )); - - let assets: Result = info - .funds - .into_iter() - .map(|coin| { - let asset = crate::assets::get_local_asset_by_reference( - deps, - AssetReference::Native { denom: coin.denom }, - )?; - Ok((asset.asset_id, coin.amount.into())) - }) - .collect(); - let call_origin = CallOrigin::Remote { user_origin: packet.user_origin }; - let execute_program = ExecuteProgramMsg { - salt: packet.salt, - program: packet.program, - assets: assets?.into(), - tip: Some(info.sender.to_string()), - }; - - let msg = ExecuteMsg::ExecuteProgramPrivileged { call_origin, execute_program }; - let msg = wasm_execute(env.contract.address, &msg, Default::default())?; - Ok(Response::new().add_submessage(SubMsg::reply_always(msg, ReplyId::ExecProgram.into()))) -} - -fn ensure_anonymous(program: &XcProgram) -> Result<()> { - use xc_core::Instruction::*; - for ix in &program.instructions { - match ix { - Transfer { .. } => {}, - Exchange { .. } => {}, - Spawn { program, .. } => ensure_anonymous(program)?, - _ => Err(ContractError::AnonymousCallsCanDoOnlyLimitedSetOfActions)?, - } - } - Ok(()) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/ics27.rs b/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/ics27.rs deleted file mode 100644 index 3341cd171fd..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/ics27.rs +++ /dev/null @@ -1,179 +0,0 @@ -//! ics27 integration to do txes - -use std::str::FromStr; - -use crate::{ - auth, - contract::ReplyId, - error::{ContractError, Result}, - events::make_event, - msg, - network::load_other, - state, -}; - -use cosmwasm_std::{ - ensure_eq, wasm_execute, Binary, BlockInfo, DepsMut, Env, Ibc3ChannelOpenResponse, - IbcBasicResponse, IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg, - IbcChannelOpenResponse, IbcMsg, IbcOrder, IbcPacketAckMsg, IbcPacketReceiveMsg, - IbcPacketTimeoutMsg, IbcReceiveResponse, MessageInfo, Response, SubMsg, -}; -use ibc_rs_scale::core::ics24_host::identifier::{ChannelId, ConnectionId}; -use xc_core::{ - proto::Isomorphism, shared::XcPacket, transport::ibc::ChannelInfo, CallOrigin, XCVMAck, -}; - -use super::make_ibc_failure_event; - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn ibc_channel_open( - _deps: DepsMut, - _env: Env, - msg: IbcChannelOpenMsg, -) -> Result { - let (channel, version) = match msg { - IbcChannelOpenMsg::OpenInit { channel } => (channel, None), - IbcChannelOpenMsg::OpenTry { channel, counterparty_version } => - (channel, Some(counterparty_version)), - }; - const IBC_VERSION: &str = xc_core::gateway::IBC_VERSION; - if version.is_some() && version.as_deref() != Some(IBC_VERSION) { - Err(ContractError::InvalidIbcVersion(version.unwrap())) - } else if channel.order != IbcOrder::Unordered { - Err(ContractError::InvalidIbcOrdering(channel.order)) - } else { - let version = version.unwrap_or_else(|| String::from(IBC_VERSION)); - Ok(Some(Ibc3ChannelOpenResponse { version })) - } -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn ibc_channel_connect( - deps: DepsMut, - _env: Env, - msg: IbcChannelConnectMsg, -) -> Result { - let channel = msg.channel(); - state::xcvm::IBC_CHANNEL_INFO.save( - deps.storage, - channel.endpoint.channel_id.clone(), - &ChannelInfo { - id: ChannelId::from_str(&channel.endpoint.channel_id)?, - counterparty_endpoint: channel.counterparty_endpoint.clone(), - connection_id: ConnectionId::from_str(&channel.connection_id)?, - }, - )?; - Ok(IbcBasicResponse::new().add_event( - make_event("ibc_connect").add_attribute("channel_id", channel.endpoint.channel_id.clone()), - )) -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn ibc_channel_close( - deps: DepsMut, - _env: Env, - msg: IbcChannelCloseMsg, -) -> Result { - let channel = msg.channel(); - state::xcvm::IBC_CHANNEL_INFO.remove(deps.storage, channel.endpoint.channel_id.clone()); - - state::xcvm::IBC_CHANNEL_NETWORK.remove(deps.storage, channel.endpoint.channel_id.clone()); - Ok(IbcBasicResponse::new().add_event( - make_event("ibc_close").add_attribute("channel_id", channel.endpoint.channel_id.clone()), - )) -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn ibc_packet_receive( - _deps: DepsMut, - env: Env, - msg: IbcPacketReceiveMsg, -) -> Result { - let response = IbcReceiveResponse::default().add_event(make_event("receive")); - let msg = (|| -> Result<_> { - let packet = XcPacket::decode(&msg.packet.data)?; - let call_origin = CallOrigin::Remote { user_origin: packet.user_origin }; - let execute_program = msg::ExecuteProgramMsg { - salt: packet.salt, - program: packet.program, - assets: packet.assets, - tip: Some(msg.relayer.to_string()), - }; - - let msg = msg::ExecuteMsg::ExecuteProgramPrivileged { call_origin, execute_program }; - let msg = wasm_execute(env.contract.address, &msg, Default::default())?; - Ok(SubMsg::reply_always(msg, ReplyId::ExecProgram.into())) - })(); - Ok(match msg { - Ok(msg) => response.set_ack(XCVMAck::Ok).add_submessage(msg), - Err(err) => response - .add_event(make_ibc_failure_event(err.to_string())) - .set_ack(XCVMAck::Fail), - }) -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn ibc_packet_ack(_deps: DepsMut, _env: Env, msg: IbcPacketAckMsg) -> Result { - let ack = XCVMAck::try_from(msg.acknowledgement.data.as_slice()) - .map_err(|_| ContractError::InvalidAck)?; - XcPacket::decode(&msg.original_packet.data)?; - Ok(IbcBasicResponse::default().add_event(make_event("ack").add_attribute("ack", ack))) -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn ibc_packet_timeout( - _deps: DepsMut, - _env: Env, - msg: IbcPacketTimeoutMsg, -) -> Result { - XcPacket::decode(&msg.packet.data)?; - // https://github.com/cosmos/ibc/pull/998 - Ok(IbcBasicResponse::default()) -} - -/// Handle a request gateway message. -/// The call must originate from an interpreter. -pub(crate) fn handle_bridge_forward_no_assets( - _: auth::Executor, - deps: DepsMut, - info: MessageInfo, - msg: msg::BridgeForwardMsg, - block: BlockInfo, -) -> Result { - ensure_eq!(msg.msg.assets.0.len(), 0, ContractError::CannotTransferAssets); - let other = load_other(deps.storage, msg.to)?; - let channel_id = other - .connection - .ics27_channel - .map(|x| x.id) - .ok_or(ContractError::UnknownChannel)?; - let packet = XcPacket { - interpreter: String::from(info.sender).into_bytes(), - user_origin: msg.executor_origin.user_origin, - salt: msg.msg.salt, - program: msg.msg.program, - assets: msg.msg.assets, - }; - let mut event = make_event("bridge") - .add_attribute("network_id", msg.to.to_string()) - .add_attribute( - "assets", - serde_json_wasm::to_string(&packet.assets) - .map_err(|_| ContractError::FailedToSerialize)?, - ) - .add_attribute( - "program", - serde_json_wasm::to_string(&packet.program) - .map_err(|_| ContractError::FailedToSerialize)?, - ); - if !packet.salt.is_empty() { - let salt_attr = Binary::from(packet.salt.as_slice()).to_string(); - event = event.add_attribute("salt", salt_attr); - } - Ok(Response::default().add_event(event).add_message(IbcMsg::SendPacket { - channel_id: channel_id.to_string(), - data: Binary::from(packet.encode()), - // TODO: should be a parameter or configuration - timeout: other.connection.counterparty_timeout.absolute(block), - })) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/mod.rs b/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/mod.rs deleted file mode 100644 index 3af3a2b6239..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/contract/ibc/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -use crate::events::make_event; - -pub mod ics20; -pub mod ics27; - -pub fn make_ibc_failure_event(reason: String) -> cosmwasm_std::Event { - make_event("receive") - .add_attribute("result", "failure") - .add_attribute("reason", reason) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/contract/mod.rs b/code/cvm/cosmwasm/contracts/gateway/src/contract/mod.rs deleted file mode 100644 index f8e66dc30a9..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/contract/mod.rs +++ /dev/null @@ -1,104 +0,0 @@ -pub mod execute; -pub mod ibc; -pub mod query; -pub mod sudo; - -use crate::{ - error::{ContractError, Result}, - events::make_event, - msg, state, -}; - -use cosmwasm_std::{DepsMut, Env, MessageInfo, Reply, Response, SubMsgResponse, SubMsgResult}; -use cw2::set_contract_version; -use cw_utils::ensure_from_older_version; -use xc_core::{ - transport::ibc::{ics20::MsgTransferResponse, TransportTrackerId}, - XCVMAck, -}; - -use self::ibc::make_ibc_failure_event; - -const CONTRACT_NAME: &str = "composable:xcvm-gateway"; -const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); - -#[derive(PartialEq, Debug, Clone, Copy, enumn::N)] -#[repr(u64)] -pub enum ReplyId { - InstantiateInterpreter = 0, - ExecProgram = 2, - TransportSent = 3, -} - -impl From for u64 { - fn from(val: ReplyId) -> Self { - val as u64 - } -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn instantiate( - deps: DepsMut, - _env: Env, - _info: MessageInfo, - msg: msg::InstantiateMsg, -) -> Result { - set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - state::save(deps.storage, &msg.0)?; - - Ok(Response::default().add_event(make_event("instantiated"))) -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn migrate(deps: DepsMut, _env: Env, _msg: msg::MigrateMsg) -> Result { - let _ = ensure_from_older_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - Ok(Response::default()) -} - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { - deps.api.debug(&format!("cvm::cosmwasm::reply {msg:?}")); - if let Some(reply_id) = ReplyId::n(msg.id) { - return match reply_id { - ReplyId::InstantiateInterpreter => - crate::interpreter::handle_instantiate_reply(deps, msg).map_err(ContractError::from), - ReplyId::TransportSent => handle_transfer_sent(deps, msg), - ReplyId::ExecProgram => handle_exec_reply(msg), - } - } - Err(ContractError::UnknownReply) -} - -fn handle_transfer_sent(deps: DepsMut, msg: Reply) -> Result { - deps.api.debug(&format!("cvm::gateway::handle_transfer_sent {:?}", msg.result)); - let SubMsgResult::Ok(SubMsgResponse { data: Some(b), .. }) = msg.result else { - return Err(ContractError::FailedIBCTransfer(format!("cvm::failed reply: {:?}", msg.result))) - }; - - use prost::Message; - let transfer_response = MsgTransferResponse::decode(&b[..]).map_err(|_e| { - ContractError::FailedIBCTransfer(format!("could not decode response: {b}")) - })?; - - let (bridge, route) = state::tracking::bridge_unlock(deps.storage)?; - let tracker_id = TransportTrackerId::Ibc { - channel_id: route.channel_to_send_over.clone(), - sequence: transfer_response.sequence, - }; - state::tracking::track(deps.storage, tracker_id, bridge)?; - - Ok(Response::new().add_event( - make_event("bridge.track.added") - .add_attribute("channel_id", route.channel_to_send_over.to_string()) - .add_attribute("sequence", transfer_response.sequence.to_string()), - )) -} - -fn handle_exec_reply(msg: Reply) -> Result { - let (data, event) = match msg.result { - SubMsgResult::Ok(_) => - (XCVMAck::Ok, make_event("receive").add_attribute("result", "success")), - SubMsgResult::Err(err) => (XCVMAck::Fail, make_ibc_failure_event(err)), - }; - Ok(Response::default().add_event(event).set_data(data)) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/contract/query.rs b/code/cvm/cosmwasm/contracts/gateway/src/contract/query.rs deleted file mode 100644 index ce7aa86c327..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/contract/query.rs +++ /dev/null @@ -1,21 +0,0 @@ -use crate::{assets, error::Result, exchange, msg, prelude::*}; - -use cosmwasm_std::{Binary, Deps, Env}; - -use super::ibc::ics20::get_this_route; - -#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn query(deps: Deps, _env: Env, msg: msg::QueryMsg) -> Result { - match msg { - msg::QueryMsg::GetAssetById { asset_id } => assets::get_asset_by_id(deps, asset_id) - .and_then(|asset| Ok(to_binary(&msg::GetAssetResponse { asset })?)), - msg::QueryMsg::GetLocalAssetByReference { reference } => - assets::get_local_asset_by_reference(deps, reference) - .and_then(|asset| Ok(to_binary(&msg::GetAssetResponse { asset })?)), - msg::QueryMsg::GetIbcIcs20Route { to_network, for_asset } => - get_this_route(deps.storage, to_network, for_asset) - .and_then(|route| Ok(to_binary(&msg::GetIbcIcs20RouteResponse { route })?)), - msg::QueryMsg::GetExchangeById { exchange_id } => exchange::get_by_id(deps, exchange_id) - .and_then(|exchange| Ok(to_binary(&msg::GetExchangeResponse { exchange })?)), - } -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/contract/sudo.rs b/code/cvm/cosmwasm/contracts/gateway/src/contract/sudo.rs deleted file mode 100644 index 4c3377948e2..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/contract/sudo.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::{error::ContractError, state}; -use cosmwasm_std::{entry_point, wasm_execute, Coin, DepsMut, Env, Event, Response}; -use ibc_rs_scale::core::ics24_host::identifier::ChannelId; -use xc_core::transport::ibc::{ics20::hook::IBCLifecycleComplete, SudoMsg}; - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> crate::error::Result { - deps.api - .debug(&format!("cvm::gateway::sudo {}", serde_json_wasm::to_string(&msg)?)); - match msg { - SudoMsg::IBCLifecycleComplete(IBCLifecycleComplete::IBCAck { - channel, - sequence, - ack, - success, - }) => - if !success { - handle_transport_failure(deps, env, channel, sequence, ack) - } else { - Ok(Response::new()) - }, - SudoMsg::IBCLifecycleComplete(IBCLifecycleComplete::IBCTimeout { channel, sequence }) => - handle_transport_failure(deps, env, channel, sequence, "timeout".to_string()), - } -} - -/// return funds to interpreter and sets final error -fn handle_transport_failure( - deps: DepsMut, - _env: Env, - channel: ChannelId, - sequence: u64, - reason: String, -) -> Result { - deps.api.debug( - format!("cvm::gateway::handle::transport_failure {} {} {}", &channel, sequence, &reason) - .as_str(), - ); - let msg = cw_xc_executor::msg::ExecuteMsg::SetErr { reason }; - let bridge_msg = - crate::state::tracking::get_interpreter_track(deps.storage, channel.as_str(), sequence)?; - let interpreter = - crate::state::interpreter::get_by_origin(deps.as_ref(), bridge_msg.executor_origin)?; - let mut response = Response::new(); - - let assets = bridge_msg - .msg - .assets - .into_iter() - .filter_map(|(asset, amount)| { - if let Ok(asset) = state::assets::ASSETS.load(deps.storage, asset) { - Some(Coin { denom: asset.denom(), amount: amount.into() }) - } else { - None - } - }) - .collect(); - - response = response.add_message(wasm_execute(interpreter.address, &msg, assets)?); - Ok(response.add_event(Event::new("cvm::gateway::handle::transport_failure"))) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/error.rs b/code/cvm/cosmwasm/contracts/gateway/src/error.rs deleted file mode 100644 index cb277744131..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/error.rs +++ /dev/null @@ -1,107 +0,0 @@ -use cosmwasm_std::{IbcOrder, Response, StdError}; -use ibc_rs_scale::core::ics24_host::identifier::IdentifierError; -use thiserror::Error; -use xc_core::{AssetId, NetworkId}; - -pub type Result = core::result::Result; - -#[derive(Error, Debug)] -pub enum ContractError { - #[error("{0}")] - Std(#[from] StdError), - #[error("Caller is not authorised to take this action.")] - NotAuthorized, - #[error("IBC channel version mismatch {0}.")] - InvalidIbcVersion(String), - #[error("Unexpected IBC channel ordering {0:?}.")] - InvalidIbcOrdering(IbcOrder), - #[error("An invalid XCVM packet has been received.")] - InvalidIbcXcvmPacket, - #[error("No IBC channel is opened to the target network.")] - UnsupportedNetwork, - #[error("Ics20 not found")] - ICS20NotFound, - #[error("Failed ibc transfer {0}")] - FailedIBCTransfer(String), - #[error("Could not serialize to JSON")] - FailedToSerialize, - #[error("Asset not been found in the registry.")] - AssetNotFound, - #[error("Exchange not been found in the registry.")] - ExchangeNotFound, - #[error("The contract must be initialized first.")] - NotInitialized, - #[error("An overflow occurred.")] - ArithmeticOverflow, - #[error("Not enough funds to cover the operation.")] - InsufficientFunds, - #[error("Program funds denom mapping to host not found")] - ProgramFundsDenomMappingToHostNotFound, - #[error("Program amount not equal to host amount")] - ProgramAmountNotEqualToHostAmount, - #[error("{0}")] - Protobuf(xc_core::proto::DecodeError), - #[error("An invalid ACK was provided, this MUST be impossible.")] - InvalidAck, - #[error("An unknown reply ID was provided, this MUST be impossible.")] - UnknownReply, - #[error("The provided channel has not been previously opened.")] - UnknownChannel, - #[error("The asset is already registered.")] - AlreadyRegistered, - #[error("Route not found.")] - RouteNotFound, - #[error("{0}")] - Bech32(bech32_no_std::Error), - #[error("{0}")] - Serde(#[from] serde_json_wasm::ser::Error), - #[error("Assets non transferrable")] - AssetsNonTransferrable, - #[error("Cannot transfer assets")] - CannotTransferAssets, - #[error("Program cannot be handled by destination")] - ProgramCannotBeHandledByDestination, - #[error("Not implemented")] - NotImplemented, - #[error("{0}")] - IbcIdentifier(IdentifierError), - #[error("Network config")] - NetworkConfig, - #[error("Unknown target network")] - UnknownTargetNetwork, - #[error("No connection information from this {0} to other network {1}")] - NoConnectionInformationFromThisToOtherNetwork(NetworkId, NetworkId), - - #[error("Asset {0} not found by id")] - AssetNotFoundById(AssetId), - #[error("Asset {0} cannot be transferred to network {1}")] - AssetCannotBeTransferredToNetwork(AssetId, NetworkId), - #[error("Gateway for network {0} not found")] - GatewayForNetworkNotFound(NetworkId), - #[error("Anonymous calls can do only limitet set of actions")] - AnonymousCallsCanDoOnlyLimitedSetOfActions, - #[error("Runtime unsupported on network")] - RuntimeUnsupportedOnNetwork, - #[error("Badly configured route because this chain can send only from cosmwasm")] - BadlyConfiguredRouteBecauseThisChainCanSendOnlyFromCosmwasm, - #[error("Account in program is not mappable to this chain")] - AccountInProgramIsNotMappableToThisChain, -} - -impl From for ContractError { - fn from(value: xc_core::proto::DecodeError) -> Self { - Self::Protobuf(value) - } -} - -impl From for ContractError { - fn from(value: bech32_no_std::Error) -> Self { - Self::Bech32(value) - } -} - -impl From for ContractError { - fn from(value: IdentifierError) -> Self { - Self::IbcIdentifier(value) - } -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/events.rs b/code/cvm/cosmwasm/contracts/gateway/src/events.rs deleted file mode 100644 index e9bc9c6440c..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/events.rs +++ /dev/null @@ -1,4 +0,0 @@ -/// Creates an event with contract’s default prefix and given action attribute. -pub(crate) fn make_event(action: &str) -> cosmwasm_std::Event { - cosmwasm_std::Event::new("cvm.gateway").add_attribute("action", action) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/exchange.rs b/code/cvm/cosmwasm/contracts/gateway/src/exchange.rs deleted file mode 100644 index e126915fcba..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/exchange.rs +++ /dev/null @@ -1,27 +0,0 @@ -use cosmwasm_std::{Deps, DepsMut}; -use xc_core::service::dex::{ExchangeId, ExchangeItem}; - -use crate::{ - auth, - batch::BatchResponse, - error::{ContractError, Result}, - events::make_event, - state::exchange::EXCHANGE, -}; - -pub(crate) fn get_by_id(deps: Deps, exchange_id: ExchangeId) -> Result { - EXCHANGE - .may_load(deps.storage, exchange_id.0)? - .ok_or(ContractError::ExchangeNotFound) -} - -pub(crate) fn force_exchange( - _: auth::Admin, - deps: DepsMut, - msg: ExchangeItem, -) -> Result { - EXCHANGE.save(deps.storage, msg.exchange_id.0, &msg)?; - Ok(BatchResponse::new().add_event( - make_event("exchange.forced").add_attribute("exchange_od", msg.exchange_id.to_string()), - )) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/interpreter.rs b/code/cvm/cosmwasm/contracts/gateway/src/interpreter.rs deleted file mode 100644 index d6effd88101..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/interpreter.rs +++ /dev/null @@ -1,128 +0,0 @@ -use crate::{ - batch::BatchResponse, - contract::ReplyId, - error::{ContractError, Result}, - events::make_event, - network::load_this, - state, -}; -use cosmwasm_std::{ - to_binary, Deps, DepsMut, Reply, Response, StdError, StdResult, SubMsg, WasmMsg, -}; - -use cw_xc_executor::events::CvmInterpreterInstantiated; -use xc_core::{CallOrigin, InterpreterOrigin}; - -use crate::{auth, prelude::*}; - -pub(crate) fn force_instantiate( - _: auth::Admin, - gateway: Addr, - deps: DepsMut, - user_origin: Addr, - salt: String, -) -> Result { - let config = load_this(deps.storage)?; - let interpreter_code_id = match config.gateway.expect("expected setup") { - GatewayId::CosmWasm { interpreter_code_id, .. } => interpreter_code_id, - GatewayId::Evm { .. } => Err(ContractError::RuntimeUnsupportedOnNetwork)?, - }; - let salt = salt.into_bytes(); - - let call_origin = CallOrigin::Local { user: user_origin }; - let interpreter_origin = - InterpreterOrigin { user_origin: call_origin.user(config.network_id), salt: salt.clone() }; - let msg = instantiate(deps.as_ref(), gateway, interpreter_code_id, &interpreter_origin, salt)?; - Ok(BatchResponse::new().add_submessage(msg).add_event( - make_event("interpreter.forced") - .add_attribute("interpreter_origin", interpreter_origin.to_string()), - )) -} - -pub fn instantiate( - deps: Deps, - admin: Addr, - interpreter_code_id: u64, - interpreter_origin: &InterpreterOrigin, - salt: Vec, -) -> Result { - let next_interpreter_id: u128 = - state::interpreter::INTERPRETERS_COUNT.load(deps.storage).unwrap_or_default() + 1; - - let instantiate_msg = WasmMsg::Instantiate2 { - admin: Some(admin.clone().into_string()), - code_id: interpreter_code_id, - msg: to_binary(&cw_xc_executor::msg::InstantiateMsg { - gateway_address: admin.into_string(), - interpreter_origin: interpreter_origin.clone(), - })?, - funds: vec![], - // and label has some unknown limits (including usage of special characters) - label: format!("cvm_executor_{}", &next_interpreter_id), - // salt limit is 64 characters - salt: to_binary(&salt)?, - }; - let interpreter_instantiate_submessage = - SubMsg::reply_on_success(instantiate_msg, ReplyId::InstantiateInterpreter.into()); - Ok(interpreter_instantiate_submessage) -} - -pub(crate) fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { - deps.api.debug(&format!( - "cvm:: {}", - serde_json_wasm::to_string(&msg).map_err(|e| StdError::generic_err(e.to_string()))? - )); - let response = msg.result.into_result().map_err(StdError::generic_err)?; - // Catch the default `instantiate` event which contains `_contract_address` attribute that - // has the instantiated contract's address - let address = &response - .events - .iter() - .find(|event| event.ty == "instantiate") - .ok_or_else(|| StdError::not_found("instantiate event not found"))? - .attributes - .iter() - .find(|attr| &attr.key == "_contract_address") - .ok_or_else(|| StdError::not_found("_contract_address attribute not found"))? - .value; - let interpreter_address = deps.api.addr_validate(address)?; - - // Interpreter provides `network_id, user_id` pair as an event for the router to know which - // pair is instantiated - - let event_name = format!("wasm-{}", CvmInterpreterInstantiated::NAME); - let interpreter_origin = &response - .events - .iter() - .find(|event| event.ty.starts_with(&event_name)) - .ok_or_else(|| StdError::not_found("interpreter event not found"))? - .attributes - .iter() - .find(|attr| attr.key == CvmInterpreterInstantiated::INTERPRETER_ORIGIN) - .ok_or_else(|| StdError::not_found("no data is returned from 'cvm_executor'"))? - .value; - let interpreter_origin = - xc_core::shared::decode_base64::<_, InterpreterOrigin>(interpreter_origin.as_str())?; - - let interpreter_id: u128 = - state::interpreter::INTERPRETERS_COUNT.load(deps.storage).unwrap_or_default() + 1; - let interpreter = state::interpreter::Interpreter { - address: interpreter_address, - interpreter_id: interpreter_id.into(), - }; - - state::interpreter::INTERPRETERS_COUNT.save(deps.storage, &interpreter_id)?; - state::interpreter::INTERPRETERS.save(deps.storage, interpreter_id, &interpreter)?; - state::interpreter::INTERPRETERS_ORIGIN_TO_ID.save( - deps.storage, - interpreter_origin, - &interpreter_id, - )?; - - deps.api.debug("cvm:: saved interpreter"); - - Ok(Response::new().add_event( - make_event("cvm.executor.instantiated") - .add_attribute("interpreter_id", interpreter_id.to_string()), - )) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/lib.rs b/code/cvm/cosmwasm/contracts/gateway/src/lib.rs deleted file mode 100644 index 076c671e4f0..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/lib.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![cfg_attr(not(test), deny(clippy::disallowed_methods, clippy::disallowed_types))] -extern crate alloc; - -pub use xc_core::gateway as msg; - -pub mod assets; -pub mod auth; -pub mod batch; -pub mod contract; -pub mod error; -pub mod events; -pub mod exchange; -pub mod interpreter; -mod network; -mod prelude; -pub mod state; diff --git a/code/cvm/cosmwasm/contracts/gateway/src/network.rs b/code/cvm/cosmwasm/contracts/gateway/src/network.rs deleted file mode 100644 index 2f9b8bb1000..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/network.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::{ - batch::BatchResponse, events::make_event, prelude::*, state::xcvm::IBC_CHANNEL_NETWORK, -}; -use cosmwasm_std::{DepsMut, Storage}; -use xc_core::{gateway::NetworkItem, NetworkId}; - -use crate::state::{self, NETWORK, NETWORK_TO_NETWORK}; - -use crate::error::{ContractError, Result}; - -pub fn load_this(storage: &dyn Storage) -> Result { - state::load(storage) - .and_then(|this| NETWORK.load(storage, this.network_id)) - .map_err(|_| ContractError::NetworkConfig) -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[serde(rename_all = "snake_case")] -pub struct OtherNetwork { - pub network: NetworkItem, - pub connection: OtherNetworkItem, -} - -pub fn load_other(storage: &dyn Storage, other: NetworkId) -> Result { - let this = state::load(storage)?; - let other = NETWORK.load(storage, other)?; - let connection = NETWORK_TO_NETWORK.load(storage, (this.network_id, other.network_id))?; - Ok(OtherNetwork { network: other, connection }) -} - -pub(crate) fn force_network_to_network( - _: crate::auth::Auth, - deps: DepsMut, - msg: xc_core::gateway::ForceNetworkToNetworkMsg, -) -> std::result::Result { - NETWORK_TO_NETWORK.save(deps.storage, (msg.from, msg.to), &msg.other)?; - if let Some(ibc) = msg.other.ics27_channel { - IBC_CHANNEL_NETWORK.save(deps.storage, ibc.id.to_string(), &msg.to)?; - } - Ok(BatchResponse::new().add_event( - make_event("network_to_network.forced") - .add_attribute("to", msg.to.to_string()) - .add_attribute("from", msg.from.to_string()) - .add_attribute("ics_20", msg.other.ics_20.is_some().to_string()), - )) -} - -pub(crate) fn force_network( - _auth: crate::auth::Auth, - deps: DepsMut, - msg: NetworkItem, -) -> crate::error::Result { - NETWORK.save(deps.storage, msg.network_id, &msg)?; - Ok(BatchResponse::new().add_event( - make_event("network.forced").add_attribute("network_id", msg.network_id.to_string()), - )) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/prelude.rs b/code/cvm/cosmwasm/contracts/gateway/src/prelude.rs deleted file mode 100644 index 80bce72b82b..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/prelude.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! mostly ensuring std vs no_std, and unified identifiers and numbers representation -pub use alloc::format; -pub use cosmwasm_std::{to_binary, Addr}; -pub use cw_storage_plus::Map; -pub use ibc_rs_scale::core::ics24_host::identifier::{ChannelId, ConnectionId}; -pub use serde::{Deserialize, Serialize}; -pub use xc_core::{gateway::config::*, shared::Displayed}; diff --git a/code/cvm/cosmwasm/contracts/gateway/src/state/assets.rs b/code/cvm/cosmwasm/contracts/gateway/src/state/assets.rs deleted file mode 100644 index ce29703a8d8..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/state/assets.rs +++ /dev/null @@ -1,13 +0,0 @@ -use xc_core::{ - gateway::{config::AssetReference, AssetItem}, - AssetId, NetworkId, -}; - -use crate::prelude::*; - -/// when assets to be sent to other network it should be mapped before sent -pub(crate) const NETWORK_ASSET: Map<(AssetId, NetworkId), AssetId> = Map::new("network_asset"); - -pub(crate) const ASSETS: Map = Map::new("assets"); - -pub(crate) const LOCAL_ASSETS: Map = Map::new("local_assets"); diff --git a/code/cvm/cosmwasm/contracts/gateway/src/state/exchange.rs b/code/cvm/cosmwasm/contracts/gateway/src/state/exchange.rs deleted file mode 100644 index e53e86e7829..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/state/exchange.rs +++ /dev/null @@ -1,4 +0,0 @@ -use cw_storage_plus::Map; -use xc_core::service::dex::ExchangeItem; - -pub(crate) const EXCHANGE: Map = Map::new("exchange"); diff --git a/code/cvm/cosmwasm/contracts/gateway/src/state/interpreter.rs b/code/cvm/cosmwasm/contracts/gateway/src/state/interpreter.rs deleted file mode 100644 index d0369db25f4..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/state/interpreter.rs +++ /dev/null @@ -1,27 +0,0 @@ -use cosmwasm_std::{Deps, StdResult}; -use cw_storage_plus::Item; -use xc_core::InterpreterOrigin; - -use crate::prelude::*; - -pub type InterpreterId = xc_core::shared::Displayed; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -pub(crate) struct Interpreter { - /// contract address - pub address: Addr, - pub interpreter_id: InterpreterId, -} - -pub(crate) fn get_by_origin(deps: Deps, origin: InterpreterOrigin) -> StdResult { - let id = INTERPRETERS_ORIGIN_TO_ID.load(deps.storage, origin)?; - INTERPRETERS.load(deps.storage, id) -} - -pub(crate) const INTERPRETERS_COUNT: Item = Item::new("interpreter_count"); - -pub(crate) const INTERPRETERS_ORIGIN_TO_ID: Map = - Map::new("interpreters_origin_to_id"); - -pub(crate) const INTERPRETERS: Map = Map::new("interpreters"); diff --git a/code/cvm/cosmwasm/contracts/gateway/src/state/mod.rs b/code/cvm/cosmwasm/contracts/gateway/src/state/mod.rs deleted file mode 100644 index 3ca2782b5c1..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/state/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -pub mod assets; -pub mod exchange; -pub mod interpreter; -pub mod tracking; -pub mod xcvm; -use crate::prelude::*; - -use cosmwasm_std::{StdResult, Storage}; -use cw_storage_plus::Item; - -use xc_core::NetworkId; - -const CONFIG: Item = Item::new("this"); - -pub(crate) fn load(storage: &dyn Storage) -> StdResult { - CONFIG.load(storage) -} - -pub(crate) fn save(storage: &mut dyn Storage, value: &HereItem) -> StdResult<()> { - CONFIG.save(storage, value) -} - -/// the connection description from first network to second -pub(crate) const NETWORK_TO_NETWORK: Map<(NetworkId, NetworkId), OtherNetworkItem> = - Map::new("network_to_network"); - -/// network state shared among all networks about it -pub(crate) const NETWORK: Map = Map::new("network"); diff --git a/code/cvm/cosmwasm/contracts/gateway/src/state/tracking.rs b/code/cvm/cosmwasm/contracts/gateway/src/state/tracking.rs deleted file mode 100644 index 4ebcb0e559d..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/state/tracking.rs +++ /dev/null @@ -1,59 +0,0 @@ -//! is used to track cross chain programs execution statuses (non atomic execution) -//! useful for timeouts, message acknowledgements failures, spawn concurrency handling - -use cosmwasm_std::{StdResult, Storage}; -use cw_storage_plus::{Item, Map}; -use xc_core::{ - gateway::BridgeForwardMsg, - transport::ibc::{IbcIcs20ProgramRoute, TransportTrackerId}, -}; - -pub(crate) const CURRENT_BRIDGE: Item<(BridgeForwardMsg, IbcIcs20ProgramRoute)> = - Item::new("current_bridge"); - -pub(crate) const CHANNEL_SEQUENCE_TO_BRIDGE_MSG: Map<(String, u64), BridgeForwardMsg> = - Map::new("channel_sequence_to_bridge_msg"); - -pub fn track( - storage: &mut dyn Storage, - tracker_id: TransportTrackerId, - msg: BridgeForwardMsg, -) -> StdResult<()> { - let (channel_id, sequence) = match tracker_id { - TransportTrackerId::Ibc { channel_id, sequence } => (channel_id, sequence), - }; - let key = (channel_id.to_string(), sequence); - - CHANNEL_SEQUENCE_TO_BRIDGE_MSG.save(storage, key, &msg) -} - -pub fn bridge_lock( - storage: &mut dyn Storage, - lock: (BridgeForwardMsg, IbcIcs20ProgramRoute), -) -> StdResult<()> { - if CURRENT_BRIDGE.load(storage).is_ok() { - return Err(cosmwasm_std::StdError::GenericErr { msg: "bridge is locked".to_string() }) - } - - CURRENT_BRIDGE.save(storage, &lock)?; - Ok(()) -} - -pub fn bridge_unlock( - storage: &mut dyn Storage, -) -> StdResult<(BridgeForwardMsg, IbcIcs20ProgramRoute)> { - let item = CURRENT_BRIDGE.load(storage)?; - CURRENT_BRIDGE.remove(storage); - Ok(item) -} - -/// Gets interpreter and gateway owned state on behalf interpreter (coins) -pub fn get_interpreter_track( - storage: &dyn Storage, - channel_id: &str, - sequence: u64, -) -> StdResult { - let key = (channel_id.to_string(), sequence); - let msg = CHANNEL_SEQUENCE_TO_BRIDGE_MSG.load(storage, key)?; - Ok(msg) -} diff --git a/code/cvm/cosmwasm/contracts/gateway/src/state/xcvm.rs b/code/cvm/cosmwasm/contracts/gateway/src/state/xcvm.rs deleted file mode 100644 index 8eda2237351..00000000000 --- a/code/cvm/cosmwasm/contracts/gateway/src/state/xcvm.rs +++ /dev/null @@ -1,6 +0,0 @@ -use cw_storage_plus::Map; - -use xc_core::{transport::ibc::ChannelInfo, NetworkId}; - -pub(crate) const IBC_CHANNEL_NETWORK: Map = Map::new("ibc_channel_network"); -pub(crate) const IBC_CHANNEL_INFO: Map = Map::new("ibc_channel_info"); diff --git a/code/cvm/cvm.json b/code/cvm/cvm.json deleted file mode 100644 index bcd68572281..00000000000 --- a/code/cvm/cvm.json +++ /dev/null @@ -1,291 +0,0 @@ -{ - "config": { - "force": [ - { - "force_network": { - "network_id": 3, - "metadata": "Cosmos Osmosis", - "accounts": { - "bech": "osmo" - }, - "gateway": { - "cosm_wasm": { - "contract": "osmo1ltevzdpc6ku5en4spjn887nnd7qt4mz0msn6jpk3s40rn80uz9yqa68crl", - "interpreter_code_id": 273, - "admin": "osmo1u2sr0p2j75fuezu92nfxg5wm46gu22yw9ezngh" - } - }, - "ibc": { - "channels": { - "ics20": { - "sender": "CosmosStargateIbcApplicationsTransferV1MsgTransfer", - "features": { - "pfm": {}, - "wasm_hooks": { - "callback": true - } - } - } - } - } - } - }, - { - "force_network": { - "network_id": 2, - "accounts": { - "bech": "centauri" - }, - "gateway": { - "cosm_wasm": { - "contract": "centauri1wpf2szs4uazej8pe7g8vlck34u24cvxx7ys0esfq6tuw8yxygzuqpjsn0d", - "interpreter_code_id": 16, - "admin": "centauri1u2sr0p2j75fuezu92nfxg5wm46gu22ywfgul6k" - } - }, - "ibc": { - "channels": { - "ics20": { - "sender": "CosmosStargateIbcApplicationsTransferV1MsgTransfer", - "features": { - "pfm": {}, - "wasm_hooks": { - "callback": true - } - } - } - } - } - } - }, - { - "force_network_to_network": { - "from": 2, - "to": 3, - "other": { - "counterparty_timeout": { - "seconds": 600 - }, - "ics_20": { - "source": "channel-3", - "sink": "channel-1279" - } - } - } - }, - { - "force_network_to_network": { - "from": 3, - "to": 2, - "other": { - "counterparty_timeout": { - "seconds": 600 - }, - "ics_20": { - "source": "channel-1279", - "sink": "channel-3" - } - } - } - }, - { - "force_asset": { - "asset_id": "237684487542793012780631851009", - "network_id": 3, - "metadata": "Picasso PICA Layer PICA on Osmosis", - "local": { - "native": { - "denom": "ibc/56D7C03B8F6A07AD322EEE1BEF3AE996E09D1C1E34C27CF37E0D4A0AC5972516" - } - }, - "bridged": { - "location_on_network": { - "ibc_ics20": { - "base_denom": "ppica", - "trace_path": "transfer/channel-1279" - } - } - } - } - }, - { - "force_asset": { - "asset_id": "237684487542793012780631851011", - "network_id": 3, - "local": { - "native": { - "denom": "ibc/6B2B19D874851F631FF0AF82C38A20D4B82F438C7A22F41EDA33568345397244" - } - }, - "bridged": { - "location_on_network": { - "ibc_ics20": { - "base_denom": "79228162514264337593543950342", - "trace_path": "transfer/channel-1279/transfer/channel-2/transfer/channel-15" - } - } - } - } - }, - { - "force_asset": { - "asset_id": "158456325028528675187087900673", - "network_id": 2, - "metadata": "Picasso PICA on Layer", - "local": { - "native": { - "denom": "ppica" - } - }, - "bridged": { - "location_on_network": { - "ibc_ics20": { - "base_denom": "1", - "trace_path": "transfer/channel-1" - } - } - } - } - }, - { - "force_asset": { - "asset_id": "158456325028528675187087900674", - "network_id": 2, - "metadata": "Osmosis OSMO on Layer", - "local": { - "native": { - "denom": "ibc/47BD209179859CDE4A2806763D7189B6E6FE13A17880FE2B42DE1E6C1E329E23" - } - }, - "bridged": { - "location_on_network": { - "ibc_ics20": { - "base_denom": "uosmo", - "trace_path": "transfer/channel-3" - } - } - } - } - }, - { - "force_asset": { - "asset_id": "158456325028528675187087900675", - "network_id": 2, - "local": { - "native": { - "denom": "ibc/6E41D54C24A4ACDDC1F2A8BF110867421C15E03CFD4A1B6B698570AC09A9EBF0" - } - }, - "bridged": { - "location_on_network": { - "ibc_ics20": { - "trace_path": "transfer/channel-2/transfer/channel-15", - "base_denom": "79228162514264337593543950342" - } - } - } - } - }, - { - "force_asset": { - "asset_id": "158456325028528675187087900676", - "network_id": 2, - "metadata": "Cosmos Hub ATOM on Layer", - "local": { - "native": { - "denom": "ibc/EF48E6B1A1A19F47ECAEA62F5670C37C0580E86A9E88498B7E393EB6F49F33C0" - } - }, - "bridged": { - "location_on_network": { - "ibc_ics20": { - "trace_path": "transfer/channel-4", - "base_denom": "uatom" - } - } - } - } - }, - { - "force_asset": { - "asset_id": "237684487542793012780631851010", - "network_id": 3, - "metadata": "Osmosis OSMO", - "local": { - "native": { - "denom": "uosmo" - } - } - } - }, - { - "force_exchange": { - "exchange": { - "osmosis_cross_chain_swap": { - "pool_id": 1057, - "token_a": "uosmo", - "token_b": "ibc/6B2B19D874851F631FF0AF82C38A20D4B82F438C7A22F41EDA33568345397244" - } - }, - "exchange_id": "237684489387467420151587012609", - "network_id": 3 - } - }, - { - "force_exchange": { - "exchange": { - "osmosis_cross_chain_swap": { - "pool_id": 1069, - "token_a": "ibc/6B2B19D874851F631FF0AF82C38A20D4B82F438C7A22F41EDA33568345397244", - "token_b": "uosmo" - } - }, - "exchange_id": "237684489387467420151587012610", - "network_id": 3 - } - }, - { - "force_asset_to_network_map": { - "this_asset": "158456325028528675187087900675", - "other_network": 3, - "other_asset": "237684487542793012780631851011" - } - }, - { - "force_asset_to_network_map": { - "this_asset": "237684487542793012780631851011", - "other_network": 2, - "other_asset": "158456325028528675187087900675" - } - }, - { - "force_asset_to_network_map": { - "this_asset": "158456325028528675187087900673", - "other_network": 3, - "other_asset": "237684487542793012780631851009" - } - }, - { - "force_asset_to_network_map": { - "this_asset": "237684487542793012780631851009", - "other_network": 2, - "other_asset": "158456325028528675187087900673" - } - }, - { - "force_asset_to_network_map": { - "this_asset": "158456325028528675187087900674", - "other_network": 3, - "other_asset": "237684487542793012780631851010" - } - }, - { - "force_asset_to_network_map": { - "this_asset": "237684487542793012780631851010", - "other_network": 2, - "other_asset": "158456325028528675187087900674" - } - } - ] - } -} \ No newline at end of file diff --git a/code/cvm/evm/.gitignore b/code/cvm/evm/.gitignore deleted file mode 100644 index 85198aaa55b..00000000000 --- a/code/cvm/evm/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# Compiler files -cache/ -out/ - -# Ignores development broadcast logs -!/broadcast -/broadcast/*/31337/ -/broadcast/**/dry-run/ - -# Docs -docs/ - -# Dotenv file -.env diff --git a/code/cvm/evm/.prettierrc.json b/code/cvm/evm/.prettierrc.json deleted file mode 100644 index be3ac7100c5..00000000000 --- a/code/cvm/evm/.prettierrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "printWidth": 120 -} \ No newline at end of file diff --git a/code/cvm/evm/.solhint.json b/code/cvm/evm/.solhint.json deleted file mode 100644 index b96d27440b6..00000000000 --- a/code/cvm/evm/.solhint.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "solhint:recommended", - "plugins": ["prettier"], - "rules": { - "prettier/prettier": "error", - "compiler-version": ["error", "^0.8.14"], - "reason-string": ["off", { "maxLength": 32 }], - "func-visibility": ["warn",{"ignoreConstructors":false}], - "no-empty-blocks": ["off"], - "not-rely-on-time": "off" - } - } \ No newline at end of file diff --git a/code/cvm/evm/README b/code/cvm/evm/README deleted file mode 100644 index e92a911dceb..00000000000 --- a/code/cvm/evm/README +++ /dev/null @@ -1,13 +0,0 @@ -# EVM - - -EVM SDK uses `cvm-typescript-sdk` library for its tests. Whenever the library source code is edited, it should be updated here in evm directory by running `npm install --force` - - -## Run tests -There are 2 set of tests - - Router and bridge related tests, which are implemented in solidity using `forge` - - `npm run test` or `forge test` - - CVM program encoding and decoding related tests, which are implemented in typescript using `hardhat` - - `npm run test-proto` - diff --git a/code/cvm/evm/flake-module.nix b/code/cvm/evm/flake-module.nix deleted file mode 100644 index f7aab0346f9..00000000000 --- a/code/cvm/evm/flake-module.nix +++ /dev/null @@ -1,113 +0,0 @@ -{ self, ... }: { - perSystem = - { config, self', inputs', pkgs, system, crane, systemCommonRust, ... }: - let nix = " --offline --out $out/lib "; - in { - - packages = rec { - openzeppelin-contracts = pkgs.stdenv.mkDerivation { - name = "openzeppelin-contracts"; - src = pkgs.fetchgit { - url = "https://github.com/OpenZeppelin/openzeppelin-contracts.git"; - rev = "fd81a96f01cc42ef1c9a5399364968d0e07e9e90"; - sha256 = "sha256-ggdq/9VgvxeFez8ouJpjRtBwOtJFgmVgOqTkzCb83oc="; - fetchSubmodules = true; - }; - phases = [ "installPhase" ]; - installPhase = '' - cp --recursive --force $src/ $out - ''; - }; - forge-std = pkgs.stdenv.mkDerivation { - name = "forge-std"; - src = pkgs.fetchgit { - url = "https://github.com/foundry-rs/forge-std.git"; - rev = "1d9650e951204a0ddce9ff89c32f1997984cef4d"; - sha256 = "sha256-KJU6k0w8ZCE8WXgwySBpatPzgf6jydB3cbKAiJIwWQY="; - fetchSubmodules = true; - }; - phases = [ "installPhase" ]; - installPhase = '' - cp --recursive --force $src/ $out - ''; - }; - - protobuf3-solidity-lib = pkgs.stdenv.mkDerivation { - name = "protobuf3-solidity-lib"; - src = pkgs.fetchgit { - url = "https://github.com/lazyledger/protobuf3-solidity-lib.git"; - rev = "bc4e75a0bf6e365e820929eb293ef9b6d6d69678"; - sha256 = "sha256-+HHUYhWDNRgA7x7p3Z0l0lS1e6pkJh4ZOSCCS4jQZQk="; - fetchSubmodules = true; - }; - phases = [ "installPhase" ]; - installPhase = '' - cp --recursive --force $src/ $out - ''; - }; - - yui-ibc-solidity = pkgs.stdenv.mkDerivation { - name = "yui-ibc-solidity"; - src = pkgs.fetchgit { - url = "https://github.com/hyperledger-labs/yui-ibc-solidity"; - rev = "d9a90cadaab7c06ddbcf0c7d73ab0c0777cef5a1"; - sha256 = "sha256-X82CvEbvyv/YPT+psnT3cu7n8HxQ8eW0CDIrTC922AA="; - fetchSubmodules = true; - }; - phases = [ "installPhase" ]; - installPhase = '' - cp --recursive --force $src/ $out - ''; - }; - - solidity-bytes-utils = pkgs.stdenv.mkDerivation { - name = "solidity-bytes-utils"; - src = pkgs.fetchgit { - url = "https://github.com/GNSPS/solidity-bytes-utils.git"; - rev = "6458fb2780a3092bc756e737f246be1de6d3d362"; - sha256 = "sha256-sJWoYag6hTIoS4Jr1XdqBKfrJaFQ1iMPy+UI5vVb7Lw="; - fetchSubmodules = true; - }; - phases = [ "installPhase" ]; - installPhase = '' - cp --recursive --force $src/ $out - ''; - }; - - evm-cvm-src = pkgs.stdenv.mkDerivation { - name = "evm-cvm-src"; - src = ./.; - phases = [ "installPhase" ]; - installPhase = '' - mkdir --parents $out - cp --no-preserve=mode,ownership --dereference --recursive --force $src/* $out - rm --recursive --force $out/lib - mkdir --parents $out/lib - function cpf { - cp --no-preserve=mode,ownership --dereference --recursive --force $@ - } - cpf "${forge-std}/" $out/lib/forge-std - cpf "${protobuf3-solidity-lib}/" $out/lib/protobuf3-solidity-lib - cpf "${openzeppelin-contracts}/" $out/lib/openzeppelin-contracts - cpf "${yui-ibc-solidity}/" $out/lib/yui-ibc-solidity - cpf "${solidity-bytes-utils}/" $out/lib/solidity-bytes-utils - ''; - }; - - evm-cvm-gateway = pkgs.stdenv.mkDerivation rec { - name = "evm-cvm-gateway"; - FOUNDRY_SOLC = "${pkgs.solc}/bin/solc"; - nativeBuildInputs = [ self'.packages.forge pkgs.solc ]; - src = evm-cvm-src; - patchPhase = "true"; - buildPhase = "true"; - installPhase = '' - mkdir --parents $out/lib - forge build ${nix} - ''; - dontFixup = true; - dontStrip = true; - }; - }; - }; -} diff --git a/code/cvm/evm/foundry.toml b/code/cvm/evm/foundry.toml deleted file mode 100644 index c32542df97c..00000000000 --- a/code/cvm/evm/foundry.toml +++ /dev/null @@ -1,12 +0,0 @@ -[profile.default] -libs = ['lib'] -out = 'out' -remappings = [ - 'forge-std/=lib/forge-std/src/', - 'openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/', - '@openzeppelin/=lib/openzeppelin-contracts/', - 'protobuf3-solidity-lib/=lib/protobuf3-solidity-lib/contracts/', - 'bytes-utils/=lib/solidity-bytes-utils/contracts/', - 'yui-ibc/=lib/yui-ibc-solidity/contracts/', -] -src = 'src' diff --git a/code/cvm/evm/hardhat.config.ts b/code/cvm/evm/hardhat.config.ts deleted file mode 100644 index 11bcc6c03b7..00000000000 --- a/code/cvm/evm/hardhat.config.ts +++ /dev/null @@ -1,53 +0,0 @@ -import fs from "fs"; -import "@nomiclabs/hardhat-waffle"; -import "@typechain/hardhat"; -import "hardhat-preprocessor"; -import {HardhatUserConfig, task} from "hardhat/config"; - -function getRemappings() { - return fs - .readFileSync("hardhatRemappings.txt", "utf8") - .split("\n") - .filter(Boolean) - .map((line) => line.trim().split("=")); -} - -const config: HardhatUserConfig = { - networks: { - hardhat: { - gas: 10000000, - allowUnlimitedContractSize: true - } - }, - solidity: { - version: "0.8.14", - settings: { - optimizer: { - enabled: true, - runs: 200, - }, - }, - }, - paths: { - sources: "./src", // Use ./src rather than ./contracts as Hardhat expects - cache: "./cache_hardhat", // Use a different cache for Hardhat than Foundry - tests: "./hardhat_tests", - }, - // This fully resolves paths for imports in the ./lib directory for Hardhat - preprocess: { - eachLine: (hre) => ({ - transform: (line: string) => { - if (line.match(/^\s*import /i)) { - getRemappings().forEach(([find, replace]) => { - if (line.match(find)) { - line = line.replace(find, replace); - } - }); - } - return line; - }, - }), - }, -}; - -export default config; diff --git a/code/cvm/evm/hardhat_tests/Interpreter-tests.ts b/code/cvm/evm/hardhat_tests/Interpreter-tests.ts deleted file mode 100644 index 2b5144a3c6a..00000000000 --- a/code/cvm/evm/hardhat_tests/Interpreter-tests.ts +++ /dev/null @@ -1,944 +0,0 @@ -import { ethers, network } from "hardhat"; -import { expect } from "chai"; -import { XCVM } from "xcvm-typescript-sdk"; - -const protobuf = require("protobufjs"); - -describe("Interpreter", function () { - let router: any; - let interpreter: any; - let owner: any; - let user1: any; - let user2: any; - let accounts: any; - let interpreterAddress: any; - let erc20: any; - let Interpreter: any; - let sdk: any; - let salt: any; - beforeEach(async function () { - accounts = await ethers.getSigners(); - [owner, user1, user2] = accounts; - - const SDK = await ethers.getContractFactory("SDK"); - const sdkLib = await SDK.deploy(); - - Interpreter = await ethers.getContractFactory("Interpreter", {libraries: {SDK: sdkLib.address}}); - const Router = await ethers.getContractFactory("Router", {libraries: {SDK: sdkLib.address}}); - router = await Router.deploy(); - //register owner as the bridge - await router.registerBridge(owner.address, 1, 1); - - salt = ethers.utils.arrayify("0x11") - await router.createInterpreter({ - networkId: 1, - account: owner.address, - }, salt); - interpreterAddress = await router.userInterpreter(1, owner.address, salt); - const ERC20Mock = await ethers.getContractFactory("ERC20Mock"); - erc20 = await ERC20Mock.deploy("test", "test", interpreterAddress, ethers.utils.parseEther("10000000000000000")); - await router.registerAsset(erc20.address, 1); - - const SDKMock = await ethers.getContractFactory("SDKMock", - { - libraries: { - SDK: sdkLib.address, - } - }); - sdk = await SDKMock.deploy(); - }); - - describe("interpreter with protobuf", function () { - it("test program using sdk: transfer unit to relayer", async function () { - let xcvm = new XCVM(); - let data = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createRelayer(), [ - xcvm.createAsset( - xcvm.createAssetId(xcvm.createGlobalId(1)), - xcvm.createBalance( - // 1.5 - xcvm.createUnit(1, xcvm.createRatio("1000", "2000")) - ) - ), - ]) - ), - ]) - ); - await router.runProgram({ networkId: 1, account: owner.address }, salt, xcvm.encodeMessage(data), [], []); - // 1.5 units - expect((await erc20.balanceOf(owner.address)).toString()).to.be.equal("1500000000000000000"); - }); - - it("test program using sdk: transfer unit", async function () { - let xcvm = new XCVM(); - let data = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset( - xcvm.createAssetId(xcvm.createGlobalId(1)), - xcvm.createBalance( - // 1.5 - xcvm.createUnit(1, xcvm.createRatio("1000", "2000")) - ) - ), - ]) - ), - ]) - ); - await router.runProgram({ networkId: 1, account: owner.address }, salt, xcvm.encodeMessage(data), [], []); - // 1.5 units - expect((await erc20.balanceOf(owner.address)).toString()).to.be.equal("1500000000000000000"); - }); - - it("test program using sdk: transfer ratio", async function () { - let xcvm = new XCVM(); - let data = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset( - xcvm.createAssetId(xcvm.createGlobalId(1)), - xcvm.createBalance(xcvm.createRatio("1000000000000000000000000000", "2000000000000000000000000000")) - ), - ]) - ), - ]) - ); - await router.runProgram({ networkId: 1, account: owner.address }, salt, xcvm.encodeMessage(data), [], []); - expect((await erc20.balanceOf(owner.address)).toString()).to.be.equal("5000000000000000000000000000000000"); - }); - - it("test program using sdk: transfer absolute", async function () { - let xcvm = new XCVM(); - let data = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset( - xcvm.createAssetId(xcvm.createGlobalId(1)), - xcvm.createBalance(xcvm.createAbsolute("1000000000000000000000000000")) - ), - ]) - ), - ]) - ); - let cc = xcvm.ProgramMessage.decode(xcvm.encodeMessage(data)); - await router.runProgram({ networkId: 1, account: owner.address }, salt, xcvm.encodeMessage(data), [], []); - expect((await erc20.balanceOf(owner.address)).toString()).to.be.equal("1000000000000000000000000000"); - }); - - it("test call function using sdk", async function () { - let functionSignature = erc20.interface.encodeFunctionData("transfer", [ - user1.address, - ethers.utils.parseEther("100"), - ]); - const abiCoder = ethers.utils.defaultAbiCoder; - const payload = ethers.utils.concat([ - ethers.utils.arrayify(abiCoder.encode(["address"], [erc20.address])), - ethers.utils.arrayify(functionSignature), - ]); - let xcvm = new XCVM(); - let programMessage = xcvm.createProgram( - "0x01", - xcvm.createInstructions([xcvm.createInstruction(xcvm.createCall(payload, xcvm.createBindings([])))]) - ); - - let encodedProgram = xcvm.encodeMessage(programMessage); - await router.runProgram({ networkId: 1, account: owner.address }, salt, encodedProgram, [], []); - expect((await erc20.balanceOf(user1.address)).toString()).to.be.equal(ethers.utils.parseEther("100").toString()); - }); - - it("test call function using sdk: call with late binding", async function () { - const abiCoder = ethers.utils.defaultAbiCoder; - - let functionSignature = erc20.interface.getSighash("transfer(address,uint256)"); - // placeholder 1 and 2 - const payload = ethers.utils.concat([ - ethers.utils.arrayify("0x01"), - ethers.utils.arrayify(functionSignature), - abiCoder.encode(["address"], [user1.address]), - ethers.utils.arrayify("0x02"), - ]); - let xcvm = new XCVM(); - let programMessage = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createCall( - payload, - xcvm.createBindings([ - xcvm.createBinding(0, xcvm.createBindingValue(xcvm.createGlobalId(1))), - // bindingValuePosition(1 byte) + function signature (4bytes) + address(32bytes, its encoded) = 37 => balanceValuePosition - xcvm.createBinding( - 37, - xcvm.createBindingValue(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio(1, 2)))) - ), - ]) - ) - ), - ]) - ); - - let encodedProgram = xcvm.encodeMessage(programMessage); - await router.runProgram({ networkId: 1, account: owner.address }, salt, encodedProgram, [], []); - expect((await erc20.balanceOf(user1.address)).toString()).to.be.equal( - ethers.utils.parseEther("5000000000000000").toString() - ); - }); - - it("test spawn program using sdk", async function () { - let xcvm = new XCVM(); - let programMessage = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createAbsolute("100"))), - ]) - ), - ]) - ); - - let data = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createSpawn(xcvm.createNetwork(1), xcvm.createSalt("0x11"), 1, programMessage, [ - xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createAbsolute(200))), - ]) - ), - ]) - ); - - await router.unregisterBridge(owner.address) - const IBCBridge = await ethers.getContractFactory("IBCBridgeMock"); - let bridge = await IBCBridge.deploy(); - await router.registerBridge(bridge.address, 1, 1) - - await expect(bridge.runProgram(router.address, { networkId: 1, account: owner.address }, "0x11", xcvm.encodeMessage(data), [], [])) - .to.emit(router, "Spawn") - .withArgs( - owner.address.toLowerCase(), - 1, - 1, - "0x11", - ethers.utils.hexlify(xcvm.encodeMessage(programMessage)), - [erc20.address], - [200] - ); - expect((await erc20.balanceOf(bridge.address)).toString()).to.be.equal("200"); - }); - - it("test program with multiple instructions", async function () { - const abiCoder = ethers.utils.defaultAbiCoder; - - let functionSignature = erc20.interface.getSighash("transfer(address,uint256)"); - // placeholder 1 and 2 - const payload = ethers.utils.concat([ - ethers.utils.arrayify("0x01"), - ethers.utils.arrayify(functionSignature), - abiCoder.encode(["address"], [user1.address]), - ethers.utils.arrayify("0x02"), - ]); - let xcvm = new XCVM(); - let programMessage = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createCall( - payload, - xcvm.createBindings([ - xcvm.createBinding(0, xcvm.createBindingValue(xcvm.createGlobalId(1))), - // bindingValuePosition(1 byte) + function signature (4bytes) + address(32bytes, its encoded) = 37 => balanceValuePosition - xcvm.createBinding( - 37, - xcvm.createBindingValue(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio(1, 2)))) - ), - ]) - ) - ), - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset( - xcvm.createAssetId(xcvm.createGlobalId(1)), - xcvm.createBalance( - // 1.5 - xcvm.createUnit(1, xcvm.createRatio("1000", "2000")) - ) - ), - ]) - ), - ]) - ); - - let encodedProgram = xcvm.encodeMessage(programMessage); - await router.runProgram({ networkId: 1, account: owner.address }, salt, encodedProgram, [], []); - expect((await erc20.balanceOf(user1.address)).toString()).to.be.equal( - ethers.utils.parseEther("5000000000000000").toString() - ); - expect((await erc20.balanceOf(owner.address)).toString()).to.be.equal(ethers.utils.parseEther("1.5").toString()); - }); - }); - - it("test generating uint128", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.convertUint128("100")))).to.be.equal( - await sdk.generateUint128("100") - ); - }); - - it("test generating absolute", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createAbsolute("100")))).to.be.equal( - await sdk.generateAbsolute("100") - ); - }); - - it("test generating ratio", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createRatio("100", "200")))).to.be.equal( - await sdk.generateRatio("100", "200") - ); - }); - - it("test generating unit", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createUnit("100", xcvm.createRatio("100", "200")))) - ).to.be.equal(await sdk.generateUnit("100", await sdk.generateRatio("100", "200"))); - }); - - it("test generating balance by ratio", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createBalance(xcvm.createRatio("100", "200"))))).to.be.equal( - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ); - }); - - it("test generating balance by absolute", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createBalance(xcvm.createAbsolute("100"))))).to.be.equal( - await sdk.generateBalanceByAbsolute(await sdk.generateAbsolute("100")) - ); - }); - - it("test generating balance by unit", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage(xcvm.createBalance(xcvm.createUnit("100", xcvm.createRatio("100", "200")))) - ) - ).to.be.equal( - await sdk.generateBalanceByUnit( - await sdk.generateUnit("100", await sdk.generateRatio("100", "200")) - ) - ); - }); - - it("test generating account", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createAccount("0x1111")))).to.be.equal( - await sdk.generateAccount("0x1111") - ); - }); - - it("test generating assetId by globalId", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createAssetId(xcvm.createGlobalId(1))))) - .to.be.equal( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)) - ); - }); - - it("test generating assetId by localId", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createAssetId(xcvm.createLocalId(owner.address))))) - .to.be.equal( - await sdk.generateAssetIdByLocalId(sdk.generateLocalId(owner.address)) - ); - }); - - it("test generating asset", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage(xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200")))) - ) - ).to.be.equal( - await sdk.generateAsset( - sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ); - }); - // self, relayer register - it("test generating assetAmount ", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200")))) - ) - ).to.be.equal( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ); - }); - - it("test generating bindingValue by globalId ", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createBindingValue(xcvm.createGlobalId(1))))).to.be.equal( - await sdk.generateBindingValueByGlobalId( - await sdk.generateGlobalId(1) - ) - ); - }); - - it("test generating bindingValue assetAmount ", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createBindingValue(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200")))) - ) - ) - ).to.be.equal( - await sdk.generateBindingValueByAssetAmount( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ) - ); - }); - - it("test generating binding", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createBinding( - 1, - xcvm.createBindingValue(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200")))) - ) - ) - ) - ).to.be.equal( - await sdk.generateBinding( - 1, - await sdk.generateBindingValueByAssetAmount( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ) - ) - ); - }); - - it("test generating bindings", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createBindings([ - xcvm.createBinding( - 1, - xcvm.createBindingValue(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200")))) - ), - xcvm.createBinding(2, xcvm.createBindingValue(xcvm.createGlobalId(1))), - ]) - ) - ) - ).to.be.equal( - await sdk.generateBindings([ - await sdk.generateBinding( - 1, - await sdk.generateBindingValueByAssetAmount( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ) - ), - await sdk.generateBinding( - 2, - await sdk.generateBindingValueByGlobalId( - await sdk.generateGlobalId(1) - ) - ), - ]) - ); - }); - - it("test generating transfer by account", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset( - xcvm.createAssetId(xcvm.createGlobalId(1)), - xcvm.createBalance(xcvm.createUnit(1, xcvm.createRatio("100", "200"))) - ), - xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(2)), xcvm.createBalance(xcvm.createAbsolute(1))), - ]) - ) - ) - ).to.be.equal( - await sdk.generateTransferByAccount(await sdk.generateAccount(owner.address), [ - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByUnit( - await sdk.generateUnit(1, await sdk.generateRatio("100", "200")) - ) - ), - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(2)), - await sdk.generateBalanceByAbsolute(await sdk.generateAbsolute(1)) - ), - ]) - ); - }); - - it("test generating instruction by transfer", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset( - xcvm.createAssetId(xcvm.createGlobalId(1)), - xcvm.createBalance(xcvm.createUnit(1, xcvm.createRatio("100", "200"))) - ), - xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(2)), xcvm.createBalance(xcvm.createAbsolute(1))), - ]) - ) - ) - ) - ).to.be.equal( - await sdk.generateInstructionByTransfer( - await sdk.generateTransferByAccount(await sdk.generateAccount(owner.address), [ - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByUnit( - await sdk.generateUnit(1, await sdk.generateRatio("100", "200")) - ) - ), - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(2)), - await sdk.generateBalanceByAbsolute(await sdk.generateAbsolute(1)) - ), - ]) - ) - ); - }); - - it("test generating salt", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createSalt("0x1111")))).to.be.equal( - await sdk.generateSalt("0x1111") - ); - }); - - it("test generating network", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect(ethers.utils.hexlify(xcvm.encodeMessage(xcvm.createNetwork(1)))).to.be.equal( - await sdk.generateNetwork(1) - ); - }); - - it("test generating spawn", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createSpawn( - xcvm.createNetwork(1), - xcvm.createSalt("0x11"), - 1, - xcvm.createProgram( - ethers.utils.hexlify("0x01"), - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createAbsolute("100"))), - ]) - ), - ]) - ), - [xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createAbsolute(200)))] - ) - ) - ) - ).to.be.equal( - await sdk.generateSpawn( - await sdk.generateNetwork(1), - 1, - await sdk.generateSalt("0x11"), - await sdk.generateProgram( - "0x01", - await sdk.generateInstructions([ - await sdk.generateInstructionByTransfer( - await sdk.generateTransferByAccount(await sdk.generateAccount(owner.address), [ - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByAbsolute(await sdk.generateAbsolute("100")) - ), - ]) - ), - ]) - ), - [ - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByAbsolute(await sdk.generateAbsolute(200)) - ), - ] - ) - ); - }); - - it("test generating instruction by spawn", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createInstruction( - xcvm.createSpawn( - xcvm.createNetwork(1), - xcvm.createSalt("0x11"), - 1, - xcvm.createProgram( - ethers.utils.hexlify("0x01"), - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createTransfer(xcvm.createAccount(owner.address), [ - xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createAbsolute("100"))), - ]) - ), - ]) - ), - [xcvm.createAsset(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createAbsolute(200)))] - ) - ) - ) - ) - ).to.be.equal( - await sdk.generateInstructionBySpawn( - await sdk.generateSpawn( - await sdk.generateNetwork(1), - 1, - await sdk.generateSalt("0x11"), - await sdk.generateProgram( - "0x01", - await sdk.generateInstructions([ - await sdk.generateInstructionByTransfer( - await sdk.generateTransferByAccount(await sdk.generateAccount(owner.address), [ - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByAbsolute(await sdk.generateAbsolute("100")) - ), - ]) - ), - ]) - ), - [ - await sdk.generateAsset( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByAbsolute(await sdk.generateAbsolute(200)) - ), - ] - ) - ) - ); - }); - - it("test generating call", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createCall( - ethers.utils.arrayify("0x11"), - xcvm.createBindings([ - xcvm.createBinding( - 1, - xcvm.createBindingValue(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200")))) - ), - xcvm.createBinding(2, xcvm.createBindingValue(xcvm.createGlobalId(1))), - ]) - ) - ) - ) - ).to.be.equal( - await sdk.generateCall( - "0x11", - await sdk.generateBindings([ - await sdk.generateBinding( - 1, - await sdk.generateBindingValueByAssetAmount( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ) - ), - await sdk.generateBinding( - 2, - await sdk.generateBindingValueByGlobalId( - await sdk.generateGlobalId(1) - ) - ), - ]) - ) - ); - }); - - it("test generating instruction by call", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createInstruction( - xcvm.createCall( - ethers.utils.arrayify("0x11"), - xcvm.createBindings([ - xcvm.createBinding( - 1, - xcvm.createBindingValue(xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200")))) - ), - xcvm.createBinding(2, xcvm.createBindingValue(xcvm.createGlobalId(1))), - ]) - ) - ) - ) - ) - ).to.be.equal( - await sdk.generateInstructionByCall( - await sdk.generateCall( - "0x11", - await sdk.generateBindings([ - await sdk.generateBinding( - 1, - await sdk.generateBindingValueByAssetAmount( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ) - ), - await sdk.generateBinding( - 2, - await sdk.generateBindingValueByGlobalId( - await sdk.generateGlobalId(1) - ) - ), - ]) - ) - ) - ); - }); - - it("test generating instructions", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createCall( - ethers.utils.arrayify("0x11"), - xcvm.createBindings([ - xcvm.createBinding( - 1, - xcvm.createBindingValue( - xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200"))) - ) - ), - xcvm.createBinding(2, xcvm.createBindingValue(xcvm.createGlobalId(1))), - ]) - ) - ), - ]) - ) - ) - ).to.be.equal( - await sdk.generateInstructions([ - await sdk.generateInstructionByCall( - await sdk.generateCall( - "0x11", - await sdk.generateBindings([ - await sdk.generateBinding( - 1, - await sdk.generateBindingValueByAssetAmount( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ) - ), - await sdk.generateBinding( - 2, - await sdk.generateBindingValueByGlobalId( - await sdk.generateGlobalId(1) - ) - ), - ]) - ) - ), - ]) - ); - }); - - it("test generating program", async function () { - let xcvm = new XCVM(); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - - expect( - ethers.utils.hexlify( - xcvm.encodeMessage( - xcvm.createProgram( - ethers.utils.hexlify("0x11"), - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createCall( - ethers.utils.arrayify("0x11"), - xcvm.createBindings([ - xcvm.createBinding( - 1, - xcvm.createBindingValue( - xcvm.createAssetAmount(xcvm.createAssetId(xcvm.createGlobalId(1)), xcvm.createBalance(xcvm.createRatio("100", "200"))) - ) - ), - xcvm.createBinding(2, xcvm.createBindingValue(xcvm.createGlobalId(1))), - ]) - ) - ), - ]) - ) - ) - ) - ).to.be.equal( - await sdk.generateProgram( - "0x11", - await sdk.generateInstructions([ - await sdk.generateInstructionByCall( - await sdk.generateCall( - "0x11", - await sdk.generateBindings([ - await sdk.generateBinding( - 1, - await sdk.generateBindingValueByAssetAmount( - await sdk.generateAssetAmount( - await sdk.generateAssetIdByGlobalId(sdk.generateGlobalId(1)), - await sdk.generateBalanceByRatio(await sdk.generateRatio("100", "200")) - ) - ) - ), - await sdk.generateBinding( - 2, - await sdk.generateBindingValueByGlobalId( - await sdk.generateGlobalId(1) - ) - ), - ]) - ) - ), - ]) - ) - ); - }); - - it("test addOwner and removeOwner by Call instruction and self later binding", async function () { - const abiCoder = ethers.utils.defaultAbiCoder; - - let functionSignature = Interpreter.interface.getSighash("addOwners(address[])"); - // placeholder 1 - let payload = ethers.utils.concat([ - ethers.utils.arrayify("0x01"), - ethers.utils.arrayify(functionSignature), - abiCoder.encode(["address[]"], [[user1.address]]), - ]); - let xcvm = new XCVM(); - let programMessage = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createCall( - payload, - xcvm.createBindings([xcvm.createBinding(0, xcvm.createBindingValue(xcvm.createSelf()))]) - ) - ), - ]) - ); - - let encodedProgram = xcvm.encodeMessage(programMessage); - let interpreter = await ethers.getContractAt("Interpreter", interpreterAddress); - expect((await interpreter.owners(user1.address)).toString()).to.be.equal("false"); - await router.runProgram({ networkId: 1, account: owner.address }, salt, encodedProgram, [], []); - expect((await interpreter.owners(user1.address)).toString()).to.be.equal("true"); - - functionSignature = Interpreter.interface.getSighash("removeOwners(address[])"); - // placeholder 1 - payload = ethers.utils.concat([ - ethers.utils.arrayify("0x01"), - ethers.utils.arrayify(functionSignature), - abiCoder.encode(["address[]"], [[user1.address]]), - ]); - programMessage = xcvm.createProgram( - "0x01", - xcvm.createInstructions([ - xcvm.createInstruction( - xcvm.createCall( - payload, - xcvm.createBindings([xcvm.createBinding(0, xcvm.createBindingValue(xcvm.createSelf()))]) - ) - ), - ]) - ); - - encodedProgram = xcvm.encodeMessage(programMessage); - await router.runProgram({ networkId: 1, account: owner.address }, salt, encodedProgram, [], []); - expect((await interpreter.owners(user1.address)).toString()).to.be.equal("false"); - }); -}); diff --git a/code/cvm/evm/package.json b/code/cvm/evm/package.json deleted file mode 100644 index 3430f54a448..00000000000 --- a/code/cvm/evm/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "xcvm", - "version": "0.0.0", - "license": "MIT", - "scripts": { - "preinstall": "cd ../xcvm-typescript-sdk/ && npm install && npm run build", - "test": "forge test -vvv", - "coverage": "forge coverage", - "solhint": "solhint src/**/*.sol", - "proto": "protoc ../xcvm-typescript-sdk/src/interpreter.proto -o interpreter_proto.bin", - "test-proto": "hardhat test", - "compile": "hardhat compile" - }, - "private": true, - "dependencies": { - "@openzeppelin/hardhat-upgrades": "^1.19.0", - "@prb/math": "^2.5.0", - "ethers": "^5.6.6", - "tslib": "^2.0.0" - }, - "devDependencies": { - "@lazyledger/protobuf3-solidity-lib": "^0.6.0", - "@nomiclabs/hardhat-ethers": "^2.0.6", - "@nomiclabs/hardhat-etherscan": "^3.1.0", - "@nomiclabs/hardhat-waffle": "^2.0.3", - "@nrwl/cli": "14.1.9", - "@nrwl/devkit": "14.1.9", - "@nrwl/eslint-plugin-nx": "14.1.9", - "@nrwl/linter": "14.1.9", - "@nrwl/node": "^14.1.9", - "@nrwl/workspace": "14.1.9", - "@openzeppelin/contracts": "^4.6.0", - "@openzeppelin/contracts-upgradeable": "^4.6.0", - "@typechain/ethers-v5": "^10.1.0", - "@typechain/hardhat": "^6.1.2", - "@types/chai": "^4.3.0", - "@types/mocha": "^9.1.0", - "@types/node": "^17.0.35", - "@typescript-eslint/eslint-plugin": "~5.18.0", - "@typescript-eslint/parser": "~5.18.0", - "chai": "^4.3.6", - "eslint": "~8.12.0", - "eslint-config-prettier": "8.1.0", - "ethereum-waffle": "^3.2.0", - "ethers": "^5.6.6", - "hardhat": "2.9.7", - "hardhat-preprocessor": "^0.1.5", - "hardhat-tracer": "^1.1.0-rc.6", - "nx": "14.1.9", - "prettier": "^2.7.1", - "prettier-plugin-solidity": "^1.0.0-beta.24", - "protobufjs": "~6.10.1", - "sol-merger": "^4.1.1", - "solhint": "^3.3.7", - "solhint-plugin-prettier": "^0.0.5", - "solidity-coverage": "^0.7.21", - "ts-node": "^10.7.0", - "typechain": "^8.1.0", - "typescript": "~4.6.2", - "xcvm-typescript-sdk": "file:../xcvm-typescript-sdk" - } -} diff --git a/code/cvm/evm/project.json b/code/cvm/evm/project.json deleted file mode 100644 index 39ec41b2e41..00000000000 --- a/code/cvm/evm/project.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "$schema": "./node_modules/nx/schemas/project-schema.json", - "sourceRoot": "./src", - "projectType": "application", - "targets": { - "build": { - "executor": "@nrwl/workspace:run-commands", - "options": { - "commands": [ - { - "command": "forge build --optimize" - } - ] - } - }, - "test": { - "executor": "@nrwl/workspace:run-commands", - "options": { - "commands": [ - { - "command": "forge test -vvv --gas-report" - } - ] - } - }, - "testWatch": { - "executor": "@nrwl/workspace:run-commands", - "options": { - "commands": [ - { - "command": "forge test -vvv --watch" - } - ] - } - }, - "coverage": { - "executor": "@nrwl/workspace:run-commands", - "options": { - "commands": [ - { - "command": "forge coverage" - } - ] - } - }, - "tags": [] -} diff --git a/code/cvm/evm/script/Counter.s.sol b/code/cvm/evm/script/Counter.s.sol deleted file mode 100644 index 5bab9859afa..00000000000 --- a/code/cvm/evm/script/Counter.s.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.14; - -//import "forge-std/Script.sol"; - -//contract CounterScript is Script { -// function setUp() public {} -// -// function run() public { -// vm.broadcast(); -// } -//} diff --git a/code/cvm/evm/src/IbcBridge.sol b/code/cvm/evm/src/IbcBridge.sol deleted file mode 100644 index 3a525d7db8f..00000000000 --- a/code/cvm/evm/src/IbcBridge.sol +++ /dev/null @@ -1,110 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.9; - -import "yui-ibc/proto/Channel.sol"; -import "yui-ibc/core/05-port/IIBCModule.sol"; -import "yui-ibc/core/25-handler/IBCHandler.sol"; -import "yui-ibc/core/24-host/IBCHost.sol"; -import "yui-ibc/apps/commons/IBCAppBase.sol"; -import "openzeppelin-contracts/utils/Context.sol"; -import "./interfaces/IRouter.sol"; - -import "protobuf3-solidity-lib/ProtobufLib.sol"; -import "./interfaces/IIbcBridge.sol"; -import "./libraries/SDK.sol"; - -contract IBCBridge is Context, IIbcBridge, IBCAppBase { - IBCHandler ibcHandler; - IBCHost ibcHost; - string public sourcePort; - string public sourceChannel; - address public routerAddress; - address public ibc; - - constructor(address _routerAddress, IBCHost _ibcHost, IBCHandler _ibcHandler) { - routerAddress = _routerAddress; - ibcHost = _ibcHost; - ibcHandler = _ibcHandler; - } - - function ibcAddress() public override view returns (address) { - return ibc; - } - - function sendProgram( - bytes memory account, - uint128 networkId, - bytes memory salt, - bytes memory spawnedProgram, - uint128[] memory assetIds, - uint256[] memory amounts - ) external { - require(msg.sender == routerAddress, "only router can send packet"); - bytes memory data = SDK.generateIBCSpawn( - SDK.generateUserOrigin(account, networkId), - SDK.generateInterpreterOrigin(account), - salt, - spawnedProgram, - assetIds, - amounts - ); - _sendPacket(data, uint64(block.timestamp + 60 * 10)); // 10 minutes - } - - - function _sendPacket(bytes memory data, uint64 timeout) virtual internal { - ibcHandler.sendPacket( - sourcePort, - sourceChannel, - Height.Data({revision_number: 0, revision_height: 0}), // to 0 because remote block height is not known - timeout, - data - ); - } - - - /// Module callbacks /// - function onRecvPacket(Packet.Data calldata packet, address relayer) external virtual override returns (bytes memory acknowledgement) { - (bytes memory interpreterOrigin, - IRouter.Origin memory origin, - bytes memory program, - bytes memory salt, - address[] memory _assets, - uint256[] memory _amounts) = SDK.decodeIBCSpawn(packet.data, routerAddress); - return _newAcknowledgement(IRouter(routerAddress).runProgram(origin, salt, program, _assets, _amounts)); - } - - function onAcknowledgementPacket(Packet.Data calldata packet, bytes calldata acknowledgement, address relayer) external virtual override { - //if (!_isSuccessAcknowledgement(acknowledgement)) { - // TODO if failed, transferred funds should be returned to user - //} - } - - function _newAcknowledgement(bool success) virtual internal pure returns (bytes memory) { - bytes memory acknowledgement = new bytes(1); - if (success) { - acknowledgement[0] = 0x01; - } else { - acknowledgement[0] = 0x00; - } - return acknowledgement; - } - - function onChanOpenInit(Channel.Order, string[] calldata, string calldata, string calldata channelId, ChannelCounterparty.Data calldata, string calldata) external virtual override { - // TODO authenticate a capability - //channelEscrowAddresses[channelId] = address(this); - } - - function onChanOpenTry(Channel.Order, string[] calldata, string calldata, string calldata channelId, ChannelCounterparty.Data calldata, string calldata, string calldata) external virtual override { - // TODO authenticate a capability - //channelEscrowAddresses[channelId] = address(this); - } - - function onChanOpenAck(string calldata portId, string calldata channelId, string calldata counterpartyVersion) external virtual override {} - - function onChanOpenConfirm(string calldata portId, string calldata channelId) external virtual override {} - - function onChanCloseInit(string calldata portId, string calldata channelId) external virtual override {} - - function onChanCloseConfirm(string calldata portId, string calldata channelId) external virtual override {} -} \ No newline at end of file diff --git a/code/cvm/evm/src/Interpreter.sol b/code/cvm/evm/src/Interpreter.sol deleted file mode 100644 index c46b7eace5e..00000000000 --- a/code/cvm/evm/src/Interpreter.sol +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; - -import "protobuf3-solidity-lib/ProtobufLib.sol"; -import "openzeppelin-contracts/token/ERC20/IERC20.sol"; -import "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import "./interfaces/IInterpreter.sol"; -import "./interfaces/IRouter.sol"; -import "./libraries/SDK.sol"; - -/** - * @title Interpreter - * @notice Custom interpreter - */ -contract Interpreter is IInterpreter { - - address public creator; - address public routerAddress; - bytes public override salt; - mapping(address => bool) public owners; - IRouter.Origin origin; - - modifier onlyOwnerOrCreator() { - require(keccak256(abi.encodePacked(msg.sender)) == keccak256(origin.account) || owners[msg.sender] || address(this) == msg.sender); - _; - } - - constructor(IRouter.Origin memory _origin, address _routerAddress, bytes memory _salt) { - owners[msg.sender] = true; - creator = msg.sender; - routerAddress = _routerAddress; - salt = _salt; - origin = _origin; - } - - function addOwners(address[] memory newOwners) public onlyOwnerOrCreator { - for(uint256 i=0; i account => salt - mapping(uint128 => mapping(bytes => mapping(bytes => address))) public userInterpreter; - - mapping(address => Bridge) public bridgesInfo; - // TODO ? do we have only one bridge per network and security - mapping(uint128 => mapping(BridgeSecurity => address)) public bridges; - mapping(uint256 => address) public assets; - mapping(address => uint256) public assetIds; - - event InstanceCreated(uint128 networkId, bytes user, bytes salt, address instance); - - event AddOwners(address sender, uint128 networkId, BridgeSecurity security, address[] owners); - - event RemoveOwners(address sender, uint128 networkId, BridgeSecurity security, address[] owners); - - event Spawn( - bytes account, - uint128 networkId, - BridgeSecurity security, - bytes salt, - bytes spawnedProgram, - address[] assetAddresses, - uint256[] amounts - ); - - modifier onlyBridge() { - require(bridgesInfo[msg.sender].security != BridgeSecurity(0)); - _; - } - - constructor() { - // enable trustless bridge; - } - - function getAsset(uint256 assetId) external view returns (address) { - return assets[assetId]; - } - - function getAssetIdByLocalId(address asset) external view returns(uint256) { - return assetIds[asset]; - } - - function getBridge(uint128 networkId, BridgeSecurity security) external view returns (address) { - return bridges[networkId][security]; - } - - function registerAsset(address assetAddress, uint128 assetId) external onlyOwner { - require(assetAddress != address(0), "Router: invalid address"); - assets[assetId] = assetAddress; - assetIds[assetAddress] = assetId; - } - - function unregisterAsset(uint128 assetId) external onlyOwner { - delete assetIds[assets[assetId]]; - delete assets[assetId]; - } - - function registerBridge( - address bridgeAddress, - BridgeSecurity security, - uint128 networkId - ) external onlyOwner { - require(bridges[networkId][security] == address(0), "Router: this type of bridge already registered"); - require(bridgeAddress != address(0), "Router: invalid address"); - require(bridgesInfo[bridgeAddress].security == BridgeSecurity(0), "Router: bridge already enabled"); - require(security != BridgeSecurity(0), "Router: should not disable bridge while registering bridge"); - bridgesInfo[bridgeAddress].security = security; - bridgesInfo[bridgeAddress].networkId = networkId; - bridges[networkId][security] = bridgeAddress; - } - - function unregisterBridge(address bridgeAddress) external onlyOwner { - require(bridgesInfo[bridgeAddress].security != BridgeSecurity(0), "Router: bridge already disabled"); - delete bridges[bridgesInfo[bridgeAddress].networkId][bridgesInfo[bridgeAddress].security]; - bridgesInfo[bridgeAddress].security = BridgeSecurity(0); - bridgesInfo[bridgeAddress].networkId = 0; - } - - //// TODO ? is the bridge who's gonna to provide internetwork assets transfer? - function _provisionAssets( - address payable interpreterAddress, - address[] memory erc20AssetList, - uint256[] memory amounts - ) internal { - require( - erc20AssetList.length == amounts.length, - "Router: asset list size should be equal to amount list size" - ); - if (msg.value > 0) { - bool sent = interpreterAddress.send(msg.value); - require(sent, "Failed to send Ether"); - } - for (uint256 i = 0; i < erc20AssetList.length; i++) { - IERC20(erc20AssetList[i]).transferFrom(msg.sender, interpreterAddress, amounts[i]); - } - } - - function runProgram( - Origin memory origin, - bytes memory salt, - bytes memory program, - address[] memory _assets, - uint256[] memory _amounts - ) public override payable onlyBridge returns (bool){ - // a program is a result of spawn function, pull the assets from the bridge to the interpreter - address payable interpreterAddress = getOrCreateInterpreter(origin, salt); - _provisionAssets(interpreterAddress, _assets, _amounts); - - IInterpreter(interpreterAddress).interpret(program, msg.sender); - return true; - } - - function createInterpreter(Origin memory origin, bytes memory salt) public returns(address payable) { - address interpreterAddress = userInterpreter[origin.networkId][origin.account][salt]; - require(interpreterAddress == address(0), "Interpreter already exists"); - return getOrCreateInterpreter(origin, salt); - } - - function getOrCreateInterpreter(Origin memory origin, bytes memory salt) public returns (address payable) { - address interpreterAddress = userInterpreter[origin.networkId][origin.account][salt]; - if (interpreterAddress == address(0)) { - //interpreterAddress = address(new Interpreter(networkId, account)); - require( - bridgesInfo[msg.sender].security == BridgeSecurity.Deterministic, - "For creating a new interpreter, the sender should be a deterministic bridge" - ); - interpreterAddress = address(new Interpreter(origin, address(this), salt)); - userInterpreter[origin.networkId][origin.account][salt] = interpreterAddress; - - emit InstanceCreated(origin.networkId, origin.account, salt, interpreterAddress); - } - return payable(interpreterAddress); - } - - function emitSpawn( - bytes memory account, - uint128 networkId, - BridgeSecurity security, - bytes memory salt, - bytes memory spawnedProgram, - address[] memory assetAddresses, - uint128[] memory _assetIds, - uint256[] memory amounts - ) override external { - address payable interpreterAddress = getOrCreateInterpreter(Origin(networkId, account), IInterpreter(msg.sender).salt()); - require(interpreterAddress == msg.sender, "Router: sender is not an interpreter address"); - emit Spawn(account, networkId, security, salt, spawnedProgram, assetAddresses, amounts); - if (security == BridgeSecurity.Deterministic) { - // send through ibc - IIbcBridge(bridges[networkId][security]).sendProgram(account, networkId, salt, spawnedProgram, _assetIds, amounts); - } - } -} diff --git a/code/cvm/evm/src/interfaces/IIbcBridge.sol b/code/cvm/evm/src/interfaces/IIbcBridge.sol deleted file mode 100644 index fd89a137161..00000000000 --- a/code/cvm/evm/src/interfaces/IIbcBridge.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.9; - -interface IIbcBridge { - function sendProgram( - bytes memory account, - uint128 networkId, - bytes memory salt, - bytes memory spawnedProgram, - uint128[] memory assetIds, - uint256[] memory amounts - ) external; -} \ No newline at end of file diff --git a/code/cvm/evm/src/interfaces/IInterpreter.sol b/code/cvm/evm/src/interfaces/IInterpreter.sol deleted file mode 100644 index 063f29ba254..00000000000 --- a/code/cvm/evm/src/interfaces/IInterpreter.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; - -interface IInterpreter { - function interpret(bytes calldata program, address relayer) external; - - function addOwners(address[] calldata newOwners) external; - - function removeOwners(address[] calldata newOwners) external; - - function salt() external view returns (bytes memory); - -} diff --git a/code/cvm/evm/src/interfaces/IRouter.sol b/code/cvm/evm/src/interfaces/IRouter.sol deleted file mode 100644 index 4545b752c99..00000000000 --- a/code/cvm/evm/src/interfaces/IRouter.sol +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; -pragma experimental ABIEncoderV2; - - -interface IRouter { - struct Bridge { - uint128 networkId; - BridgeSecurity security; - } - - enum BridgeSecurity { - Disabled, - Deterministic, - Probabilistic, - Optimistic - } - - struct Origin { - uint128 networkId; - bytes account; - } - - function getAsset(uint256 assetId) external view returns (address); - - function getAssetIdByLocalId(address asset) external view returns (uint256); - - function getBridge(uint128 networkId, BridgeSecurity security) external view returns (address); - - function runProgram( - Origin memory origin, - bytes memory salt, - bytes memory program, - address[] memory _assets, - uint256[] memory _amounts - ) external payable returns (bool); - - function emitSpawn( - bytes memory account, - uint128 networkId, - BridgeSecurity security, - bytes memory salt, - bytes memory spawnedProgram, - address[] memory assetAddresses, - uint128[] memory assetIds, - uint256[] memory amounts - ) external; -} diff --git a/code/cvm/evm/src/libraries/SDK.sol b/code/cvm/evm/src/libraries/SDK.sol deleted file mode 100644 index 17af92f53ed..00000000000 --- a/code/cvm/evm/src/libraries/SDK.sol +++ /dev/null @@ -1,996 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; - -import "protobuf3-solidity-lib/ProtobufLib.sol"; -import "openzeppelin-contracts/token/ERC20/IERC20.sol"; -import "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import "../interfaces/IRouter.sol"; -import "bytes-utils/BytesLib.sol"; -import "../libraries/xc/xcvm.sol"; - -library SDK { - - using BytesLib for bytes; - - struct SpawnPacket { - Spawn[] spawn; - Program program; - } - - struct Spawn { - Program program; - } - - /// as program interpetered, operatios poped out - /// for each operation, it goes to relevant instuction index to pop - struct Program { - OPERATION[] operation; - /// actually recursive definition (which is not part of solidity language) - uint8[] spawns; - } - - enum BindingValueType { - NONE, - ADDRESS, - UINT256, - BYTES, - BALANCE - } - - struct Binding { - uint32 position; - bytes bindingValue; - BindingValueType bindingType; - } - - enum OPERATION { - NONE, - TRANSFER, - SPAWN, - CALL, - QUERY - } - - struct AssetInfos { - address[] assetAddresses; - uint128[] assetIds; - uint256[] amounts; - } - - function bytesToAddress(bytes memory bys) private pure returns (address addr) { - assembly { - addr := mload(add(bys, 20)) - } - } - - function _checkField( - bytes memory program, - uint64 expectedField, - ProtobufLib.WireType expectedFieldType, - uint64 pos - ) private pure returns (uint64 newPos) { - // reading program message - bool success; - uint64 _field; - ProtobufLib.WireType _type; - (success, newPos, _field, _type) = ProtobufLib.decode_key(pos, program); - - require(success, "decode key failed"); - require(_field == expectedField, "field validation failed"); - require(_type == expectedFieldType, "type validation failed"); - } - - function _getMessageLength(bytes memory program, uint64 pos) private pure returns (uint64 size, uint64 newPos) { - // reading instruction message - bool success; - (success, newPos, size) = ProtobufLib.decode_embedded_message(pos, program); - require(success, "decode embedded message failed"); - } - - function _handleAccount(bytes memory program, uint64 pos) internal view returns (address account, uint64 newPos) { - // read account info - uint64 size; - (size, pos) = _getMessageLength(program, pos); - - // reading Account - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - account = bytesToAddress(program.slice(pos, size)); - newPos = pos + size; - } - - function _handleUint128(bytes memory program, uint64 pos) internal pure returns (uint128 value, uint64 newPos) { - bool success; - uint64 size; - // read uint128 message body - (size, pos) = _getMessageLength(program, pos); - - pos = _checkField(program, 1, ProtobufLib.WireType.Varint, pos); - uint64 highBits; - (success, pos, highBits) = ProtobufLib.decode_uint64(pos, program); - - pos = _checkField(program, 2, ProtobufLib.WireType.Varint, pos); - uint64 lowBits; - (success, newPos, lowBits) = ProtobufLib.decode_uint64(pos, program); - value = uint128(highBits) * 2**64 + uint128(lowBits); - } - - function _handleUnit( - bytes memory program, - uint64 pos, - address tokenAddress - ) internal view returns (uint256 amount, uint64 newPos) { - uint64 size; - // read ratio message body - (size, pos) = _getMessageLength(program, pos); - // reading Unit - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - uint128 unit; - (unit, pos) = _handleUint128(program, pos); - // reading balance type - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - - uint256 nominator; - uint256 denominator; - (nominator, denominator, newPos) = _handleRatio(program, pos); - uint256 decimals = IERC20Metadata(tokenAddress).decimals(); - amount = uint256(unit) * (10**decimals) + (nominator * (10**decimals)) / denominator; - } - - function _handleRatio(bytes memory program, uint64 pos) - internal pure - returns ( - uint256 nominator, - uint256 denominator, - uint64 newPos - ) - { - uint64 size; - // read ratio message body - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (nominator, pos) = _handleUint128(program, pos); - - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - (denominator, newPos) = _handleUint128(program, pos); - } - - function _handleAbsolute(bytes memory program, uint64 pos) internal pure returns (uint256 amount, uint64 newPos) { - uint64 size; - (size, pos) = _getMessageLength(program, pos); - - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (amount, newPos) = _handleUint128(program, pos); - } - - function _handleAssetAmount(bytes memory program, uint64 pos, address routerAddress) internal view returns (uint256 amount, uint64 newPos) { - uint64 size; - bool success; - uint64 field; - ProtobufLib.WireType _type; - // read balance message body - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - - address asset; - uint128 assetId; - (asset, assetId, pos) = _handleAssetId(program, pos, routerAddress); - - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - (amount, newPos) = _handleBalance(program, asset, pos); - } - - function _handleBalance( - bytes memory program, - address assetAddress, - uint64 pos - ) internal view returns (uint256 amount, uint64 newPos) { - bool success; - uint64 size; - uint64 field; - ProtobufLib.WireType _type; - - // read balance message body - (success, pos, size) = ProtobufLib.decode_embedded_message(pos, program); - require(success, "decode embedded message failed"); - - // reading balance type - (success, pos, field, _type) = ProtobufLib.decode_key(pos, program); - require(success, "decode key failed"); - require(_type == ProtobufLib.WireType.LengthDelimited, "decode type is not embedded messages"); - - if (field == 1) { - // ratio - uint256 nominator; - uint256 denominator; - (nominator, denominator, newPos) = _handleRatio(program, pos); - amount = (IERC20(assetAddress).balanceOf(address(this)) * nominator) / denominator; - } else if (field == 2) { - // absolute - (amount, newPos) = _handleAbsolute(program, pos); - } else if (field == 3) { - // unit - (amount, newPos) = _handleUnit(program, pos, assetAddress); - } else { - require(false, "unknown balance type"); - } - } - - function _handleLocalId(bytes memory program, uint64 pos) internal pure returns(address assetAddress, uint64 newPos) { - uint64 size; - bool success; - uint64 field; - ProtobufLib.WireType _type; - // read balance message body - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - assetAddress = bytesToAddress(program.slice(pos, size)); - newPos = pos + size; - } - - function _handleGlobalId(bytes memory program, uint64 pos) internal view returns(uint128 assetId, uint64 newPos) { - uint64 size; - bool success; - uint64 field; - ProtobufLib.WireType _type; - // read balance message body - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (assetId, newPos) = _handleUint128(program, pos); - } - - function _handleAssetId(bytes memory program, uint64 pos, address routerAddress) internal view returns (address asset, uint128 assetId, uint64 newPos) { - uint64 size; - // read asset message body - (size, pos) = _getMessageLength(program, pos); - - bool success; - uint64 field; - ProtobufLib.WireType _type; - (success, pos, field, _type) = ProtobufLib.decode_key(pos, program); - require(field == 1 || field == 2, "invalid key field"); - require(success, "decode key failed"); - - // asset id - if (field == 1) { - (assetId, newPos) = _handleGlobalId(program, pos); - asset = IRouter(routerAddress).getAsset(uint256(assetId)); - } else if (field == 2) { - (asset, newPos) = _handleLocalId(program, pos); - assetId = uint128(IRouter(routerAddress).getAssetIdByLocalId(asset)); - } else { - revert("no valid field"); - } - } - - function _handleAsset(bytes memory program, uint64 pos, address routerAddress) - internal view - returns ( - address asset, - uint128 assetId, - uint256 amount, - uint64 newPos - ) - { - // reading asset message - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (asset, assetId, pos) = _handleAssetId(program, pos, routerAddress); - - // reading asset balance message - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - // reading - (amount, newPos) = _handleBalance(program, asset, pos); - } - - function _getAssetListLength(bytes memory program, uint64 pos, uint256 totalAssetsLength, address routerAddress) internal view returns (uint256 length){ - //TODO optimization - while (pos < totalAssetsLength) { - (, , , pos) = _handleAsset(program, pos, routerAddress); - length += 1; - } - } - - function _handleAssets( - bytes memory program, - uint64 pos, - address routerAddress - ) - internal - returns ( - uint64 newPos, - AssetInfos memory assetInfos - ) - { - uint64 size; - (size, pos) = _getMessageLength(program, pos); - uint256 totalAssetsLength = pos + size; - uint256 assetListLength = _getAssetListLength(program, pos, totalAssetsLength, routerAddress); - - assetInfos.assetAddresses = new address[](assetListLength); - assetInfos.assetIds = new uint128[](assetListLength); - assetInfos.amounts = new uint256[](assetListLength); - uint256 count; - while (pos < totalAssetsLength) { - (assetInfos.assetAddresses[count], assetInfos.assetIds[count], assetInfos.amounts[count], pos) = _handleAsset(program, pos, routerAddress); - count += 1; - } - newPos = pos; - } - - - function _handleTransfer(bytes memory program, uint64 pos, address relayer, address routerAddress) internal returns (uint64 newPos) { - // reading transfer instruction - uint64 size; - (size, pos) = _getMessageLength(program, pos); - - bool success; - uint64 field; - ProtobufLib.WireType _type; - (success, pos, field, _type) = ProtobufLib.decode_key(pos, program); - require(field == 1 || field == 2, "invalid key field"); - require(success, "decode key failed"); - - // account - address account; - if (field == 1) { - (account, pos) = _handleAccount(program, pos); - } else if (field == 2) { - //self - (success, pos, size) = ProtobufLib.decode_embedded_message(pos, program); - newPos = pos + size; - account = relayer; - } else { - revert("no valid field"); - } - - // read asset info - pos = _checkField(program, 3, ProtobufLib.WireType.LengthDelimited, pos); - // read assets info and transfer asset funds - AssetInfos memory assetInfos; - (newPos, assetInfos) = _handleAssets(program, pos, routerAddress); - for (uint256 count = 0; count < assetInfos.assetAddresses.length; count++){ - IERC20(assetInfos.assetAddresses[count]).transfer(account, assetInfos.amounts[count]); - } - } - - function _handleBindingValue(bytes memory program, uint64 pos, address relayer, address routerAddress) - internal view - returns (bytes memory valueToReplace, uint64 newPos) - { - bool success; - uint64 size; - ProtobufLib.WireType _type; - uint64 valueType; - - // read binding value - //self - (success, pos, size) = ProtobufLib.decode_embedded_message(pos, program); - require(success, "decode embedded message failed"); - - (success, pos, valueType, _type) = ProtobufLib.decode_key(pos, program); - require(success, "decode key failed"); - - if (valueType == 1) { - //self - (success, pos, size) = ProtobufLib.decode_embedded_message(pos, program); - newPos = pos + size; - valueToReplace = abi.encode(address(this)); - } else if (valueType == 2) { - //relayer - (success, pos, size) = ProtobufLib.decode_embedded_message(pos, program); - newPos = pos + size; - valueToReplace = abi.encode(relayer); - } else if (valueType == 3) { - //TODO result - } else if (valueType == 4) { - uint256 amount; - (amount, newPos) = _handleAssetAmount(program, pos, routerAddress); - valueToReplace = abi.encode(uint256(amount)); - //balance - } else if (valueType == 5) { - // global id - address asset; - uint256 assetId; - (assetId, newPos) = _handleGlobalId(program, pos); - asset = IRouter(routerAddress).getAsset(uint256(assetId)); - valueToReplace = abi.encode(asset); - } else { - revert("wrong binding value type"); - } - } - - function _handleBinding( - bytes memory program, - uint64 pos, - bytes memory payload, - address relayer, - address routerAddress - ) - internal view - returns ( - uint64 position, - bytes memory valueToReplace, - uint64 newPos - ) - { - uint64 size; - bool success; - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.Varint, pos); - (success, pos, position) = ProtobufLib.decode_uint32(pos, program); - require(success, "decode embedded message failed"); - - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - (valueToReplace, pos) = _handleBindingValue(program, pos, relayer, routerAddress); - newPos = pos; - } - - function _handleNetwork(bytes memory program, uint64 pos) internal pure returns (uint128 networkId, uint64 newPos) { - // reading network - uint64 size; - bool success; - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (networkId, newPos) = _handleUint128(program, pos); - } - - function _handleSecurity(bytes memory program, uint64 pos) - internal pure - returns (IRouter.BridgeSecurity security, uint64 newPos) - { - // reading network - bool success; - int32 value; - (success, newPos, value) = ProtobufLib.decode_enum(pos, program); - require(success, "decode key failed"); - security = IRouter.BridgeSecurity(uint32(value)); - } - - function _handleSalt(bytes memory program, uint64 pos) internal pure returns (bytes memory salt, uint64 newPos) { - // reading salt - uint64 size; - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - newPos = pos + size; - salt = program.slice(pos, size); - } - - function _handleProgram(bytes memory program, uint64 pos) - internal pure - returns (bytes memory subProgram, uint64 newPos) - { - // reading program - uint64 size; - (size, pos) = _getMessageLength(program, pos); - subProgram = program.slice(pos, size); - newPos = pos + size; - } - - function _handleSpawnParams(bytes memory program, uint64 pos) - internal pure - returns ( - uint64 newPos, - uint256 maxPos, - uint128 networkId, - IRouter.BridgeSecurity security, - bytes memory salt, - bytes memory spawnedProgram - ) - { - // reading spawn instruction - uint64 size; - (size, pos) = _getMessageLength(program, pos); - maxPos = pos + size; - - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (networkId, pos) = _handleNetwork(program, pos); - - pos = _checkField(program, 2, ProtobufLib.WireType.Varint, pos); - (security, pos) = _handleSecurity(program, pos); - - // read salt - pos = _checkField(program, 3, ProtobufLib.WireType.LengthDelimited, pos); - (salt, pos) = _handleSalt(program, pos); - - // read program - pos = _checkField(program, 4, ProtobufLib.WireType.LengthDelimited, pos); - (spawnedProgram, newPos) = _handleProgram(program, pos); - } - - function _handleSpawn(bytes memory program, uint64 pos, address routerAddress, IRouter.Origin memory origin) internal returns (uint64 newPos) { - - uint256 maxPos; - uint128 networkId; - IRouter.BridgeSecurity security; - bytes memory salt; - bytes memory spawnedProgram; - - (pos, maxPos, networkId, security, salt, spawnedProgram) = _handleSpawnParams(program, pos); // TODO The fund should be pulled by the Bridge or sent from here??? which is more secure?? - pos = _checkField(program, 5, ProtobufLib.WireType.LengthDelimited, pos); - - AssetInfos memory assetInfos; - if (pos < maxPos) { - (newPos, assetInfos) = _handleAssets(program, pos, routerAddress); - } - - address to = IRouter(routerAddress).getBridge(networkId, security); - for (uint256 count = 0; count < assetInfos.assetAddresses.length; count++){ - IERC20(assetInfos.assetAddresses[count]).transfer(to, assetInfos.amounts[count]); - } - - IRouter(routerAddress).emitSpawn( - origin.account, - networkId, - security, - salt, - spawnedProgram, - assetInfos.assetAddresses, - assetInfos.assetIds, - assetInfos.amounts - ); - } - - function _replaceBytesByPosition( - bytes memory payload, - uint64 position, - bytes memory s - ) internal pure returns (bytes memory) { - bytes memory temp = new bytes(payload.length + s.length - 1); - uint256 count = 0; - for (uint256 i = 0; i < payload.length; i++) { - if (i != position) { - temp[i + count] = payload[i]; - } else { - for (uint256 j = 0; j < s.length; j++) { - temp[i + count] = s[count]; - count++; - } - count -= 1; - } - } - return temp; - } - - function _handleCall(bytes memory program, uint64 pos, address relayer, address routerAddress) internal returns (uint64 newPos) { - // reading call instruction - uint64 size; - (size, pos) = _getMessageLength(program, pos); - uint256 maxPos = pos + size; - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - bytes memory payload = program.slice(pos, size); - bytes memory finalPayload; - pos = pos + size; - //bytes memory bindingValues; - - if (pos < maxPos) { - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - uint64 totalBindingsLength = pos + size; - uint64 positionToRight; - while (pos < totalBindingsLength) { - uint64 position; - bytes memory valueToReplace; - (position, valueToReplace, pos) = _handleBinding(program, pos, payload, relayer, routerAddress); - payload = _replaceBytesByPosition(payload, position + positionToRight, valueToReplace); - positionToRight += uint64(valueToReplace.length) - 1; - } - } - address addr; - - //get the address from first bytes - (addr) = abi.decode(payload, (address)); - finalPayload = payload.slice(32, payload.length - 32); - (bool succ, bytes memory result) = addr.call(finalPayload); - require(succ, "error calling target"); - newPos = pos; - } - - function interpretProgram(bytes memory program, address relayer, address routerAddress, IRouter.Origin memory origin) public { - // reading program tag message - uint64 pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, 0); - uint64 size; - (size, pos) = _getMessageLength(program, pos); - bytes memory tag = program.slice(pos, size); - pos = pos + size; - - // reading program message - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - uint64 totalInstructionsLength = pos + size; - while (pos < totalInstructionsLength) { - // reading instruction message - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - - uint64 instruction; - bool success; - ProtobufLib.WireType _type; - (success, pos, instruction, _type) = ProtobufLib.decode_key(pos, program); - require(success, "decode key failed"); - - if (instruction == uint64(OPERATION.TRANSFER)) { - pos = _handleTransfer(program, pos, relayer, routerAddress); - } else if (instruction == uint64(OPERATION.SPAWN)) { - pos = _handleSpawn(program, pos, routerAddress, origin); - } else if (instruction == uint8(OPERATION.CALL)) { - pos = _handleCall(program, pos, relayer, routerAddress); - } - } - } - - // ibc package specific functions - function _handleInterpreterOrigin(bytes memory program, uint64 pos) public pure returns(bytes memory originInterpreter, uint64 newPos) { - uint64 size; - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (size, pos) = _getMessageLength(program, pos); - originInterpreter = program.slice(pos, size); - newPos = pos + size; - } - - function _handleUserOrigin(bytes memory program, uint64 pos) public view returns(address account, uint128 networkId, uint64 newPos) { - uint64 size; - (size, pos) = _getMessageLength(program, pos); - pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - (account, pos) = _handleAccount(program, pos); - pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - (networkId, newPos) = _handleNetwork(program, pos); - } - - // view functions to generate xcvm bytecode using protobuf - - function generateUint128(uint128 n) public pure returns (bytes memory u128) { - - uint64 highBits = uint64(n >> 64); - uint64 lowBits = uint64(n); - return abi.encodePacked(ProtobufLib.encode_key(1, 0), ProtobufLib.encode_uint64(highBits), ProtobufLib.encode_key(2, 0), ProtobufLib.encode_uint64(lowBits)); - } - - function generateAbsolute(uint128 n) public pure returns (bytes memory absolute) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(abi.encodePacked(generateUint128(n))) - ); - } - - function generateRatio(uint128 nominator, uint128 denominator) public pure returns (bytes memory ratio) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(generateUint128(nominator)), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(generateUint128(denominator)) - ); - } - - function generateUnit(uint128 integer, bytes memory ratio) public pure returns (bytes memory unit) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(generateUint128(integer)), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(ratio) - ); - } - - function generateBalanceByRatio(bytes memory ratio) public pure returns (bytes memory balance) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(ratio) - ); - } - - function generateBalanceByAbsolute(bytes memory absolute) public pure returns (bytes memory balance) { - return abi.encodePacked( - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(absolute) - ); - } - - function generateBalanceByUnit(bytes memory _unit) public pure returns (bytes memory balance) { - return abi.encodePacked( - ProtobufLib.encode_key(3, 2), - ProtobufLib.encode_length_delimited(_unit) - ); - } - - function generateAccount(bytes memory _account) public pure returns (bytes memory account) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_account) - ); - } - - function generateGlobalId(uint128 _globalId) public pure returns (bytes memory globalId) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(generateUint128(_globalId)) - ); - } - - function generateLocalId(bytes memory _localId) public pure returns (bytes memory localId) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_localId) - ); - } - - function generateAssetIdByGlobalId(bytes memory globalId) public pure returns (bytes memory assetId) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(globalId) - ); - } - - function generateAssetIdByLocalId(bytes memory local) public pure returns (bytes memory assetId) { - return abi.encodePacked( - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(local) - ); - } - - function generateAsset(bytes memory _assetId, bytes memory _balance) public pure returns (bytes memory asset) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_assetId), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(_balance) - ); - } - - function generateSelf(uint32 _self) public pure returns (bytes memory self) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 0), - ProtobufLib.encode_uint32(_self) - ); - } - - function generateRelayer(uint32 _relayer) public pure returns (bytes memory relayer) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 0), - ProtobufLib.encode_uint32(_relayer) - ); - } - - function generateResult(uint32 _result) public pure returns (bytes memory result) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 0), - ProtobufLib.encode_uint32(_result) - ); - } - - function generateAssetAmount(bytes memory assetId, bytes memory balance) public pure returns (bytes memory assetAmount) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(assetId), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(balance) - ); - } - - function generateBindingValueByAssetAmount(bytes memory _assetAmount) public pure returns (bytes memory bindingValue) { - return abi.encodePacked( - ProtobufLib.encode_key(4, 2), - ProtobufLib.encode_length_delimited(_assetAmount) - ); - } - - function generateBindingValueByGlobalId(bytes memory _globalId) public pure returns (bytes memory bindingValue) { - return abi.encodePacked( - ProtobufLib.encode_key(5, 2), - ProtobufLib.encode_length_delimited(_globalId) - ); - } - - function generateBinding(uint32 position, bytes memory _bindingValue) public pure returns (bytes memory binding) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 0), - ProtobufLib.encode_uint32(uint32(position)), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(_bindingValue) - ); - } - - function generateBindings(bytes[] memory _bindings) public pure returns (bytes memory bindings) { - for (uint i = 0; i < _bindings.length; i++) { - bindings = abi.encodePacked(bindings, ProtobufLib.encode_key(1, 2), ProtobufLib.encode_length_delimited(_bindings[i])); - } - } - - function generateTransferByAccount(bytes memory _account, bytes[] memory _assets) public pure returns (bytes memory transfer) { - transfer = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_account) - ); - for (uint i = 0; i < _assets.length; i++) { - transfer = abi.encodePacked(transfer, ProtobufLib.encode_key(3, 2), ProtobufLib.encode_length_delimited(_assets[i])); - } - } - - function generateSalt(bytes memory _salt) public pure returns (bytes memory salt) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_salt) - ); - } - - function generateNetwork(uint128 _network) public pure returns (bytes memory network) { - return abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(abi.encodePacked(generateUint128(_network))) - ); - } - - function generateSpawn( - bytes memory _network, - int32 _security, - bytes memory _salt, - bytes memory _spawnedProgram, - bytes[] memory _assets - ) public pure returns (bytes memory spawn) { - spawn = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_network), - ProtobufLib.encode_key(2, 0), - ProtobufLib.encode_enum(_security), - ProtobufLib.encode_key(3, 2), - ProtobufLib.encode_length_delimited(_salt), - ProtobufLib.encode_key(4, 2), - ProtobufLib.encode_length_delimited(_spawnedProgram) - ); - for (uint i = 0; i < _assets.length; i++) { - spawn = abi.encodePacked(spawn, ProtobufLib.encode_key(5, 2), ProtobufLib.encode_length_delimited(_assets[i])); - } - } - - function generateCall( - bytes memory _payload, - bytes memory _bindings - ) public pure returns (bytes memory call) { - call = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_payload), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(_bindings) - ); - } - - function generateInstructionByTransfer( - bytes memory _transfer - ) public pure returns (bytes memory instruction) { - instruction = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_transfer) - ); - } - - function generateInstructionByCall( - bytes memory _call - ) public pure returns (bytes memory instruction) { - instruction = abi.encodePacked( - ProtobufLib.encode_key(3, 2), - ProtobufLib.encode_length_delimited(_call) - ); - } - - function generateInstructionBySpawn( - bytes memory _spawn - ) public pure returns (bytes memory instruction) { - instruction = abi.encodePacked( - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(_spawn) - ); - } - - function generateInstructionByQuery( - bytes memory _query - ) public pure returns (bytes memory instruction) { - instruction = abi.encodePacked( - ProtobufLib.encode_key(4, 2), - ProtobufLib.encode_length_delimited(_query) - ); - } - - function generateInstructions(bytes[] memory _instructions) public pure returns (bytes memory instructions) { - for (uint i = 0; i < _instructions.length; i++) { - instructions = abi.encodePacked(instructions, ProtobufLib.encode_key(1, 2), ProtobufLib.encode_length_delimited(_instructions[i])); - } - } - - function generateProgram( - bytes memory _tag, - bytes memory _instructions - ) public pure returns (bytes memory program) { - program = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(_tag), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(_instructions) - ); - } - - // IBC spawn program encoder and decoder - function generateUserOrigin(bytes memory account, uint128 networkId) public pure returns (bytes memory userOrigin) { - userOrigin = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(generateAccount(account)), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(generateNetwork(networkId)) - ); - } - - function generateInterpreterOrigin(bytes memory account) public pure returns (bytes memory interpreterOrigin) { - interpreterOrigin = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(generateAccount(account)) - ); - } - - function generateIBCSpawn( - bytes memory interpreterOrigin, - bytes memory userOrigin, - bytes memory _salt, - bytes memory _spawnedProgram, - uint128[] memory assetIds, - uint256[] memory amounts - ) public pure returns (bytes memory spawn) { - spawn = abi.encodePacked( - ProtobufLib.encode_key(1, 2), - ProtobufLib.encode_length_delimited(interpreterOrigin), - ProtobufLib.encode_key(2, 2), - ProtobufLib.encode_length_delimited(userOrigin), - ProtobufLib.encode_key(3, 2), - ProtobufLib.encode_length_delimited(generateSalt(_salt)), - ProtobufLib.encode_key(4, 2), - ProtobufLib.encode_length_delimited(_spawnedProgram) - ); - for (uint i = 0; i < assetIds.length; i++) { - bytes memory assetId = generateAssetIdByGlobalId(generateGlobalId(assetIds[i])); - bytes memory asset = generateAsset( - assetId, generateBalanceByAbsolute( - generateAbsolute(uint128(amounts[i])) - )); - spawn = abi.encodePacked(spawn, ProtobufLib.encode_key(5, 2), ProtobufLib.encode_length_delimited(asset)); - } - } - - - - function decodeIBCSpawn( - bytes memory program, - address routerAddress - ) public - returns ( - bytes memory originInterpreter, IRouter.Origin memory origin, bytes memory spawnedProgram, bytes memory salt, address[] memory assetAddresses, uint256[] memory assetAmounts) - { - CvmXcvmPacket.Data memory packet = CvmXcvmPacket.decode(program); - require(false, "next PRs will switch from manual parser to generated"); - // // reading spawn instruction - // uint64 size; - // uint64 pos; - - // pos = _checkField(program, 1, ProtobufLib.WireType.LengthDelimited, pos); - // (originInterpreter, pos) = _handleInterpreterOrigin(program, pos); - - // pos = _checkField(program, 2, ProtobufLib.WireType.LengthDelimited, pos); - // uint128 networkId; - // address account; - // (account, networkId, pos) = _handleUserOrigin(program, pos); - - // origin.account = abi.encodePacked(account); - // pos = _checkField(program, 5, ProtobufLib.WireType.LengthDelimited, pos); - // // transfer assets to router - // (, AssetInfos memory assetInfos) = _handleAssets( - // program, - // pos, - // routerAddress - // ); - // for (uint256 count = 0; count < assetInfos.assetAddresses.length; count++){ - // IERC20(assetInfos.assetAddresses[count]).transfer(routerAddress, assetInfos.amounts[count]); - // } - // assetAddresses = assetInfos.assetAddresses; - // assetAmounts = assetInfos.amounts; - } -} \ No newline at end of file diff --git a/code/cvm/evm/src/libraries/xc/README.md b/code/cvm/evm/src/libraries/xc/README.md deleted file mode 100644 index 2e8cf207d71..00000000000 --- a/code/cvm/evm/src/libraries/xc/README.md +++ /dev/null @@ -1,8 +0,0 @@ - - - -```sh -# i shelled into nix https://github.com/datachainlab/solidity-protobuf/pull/39 and -./run.sh -i /home/dz/github.com/ComposableFi/composable/code/cvm/lib/core/protos/cvm.proto -o . -# to get files -``` \ No newline at end of file diff --git a/code/cvm/evm/src/libraries/xc/common.sol b/code/cvm/evm/src/libraries/xc/common.sol deleted file mode 100644 index 17b10284392..00000000000 --- a/code/cvm/evm/src/libraries/xc/common.sol +++ /dev/null @@ -1,262 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.10; -import "yui-ibc/proto/ProtoBufRuntime.sol"; -import "yui-ibc/proto/GoogleProtobufAny.sol"; - -library CvmCommonUint128 { - - - //struct definition - struct Data { - uint64 highBits; - uint64 lowBits; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_highBits(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_lowBits(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_highBits( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs); - r.highBits = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_lowBits( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs); - r.lowBits = x; - return sz; - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - if (r.highBits != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_uint64(r.highBits, pointer, bs); - } - if (r.lowBits != 0) { - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_uint64(r.lowBits, pointer, bs); - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_uint64(r.highBits); - e += 1 + ProtoBufRuntime._sz_uint64(r.lowBits); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.highBits != 0) { - return false; - } - - if (r.lowBits != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.highBits = input.highBits; - output.lowBits = input.lowBits; - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmCommonUint128 \ No newline at end of file diff --git a/code/cvm/evm/src/libraries/xc/xcvm.sol b/code/cvm/evm/src/libraries/xc/xcvm.sol deleted file mode 100644 index ea6c924901b..00000000000 --- a/code/cvm/evm/src/libraries/xc/xcvm.sol +++ /dev/null @@ -1,5838 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.10; -import "yui-ibc/proto/ProtoBufRuntime.sol"; -import "yui-ibc/proto/GoogleProtobufAny.sol"; -import "./common.sol"; - -library CvmXcvmPacketAsset { - - - //struct definition - struct Data { - CvmCommonUint128.Data asset_id; - CvmCommonUint128.Data amount; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_asset_id(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_amount(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_asset_id( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.asset_id = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_amount( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.amount = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmCommonUint128(uint256 p, bytes memory bs) - internal - pure - returns (CvmCommonUint128.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmCommonUint128.Data memory r, ) = CvmCommonUint128._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.asset_id, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.amount, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.asset_id)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.amount)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmCommonUint128.store(input.asset_id, output.asset_id); - CvmCommonUint128.store(input.amount, output.amount); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmPacketAsset - -library CvmXcvmPacket { - - - //struct definition - struct Data { - bytes interpreter; - CvmXcvmUserOrigin.Data user_origin; - bytes salt; - CvmXcvmProgram.Data program; - CvmXcvmPacketAsset.Data[] assets; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint[6] memory counters; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_interpreter(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_user_origin(pointer, bs, r); - } else - if (fieldId == 3) { - pointer += _read_salt(pointer, bs, r); - } else - if (fieldId == 4) { - pointer += _read_program(pointer, bs, r); - } else - if (fieldId == 5) { - pointer += _read_unpacked_repeated_assets(pointer, bs, nil(), counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - pointer = offset; - if (counters[5] > 0) { - require(r.assets.length == 0); - r.assets = new CvmXcvmPacketAsset.Data[](counters[5]); - } - - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 5) { - pointer += _read_unpacked_repeated_assets(pointer, bs, r, counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_interpreter( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); - r.interpreter = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_user_origin( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmUserOrigin.Data memory x, uint256 sz) = _decode_CvmXcvmUserOrigin(p, bs); - r.user_origin = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_salt( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); - r.salt = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_program( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmProgram.Data memory x, uint256 sz) = _decode_CvmXcvmProgram(p, bs); - r.program = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @param counters The counters for repeated fields - * @return The number of bytes decoded - */ - function _read_unpacked_repeated_assets( - uint256 p, - bytes memory bs, - Data memory r, - uint[6] memory counters - ) internal pure returns (uint) { - /** - * if `r` is NULL, then only counting the number of fields. - */ - (CvmXcvmPacketAsset.Data memory x, uint256 sz) = _decode_CvmXcvmPacketAsset(p, bs); - if (isNil(r)) { - counters[5] += 1; - } else { - r.assets[r.assets.length - counters[5]] = x; - counters[5] -= 1; - } - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmUserOrigin(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmUserOrigin.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmUserOrigin.Data memory r, ) = CvmXcvmUserOrigin._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmProgram(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmProgram.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmProgram.Data memory r, ) = CvmXcvmProgram._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmPacketAsset(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmPacketAsset.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmPacketAsset.Data memory r, ) = CvmXcvmPacketAsset._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - uint256 i; - if (r.interpreter.length != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_bytes(r.interpreter, pointer, bs); - } - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmUserOrigin._encode_nested(r.user_origin, pointer, bs); - - if (r.salt.length != 0) { - pointer += ProtoBufRuntime._encode_key( - 3, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_bytes(r.salt, pointer, bs); - } - - pointer += ProtoBufRuntime._encode_key( - 4, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmProgram._encode_nested(r.program, pointer, bs); - - if (r.assets.length != 0) { - for(i = 0; i < r.assets.length; i++) { - pointer += ProtoBufRuntime._encode_key( - 5, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs) - ; - pointer += CvmXcvmPacketAsset._encode_nested(r.assets[i], pointer, bs); - } - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e;uint256 i; - e += 1 + ProtoBufRuntime._sz_lendelim(r.interpreter.length); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmUserOrigin._estimate(r.user_origin)); - e += 1 + ProtoBufRuntime._sz_lendelim(r.salt.length); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmProgram._estimate(r.program)); - for(i = 0; i < r.assets.length; i++) { - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmPacketAsset._estimate(r.assets[i])); - } - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.interpreter.length != 0) { - return false; - } - - if (r.salt.length != 0) { - return false; - } - - if (r.assets.length != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.interpreter = input.interpreter; - CvmXcvmUserOrigin.store(input.user_origin, output.user_origin); - output.salt = input.salt; - CvmXcvmProgram.store(input.program, output.program); - - for(uint256 i5 = 0; i5 < input.assets.length; i5++) { - output.assets.push(input.assets[i5]); - } - - - } - - - //array helpers for Assets - /** - * @dev Add value to an array - * @param self The in-memory struct - * @param value The value to add - */ - function addAssets(Data memory self, CvmXcvmPacketAsset.Data memory value) internal pure { - /** - * First resize the array. Then add the new element to the end. - */ - CvmXcvmPacketAsset.Data[] memory tmp = new CvmXcvmPacketAsset.Data[](self.assets.length + 1); - for (uint256 i = 0; i < self.assets.length; i++) { - tmp[i] = self.assets[i]; - } - tmp[self.assets.length] = value; - self.assets = tmp; - } - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmPacket - -library CvmXcvmUserOrigin { - - - //struct definition - struct Data { - uint32 network_id; - bytes account; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_network_id(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_account(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_network_id( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (uint32 x, uint256 sz) = ProtoBufRuntime._decode_uint32(p, bs); - r.network_id = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_account( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); - r.account = x; - return sz; - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - if (r.network_id != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_uint32(r.network_id, pointer, bs); - } - if (r.account.length != 0) { - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_bytes(r.account, pointer, bs); - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_uint32(r.network_id); - e += 1 + ProtoBufRuntime._sz_lendelim(r.account.length); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.network_id != 0) { - return false; - } - - if (r.account.length != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.network_id = input.network_id; - output.account = input.account; - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmUserOrigin - -library CvmXcvmProgram { - - - //struct definition - struct Data { - bytes tag; - CvmXcvmInstruction.Data[] instructions; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint[3] memory counters; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_tag(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_unpacked_repeated_instructions(pointer, bs, nil(), counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - pointer = offset; - if (counters[2] > 0) { - require(r.instructions.length == 0); - r.instructions = new CvmXcvmInstruction.Data[](counters[2]); - } - - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 2) { - pointer += _read_unpacked_repeated_instructions(pointer, bs, r, counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_tag( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); - r.tag = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @param counters The counters for repeated fields - * @return The number of bytes decoded - */ - function _read_unpacked_repeated_instructions( - uint256 p, - bytes memory bs, - Data memory r, - uint[3] memory counters - ) internal pure returns (uint) { - /** - * if `r` is NULL, then only counting the number of fields. - */ - (CvmXcvmInstruction.Data memory x, uint256 sz) = _decode_CvmXcvmInstruction(p, bs); - if (isNil(r)) { - counters[2] += 1; - } else { - r.instructions[r.instructions.length - counters[2]] = x; - counters[2] -= 1; - } - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmInstruction(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmInstruction.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmInstruction.Data memory r, ) = CvmXcvmInstruction._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - uint256 i; - if (r.tag.length != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_bytes(r.tag, pointer, bs); - } - if (r.instructions.length != 0) { - for(i = 0; i < r.instructions.length; i++) { - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs) - ; - pointer += CvmXcvmInstruction._encode_nested(r.instructions[i], pointer, bs); - } - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e;uint256 i; - e += 1 + ProtoBufRuntime._sz_lendelim(r.tag.length); - for(i = 0; i < r.instructions.length; i++) { - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmInstruction._estimate(r.instructions[i])); - } - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.tag.length != 0) { - return false; - } - - if (r.instructions.length != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.tag = input.tag; - - for(uint256 i2 = 0; i2 < input.instructions.length; i2++) { - output.instructions.push(input.instructions[i2]); - } - - - } - - - //array helpers for Instructions - /** - * @dev Add value to an array - * @param self The in-memory struct - * @param value The value to add - */ - function addInstructions(Data memory self, CvmXcvmInstruction.Data memory value) internal pure { - /** - * First resize the array. Then add the new element to the end. - */ - CvmXcvmInstruction.Data[] memory tmp = new CvmXcvmInstruction.Data[](self.instructions.length + 1); - for (uint256 i = 0; i < self.instructions.length; i++) { - tmp[i] = self.instructions[i]; - } - tmp[self.instructions.length] = value; - self.instructions = tmp; - } - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmProgram - -library CvmXcvmInstruction { - - - //struct definition - struct Data { - CvmXcvmTransfer.Data transfer; - CvmXcvmSpawn.Data spawn; - CvmXcvmCall.Data call; - CvmXcvmExchange.Data exchange; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_transfer(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_spawn(pointer, bs, r); - } else - if (fieldId == 3) { - pointer += _read_call(pointer, bs, r); - } else - if (fieldId == 4) { - pointer += _read_exchange(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_transfer( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmTransfer.Data memory x, uint256 sz) = _decode_CvmXcvmTransfer(p, bs); - r.transfer = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_spawn( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmSpawn.Data memory x, uint256 sz) = _decode_CvmXcvmSpawn(p, bs); - r.spawn = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_call( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmCall.Data memory x, uint256 sz) = _decode_CvmXcvmCall(p, bs); - r.call = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_exchange( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmExchange.Data memory x, uint256 sz) = _decode_CvmXcvmExchange(p, bs); - r.exchange = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmTransfer(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmTransfer.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmTransfer.Data memory r, ) = CvmXcvmTransfer._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmSpawn(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmSpawn.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmSpawn.Data memory r, ) = CvmXcvmSpawn._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmCall(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmCall.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmCall.Data memory r, ) = CvmXcvmCall._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmExchange(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmExchange.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmExchange.Data memory r, ) = CvmXcvmExchange._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmTransfer._encode_nested(r.transfer, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmSpawn._encode_nested(r.spawn, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 3, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmCall._encode_nested(r.call, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 4, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmExchange._encode_nested(r.exchange, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmTransfer._estimate(r.transfer)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmSpawn._estimate(r.spawn)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmCall._estimate(r.call)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmExchange._estimate(r.exchange)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmXcvmTransfer.store(input.transfer, output.transfer); - CvmXcvmSpawn.store(input.spawn, output.spawn); - CvmXcvmCall.store(input.call, output.call); - CvmXcvmExchange.store(input.exchange, output.exchange); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmInstruction - -library CvmXcvmRatio { - - - //struct definition - struct Data { - uint64 nominator; - uint64 denominator; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_nominator(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_denominator(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_nominator( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs); - r.nominator = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_denominator( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs); - r.denominator = x; - return sz; - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - if (r.nominator != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_uint64(r.nominator, pointer, bs); - } - if (r.denominator != 0) { - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_uint64(r.denominator, pointer, bs); - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_uint64(r.nominator); - e += 1 + ProtoBufRuntime._sz_uint64(r.denominator); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.nominator != 0) { - return false; - } - - if (r.denominator != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.nominator = input.nominator; - output.denominator = input.denominator; - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmRatio - -library CvmXcvmUnit { - - - //struct definition - struct Data { - CvmCommonUint128.Data integer; - CvmXcvmRatio.Data ratio; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_integer(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_ratio(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_integer( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.integer = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_ratio( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmRatio.Data memory x, uint256 sz) = _decode_CvmXcvmRatio(p, bs); - r.ratio = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmCommonUint128(uint256 p, bytes memory bs) - internal - pure - returns (CvmCommonUint128.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmCommonUint128.Data memory r, ) = CvmCommonUint128._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmRatio(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmRatio.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmRatio.Data memory r, ) = CvmXcvmRatio._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.integer, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmRatio._encode_nested(r.ratio, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.integer)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmRatio._estimate(r.ratio)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmCommonUint128.store(input.integer, output.integer); - CvmXcvmRatio.store(input.ratio, output.ratio); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmUnit - -library CvmXcvmAbsolute { - - - //struct definition - struct Data { - CvmCommonUint128.Data value; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_value(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_value( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.value = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmCommonUint128(uint256 p, bytes memory bs) - internal - pure - returns (CvmCommonUint128.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmCommonUint128.Data memory r, ) = CvmCommonUint128._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.value, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.value)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmCommonUint128.store(input.value, output.value); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmAbsolute - -library CvmXcvmBalance { - - - //struct definition - struct Data { - CvmXcvmRatio.Data ratio; - CvmXcvmAbsolute.Data absolute; - CvmXcvmUnit.Data unit; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_ratio(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_absolute(pointer, bs, r); - } else - if (fieldId == 3) { - pointer += _read_unit(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_ratio( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmRatio.Data memory x, uint256 sz) = _decode_CvmXcvmRatio(p, bs); - r.ratio = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_absolute( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmAbsolute.Data memory x, uint256 sz) = _decode_CvmXcvmAbsolute(p, bs); - r.absolute = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_unit( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmUnit.Data memory x, uint256 sz) = _decode_CvmXcvmUnit(p, bs); - r.unit = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmRatio(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmRatio.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmRatio.Data memory r, ) = CvmXcvmRatio._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmAbsolute(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmAbsolute.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmAbsolute.Data memory r, ) = CvmXcvmAbsolute._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmUnit(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmUnit.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmUnit.Data memory r, ) = CvmXcvmUnit._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmRatio._encode_nested(r.ratio, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmAbsolute._encode_nested(r.absolute, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 3, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmUnit._encode_nested(r.unit, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmRatio._estimate(r.ratio)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmAbsolute._estimate(r.absolute)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmUnit._estimate(r.unit)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmXcvmRatio.store(input.ratio, output.ratio); - CvmXcvmAbsolute.store(input.absolute, output.absolute); - CvmXcvmUnit.store(input.unit, output.unit); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmBalance - -library CvmXcvmAsset { - - - //struct definition - struct Data { - CvmCommonUint128.Data asset_id; - CvmXcvmBalance.Data balance; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_asset_id(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_balance(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_asset_id( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.asset_id = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_balance( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmBalance.Data memory x, uint256 sz) = _decode_CvmXcvmBalance(p, bs); - r.balance = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmCommonUint128(uint256 p, bytes memory bs) - internal - pure - returns (CvmCommonUint128.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmCommonUint128.Data memory r, ) = CvmCommonUint128._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmBalance(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmBalance.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmBalance.Data memory r, ) = CvmXcvmBalance._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.asset_id, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmBalance._encode_nested(r.balance, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.asset_id)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmBalance._estimate(r.balance)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmCommonUint128.store(input.asset_id, output.asset_id); - CvmXcvmBalance.store(input.balance, output.balance); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmAsset - -library CvmXcvmAssetAmount { - - - //struct definition - struct Data { - CvmCommonUint128.Data asset_id; - CvmXcvmBalance.Data balance; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_asset_id(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_balance(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_asset_id( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.asset_id = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_balance( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmBalance.Data memory x, uint256 sz) = _decode_CvmXcvmBalance(p, bs); - r.balance = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmCommonUint128(uint256 p, bytes memory bs) - internal - pure - returns (CvmCommonUint128.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmCommonUint128.Data memory r, ) = CvmCommonUint128._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmBalance(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmBalance.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmBalance.Data memory r, ) = CvmXcvmBalance._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.asset_id, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmBalance._encode_nested(r.balance, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.asset_id)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmBalance._estimate(r.balance)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmCommonUint128.store(input.asset_id, output.asset_id); - CvmXcvmBalance.store(input.balance, output.balance); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmAssetAmount - -library CvmXcvmBindingValue { - - - //struct definition - struct Data { - XCVM_PROTO_GLOBAL_ENUMS.Register register; - CvmCommonUint128.Data asset_id; - CvmXcvmAssetAmount.Data asset_amount; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_register(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_asset_id(pointer, bs, r); - } else - if (fieldId == 3) { - pointer += _read_asset_amount(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_register( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (int64 tmp, uint256 sz) = ProtoBufRuntime._decode_enum(p, bs); - XCVM_PROTO_GLOBAL_ENUMS.Register x = XCVM_PROTO_GLOBAL_ENUMS.decode_Register(tmp); - r.register = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_asset_id( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.asset_id = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_asset_amount( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmAssetAmount.Data memory x, uint256 sz) = _decode_CvmXcvmAssetAmount(p, bs); - r.asset_amount = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmCommonUint128(uint256 p, bytes memory bs) - internal - pure - returns (CvmCommonUint128.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmCommonUint128.Data memory r, ) = CvmCommonUint128._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmAssetAmount(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmAssetAmount.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmAssetAmount.Data memory r, ) = CvmXcvmAssetAmount._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - if (uint(r.register) != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - int32 _enum_register = XCVM_PROTO_GLOBAL_ENUMS.encode_Register(r.register); - pointer += ProtoBufRuntime._encode_enum(_enum_register, pointer, bs); - } - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.asset_id, pointer, bs); - - - pointer += ProtoBufRuntime._encode_key( - 3, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmAssetAmount._encode_nested(r.asset_amount, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_enum(XCVM_PROTO_GLOBAL_ENUMS.encode_Register(r.register)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.asset_id)); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmAssetAmount._estimate(r.asset_amount)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (uint(r.register) != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.register = input.register; - CvmCommonUint128.store(input.asset_id, output.asset_id); - CvmXcvmAssetAmount.store(input.asset_amount, output.asset_amount); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmBindingValue - -library CvmXcvmBinding { - - - //struct definition - struct Data { - uint32 position; - CvmXcvmBindingValue.Data binding_value; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_position(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_binding_value(pointer, bs, r); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_position( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (uint32 x, uint256 sz) = ProtoBufRuntime._decode_uint32(p, bs); - r.position = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_binding_value( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmBindingValue.Data memory x, uint256 sz) = _decode_CvmXcvmBindingValue(p, bs); - r.binding_value = x; - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmBindingValue(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmBindingValue.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmBindingValue.Data memory r, ) = CvmXcvmBindingValue._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - if (r.position != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_uint32(r.position, pointer, bs); - } - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmBindingValue._encode_nested(r.binding_value, pointer, bs); - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e; - e += 1 + ProtoBufRuntime._sz_uint32(r.position); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmBindingValue._estimate(r.binding_value)); - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.position != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.position = input.position; - CvmXcvmBindingValue.store(input.binding_value, output.binding_value); - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmBinding - -library CvmXcvmTransfer { - - - //struct definition - struct Data { - bytes account; - CvmXcvmTip.Data tip; - CvmXcvmAsset.Data[] assets; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint[4] memory counters; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_account(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_tip(pointer, bs, r); - } else - if (fieldId == 3) { - pointer += _read_unpacked_repeated_assets(pointer, bs, nil(), counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - pointer = offset; - if (counters[3] > 0) { - require(r.assets.length == 0); - r.assets = new CvmXcvmAsset.Data[](counters[3]); - } - - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 3) { - pointer += _read_unpacked_repeated_assets(pointer, bs, r, counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_account( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); - r.account = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_tip( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmTip.Data memory x, uint256 sz) = _decode_CvmXcvmTip(p, bs); - r.tip = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @param counters The counters for repeated fields - * @return The number of bytes decoded - */ - function _read_unpacked_repeated_assets( - uint256 p, - bytes memory bs, - Data memory r, - uint[4] memory counters - ) internal pure returns (uint) { - /** - * if `r` is NULL, then only counting the number of fields. - */ - (CvmXcvmAsset.Data memory x, uint256 sz) = _decode_CvmXcvmAsset(p, bs); - if (isNil(r)) { - counters[3] += 1; - } else { - r.assets[r.assets.length - counters[3]] = x; - counters[3] -= 1; - } - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmTip(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmTip.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmTip.Data memory r, ) = CvmXcvmTip._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmAsset(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmAsset.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmAsset.Data memory r, ) = CvmXcvmAsset._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - uint256 i; - if (r.account.length != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_bytes(r.account, pointer, bs); - } - - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmTip._encode_nested(r.tip, pointer, bs); - - if (r.assets.length != 0) { - for(i = 0; i < r.assets.length; i++) { - pointer += ProtoBufRuntime._encode_key( - 3, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs) - ; - pointer += CvmXcvmAsset._encode_nested(r.assets[i], pointer, bs); - } - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e;uint256 i; - e += 1 + ProtoBufRuntime._sz_lendelim(r.account.length); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmTip._estimate(r.tip)); - for(i = 0; i < r.assets.length; i++) { - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmAsset._estimate(r.assets[i])); - } - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.account.length != 0) { - return false; - } - - if (r.assets.length != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.account = input.account; - CvmXcvmTip.store(input.tip, output.tip); - - for(uint256 i3 = 0; i3 < input.assets.length; i3++) { - output.assets.push(input.assets[i3]); - } - - - } - - - //array helpers for Assets - /** - * @dev Add value to an array - * @param self The in-memory struct - * @param value The value to add - */ - function addAssets(Data memory self, CvmXcvmAsset.Data memory value) internal pure { - /** - * First resize the array. Then add the new element to the end. - */ - CvmXcvmAsset.Data[] memory tmp = new CvmXcvmAsset.Data[](self.assets.length + 1); - for (uint256 i = 0; i < self.assets.length; i++) { - tmp[i] = self.assets[i]; - } - tmp[self.assets.length] = value; - self.assets = tmp; - } - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmTransfer - -library CvmXcvmTip { - - - //struct definition - struct Data { - bool x; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - } - return (r, sz); - } - - // field readers - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory /* r */ - ) internal pure returns (uint) { - uint256 e; - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - - } - - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmTip - -library CvmXcvmExchange { - - - //struct definition - struct Data { - CvmCommonUint128.Data exchange_id; - CvmXcvmAsset.Data[] give; - CvmXcvmAsset.Data[] want; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint[7] memory counters; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_exchange_id(pointer, bs, r); - } else - if (fieldId == 5) { - pointer += _read_unpacked_repeated_give(pointer, bs, nil(), counters); - } else - if (fieldId == 6) { - pointer += _read_unpacked_repeated_want(pointer, bs, nil(), counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - pointer = offset; - if (counters[5] > 0) { - require(r.give.length == 0); - r.give = new CvmXcvmAsset.Data[](counters[5]); - } - if (counters[6] > 0) { - require(r.want.length == 0); - r.want = new CvmXcvmAsset.Data[](counters[6]); - } - - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 5) { - pointer += _read_unpacked_repeated_give(pointer, bs, r, counters); - } else - if (fieldId == 6) { - pointer += _read_unpacked_repeated_want(pointer, bs, r, counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_exchange_id( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmCommonUint128.Data memory x, uint256 sz) = _decode_CvmCommonUint128(p, bs); - r.exchange_id = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @param counters The counters for repeated fields - * @return The number of bytes decoded - */ - function _read_unpacked_repeated_give( - uint256 p, - bytes memory bs, - Data memory r, - uint[7] memory counters - ) internal pure returns (uint) { - /** - * if `r` is NULL, then only counting the number of fields. - */ - (CvmXcvmAsset.Data memory x, uint256 sz) = _decode_CvmXcvmAsset(p, bs); - if (isNil(r)) { - counters[5] += 1; - } else { - r.give[r.give.length - counters[5]] = x; - counters[5] -= 1; - } - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @param counters The counters for repeated fields - * @return The number of bytes decoded - */ - function _read_unpacked_repeated_want( - uint256 p, - bytes memory bs, - Data memory r, - uint[7] memory counters - ) internal pure returns (uint) { - /** - * if `r` is NULL, then only counting the number of fields. - */ - (CvmXcvmAsset.Data memory x, uint256 sz) = _decode_CvmXcvmAsset(p, bs); - if (isNil(r)) { - counters[6] += 1; - } else { - r.want[r.want.length - counters[6]] = x; - counters[6] -= 1; - } - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmCommonUint128(uint256 p, bytes memory bs) - internal - pure - returns (CvmCommonUint128.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmCommonUint128.Data memory r, ) = CvmCommonUint128._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmAsset(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmAsset.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmAsset.Data memory r, ) = CvmXcvmAsset._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - uint256 i; - - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmCommonUint128._encode_nested(r.exchange_id, pointer, bs); - - if (r.give.length != 0) { - for(i = 0; i < r.give.length; i++) { - pointer += ProtoBufRuntime._encode_key( - 5, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs) - ; - pointer += CvmXcvmAsset._encode_nested(r.give[i], pointer, bs); - } - } - if (r.want.length != 0) { - for(i = 0; i < r.want.length; i++) { - pointer += ProtoBufRuntime._encode_key( - 6, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs) - ; - pointer += CvmXcvmAsset._encode_nested(r.want[i], pointer, bs); - } - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e;uint256 i; - e += 1 + ProtoBufRuntime._sz_lendelim(CvmCommonUint128._estimate(r.exchange_id)); - for(i = 0; i < r.give.length; i++) { - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmAsset._estimate(r.give[i])); - } - for(i = 0; i < r.want.length; i++) { - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmAsset._estimate(r.want[i])); - } - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.give.length != 0) { - return false; - } - - if (r.want.length != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - CvmCommonUint128.store(input.exchange_id, output.exchange_id); - - for(uint256 i5 = 0; i5 < input.give.length; i5++) { - output.give.push(input.give[i5]); - } - - - for(uint256 i6 = 0; i6 < input.want.length; i6++) { - output.want.push(input.want[i6]); - } - - - } - - - //array helpers for Give - /** - * @dev Add value to an array - * @param self The in-memory struct - * @param value The value to add - */ - function addGive(Data memory self, CvmXcvmAsset.Data memory value) internal pure { - /** - * First resize the array. Then add the new element to the end. - */ - CvmXcvmAsset.Data[] memory tmp = new CvmXcvmAsset.Data[](self.give.length + 1); - for (uint256 i = 0; i < self.give.length; i++) { - tmp[i] = self.give[i]; - } - tmp[self.give.length] = value; - self.give = tmp; - } - - //array helpers for Want - /** - * @dev Add value to an array - * @param self The in-memory struct - * @param value The value to add - */ - function addWant(Data memory self, CvmXcvmAsset.Data memory value) internal pure { - /** - * First resize the array. Then add the new element to the end. - */ - CvmXcvmAsset.Data[] memory tmp = new CvmXcvmAsset.Data[](self.want.length + 1); - for (uint256 i = 0; i < self.want.length; i++) { - tmp[i] = self.want[i]; - } - tmp[self.want.length] = value; - self.want = tmp; - } - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmExchange - -library CvmXcvmSpawn { - - - //struct definition - struct Data { - uint32 network_id; - bytes salt; - CvmXcvmProgram.Data program; - CvmXcvmAsset.Data[] assets; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint[6] memory counters; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_network_id(pointer, bs, r); - } else - if (fieldId == 3) { - pointer += _read_salt(pointer, bs, r); - } else - if (fieldId == 4) { - pointer += _read_program(pointer, bs, r); - } else - if (fieldId == 5) { - pointer += _read_unpacked_repeated_assets(pointer, bs, nil(), counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - pointer = offset; - if (counters[5] > 0) { - require(r.assets.length == 0); - r.assets = new CvmXcvmAsset.Data[](counters[5]); - } - - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 5) { - pointer += _read_unpacked_repeated_assets(pointer, bs, r, counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_network_id( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (uint32 x, uint256 sz) = ProtoBufRuntime._decode_uint32(p, bs); - r.network_id = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_salt( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); - r.salt = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_program( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (CvmXcvmProgram.Data memory x, uint256 sz) = _decode_CvmXcvmProgram(p, bs); - r.program = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @param counters The counters for repeated fields - * @return The number of bytes decoded - */ - function _read_unpacked_repeated_assets( - uint256 p, - bytes memory bs, - Data memory r, - uint[6] memory counters - ) internal pure returns (uint) { - /** - * if `r` is NULL, then only counting the number of fields. - */ - (CvmXcvmAsset.Data memory x, uint256 sz) = _decode_CvmXcvmAsset(p, bs); - if (isNil(r)) { - counters[5] += 1; - } else { - r.assets[r.assets.length - counters[5]] = x; - counters[5] -= 1; - } - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmProgram(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmProgram.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmProgram.Data memory r, ) = CvmXcvmProgram._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmAsset(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmAsset.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmAsset.Data memory r, ) = CvmXcvmAsset._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - uint256 i; - if (r.network_id != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.Varint, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_uint32(r.network_id, pointer, bs); - } - if (r.salt.length != 0) { - pointer += ProtoBufRuntime._encode_key( - 3, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_bytes(r.salt, pointer, bs); - } - - pointer += ProtoBufRuntime._encode_key( - 4, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += CvmXcvmProgram._encode_nested(r.program, pointer, bs); - - if (r.assets.length != 0) { - for(i = 0; i < r.assets.length; i++) { - pointer += ProtoBufRuntime._encode_key( - 5, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs) - ; - pointer += CvmXcvmAsset._encode_nested(r.assets[i], pointer, bs); - } - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e;uint256 i; - e += 1 + ProtoBufRuntime._sz_uint32(r.network_id); - e += 1 + ProtoBufRuntime._sz_lendelim(r.salt.length); - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmProgram._estimate(r.program)); - for(i = 0; i < r.assets.length; i++) { - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmAsset._estimate(r.assets[i])); - } - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.network_id != 0) { - return false; - } - - if (r.salt.length != 0) { - return false; - } - - if (r.assets.length != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.network_id = input.network_id; - output.salt = input.salt; - CvmXcvmProgram.store(input.program, output.program); - - for(uint256 i5 = 0; i5 < input.assets.length; i5++) { - output.assets.push(input.assets[i5]); - } - - - } - - - //array helpers for Assets - /** - * @dev Add value to an array - * @param self The in-memory struct - * @param value The value to add - */ - function addAssets(Data memory self, CvmXcvmAsset.Data memory value) internal pure { - /** - * First resize the array. Then add the new element to the end. - */ - CvmXcvmAsset.Data[] memory tmp = new CvmXcvmAsset.Data[](self.assets.length + 1); - for (uint256 i = 0; i < self.assets.length; i++) { - tmp[i] = self.assets[i]; - } - tmp[self.assets.length] = value; - self.assets = tmp; - } - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmSpawn - -library CvmXcvmCall { - - - //struct definition - struct Data { - bytes payload; - CvmXcvmBinding.Data[] bindings; - } - - // Decoder section - - /** - * @dev The main decoder for memory - * @param bs The bytes array to be decoded - * @return The decoded struct - */ - function decode(bytes memory bs) internal pure returns (Data memory) { - (Data memory x, ) = _decode(32, bs, bs.length); - return x; - } - - /** - * @dev The main decoder for storage - * @param self The in-storage struct - * @param bs The bytes array to be decoded - */ - function decode(Data storage self, bytes memory bs) internal { - (Data memory x, ) = _decode(32, bs, bs.length); - store(x, self); - } - // inner decoder - - /** - * @dev The decoder for internal usage - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param sz The number of bytes expected - * @return The decoded struct - * @return The number of bytes decoded - */ - function _decode(uint256 p, bytes memory bs, uint256 sz) - internal - pure - returns (Data memory, uint) - { - Data memory r; - uint[3] memory counters; - uint256 fieldId; - ProtoBufRuntime.WireType wireType; - uint256 bytesRead; - uint256 offset = p; - uint256 pointer = p; - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 1) { - pointer += _read_payload(pointer, bs, r); - } else - if (fieldId == 2) { - pointer += _read_unpacked_repeated_bindings(pointer, bs, nil(), counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - - } - pointer = offset; - if (counters[2] > 0) { - require(r.bindings.length == 0); - r.bindings = new CvmXcvmBinding.Data[](counters[2]); - } - - while (pointer < offset + sz) { - (fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs); - pointer += bytesRead; - if (fieldId == 2) { - pointer += _read_unpacked_repeated_bindings(pointer, bs, r, counters); - } else - { - pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs); - } - } - return (r, sz); - } - - // field readers - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @return The number of bytes decoded - */ - function _read_payload( - uint256 p, - bytes memory bs, - Data memory r - ) internal pure returns (uint) { - (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); - r.payload = x; - return sz; - } - - /** - * @dev The decoder for reading a field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @param r The in-memory struct - * @param counters The counters for repeated fields - * @return The number of bytes decoded - */ - function _read_unpacked_repeated_bindings( - uint256 p, - bytes memory bs, - Data memory r, - uint[3] memory counters - ) internal pure returns (uint) { - /** - * if `r` is NULL, then only counting the number of fields. - */ - (CvmXcvmBinding.Data memory x, uint256 sz) = _decode_CvmXcvmBinding(p, bs); - if (isNil(r)) { - counters[2] += 1; - } else { - r.bindings[r.bindings.length - counters[2]] = x; - counters[2] -= 1; - } - return sz; - } - - // struct decoder - /** - * @dev The decoder for reading a inner struct field - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The decoded inner-struct - * @return The number of bytes used to decode - */ - function _decode_CvmXcvmBinding(uint256 p, bytes memory bs) - internal - pure - returns (CvmXcvmBinding.Data memory, uint) - { - uint256 pointer = p; - (uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs); - pointer += bytesRead; - (CvmXcvmBinding.Data memory r, ) = CvmXcvmBinding._decode(pointer, bs, sz); - return (r, sz + bytesRead); - } - - - // Encoder section - - /** - * @dev The main encoder for memory - * @param r The struct to be encoded - * @return The encoded byte array - */ - function encode(Data memory r) internal pure returns (bytes memory) { - bytes memory bs = new bytes(_estimate(r)); - uint256 sz = _encode(r, 32, bs); - assembly { - mstore(bs, sz) - } - return bs; - } - // inner encoder - - /** - * @dev The encoder for internal usage - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - uint256 offset = p; - uint256 pointer = p; - uint256 i; - if (r.payload.length != 0) { - pointer += ProtoBufRuntime._encode_key( - 1, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs - ); - pointer += ProtoBufRuntime._encode_bytes(r.payload, pointer, bs); - } - if (r.bindings.length != 0) { - for(i = 0; i < r.bindings.length; i++) { - pointer += ProtoBufRuntime._encode_key( - 2, - ProtoBufRuntime.WireType.LengthDelim, - pointer, - bs) - ; - pointer += CvmXcvmBinding._encode_nested(r.bindings[i], pointer, bs); - } - } - return pointer - offset; - } - // nested encoder - - /** - * @dev The encoder for inner struct - * @param r The struct to be encoded - * @param p The offset of bytes array to start decode - * @param bs The bytes array to be decoded - * @return The number of bytes encoded - */ - function _encode_nested(Data memory r, uint256 p, bytes memory bs) - internal - pure - returns (uint) - { - /** - * First encoded `r` into a temporary array, and encode the actual size used. - * Then copy the temporary array into `bs`. - */ - uint256 offset = p; - uint256 pointer = p; - bytes memory tmp = new bytes(_estimate(r)); - uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp); - uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs); - uint256 size = _encode(r, 32, tmp); - pointer += ProtoBufRuntime._encode_varint(size, pointer, bs); - ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size); - pointer += size; - delete tmp; - return pointer - offset; - } - // estimator - - /** - * @dev The estimator for a struct - * @param r The struct to be encoded - * @return The number of bytes encoded in estimation - */ - function _estimate( - Data memory r - ) internal pure returns (uint) { - uint256 e;uint256 i; - e += 1 + ProtoBufRuntime._sz_lendelim(r.payload.length); - for(i = 0; i < r.bindings.length; i++) { - e += 1 + ProtoBufRuntime._sz_lendelim(CvmXcvmBinding._estimate(r.bindings[i])); - } - return e; - } - // empty checker - - function _empty( - Data memory r - ) internal pure returns (bool) { - - if (r.payload.length != 0) { - return false; - } - - if (r.bindings.length != 0) { - return false; - } - - return true; - } - - - //store function - /** - * @dev Store in-memory struct to storage - * @param input The in-memory struct - * @param output The in-storage struct - */ - function store(Data memory input, Data storage output) internal { - output.payload = input.payload; - - for(uint256 i2 = 0; i2 < input.bindings.length; i2++) { - output.bindings.push(input.bindings[i2]); - } - - - } - - - //array helpers for Bindings - /** - * @dev Add value to an array - * @param self The in-memory struct - * @param value The value to add - */ - function addBindings(Data memory self, CvmXcvmBinding.Data memory value) internal pure { - /** - * First resize the array. Then add the new element to the end. - */ - CvmXcvmBinding.Data[] memory tmp = new CvmXcvmBinding.Data[](self.bindings.length + 1); - for (uint256 i = 0; i < self.bindings.length; i++) { - tmp[i] = self.bindings[i]; - } - tmp[self.bindings.length] = value; - self.bindings = tmp; - } - - - //utility functions - /** - * @dev Return an empty struct - * @return r The empty struct - */ - function nil() internal pure returns (Data memory r) { - assembly { - r := 0 - } - } - - /** - * @dev Test whether a struct is empty - * @param x The struct to be tested - * @return r True if it is empty - */ - function isNil(Data memory x) internal pure returns (bool r) { - assembly { - r := iszero(x) - } - } -} -//library CvmXcvmCall - -library XCVM_PROTO_GLOBAL_ENUMS { - - //enum definition - // Solidity enum definitions - enum Register { - IP, - TIP, - THIS, - RESULT - } - - - // Solidity enum encoder - function encode_Register(Register x) internal pure returns (int32) { - - if (x == Register.IP) { - return 0; - } - - if (x == Register.TIP) { - return 1; - } - - if (x == Register.THIS) { - return 2; - } - - if (x == Register.RESULT) { - return 3; - } - revert(); - } - - - // Solidity enum decoder - function decode_Register(int64 x) internal pure returns (Register) { - - if (x == 0) { - return Register.IP; - } - - if (x == 1) { - return Register.TIP; - } - - if (x == 2) { - return Register.THIS; - } - - if (x == 3) { - return Register.RESULT; - } - revert(); - } - - - /** - * @dev The estimator for an packed enum array - * @return The number of bytes encoded - */ - function estimate_packed_repeated_Register( - Register[] memory a - ) internal pure returns (uint256) { - uint256 e = 0; - for (uint i = 0; i < a.length; i++) { - e += ProtoBufRuntime._sz_enum(encode_Register(a[i])); - } - return e; - } -} -//library XCVM_PROTO_GLOBAL_ENUMS \ No newline at end of file diff --git a/code/cvm/evm/src/mocks/ERC20Mock.sol b/code/cvm/evm/src/mocks/ERC20Mock.sol deleted file mode 100644 index 0f2b8049794..00000000000 --- a/code/cvm/evm/src/mocks/ERC20Mock.sol +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; -pragma abicoder v2; - -import "openzeppelin-contracts/token/ERC20/ERC20.sol"; -import "openzeppelin-contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; - -contract ERC20Mock is ERC20, ERC20Permit { - constructor( - string memory name, - string memory symbol, - address initialAccount, - uint256 initialBalance - ) payable ERC20(name, symbol) ERC20Permit(name) { - _mint(initialAccount, initialBalance); - } -} diff --git a/code/cvm/evm/src/mocks/IbcBridgeMock.sol b/code/cvm/evm/src/mocks/IbcBridgeMock.sol deleted file mode 100644 index 8b86e597c46..00000000000 --- a/code/cvm/evm/src/mocks/IbcBridgeMock.sol +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.9; -import "../interfaces/IRouter.sol"; - -contract IBCBridgeMock { - function runProgram( - address router, - IRouter.Origin memory origin, - bytes memory salt, - bytes memory program, - address[] memory _assets, - uint256[] memory _amounts) - public { - IRouter(router).runProgram(origin, salt, program, _assets, _amounts); - } - - function sendProgram( - bytes memory account, - uint128 networkId, - bytes memory salt, - bytes memory spawnedProgram, - uint128[] memory assetIds, - uint256[] memory amounts - ) external { - } -} \ No newline at end of file diff --git a/code/cvm/evm/src/mocks/SDKMock.sol b/code/cvm/evm/src/mocks/SDKMock.sol deleted file mode 100644 index 14457e33d8a..00000000000 --- a/code/cvm/evm/src/mocks/SDKMock.sol +++ /dev/null @@ -1,153 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; -import "../libraries/SDK.sol"; - -contract SDKMock { - function generateUint128(uint128 n) public pure returns (bytes memory u128) { - return SDK.generateUint128(n); - } - - function generateAbsolute(uint128 n) public pure returns (bytes memory absolute) { - return SDK.generateAbsolute(n); - } - - function generateRatio(uint128 nominator, uint128 denominator) public pure returns (bytes memory ratio) { - return SDK.generateRatio(nominator, denominator); - } - - function generateUnit(uint128 integer, bytes memory ratio) public pure returns (bytes memory unit) { - return SDK.generateUnit(integer, ratio); - } - - function generateBalanceByRatio(bytes memory ratio) public pure returns (bytes memory balance) { - return SDK.generateBalanceByRatio(ratio); - } - - function generateBalanceByAbsolute(bytes memory absolute) public pure returns (bytes memory balance) { - return SDK.generateBalanceByAbsolute(absolute); - } - - function generateBalanceByUnit(bytes memory _unit) public pure returns (bytes memory balance) { - return SDK.generateBalanceByUnit(_unit); - } - - function generateAccount(bytes memory _account) public pure returns (bytes memory account) { - return SDK.generateAccount(_account); - } - - function generateGlobalId(uint128 _globalId) public pure returns (bytes memory globalId) { - return SDK.generateGlobalId(_globalId); - } - - function generateLocalId(bytes memory _localId) public pure returns (bytes memory localId) { - return SDK.generateLocalId(_localId); - } - - function generateAssetIdByGlobalId(bytes memory _globalId) public pure returns (bytes memory assetId) { - return SDK.generateAssetIdByGlobalId(_globalId); - } - - function generateAssetIdByLocalId(bytes memory _localId) public pure returns (bytes memory assetId) { - return SDK.generateAssetIdByLocalId(_localId); - } - - function generateAsset(bytes memory _assetId, bytes memory _balance) public pure returns (bytes memory asset) { - return SDK.generateAsset(_assetId, _balance); - } - - function generateSelf(uint32 _self) public pure returns (bytes memory self) { - return SDK.generateSelf(_self); - } - - function generateRelayer(uint32 _relayer) public pure returns (bytes memory relayer) { - return SDK.generateRelayer(_relayer); - } - - function generateResult(uint32 _result) public pure returns (bytes memory result) { - return SDK.generateResult(_result); - } - - function generateAssetAmount(bytes memory assetId, bytes memory ratio) public pure returns (bytes memory assetAmount) { - return SDK.generateAssetAmount(assetId, ratio); - } - - function generateBindingValueByAssetAmount(bytes memory _assetAmount) public pure returns (bytes memory bindingValue) { - return SDK.generateBindingValueByAssetAmount(_assetAmount); - } - - function generateBindingValueByGlobalId(bytes memory _globalId) public pure returns (bytes memory bindingValue) { - return SDK.generateBindingValueByGlobalId(_globalId); - } - - function generateBinding(uint32 position, bytes memory _bindingValue) public pure returns (bytes memory binding) { - return SDK.generateBinding(position, _bindingValue); - } - - function generateBindings(bytes[] memory _bindings) public pure returns (bytes memory bindings) { - return SDK.generateBindings(_bindings); - } - - function generateTransferByAccount(bytes memory _account, bytes[] memory _assets) public pure returns (bytes memory transfer) { - return SDK.generateTransferByAccount(_account, _assets); - } - - function generateSalt(bytes memory _salt) public pure returns (bytes memory salt) { - return SDK.generateSalt(_salt); - } - - function generateNetwork(uint128 _network) public pure returns (bytes memory network) { - return SDK.generateNetwork(_network); - } - - function generateSpawn( - bytes memory _network, - int32 _security, - bytes memory _salt, - bytes memory _spawnedProgram, - bytes[] memory _assets - ) public pure returns (bytes memory spawn) { - return SDK.generateSpawn(_network, _security, _salt, _spawnedProgram, _assets); - } - - function generateCall( - bytes memory _payload, - bytes memory _bindings - ) public pure returns (bytes memory call) { - return SDK.generateCall(_payload, _bindings); - } - - function generateInstructionByTransfer( - bytes memory _transfer - ) public pure returns (bytes memory instruction) { - return SDK.generateInstructionByTransfer(_transfer); - } - - function generateInstructionByCall( - bytes memory _call - ) public pure returns (bytes memory instruction) { - return SDK.generateInstructionByCall(_call); - } - - function generateInstructionBySpawn( - bytes memory _spawn - ) public pure returns (bytes memory instruction) { - return SDK.generateInstructionBySpawn(_spawn); - } - - function generateInstructionByQuery( - bytes memory _query - ) public pure returns (bytes memory instruction) { - return SDK.generateInstructionByQuery(_query); - } - - function generateInstructions(bytes[] memory _instructions) public pure returns (bytes memory instructions) { - return SDK.generateInstructions(_instructions); - } - - function generateProgram( - bytes memory _tag, - bytes memory _instructions - ) public pure returns (bytes memory program) { - return SDK.generateProgram(_tag, _instructions); - } -} \ No newline at end of file diff --git a/code/cvm/evm/test/IBCBridge.t.sol b/code/cvm/evm/test/IBCBridge.t.sol deleted file mode 100644 index e7fabe920ef..00000000000 --- a/code/cvm/evm/test/IBCBridge.t.sol +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; -pragma abicoder v2; - -import "forge-std/console.sol"; -import "forge-std/Test.sol"; - -import "../src/Router.sol"; -import "../src/mocks/ERC20Mock.sol"; -import "../utils/util.sol"; -import "../src/interfaces/IInterpreter.sol"; -import "../src/libraries/SDK.sol"; -import "yui-ibc/core/25-handler/IBCHandler.sol"; -import "yui-ibc/core/24-host/IBCHost.sol"; -import "../src/IbcBridge.sol"; - -contract test_IBCBridge is Test { - Utils internal utils; - - IBCBridge internal bridge; - address internal user; - address internal owner; - address internal ibcHost; - address internal ibcHandler; - uint256 internal defaultTokenAmount = 100000 * 1e18; - ERC20Mock internal assetToken1; - ERC20Mock internal assetToken2; - Router internal router; - - fallback() external payable {} - - receive() external payable {} - - function setUp() public { - utils = new Utils(vm); - address payable[] memory users = utils.createUsers(6); - - owner = users[0]; - ibcHost = users[1]; - ibcHandler = users[2]; - user = users[3]; - - defaultTokenAmount = 10 * 10**18; - assetToken1 = new ERC20Mock("Asset Token 1", "AT1", owner, defaultTokenAmount); - assetToken2 = new ERC20Mock("Asset Token 2", "AT2", owner, defaultTokenAmount); - - vm.prank(owner); - router = new Router(); - - bridge = new IBCBridge(address(router), IBCHost(ibcHost), IBCHandler(ibcHandler)); - } - - function testInitParams() public { - assertEq(router.owner(), owner); - assertEq(bridge.routerAddress(), address(router)); - } - - function testEncodeAndDecodeIBCProgram(address routerAddress, uint128 networkId, bytes memory salt, bytes memory spawnedProgram) public { - vm.assume(routerAddress != address(0)); - uint128[] memory assetIds; - uint256[] memory amounts; - assetIds = new uint128[](1); - assetIds[0] = 1; - amounts = new uint256[](1); - amounts[0] = 1 ether; - bytes memory accountInBytes = abi.encodePacked(address(123)); - - // transfer 1 ether to this contract to simulate the asset transfer - vm.prank(owner); - assetToken1.transfer(address(this), 1 ether); - vm.mockCall( - routerAddress, - abi.encodeWithSelector(IRouter.getAsset.selector), - abi.encode(address(assetToken1)) - ); - - bytes memory ibcProgram = SDK.generateIBCSpawn(SDK.generateInterpreterOrigin(accountInBytes), - SDK.generateUserOrigin(accountInBytes, networkId), salt, spawnedProgram, assetIds, amounts); - ( - , - IRouter.Origin memory expectedOrigin, - bytes memory expectedSpawnedProgram, - bytes memory expectedSalt, - address[] memory expectedAssetAddresses, - uint256[] memory expectedAssetAmounts - ) = SDK.decodeIBCSpawn(ibcProgram, routerAddress); - - assertEq(expectedOrigin.networkId, networkId); - assertEq(expectedOrigin.account, accountInBytes); - assertEq(expectedSpawnedProgram, spawnedProgram); - assertEq(expectedSalt, salt); - assertEq(expectedAssetAddresses[0], address(assetToken1)); - assertEq(expectedAssetAmounts[0], 1 ether); - // asset sent to router - assertEq(assetToken1.balanceOf(routerAddress), 1 ether); - } -} diff --git a/code/cvm/evm/test/Interpreter.t.sol b/code/cvm/evm/test/Interpreter.t.sol deleted file mode 100644 index 86f79fc124e..00000000000 --- a/code/cvm/evm/test/Interpreter.t.sol +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; -pragma abicoder v2; - -import "forge-std/console.sol"; -import "forge-std/Test.sol"; - -import "../src/Router.sol"; -import "../src/mocks/ERC20Mock.sol"; -import "../utils/util.sol"; -import "../src/Interpreter.sol"; -import "../src/interfaces/IRouter.sol"; - -contract test_Interpreter is Test { - Utils internal utils; - - address internal bridge1; - address internal bridge2; - address internal user; - address internal owner; - uint256 internal defaultTokenAmount = 100000 * 1e18; - address internal interpreterAddress; - ERC20Mock internal assetToken1; - ERC20Mock internal assetToken2; - Interpreter internal interpreter; - Router internal router; - - fallback() external payable {} - - receive() external payable {} - - function setUp() public { - utils = new Utils(vm); - - address payable[] memory users = utils.createUsers(6); - - owner = users[0]; - user = users[1]; - - router = new Router(); - //register owner as the bridge - router.registerBridge(user, IRouter.BridgeSecurity(1), 1); - - vm.prank(user); - router.createInterpreter(IRouter.Origin({networkId: 1, account: abi.encodePacked(owner)}), "salt"); - interpreterAddress = router.userInterpreter(1, abi.encodePacked(owner), "salt"); - console.log(interpreterAddress); - ERC20Mock erc20 = new ERC20Mock("test", "test", interpreterAddress, 100 ether); - router.registerAsset(address(erc20), 1); - - vm.prank(owner); - interpreter = new Interpreter(IRouter.Origin({account: bytes("test"), networkId: 1}), owner, "salt"); - } - - function testRunProgram(address relayerAddress) private { - //bytes memory input = hex"0a330a310a2f0a210a1fd317f7f4577a7b9d5a69df3c17a17871ee9a07cf36ef6efd71f7c56fddb6eb1a0a0a020801120412020864"; - - bytes - memory input = hex"0a3a0a381a360a1a01a9059cbb70997970c51812dc3a010c7d01b50e0d17dc79c80212180a08080012042a0208010a0c081912082206120408c0843d"; - vm.prank(address(router)); - Interpreter(payable(interpreterAddress)).interpret(input, relayerAddress); - } -} diff --git a/code/cvm/evm/test/Router.t.sol b/code/cvm/evm/test/Router.t.sol deleted file mode 100644 index 88c33ed22ba..00000000000 --- a/code/cvm/evm/test/Router.t.sol +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.14; -pragma abicoder v2; - -import "forge-std/console.sol"; -import "forge-std/Test.sol"; - -import "../src/Router.sol"; -import "../src/mocks/ERC20Mock.sol"; -import "../utils/util.sol"; -import "../src/interfaces/IRouter.sol"; -import "../src/interfaces/IInterpreter.sol"; - -contract test_Router is Test { - Utils internal utils; - - address internal bridge1; - address internal bridge2; - address internal user; - address internal owner; - uint256 internal defaultTokenAmount = 100000 * 1e18; - ERC20Mock internal assetToken1; - ERC20Mock internal assetToken2; - Router internal router; - - fallback() external payable {} - - receive() external payable {} - - function setUp() public { - utils = new Utils(vm); - - address payable[] memory users = utils.createUsers(6); - - owner = users[0]; - bridge1 = users[1]; - bridge2 = users[2]; - user = users[3]; - - defaultTokenAmount = 10 * 10**18; - assetToken1 = new ERC20Mock("Asset Token 1", "AT1", owner, defaultTokenAmount); - assetToken2 = new ERC20Mock("Asset Token 2", "AT2", owner, defaultTokenAmount); - - vm.prank(owner); - router = new Router(); - } - - function testInitParams() public { - assertEq(router.owner(), owner); - } - - function testRegisterBridgeFailed() public { - vm.expectRevert("Ownable: caller is not the owner"); - router.registerBridge(bridge1, IRouter.BridgeSecurity(1), 1); - vm.startPrank(owner); - vm.expectRevert("Router: invalid address"); - router.registerBridge(address(0), IRouter.BridgeSecurity(1), 1); - vm.expectRevert("Router: should not disable bridge while registering bridge"); - router.registerBridge(address(1), IRouter.BridgeSecurity(0), 1); - vm.stopPrank(); - } - - function testRegisterBridge() public { - vm.prank(owner); - router.registerBridge(bridge1, IRouter.BridgeSecurity(1), 1); - } - - function testUnregisterBridgeFailed() public { - vm.expectRevert("Ownable: caller is not the owner"); - router.unregisterBridge(bridge1); - } - - function testUnregisterBridge() public { - vm.prank(owner); - router.registerBridge(bridge1, IRouter.BridgeSecurity(1), 1); - vm.prank(owner); - router.unregisterBridge(bridge1); - } - - function testRegisterAssetAddressFailed(uint128 assetId) public { - vm.expectRevert("Ownable: caller is not the owner"); - router.registerAsset(address(assetToken1), assetId); - vm.startPrank(owner); - vm.expectRevert("Router: invalid address"); - router.registerAsset(address(0), assetId); - vm.stopPrank(); - } - - function testRegisterAssetAddress(uint128 assetId) public { - vm.prank(owner); - router.registerAsset(address(assetToken1), assetId); - assertEq(router.assets(assetId), address(assetToken1)); - } - - function testUnregisterAssetAddress(uint128 assetId) public { - vm.startPrank(owner); - router.registerAsset(address(assetToken1), assetId); - router.unregisterAsset(assetId); - vm.stopPrank(); - assertEq(router.assets(assetId), address(0)); - } - - - function testCreateInterpreter(uint128 networkId, bytes memory account, bytes memory salt) public { - vm.prank(owner); - router.registerBridge(bridge1, IRouter.BridgeSecurity(1), 1); - - vm.prank(bridge1); - IRouter.Origin memory origin = IRouter.Origin(networkId, account); - address payable interpreterAddress = router.createInterpreter(origin, salt); - assertTrue(interpreterAddress != address(0)); - } - - function testCreateInterpreterWithSameSalt(uint128 networkId, bytes memory account, bytes memory salt) public { - vm.prank(owner); - router.registerBridge(bridge1, IRouter.BridgeSecurity(1), 1); - - vm.prank(bridge1); - IRouter.Origin memory origin = IRouter.Origin(networkId, account); - address payable interpreterAddress = router.createInterpreter(origin, salt); - assertTrue(interpreterAddress != address(0)); - - vm.prank(bridge1); - vm.expectRevert('Interpreter already exists'); - router.createInterpreter(origin, salt); - } - - function testCreateInterpreterWithDifferentSalt(uint128 networkId, bytes memory account, bytes memory salt, bytes memory salt2) public { - vm.prank(owner); - router.registerBridge(bridge1, IRouter.BridgeSecurity(1), 1); - - vm.prank(bridge1); - IRouter.Origin memory origin = IRouter.Origin(networkId, account); - address payable interpreterAddress = router.createInterpreter(origin, salt); - assertTrue(interpreterAddress != address(0)); - - vm.prank(bridge1); - address payable interpreterAddress2 = router.createInterpreter(origin, salt2); - assertTrue(interpreterAddress2 != address(0)); - - assertTrue(interpreterAddress != interpreterAddress2); - - } -} diff --git a/code/cvm/evm/utils/util.sol b/code/cvm/evm/utils/util.sol deleted file mode 100644 index acdbbabbd7d..00000000000 --- a/code/cvm/evm/utils/util.sol +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: Unlicense -pragma solidity >=0.8.13; - -// Based on: https://github.com/FrankieIsLost/forge-template/blob/master/src/test/utils/Utilities.sol - -import "forge-std/Vm.sol"; -import "ds-test/test.sol"; - -//common utilities for forge tests -contract Utils { - Vm vm; - bytes32 internal nextUser = - keccak256(abi.encodePacked("user address")); - - constructor(Vm newVm) { - vm = newVm; - } - - function getNextUserAddress() external returns (address payable) { - //bytes32 to address conversion - address payable user = payable( - address(uint160(uint256(nextUser))) - ); - nextUser = keccak256(abi.encodePacked(nextUser)); - return user; - } - - //create users with 100 ether balance - function createUsers(uint256 userNum) - external - returns (address payable[] memory) - { - address payable[] memory users = new address payable[]( - userNum - ); - for (uint256 i = 0; i < userNum; i++) { - address payable user = this.getNextUserAddress(); - vm.deal(user, 100 ether); - users[i] = user; - } - return users; - } - - //move block.number forward by a given number of blocks - function mineBlocks(uint256 numBlocks) external { - uint256 targetBlock = block.number + numBlocks; - vm.roll(targetBlock); - } - -} diff --git a/code/cvm/evm/workspace.json b/code/cvm/evm/workspace.json deleted file mode 100644 index 52033e3c568..00000000000 --- a/code/cvm/evm/workspace.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "./node_modules/nx/schemas/workspace-schema.json", - "version": 2, - "projects": { - "smart-contracts": "./" - } -} diff --git a/code/cvm/flake-module.nix b/code/cvm/flake-module.nix deleted file mode 100644 index 4e6e279541a..00000000000 --- a/code/cvm/flake-module.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ self, ... }: { - perSystem = - { config, self', inputs', pkgs, system, crane, systemCommonRust, ... }: - let - makeCosmwasmContract = name: rust: std-config: - let binaryName = "${builtins.replaceStrings [ "-" ] [ "_" ] name}.wasm"; - in rust.buildPackage (systemCommonRust.common-attrs // { - src = systemCommonRust.rustSrc; - version = "0.1"; - pnameSuffix = "-${name}"; - nativeBuildInputs = [ - pkgs.binaryen - self.inputs.cosmos.packages.${system}.cosmwasm-check - ]; - pname = name; - cargoBuildCommand = - "cargo build --target wasm32-unknown-unknown --profile cosmwasm-contracts --package ${name} ${std-config}"; - RUSTFLAGS = "-C link-arg=-s"; - installPhaseCommand = '' - mkdir --parents $out/lib - # from CosmWasm/rust-optimizer - # --signext-lowering is needed to support blockchains runnning CosmWasm < 1.3. It can be removed eventually - wasm-opt target/wasm32-unknown-unknown/cosmwasm-contracts/${binaryName} -o $out/lib/${binaryName} -Os --signext-lowering - cosmwasm-check $out/lib/${binaryName} - ''; - }); - rust = (self.inputs.crane.mkLib pkgs).overrideToolchain - (pkgs.rust-bin.stable."1.73.0".default.override { - targets = [ "wasm32-unknown-unknown" ]; - }); - mkCvmContract = name: - makeCosmwasmContract name crane.nightly "--no-default-features"; - mkMantisContract = name: - makeCosmwasmContract name crane.nightly "--no-default-features"; - in { - packages = rec { - cw-xc-executor = mkCvmContract "cw-xc-executor"; - cw-xc-gateway = mkCvmContract "cw-xc-gateway"; - - xc-cw-contracts = pkgs.symlinkJoin { - name = "xc-cw-contracts"; - paths = [ - cw-xc-executor - cw-xc-gateway - self.inputs.cvm.packages.${system}.cw-mantis-order - ]; - }; - cvm-deps = crane.nightly.buildDepsOnly (systemCommonRust.common-attrs - // { - SKIP_WASM_BUILD = 1; - src = systemCommonRust.rustSrc; - }); - - build-cvm-json-schema-ts = pkgs.writeShellApplication { - name = "build-ts-schema"; - runtimeInputs = with pkgs; [ - self'.packages.rust-nightly - nodejs - nodePackages.npm - ]; - text = '' - echo "generating TypeScript types and client definitions from JSON schema of CosmWasm contracts" - cd code/cvm - npm install - rm --recursive --force dist - - rm --recursive --force schema - cargo run --bin order --package cw-mantis-order - npm run build-cw-mantis-order - - rm --recursive --force schema - cargo run --bin gateway --package xc-core - npm run build-xc-core - - npm publish - ''; - }; - - cvm-mount = pkgs.stdenv.mkDerivation rec { - name = "cvm-mount"; - pname = "${name}"; - src = systemCommonRust.rustSrc; - patchPhase = "true"; - - installPhase = '' - mkdir --parents $out - mkdir --parents $out/target/wasm32-unknown-unknown/cosmwasm-contracts/ - cp --recursive --no-preserve=mode,ownership $src/. $out/ - cp "${xc-cw-contracts}/lib/cw_xc_executor.wasm" $out/target/wasm32-unknown-unknown/cosmwasm-contracts/ - cp "${xc-cw-contracts}/lib/cw_xc_gateway.wasm" $out/target/wasm32-unknown-unknown/cosmwasm-contracts/ - ''; - dontFixup = true; - dontStrip = true; - }; - }; - }; -} diff --git a/code/cvm/lib/core/README.md b/code/cvm/lib/core/README.md index 084f261de17..9bedd6761fa 100644 --- a/code/cvm/lib/core/README.md +++ b/code/cvm/lib/core/README.md @@ -1,7 +1,3 @@ -# Overview +# Obsolete -Stuff to do cross chains apps. - -1. High level interface to define and manage cross chain execution and routing. -2. Interfaces for Substrate contract extensions interfaces (precompiles) and Cosmos SDK host extensions (modules). -3. Interpreter can be instantiated only from code identifiers configured in gateway. \ No newline at end of file +Obsolete package. For memo use `ComposableFi/ibc-apps-rs`. For XCM support move it to pallet-CosmWasm sub crate (/xcm), for Pablo pallet move it to sub crate(/cw). \ No newline at end of file diff --git a/code/cvm/package-lock.json b/code/cvm/package-lock.json deleted file mode 100644 index 3d77e823414..00000000000 --- a/code/cvm/package-lock.json +++ /dev/null @@ -1,5299 +0,0 @@ -{ - "name": "cvm-cw-types", - "version": "0.0.6", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "cvm-cw-types", - "version": "0.0.6", - "license": "MIT", - "dependencies": { - "@cosmjs/cosmwasm-stargate": "0.31.3", - "cosmjs-types": "0.9.0" - }, - "devDependencies": { - "@cosmwasm/ts-codegen": "0.35.3", - "bun": "1.0.7" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", - "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.22.13", - "chalk": "^2.4.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.2.tgz", - "integrity": "sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.10.tgz", - "integrity": "sha512-JQM6k6ENcBFKVtWvLavlvi/mPcpYZ3+R+2EySDEMSMbp7Mn4FexlbbJVrx2R7Ijhr01T8gyqrOaABWIOgxeUyw==", - "dev": true, - "dependencies": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.10", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-module-transforms": "^7.18.9", - "@babel/helpers": "^7.18.9", - "@babel/parser": "^7.18.10", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.18.10", - "@babel/types": "^7.18.10", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.18.12", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.12.tgz", - "integrity": "sha512-dfQ8ebCN98SvyL7IxNMCUtZQSq5R7kxgN+r8qYTGDmmSion1hX2C0zq2yo1bsCDhXixokv1SAWTZUMYbO/V5zg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.10", - "@jridgewell/gen-mapping": "^0.3.2", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", - "integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-annotate-as-pure/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.15.tgz", - "integrity": "sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", - "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.22.9", - "@babel/helper-validator-option": "^7.22.15", - "browserslist": "^4.21.9", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.15.tgz", - "integrity": "sha512-jKkwA59IXcvSaiK2UN45kKwSC9o+KuoXsBDvHvU/7BecYIp8GQ2UwrVvFgJASUT+hBnwJx6MhvMCuMzwZZ7jlg==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", - "@babel/helper-member-expression-to-functions": "^7.22.15", - "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz", - "integrity": "sha512-29FkPLFjn4TPEa3RE7GpW+qbE8tlsu3jntNYNfcGsc49LphF1PQIiD+vMZ1z1xVOKt+93khA9tc2JBs3kBjA7w==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "regexpu-core": "^5.3.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", - "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", - "dev": true, - "dependencies": { - "@babel/helper-compilation-targets": "^7.17.7", - "@babel/helper-plugin-utils": "^7.16.7", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0-0" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", - "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", - "dev": true, - "dependencies": { - "@babel/template": "^7.22.15", - "@babel/types": "^7.23.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", - "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz", - "integrity": "sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.23.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", - "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", - "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", - "dev": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-simple-access": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/helper-validator-identifier": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz", - "integrity": "sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.20.tgz", - "integrity": "sha512-pBGyV4uBqOns+0UvhsTO8qgl8hO89PmiDYv+/COyp1aeMcmfrfruz+/nCMFiYyFF/Knn0yfrC85ZzNFjembFTw==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-wrap-function": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz", - "integrity": "sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw==", - "dev": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-member-expression-to-functions": "^7.22.15", - "@babel/helper-optimise-call-expression": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", - "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz", - "integrity": "sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-skip-transparent-expression-wrappers/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.22.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", - "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", - "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", - "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-wrap-function": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.22.20.tgz", - "integrity": "sha512-pms/UwkOpnQe/PDAEdV/d7dVCoBbB+R4FvYoHGZz+4VPcg7RtYy2KP7S2lbuWM6FCSgob5wshfGESbC/hzNXZw==", - "dev": true, - "dependencies": { - "@babel/helper-function-name": "^7.22.5", - "@babel/template": "^7.22.15", - "@babel/types": "^7.22.19" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-wrap-function/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.2.tgz", - "integrity": "sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==", - "dev": true, - "dependencies": { - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.2", - "@babel/types": "^7.23.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers/node_modules/@babel/generator": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", - "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", - "dev": true, - "dependencies": { - "@babel/types": "^7.23.0", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers/node_modules/@babel/parser": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", - "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/helpers/node_modules/@babel/traverse": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", - "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.23.0", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.0", - "@babel/types": "^7.23.0", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", - "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", - "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.22.15.tgz", - "integrity": "sha512-FB9iYlz7rURmRJyXRKEnalYPPdn87H5no108cyuQQyMwlpJ2SJtpIUBI27kdTin956pz+LPypkPVPUTlxOmrsg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.22.15.tgz", - "integrity": "sha512-Hyph9LseGvAeeXzikV88bczhsrLrIZqDPxO+sSmAunMPaGrBGhfMWzCPYTtiW9t+HzSE2wtV8e5cc5P6r1xMDQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/plugin-transform-optional-chaining": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.13.0" - } - }, - "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz", - "integrity": "sha512-xMbiLsn/8RK7Wq7VeVytytS2L6qE69bXPB10YCmMdDZbKF4okCqY74pI/jJQ/8U0b/F6NrT2+14b8/P9/3AMGA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.", - "dev": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-remap-async-to-generator": "^7.18.9", - "@babel/plugin-syntax-async-generators": "^7.8.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.", - "dev": true, - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-class-static-block": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.21.0.tgz", - "integrity": "sha512-XP5G9MWNUskFuP30IfFSEFB0Z6HzLIUcjYM4bYOPHXl7eiJ9HFv8tWj6TXTN5QODiEhDZAeI4hLok2iHFFV4hw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-static-block instead.", - "dev": true, - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.21.0", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0" - } - }, - "node_modules/@babel/plugin-proposal-dynamic-import": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz", - "integrity": "sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-dynamic-import instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-export-default-from": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.18.10.tgz", - "integrity": "sha512-5H2N3R2aQFxkV4PIBUR/i7PUSwgTZjouJKzI8eKswfIjT0PhvzkPn0t0wIS5zn6maQuvtT0t1oHtMUz61LOuow==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-default-from": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz", - "integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-json-strings": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz", - "integrity": "sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-json-strings instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.20.7.tgz", - "integrity": "sha512-y7C7cZgpMIjWlKE5T7eJwp+tnRYM89HmRvWM5EQuB5BoHEONjmQ8lSNmBUwOyy/GFRsohJED51YBF79hE1djug==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-logical-assignment-operators instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz", - "integrity": "sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz", - "integrity": "sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz", - "integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz", - "integrity": "sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.", - "dev": true, - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.21.11", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.11.tgz", - "integrity": "sha512-0QZ8qP/3RLDVBwBFoWAwCtgcDZJVwA5LUJRZU8x2YFfKNuFq161wK3cuGrALu5yiPu+vzwTAg/sMWVNeWeNyaw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-property-in-object instead.", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.21.0", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz", - "integrity": "sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-unicode-property-regex instead.", - "dev": true, - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-default-from": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.22.5.tgz", - "integrity": "sha512-ODAqWWXB/yReh/jVQDag/3/tl6lgBueQkk/TcfW/59Oykm4c8a55XloX0CTk2k2VJiFWMgHby9xNX29IbCv9dQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.22.5.tgz", - "integrity": "sha512-rdV97N7KqsRzeNGoWUOK6yUsWarLjE5Su/Snk9IYPU9CwkWHs4t+rTGOvffTR8XGkJMTAdLfO0xVnXm8wugIJg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", - "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", - "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.22.5.tgz", - "integrity": "sha512-26lTNXoVRdAnsaDXPpvCNUq+OVWEVC6bx7Vvz9rC53F2bagUWW4u4ii2+h8Fejfh7RYqPxn+libeFBBck9muEw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.22.5.tgz", - "integrity": "sha512-b1A8D8ZzE/VhNDoV1MSJTnpKkCG5bJo+19R4o4oy03zM7ws8yEMK755j61Dc3EyvdysbqH5BOOTquJ7ZX9C6vQ==", - "dev": true, - "dependencies": { - "@babel/helper-module-imports": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-remap-async-to-generator": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.22.5.tgz", - "integrity": "sha512-tdXZ2UdknEKQWKJP1KMNmuF5Lx3MymtMN/pvA+p/VEkhK8jVcQ1fzSy8KM9qRYhAf2/lV33hoMPKI/xaI9sADA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.23.0.tgz", - "integrity": "sha512-cOsrbmIOXmf+5YbL99/S49Y3j46k/T16b9ml8bm9lP6N9US5iQ2yBK7gpui1pg0V/WMcXdkfKbTb7HXq9u+v4g==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.22.15.tgz", - "integrity": "sha512-VbbC3PGjBdE0wAWDdHM9G8Gm977pnYI0XpqMd6LrKISj8/DJXEsWqgRuTYaNE9Bv0JGhTZUzHDlMk18IpOuoqw==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", - "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.9", - "@babel/helper-split-export-declaration": "^7.22.6", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.22.5.tgz", - "integrity": "sha512-4GHWBgRf0krxPX+AaPtgBAlTgTeZmqDynokHOX7aqqAB4tHs3U2Y02zH6ETFdLZGcg9UQSD1WCmkVrE9ErHeOg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/template": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.23.0.tgz", - "integrity": "sha512-vaMdgNXFkYrB+8lbgniSYWHsgqK5gjaMNcc84bMIOMRLH0L9AqYq3hwMdvnyqj1OPqea8UtjPEuS/DCenah1wg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.22.5.tgz", - "integrity": "sha512-5/Yk9QxCQCl+sOIB1WelKnVRxTJDSAIxtJLL2/pqL14ZVlbH0fUQUZa/T5/UnQtBNgghR7mfB8ERBKyKPCi7Vw==", - "dev": true, - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.22.5.tgz", - "integrity": "sha512-dEnYD+9BBgld5VBXHnF/DbYGp3fqGMsyxKbtD1mDyIA7AkTSpKXFhCVuj/oQVOoALfBs77DudA0BE4d5mcpmqw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.22.5.tgz", - "integrity": "sha512-vIpJFNM/FjZ4rh1myqIya9jXwrwwgFRHPjT3DkUA9ZLHuzox8jiXkOLvwm1H+PQIP3CqfC++WPKeuDi0Sjdj1g==", - "dev": true, - "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.22.15.tgz", - "integrity": "sha512-me6VGeHsx30+xh9fbDLLPi0J1HzmeIIyenoOQHuw2D4m2SAU3NrspX5XxJLBpqn5yrLzrlw2Iy3RA//Bx27iOA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.22.5.tgz", - "integrity": "sha512-UIzQNMS0p0HHiQm3oelztj+ECwFnj+ZRV4KnguvlsD2of1whUeM6o7wGNj6oLwcDoAXQ8gEqfgC24D+VdIcevg==", - "dev": true, - "dependencies": { - "@babel/helper-compilation-targets": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.22.5.tgz", - "integrity": "sha512-fTLj4D79M+mepcw3dgFBTIDYpbcB9Sm0bpm4ppXPaO+U+PKFFyV9MGRvS0gvGw62sd10kT5lRMKXAADb9pWy8g==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.22.5.tgz", - "integrity": "sha512-RZEdkNtzzYCFl9SE9ATaUMTj2hqMb4StarOJLrZRbqqU4HSBE7UlBw9WBWQiDzrJZJdUWiMTVDI6Gv/8DPvfew==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.23.0.tgz", - "integrity": "sha512-xWT5gefv2HGSm4QHtgc1sYPbseOyf+FFDo2JbpE25GWl5BqTGO9IMwTYJRoIdjsF85GE+VegHxSCUt5EvoYTAw==", - "dev": true, - "dependencies": { - "@babel/helper-module-transforms": "^7.23.0", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.0.tgz", - "integrity": "sha512-32Xzss14/UVc7k9g775yMIvkVK8xwKE0DPdP5JTapr3+Z9w4tzeOuLNY6BXDQR6BdnzIlXnCGAzsk/ICHBLVWQ==", - "dev": true, - "dependencies": { - "@babel/helper-module-transforms": "^7.23.0", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-simple-access": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.23.0.tgz", - "integrity": "sha512-qBej6ctXZD2f+DhlOC9yO47yEYgUh5CZNz/aBoH4j/3NOlRfJXJbY7xDQCqQVf9KbrqGzIWER1f23doHGrIHFg==", - "dev": true, - "dependencies": { - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-module-transforms": "^7.23.0", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.22.5.tgz", - "integrity": "sha512-+S6kzefN/E1vkSsKx8kmQuqeQsvCKCd1fraCM7zXm4SFoggI099Tr4G8U81+5gtMdUeMQ4ipdQffbKLX0/7dBQ==", - "dev": true, - "dependencies": { - "@babel/helper-module-transforms": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.22.5.tgz", - "integrity": "sha512-YgLLKmS3aUBhHaxp5hi1WJTgOUb/NCuDHzGT9z9WTt3YG+CPRhJs6nprbStx6DnWM4dh6gt7SU3sZodbZ08adQ==", - "dev": true, - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-new-target": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.22.5.tgz", - "integrity": "sha512-AsF7K0Fx/cNKVyk3a+DW0JLo+Ua598/NxMRvxDnkpCIGFh43+h/v2xyhRUYf6oD8gE4QtL83C7zZVghMjHd+iw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.22.5.tgz", - "integrity": "sha512-klXqyaT9trSjIUrcsYIfETAzmOEZL3cBYqOYLJxBHfMFFggmXOv+NYSX/Jbs9mzMVESw/WycLFPRx8ba/b2Ipw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-optional-chaining": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.23.0.tgz", - "integrity": "sha512-sBBGXbLJjxTzLBF5rFWaikMnOGOk/BmK6vVByIdEggZ7Vn6CvWXZyRkkLFK6WE0IF8jSliyOkUN6SScFgzCM0g==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.15.tgz", - "integrity": "sha512-hjk7qKIqhyzhhUvRT683TYQOFa/4cQKwQy7ALvTpODswN40MljzNDa0YldevS6tGbxwaEKVn502JmY0dP7qEtQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.22.5.tgz", - "integrity": "sha512-TiOArgddK3mK/x1Qwf5hay2pxI6wCZnvQqrFSqbtg1GLl2JcNMitVH/YnqjP+M31pLUeTfzY1HAXFDnUBV30rQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.22.10.tgz", - "integrity": "sha512-F28b1mDt8KcT5bUyJc/U9nwzw6cV+UmTeRlXYIl2TNqMMJif0Jeey9/RQ3C4NOd2zp0/TRsDns9ttj2L523rsw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "regenerator-transform": "^0.15.2" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.22.5.tgz", - "integrity": "sha512-DTtGKFRQUDm8svigJzZHzb/2xatPc6TzNvAIJ5GqOKDsGFYgAskjRulbR/vGsPKq3OPqtexnz327qYpP57RFyA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-runtime": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.18.10.tgz", - "integrity": "sha512-q5mMeYAdfEbpBAgzl7tBre/la3LeCxmDO1+wMXRdPWbcoMjR3GiXlCLk7JBZVVye0bqTGNMbt0yYVXX1B1jEWQ==", - "dev": true, - "dependencies": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.9", - "babel-plugin-polyfill-corejs2": "^0.3.2", - "babel-plugin-polyfill-corejs3": "^0.5.3", - "babel-plugin-polyfill-regenerator": "^0.4.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.22.5.tgz", - "integrity": "sha512-vM4fq9IXHscXVKzDv5itkO1X52SmdFBFcMIBZ2FRn2nqVYqw6dBexUgMvAjHW+KXpPPViD/Yo3GrDEBaRC0QYA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-spread": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.22.5.tgz", - "integrity": "sha512-5ZzDQIGyvN4w8+dMmpohL6MBo+l2G7tfC/O2Dg7/hjpgeWvUx8FzfeOKxGog9IimPa4YekaQ9PlDqTLOljkcxg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.22.5.tgz", - "integrity": "sha512-zf7LuNpHG0iEeiyCNwX4j3gDg1jgt1k3ZdXBKbZSoA3BbGQGvMiSvfbZRR3Dr3aeJe3ooWFZxOOG3IRStYp2Bw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.22.5.tgz", - "integrity": "sha512-5ciOehRNf+EyUeewo8NkbQiUs4d6ZxiHo6BcBcnFlgiJfu16q0bQUw9Jvo0b0gBKFG1SMhDSjeKXSYuJLeFSMA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.22.5.tgz", - "integrity": "sha512-bYkI5lMzL4kPii4HHEEChkD0rkc+nvnlR6+o/qdqR6zrm0Sv/nodmyLhlq2DO0YKLUNd2VePmPRjJXSBh9OIdA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-typescript": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.15.tgz", - "integrity": "sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-create-class-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-typescript": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.22.10.tgz", - "integrity": "sha512-lRfaRKGZCBqDlRU3UIFovdp9c9mEvlylmpod0/OatICsSfuQ9YFthRo1tpTkGsklEefZdqlEFdY4A2dwTb6ohg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.22.5.tgz", - "integrity": "sha512-028laaOKptN5vHJf9/Arr/HiJekMd41hOEZYvNsrsXqJ7YPYuX2bQxh31fkZzGmq3YqHRJzYFFAVYvKfMPKqyg==", - "dev": true, - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-env": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.18.10.tgz", - "integrity": "sha512-wVxs1yjFdW3Z/XkNfXKoblxoHgbtUF7/l3PvvP4m02Qz9TZ6uZGxRVYjSQeR87oQmHco9zWitW5J82DJ7sCjvA==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-validator-option": "^7.18.6", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.18.10", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-class-static-block": "^7.18.6", - "@babel/plugin-proposal-dynamic-import": "^7.18.6", - "@babel/plugin-proposal-export-namespace-from": "^7.18.9", - "@babel/plugin-proposal-json-strings": "^7.18.6", - "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", - "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-private-methods": "^7.18.6", - "@babel/plugin-proposal-private-property-in-object": "^7.18.6", - "@babel/plugin-proposal-unicode-property-regex": "^7.18.6", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.18.6", - "@babel/plugin-transform-async-to-generator": "^7.18.6", - "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.18.9", - "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.9", - "@babel/plugin-transform-dotall-regex": "^7.18.6", - "@babel/plugin-transform-duplicate-keys": "^7.18.9", - "@babel/plugin-transform-exponentiation-operator": "^7.18.6", - "@babel/plugin-transform-for-of": "^7.18.8", - "@babel/plugin-transform-function-name": "^7.18.9", - "@babel/plugin-transform-literals": "^7.18.9", - "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.18.9", - "@babel/plugin-transform-modules-umd": "^7.18.6", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.18.6", - "@babel/plugin-transform-new-target": "^7.18.6", - "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", - "@babel/plugin-transform-property-literals": "^7.18.6", - "@babel/plugin-transform-regenerator": "^7.18.6", - "@babel/plugin-transform-reserved-words": "^7.18.6", - "@babel/plugin-transform-shorthand-properties": "^7.18.6", - "@babel/plugin-transform-spread": "^7.18.9", - "@babel/plugin-transform-sticky-regex": "^7.18.6", - "@babel/plugin-transform-template-literals": "^7.18.9", - "@babel/plugin-transform-typeof-symbol": "^7.18.9", - "@babel/plugin-transform-unicode-escapes": "^7.18.10", - "@babel/plugin-transform-unicode-regex": "^7.18.6", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.18.10", - "babel-plugin-polyfill-corejs2": "^0.3.2", - "babel-plugin-polyfill-corejs3": "^0.5.3", - "babel-plugin-polyfill-regenerator": "^0.4.0", - "core-js-compat": "^3.22.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-modules": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6.tgz", - "integrity": "sha512-ID2yj6K/4lKfhuU3+EX4UvNbIt7eACFbHmNUjzA+ep+B5971CknnA/9DEWKbRokfbbtblxxxXFJJrH47UEAMVg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/@babel/preset-typescript": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.23.2.tgz", - "integrity": "sha512-u4UJc1XsS1GhIGteM8rnGiIvf9rJpiVgMEeCnwlLA7WJPC+jcXWJAGxYmeqs5hOZD8BbAfnV5ezBOxQbb4OUxA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-validator-option": "^7.22.15", - "@babel/plugin-syntax-jsx": "^7.22.5", - "@babel/plugin-transform-modules-commonjs": "^7.23.0", - "@babel/plugin-transform-typescript": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/regjsgen": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", - "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", - "dev": true - }, - "node_modules/@babel/runtime": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", - "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", - "dev": true, - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", - "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/parser": "^7.22.15", - "@babel/types": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template/node_modules/@babel/parser": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", - "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/template/node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.11.tgz", - "integrity": "sha512-TG9PiM2R/cWCAy6BPJKeHzNbu4lPzOSZpeMfeNErskGpTJx6trEvFaVCbDvpcxwy49BKWmEPwiW8mrysNiDvIQ==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.10", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.11", - "@babel/types": "^7.18.10", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.10.tgz", - "integrity": "sha512-MJvnbEiiNkpjo+LknnmRrqbY1GPUUggjv+wQVjetM/AONoupqRALB7I6jGqNUAZsKcRIEu2J6FRFvsczljjsaQ==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@confio/ics23": { - "version": "0.6.8", - "resolved": "https://registry.npmjs.org/@confio/ics23/-/ics23-0.6.8.tgz", - "integrity": "sha512-wB6uo+3A50m0sW/EWcU64xpV/8wShZ6bMTa7pF8eYsTrSkQA7oLUIJcs/wb8g4y2Oyq701BaGiO6n/ak5WXO1w==", - "dependencies": { - "@noble/hashes": "^1.0.0", - "protobufjs": "^6.8.8" - } - }, - "node_modules/@cosmjs/amino": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.31.3.tgz", - "integrity": "sha512-36emtUq895sPRX8PTSOnG+lhJDCVyIcE0Tr5ct59sUbgQiI14y43vj/4WAlJ/utSOxy+Zhj9wxcs4AZfu0BHsw==", - "dependencies": { - "@cosmjs/crypto": "^0.31.3", - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/utils": "^0.31.3" - } - }, - "node_modules/@cosmjs/cosmwasm-stargate": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.31.3.tgz", - "integrity": "sha512-Uv9TmCn3650gdFeZm7SEfUZF3uX3lfJfFhXOk6I2ZLr/FrKximnlb+vwAfZaZnWYvlA7qrKtHIjeRNHvT23zcw==", - "dependencies": { - "@cosmjs/amino": "^0.31.3", - "@cosmjs/crypto": "^0.31.3", - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/proto-signing": "^0.31.3", - "@cosmjs/stargate": "^0.31.3", - "@cosmjs/tendermint-rpc": "^0.31.3", - "@cosmjs/utils": "^0.31.3", - "cosmjs-types": "^0.8.0", - "long": "^4.0.0", - "pako": "^2.0.2" - } - }, - "node_modules/@cosmjs/cosmwasm-stargate/node_modules/cosmjs-types": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.8.0.tgz", - "integrity": "sha512-Q2Mj95Fl0PYMWEhA2LuGEIhipF7mQwd9gTQ85DdP9jjjopeoGaDxvmPa5nakNzsq7FnO1DMTatXTAx6bxMH7Lg==", - "dependencies": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } - }, - "node_modules/@cosmjs/cosmwasm-stargate/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/@cosmjs/crypto": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.31.3.tgz", - "integrity": "sha512-vRbvM9ZKR2017TO73dtJ50KxoGcFzKtKI7C8iO302BQ5p+DuB+AirUg1952UpSoLfv5ki9O416MFANNg8UN/EQ==", - "dependencies": { - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/utils": "^0.31.3", - "@noble/hashes": "^1", - "bn.js": "^5.2.0", - "elliptic": "^6.5.4", - "libsodium-wrappers-sumo": "^0.7.11" - } - }, - "node_modules/@cosmjs/encoding": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.31.3.tgz", - "integrity": "sha512-6IRtG0fiVYwyP7n+8e54uTx2pLYijO48V3t9TLiROERm5aUAIzIlz6Wp0NYaI5he9nh1lcEGJ1lkquVKFw3sUg==", - "dependencies": { - "base64-js": "^1.3.0", - "bech32": "^1.1.4", - "readonly-date": "^1.0.0" - } - }, - "node_modules/@cosmjs/json-rpc": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.31.3.tgz", - "integrity": "sha512-7LVYerXjnm69qqYR3uA6LGCrBW2EO5/F7lfJxAmY+iII2C7xO3a0vAjMSt5zBBh29PXrJVS6c2qRP22W1Le2Wg==", - "dependencies": { - "@cosmjs/stream": "^0.31.3", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/math": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.31.3.tgz", - "integrity": "sha512-kZ2C6glA5HDb9hLz1WrftAjqdTBb3fWQsRR+Us2HsjAYdeE6M3VdXMsYCP5M3yiihal1WDwAY2U7HmfJw7Uh4A==", - "dependencies": { - "bn.js": "^5.2.0" - } - }, - "node_modules/@cosmjs/proto-signing": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.31.3.tgz", - "integrity": "sha512-24+10/cGl6lLS4VCrGTCJeDRPQTn1K5JfknzXzDIHOx8THR31JxA7/HV5eWGHqWgAbudA7ccdSvEK08lEHHtLA==", - "dependencies": { - "@cosmjs/amino": "^0.31.3", - "@cosmjs/crypto": "^0.31.3", - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/utils": "^0.31.3", - "cosmjs-types": "^0.8.0", - "long": "^4.0.0" - } - }, - "node_modules/@cosmjs/proto-signing/node_modules/cosmjs-types": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.8.0.tgz", - "integrity": "sha512-Q2Mj95Fl0PYMWEhA2LuGEIhipF7mQwd9gTQ85DdP9jjjopeoGaDxvmPa5nakNzsq7FnO1DMTatXTAx6bxMH7Lg==", - "dependencies": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } - }, - "node_modules/@cosmjs/proto-signing/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/@cosmjs/socket": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.31.3.tgz", - "integrity": "sha512-aqrDGGi7os/hsz5p++avI4L0ZushJ+ItnzbqA7C6hamFSCJwgOkXaOUs+K9hXZdX4rhY7rXO4PH9IH8q09JkTw==", - "dependencies": { - "@cosmjs/stream": "^0.31.3", - "isomorphic-ws": "^4.0.1", - "ws": "^7", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/stargate": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.31.3.tgz", - "integrity": "sha512-53NxnzmB9FfXpG4KjOUAYAvWLYKdEmZKsutcat/u2BrDXNZ7BN8jim/ENcpwXfs9/Og0K24lEIdvA4gsq3JDQw==", - "dependencies": { - "@confio/ics23": "^0.6.8", - "@cosmjs/amino": "^0.31.3", - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/proto-signing": "^0.31.3", - "@cosmjs/stream": "^0.31.3", - "@cosmjs/tendermint-rpc": "^0.31.3", - "@cosmjs/utils": "^0.31.3", - "cosmjs-types": "^0.8.0", - "long": "^4.0.0", - "protobufjs": "~6.11.3", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/stargate/node_modules/cosmjs-types": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.8.0.tgz", - "integrity": "sha512-Q2Mj95Fl0PYMWEhA2LuGEIhipF7mQwd9gTQ85DdP9jjjopeoGaDxvmPa5nakNzsq7FnO1DMTatXTAx6bxMH7Lg==", - "dependencies": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } - }, - "node_modules/@cosmjs/stargate/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/@cosmjs/stream": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.31.3.tgz", - "integrity": "sha512-8keYyI7X0RjsLyVcZuBeNjSv5FA4IHwbFKx7H60NHFXszN8/MvXL6aZbNIvxtcIHHsW7K9QSQos26eoEWlAd+w==", - "dependencies": { - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/tendermint-rpc": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.31.3.tgz", - "integrity": "sha512-s3TiWkPCW4QceTQjpYqn4xttUJH36mTPqplMl+qyocdqk5+X5mergzExU/pHZRWQ4pbby8bnR7kMvG4OC1aZ8g==", - "dependencies": { - "@cosmjs/crypto": "^0.31.3", - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/json-rpc": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/socket": "^0.31.3", - "@cosmjs/stream": "^0.31.3", - "@cosmjs/utils": "^0.31.3", - "axios": "^0.21.2", - "readonly-date": "^1.0.0", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/utils": { - "version": "0.31.3", - "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.31.3.tgz", - "integrity": "sha512-VBhAgzrrYdIe0O5IbKRqwszbQa7ZyQLx9nEQuHQ3HUplQW7P44COG/ye2n6AzCudtqxmwdX7nyX8ta1J07GoqA==" - }, - "node_modules/@cosmwasm/ts-codegen": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@cosmwasm/ts-codegen/-/ts-codegen-0.35.3.tgz", - "integrity": "sha512-L7T4yjAQIWJ/h0YmqVjihzv78ZbqGD/f0G8EJTwccsPXqWzbcnXzQKsvtFXpDp6AzaJKVMchFHfp6ZPRP3boUQ==", - "dev": true, - "dependencies": { - "@babel/core": "7.18.10", - "@babel/generator": "7.18.12", - "@babel/parser": "7.18.11", - "@babel/plugin-proposal-class-properties": "7.18.6", - "@babel/plugin-proposal-export-default-from": "7.18.10", - "@babel/plugin-proposal-object-rest-spread": "7.18.9", - "@babel/plugin-transform-runtime": "7.18.10", - "@babel/preset-env": "7.18.10", - "@babel/preset-typescript": "^7.18.6", - "@babel/runtime": "^7.18.9", - "@babel/traverse": "7.18.11", - "@babel/types": "7.18.10", - "@pyramation/json-schema-to-typescript": " 11.0.4", - "case": "1.6.3", - "dargs": "7.0.0", - "deepmerge": "4.2.2", - "dotty": "0.1.2", - "fuzzy": "0.1.3", - "glob": "8.0.3", - "inquirerer": "0.1.3", - "long": "^5.2.0", - "minimist": "1.2.6", - "mkdirp": "1.0.4", - "parse-package-name": "1.0.0", - "rimraf": "3.0.2", - "shelljs": "0.8.5", - "wasm-ast-types": "^0.26.2" - }, - "bin": { - "cosmwasm-ts-codegen": "main/ts-codegen.js" - } - }, - "node_modules/@cosmwasm/ts-codegen/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@cosmwasm/ts-codegen/node_modules/glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@cosmwasm/ts-codegen/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@cosmwasm/ts-codegen/node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/schemas": { - "version": "28.1.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-28.1.3.tgz", - "integrity": "sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg==", - "dev": true, - "dependencies": { - "@sinclair/typebox": "^0.24.1" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" - } - }, - "node_modules/@jest/transform": { - "version": "28.1.3", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-28.1.3.tgz", - "integrity": "sha512-u5dT5di+oFI6hfcLOHGTAfmUxFRrjK+vnaP0kkVow9Md/M7V/MxqQMOz/VV25UZO8pzeA9PjfTpOu6BDuwSPQA==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/types": "^28.1.3", - "@jridgewell/trace-mapping": "^0.3.13", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^28.1.3", - "jest-regex-util": "^28.0.2", - "jest-util": "^28.1.3", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.1" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" - } - }, - "node_modules/@jest/transform/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/transform/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/transform/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/transform/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/transform/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/transform/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types": { - "version": "28.1.3", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.1.3.tgz", - "integrity": "sha512-RyjiyMUZrKz/c+zlMFO1pm70DcIlST8AeWTkoUdZevew44wcNZQHsEVOiCVtgVnlFFD82FPaXycys58cf2muVQ==", - "dev": true, - "dependencies": { - "@jest/schemas": "^28.1.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" - } - }, - "node_modules/@jest/types/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/types/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/types/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/types/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/types/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", - "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@jsdevtools/ono": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", - "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", - "dev": true - }, - "node_modules/@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@oven/bun-darwin-aarch64": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.0.7.tgz", - "integrity": "sha512-PyQymaGOl4HFVu0WqMGCVp4hRNTs4oiqEhS+l4WQJdxXNc7GeCh/rMq9MaTquRXbXsdAUWPQ1o0Lw+VKMQ5iTg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@oven/bun-darwin-x64": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.0.7.tgz", - "integrity": "sha512-Z3IhLjUkxCYf7tXWu+YTva5yycAgC6KipAQBESFZY+PzhQubU9WacskdFwTC1daZ3dF0xVxRjLeMYOIrC8/ADg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@oven/bun-darwin-x64-baseline": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.0.7.tgz", - "integrity": "sha512-+8Xe9XycaZR7qYe4w2kZBckijms43LqfgbdpPZBr91wjO8QVzFBhFF8vYnud5C8WHrKTDjEWWnk2mhGym+xWRA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@oven/bun-linux-aarch64": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.0.7.tgz", - "integrity": "sha512-blnL4jP3dAr+eEt/jA5EW4DiY20k7x/IYKSc6EBrYt7P0olXbMiQQfQUcVoqRMV42wioP/dKdkGBw6wNJXpgfA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@oven/bun-linux-x64": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.0.7.tgz", - "integrity": "sha512-fYlJgm10g4WLPV55cH1cVhrE2Z1Uu7nYKBXX7jur9YGn9suNw+xeLp36I716pX9EIkYBVKXyfJ38q2BT+RbEug==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@oven/bun-linux-x64-baseline": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.0.7.tgz", - "integrity": "sha512-URNn0plTU7VJ4uRXuHfVFln7n90vmG8VU68TboLd1CSe+nukkhNid7fZl1yDfXU7Y4l4iKn7meqGxRDXyrjeXw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" - }, - "node_modules/@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "node_modules/@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "node_modules/@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" - }, - "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "node_modules/@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" - }, - "node_modules/@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" - }, - "node_modules/@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" - }, - "node_modules/@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" - }, - "node_modules/@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" - }, - "node_modules/@pyramation/json-schema-ref-parser": { - "version": "9.0.6", - "resolved": "https://registry.npmjs.org/@pyramation/json-schema-ref-parser/-/json-schema-ref-parser-9.0.6.tgz", - "integrity": "sha512-L5kToHAEc1Q87R8ZwWFaNa4tPHr8Hnm+U+DRdUVq3tUtk+EX4pCqSd34Z6EMxNi/bjTzt1syAG9J2Oo1YFlqSg==", - "dev": true, - "dependencies": { - "@jsdevtools/ono": "^7.1.3", - "call-me-maybe": "^1.0.1", - "js-yaml": "^3.13.1" - } - }, - "node_modules/@pyramation/json-schema-ref-parser/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@pyramation/json-schema-ref-parser/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@pyramation/json-schema-to-typescript": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/@pyramation/json-schema-to-typescript/-/json-schema-to-typescript-11.0.4.tgz", - "integrity": "sha512-+aSzXDLhMHOEdV2cJ7Tjg/9YenjHU5BCmClVygzwxJZ1R16NOfEn7lTAwVzb/2jivOSnhjHzMJbnSf8b6rd1zg==", - "dev": true, - "dependencies": { - "@pyramation/json-schema-ref-parser": "9.0.6", - "@types/json-schema": "^7.0.11", - "@types/lodash": "^4.14.182", - "@types/prettier": "^2.6.1", - "cli-color": "^2.0.2", - "get-stdin": "^8.0.0", - "glob": "^7.1.6", - "glob-promise": "^4.2.2", - "is-glob": "^4.0.3", - "lodash": "^4.17.21", - "minimist": "^1.2.6", - "mkdirp": "^1.0.4", - "mz": "^2.7.0", - "prettier": "^2.6.2" - }, - "bin": { - "json2ts": "dist/src/cli.js" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@sinclair/typebox": { - "version": "0.24.51", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", - "integrity": "sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA==", - "dev": true - }, - "node_modules/@types/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", - "dev": true, - "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "node_modules/@types/graceful-fs": { - "version": "4.1.8", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.8.tgz", - "integrity": "sha512-NhRH7YzWq8WiNKVavKPBmtLYZHxNY19Hh+az28O/phfp68CF45pMFud+ZzJ8ewnxnC5smIdF3dqFeiSUQ5I+pw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", - "integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==", - "dev": true - }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.2.tgz", - "integrity": "sha512-8toY6FgdltSdONav1XtUHl4LN1yTmLza+EuDazb/fEmRNCwjyqNVIQWs2IfC74IqjHkREs/nQ2FWq5kZU9IC0w==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.3.tgz", - "integrity": "sha512-1nESsePMBlf0RPRffLZi5ujYh7IH1BWL4y9pr+Bn3cJBdxz+RTP8bUFljLz9HvzhhOSWKdyBZ4DIivdL6rvgZg==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.14", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", - "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", - "dev": true - }, - "node_modules/@types/lodash": { - "version": "4.14.200", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz", - "integrity": "sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==", - "dev": true - }, - "node_modules/@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" - }, - "node_modules/@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", - "dev": true - }, - "node_modules/@types/node": { - "version": "20.8.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", - "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/prettier": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", - "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", - "dev": true - }, - "node_modules/@types/yargs": { - "version": "17.0.29", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.29.tgz", - "integrity": "sha512-nacjqA3ee9zRF/++a3FUY1suHTFKZeHba2n8WeDw9cCVdmzmHpIxyzOJBcpHvvEmS8E9KqWlSnWHUkOrkhWcvA==", - "dev": true, - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "21.0.2", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.2.tgz", - "integrity": "sha512-5qcvofLPbfjmBfKaLfj/+f+Sbd6pN4zl7w7VSVI5uz7m9QZTuB2aZAa2uo1wHFBNN2x6g/SoTkXmd8mQnQF2Cw==", - "dev": true - }, - "node_modules/ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/ast-stringify": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ast-stringify/-/ast-stringify-0.1.0.tgz", - "integrity": "sha512-J1PgFYV3RG6r37+M6ySZJH406hR82okwGvFM9hLXpOvdx4WC4GEW8/qiw6pi1hKTrqcRvoHP8a7mp87egYr6iA==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.11.2" - } - }, - "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", - "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.3", - "semver": "^6.1.1" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.3.tgz", - "integrity": "sha512-zKsXDh0XjnrUEW0mxIHLfjBfnXSMr5Q/goMe/fxpQnLm07mcOZiIZHBNWCMx60HmdvjxfXcalac0tfFg0wqxyw==", - "dev": true, - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.2", - "core-js-compat": "^3.21.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz", - "integrity": "sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw==", - "dev": true, - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, - "node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" - }, - "node_modules/browserslist": { - "version": "4.22.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", - "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "caniuse-lite": "^1.0.30001541", - "electron-to-chromium": "^1.4.535", - "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.13" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "dependencies": { - "node-int64": "^0.4.0" - } - }, - "node_modules/bun": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/bun/-/bun-1.0.7.tgz", - "integrity": "sha512-eeIbTup0ndMLJi2LVEdjnMqV2joeuQ9byiIMEa3DROJtP0+vI6YYob7jYYk3xMEK51fDOs9tPg/CPPraIJ7M1A==", - "cpu": [ - "arm64", - "x64" - ], - "dev": true, - "hasInstallScript": true, - "os": [ - "darwin", - "linux" - ], - "bin": { - "bun": "bin/bun", - "bunx": "bin/bun" - }, - "optionalDependencies": { - "@oven/bun-darwin-aarch64": "1.0.7", - "@oven/bun-darwin-x64": "1.0.7", - "@oven/bun-darwin-x64-baseline": "1.0.7", - "@oven/bun-linux-aarch64": "1.0.7", - "@oven/bun-linux-x64": "1.0.7", - "@oven/bun-linux-x64-baseline": "1.0.7" - } - }, - "node_modules/call-me-maybe": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", - "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", - "dev": true - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001559", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz", - "integrity": "sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, - "node_modules/case": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/case/-/case-1.6.3.tgz", - "integrity": "sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, - "node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "engines": { - "node": ">=8" - } - }, - "node_modules/cli-color": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.3.tgz", - "integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==", - "dev": true, - "dependencies": { - "d": "^1.0.1", - "es5-ext": "^0.10.61", - "es6-iterator": "^2.0.3", - "memoizee": "^0.4.15", - "timers-ext": "^0.1.7" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", - "dev": true, - "dependencies": { - "restore-cursor": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "dev": true, - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true - }, - "node_modules/core-js-compat": { - "version": "3.33.2", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.2.tgz", - "integrity": "sha512-axfo+wxFVxnqf8RvxTzoAlzW4gRoacrHeoFlc9n0x50+7BEyZL/Rt3hicaED1/CEd7I6tPCPVUYcJwCMO5XUYw==", - "dev": true, - "dependencies": { - "browserslist": "^4.22.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/cosmjs-types": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.9.0.tgz", - "integrity": "sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ==" - }, - "node_modules/d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "dev": true, - "dependencies": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, - "node_modules/dargs": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", - "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", - "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dependencies": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/dotty": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dotty/-/dotty-0.1.2.tgz", - "integrity": "sha512-V0EWmKeH3DEhMwAZ+8ZB2Ao4OK6p++Z0hsDtZq3N0+0ZMVqkzrcEGROvOnZpLnvBg5PTNG23JEDLAm64gPaotQ==", - "dev": true - }, - "node_modules/electron-to-chromium": { - "version": "1.4.571", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.571.tgz", - "integrity": "sha512-Sc+VtKwKCDj3f/kLBjdyjMpNzoZsU6WuL/wFb6EH8USmHEcebxRXcRrVpOpayxd52tuey4RUDpUsw5OS5LhJqg==", - "dev": true - }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/es5-ext": { - "version": "0.10.62", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", - "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", - "dev": true, - "dependencies": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", - "dev": true, - "dependencies": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "node_modules/es6-weak-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", - "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", - "dev": true, - "dependencies": { - "d": "1", - "es5-ext": "^0.10.46", - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", - "dev": true, - "dependencies": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, - "node_modules/ext": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", - "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", - "dev": true, - "dependencies": { - "type": "^2.7.2" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", - "dev": true - }, - "node_modules/external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "dependencies": { - "bser": "2.1.1" - } - }, - "node_modules/figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/fuzzy": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/fuzzy/-/fuzzy-0.1.3.tgz", - "integrity": "sha512-/gZffu4ykarLrCiP3Ygsa86UAo1E5vEVlvTrpkKywXSbP9Xhln3oSp9QSV57gEq3JFFpGJ4GZ+5zdEp3FcUh4w==", - "dev": true, - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-intrinsic": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", - "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", - "dependencies": { - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/get-stdin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", - "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-promise": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/glob-promise/-/glob-promise-4.2.2.tgz", - "integrity": "sha512-xcUzJ8NWN5bktoTIX7eOclO1Npxd/dyVqUJxlLIDasT4C7KZyqlPIwkdJ0Ypiy3p2ZKahTjK4M9uC3sNSfNMzw==", - "dev": true, - "dependencies": { - "@types/glob": "^7.1.3" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/ahmadnassri" - }, - "peerDependencies": { - "glob": "^7.1.6" - } - }, - "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/globalthis": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", - "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", - "dependencies": { - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", - "dev": true, - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-ansi/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", - "dependencies": { - "get-intrinsic": "^1.2.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/inquirer": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", - "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", - "dev": true, - "dependencies": { - "ansi-escapes": "^3.2.0", - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.12", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.4.0", - "string-width": "^2.1.0", - "strip-ansi": "^5.1.0", - "through": "^2.3.6" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/inquirer-autocomplete-prompt": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/inquirer-autocomplete-prompt/-/inquirer-autocomplete-prompt-0.11.1.tgz", - "integrity": "sha512-VM4eNiyRD4CeUc2cyKni+F8qgHwL9WC4LdOr+mEC85qP/QNsDV+ysVqUrJYhw1TmDQu1QVhc8hbaL7wfk8SJxw==", - "dev": true, - "dependencies": { - "ansi-escapes": "^2.0.0", - "chalk": "^1.1.3", - "figures": "^2.0.0", - "inquirer": "3.1.1", - "lodash": "^4.17.4", - "run-async": "^2.3.0", - "util": "^0.10.3" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/ansi-escapes": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz", - "integrity": "sha512-tH/fSoQp4DrEodDK3QpdiWiZTSe7sBJ9eOqcQBZ0o9HTM+5M/viSEn+sPMoTuPjQQ8n++w3QJoPEjt8LVPcrCg==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", - "dev": true, - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha512-j/Toj7f1z98Hh2cYo2BVr85EpIRWqUi7rtRSGxh/cqUjqrnJe9l9UE7IUGd2vQ2p+kSHLkSzObQPZPLUC6TQwg==", - "dev": true - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", - "dev": true, - "dependencies": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/inquirer": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.1.1.tgz", - "integrity": "sha512-H50sHQwgvvaTBd3HpKMVtL/u6LoHDvYym51gd7bGQe/+9HkCE+J0/3N5FJLfd6O6oz44hHewC2Pc2LodzWVafQ==", - "dev": true, - "dependencies": { - "ansi-escapes": "^2.0.0", - "chalk": "^1.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^2.0.4", - "figures": "^2.0.0", - "lodash": "^4.3.0", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rx-lite": "^4.0.8", - "rx-lite-aggregates": "^4.0.8", - "string-width": "^2.0.0", - "strip-ansi": "^3.0.0", - "through": "^2.3.6" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", - "dev": true, - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inquirer-autocomplete-prompt/node_modules/supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/inquirerer": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/inquirerer/-/inquirerer-0.1.3.tgz", - "integrity": "sha512-yGgLUOqPxTsINBjZNZeLi3cv2zgxXtw9feaAOSJf2j6AqIT5Uxs5ZOqOrfAf+xP65Sicla1FD3iDxa3D6TsCAQ==", - "dev": true, - "dependencies": { - "colors": "^1.1.2", - "inquirer": "^6.0.0", - "inquirer-autocomplete-prompt": "^0.11.1" - } - }, - "node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dev": true, - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-promise": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", - "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", - "dev": true - }, - "node_modules/isomorphic-ws": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", - "peerDependencies": { - "ws": "*" - } - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", - "dev": true, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-haste-map": { - "version": "28.1.3", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-28.1.3.tgz", - "integrity": "sha512-3S+RQWDXccXDKSWnkHa/dPwt+2qwA8CJzR61w3FoYCvoo3Pn8tvGcysmMF0Bj0EX5RYvAI2EIvC57OmotfdtKA==", - "dev": true, - "dependencies": { - "@jest/types": "^28.1.3", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^28.0.2", - "jest-util": "^28.1.3", - "jest-worker": "^28.1.3", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" - }, - "optionalDependencies": { - "fsevents": "^2.3.2" - } - }, - "node_modules/jest-regex-util": { - "version": "28.0.2", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-28.0.2.tgz", - "integrity": "sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw==", - "dev": true, - "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" - } - }, - "node_modules/jest-util": { - "version": "28.1.3", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.1.3.tgz", - "integrity": "sha512-XdqfpHwpcSRko/C35uLYFM2emRAltIIKZiJ9eAmhjsj0CqZMa0p1ib0R5fWIqGhn1a103DebTbpqIaP1qCQ6tQ==", - "dev": true, - "dependencies": { - "@jest/types": "^28.1.3", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" - } - }, - "node_modules/jest-util/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-util/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-util/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-util/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker": { - "version": "28.1.3", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-28.1.3.tgz", - "integrity": "sha512-CqRA220YV/6jCo8VWvAt1KKx6eek1VIHMPeLEbpcfSfkEeWyBNppynM/o6q+Wmw+sOhos2ml34wZbSX3G13//g==", - "dev": true, - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" - } - }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/libsodium-sumo": { - "version": "0.7.13", - "resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.13.tgz", - "integrity": "sha512-zTGdLu4b9zSNLfovImpBCbdAA4xkpkZbMnSQjP8HShyOutnGjRHmSOKlsylh1okao6QhLiz7nG98EGn+04cZjQ==" - }, - "node_modules/libsodium-wrappers-sumo": { - "version": "0.7.13", - "resolved": "https://registry.npmjs.org/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.13.tgz", - "integrity": "sha512-lz4YdplzDRh6AhnLGF2Dj2IUj94xRN6Bh8T0HLNwzYGwPehQJX6c7iYVrFUPZ3QqxE0bqC+K0IIqqZJYWumwSQ==", - "dependencies": { - "libsodium-sumo": "^0.7.13" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", - "dev": true - }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", - "dev": true - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/lru-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", - "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==", - "dev": true, - "dependencies": { - "es5-ext": "~0.10.2" - } - }, - "node_modules/makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "dependencies": { - "tmpl": "1.0.5" - } - }, - "node_modules/memoizee": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", - "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==", - "dev": true, - "dependencies": { - "d": "^1.0.1", - "es5-ext": "^0.10.53", - "es6-weak-map": "^2.0.3", - "event-emitter": "^0.3.5", - "is-promise": "^2.2.2", - "lru-queue": "^0.1.0", - "next-tick": "^1.1.0", - "timers-ext": "^0.1.7" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ==", - "dev": true - }, - "node_modules/mz": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "dev": true, - "dependencies": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "node_modules/next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", - "dev": true - }, - "node_modules/node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true - }, - "node_modules/node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", - "dev": true - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" - }, - "node_modules/parse-package-name": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-package-name/-/parse-package-name-1.0.0.tgz", - "integrity": "sha512-kBeTUtcj+SkyfaW4+KBe0HtsloBJ/mKTPoxpVdA57GZiPerREsUWJOhVj9anXweFiJkm5y8FG1sxFZkZ0SN6wg==", - "dev": true - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pirates": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", - "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/protobufjs": { - "version": "6.11.4", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz", - "integrity": "sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", - "@types/node": ">=13.7.0", - "long": "^4.0.0" - }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" - } - }, - "node_modules/protobufjs/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/readonly-date": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz", - "integrity": "sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==" - }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "dev": true, - "dependencies": { - "resolve": "^1.1.6" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/regenerate": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", - "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", - "dev": true - }, - "node_modules/regenerate-unicode-properties": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz", - "integrity": "sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==", - "dev": true, - "dependencies": { - "regenerate": "^1.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", - "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", - "dev": true - }, - "node_modules/regenerator-transform": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", - "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.8.4" - } - }, - "node_modules/regexpu-core": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", - "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", - "dev": true, - "dependencies": { - "@babel/regjsgen": "^0.8.0", - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regjsparser": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", - "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", - "dev": true, - "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", - "dev": true, - "dependencies": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha512-Cun9QucwK6MIrp3mry/Y7hqD1oFqTYLQ4pGxaHTjIdaFDWRGGLikqp6u8LcWJnzpoALg9hap+JGk8sFIUuEGNA==", - "dev": true - }, - "node_modules/rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha512-3xPNZGW93oCjiO7PtKxRK6iOVYBWBvtf9QHDfU23Oc+dLIQmAV//UnyXV/yihv81VS/UqoQPk4NegS8EFi55Hg==", - "dev": true, - "dependencies": { - "rx-lite": "*" - } - }, - "node_modules/rxjs": { - "version": "6.6.7", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", - "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", - "dev": true, - "dependencies": { - "tslib": "^1.9.0" - }, - "engines": { - "npm": ">=2.0.0" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "dev": true, - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "node_modules/string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", - "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", - "dev": true, - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/symbol-observable": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz", - "integrity": "sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/thenify": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", - "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", - "dev": true, - "dependencies": { - "any-promise": "^1.0.0" - } - }, - "node_modules/thenify-all": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", - "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", - "dev": true, - "dependencies": { - "thenify": ">= 3.1.0 < 4" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true - }, - "node_modules/timers-ext": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", - "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", - "dev": true, - "dependencies": { - "es5-ext": "~0.10.46", - "next-tick": "1" - } - }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "dev": true - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", - "dev": true - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", - "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", - "dev": true, - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", - "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", - "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", - "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", - "dev": true, - "dependencies": { - "inherits": "2.0.3" - } - }, - "node_modules/util/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", - "dev": true - }, - "node_modules/walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "dev": true, - "dependencies": { - "makeerror": "1.0.12" - } - }, - "node_modules/wasm-ast-types": { - "version": "0.26.2", - "resolved": "https://registry.npmjs.org/wasm-ast-types/-/wasm-ast-types-0.26.2.tgz", - "integrity": "sha512-DM34W0Sexd/BreN4g1ZjfaDC8hkKIw3FykV7vT9KdhCoroH+Qncz+jvSEI0fEDqbtJkWiP9Z+u61a5LPObHKaA==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.18.9", - "@babel/types": "7.18.10", - "@jest/transform": "28.1.3", - "ast-stringify": "0.1.0", - "case": "1.6.3", - "deepmerge": "4.2.2" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "dev": true, - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xstream": { - "version": "11.14.0", - "resolved": "https://registry.npmjs.org/xstream/-/xstream-11.14.0.tgz", - "integrity": "sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw==", - "dependencies": { - "globalthis": "^1.0.1", - "symbol-observable": "^2.0.3" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - } - } -} diff --git a/code/cvm/package.json b/code/cvm/package.json deleted file mode 100644 index c01f56523e4..00000000000 --- a/code/cvm/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "cvm-cw-types", - "version": "0.0.6", - "description": "Composable VM CosmWasm types and client", - "files": [ - "dist/**/*" - ], - "scripts": { - "build-xc-core": "cosmwasm-ts-codegen generate --plugin client --schema ./schema --no-bundle --out dist/cw-xc-core/ --name cw-xc-core && cp --recursive schema/* dist/cw-xc-core/ ", - "build-cw-xc-executor": "cosmwasm-ts-codegen generate --plugin client --schema ./schema --no-bundle --out dist/cw-xc-executor/ --name cw-xc-executor && cp --recursive schema/* dist/cw-xc-executor/", - "build-cw-mantis-order": "cosmwasm-ts-codegen generate --plugin client --schema ./schema --no-bundle --out ./dist/cw-mantis-order --name cw-mantis-order && cp --recursive schema/* dist/cw-mantis-order/", - "cvm": "bun cvm.ts", - "mantis": "bun mantis.ts" - - }, - "type": "module", - "license": "MIT", - "dependencies": { - "@cosmjs/cosmwasm-stargate": "0.31.3", - "cosmjs-types": "0.9.0" - }, - "devDependencies": { - "@cosmwasm/ts-codegen": "0.35.3", - "bun" : "1.0.7" - } -} \ No newline at end of file diff --git a/code/cvm/tsconfig.json b/code/cvm/tsconfig.json deleted file mode 100644 index 345f09eb2f8..00000000000 --- a/code/cvm/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "ES2022", - "moduleResolution": "NodeNext", - "strict": true, - } -} \ No newline at end of file diff --git a/code/parachain/node/src/chain_spec/picasso.rs b/code/parachain/node/src/chain_spec/picasso.rs index 41db1e5663e..52deb2efd0e 100644 --- a/code/parachain/node/src/chain_spec/picasso.rs +++ b/code/parachain/node/src/chain_spec/picasso.rs @@ -27,7 +27,7 @@ pub fn genesis_config( treasury: AccountId, ) -> picasso_runtime::GenesisConfig { let contracts = - [option_env!("CW_XC_GATEWAY_WASM_PATH"), option_env!("CW_XC_EXECUTOR_WASM_PATH")] + [option_env!("CW_CVM_GATEWAY_WASM_PATH"), option_env!("CW_CVM_EXECUTOR_WASM_PATH")] .into_iter() .flatten() .map(|path| match std::fs::read(path).map(|bytes| bytes.try_into()) { diff --git a/code/cvm/examples/centauri-osmo-to-osmosis-to-pica-to-centauri.json b/docs/docs/technology/cvm/centauri-osmo-to-osmosis-to-pica-to-centauri.json similarity index 100% rename from code/cvm/examples/centauri-osmo-to-osmosis-to-pica-to-centauri.json rename to docs/docs/technology/cvm/centauri-osmo-to-osmosis-to-pica-to-centauri.json diff --git a/code/cvm/cosmwasm/README.md b/docs/docs/technology/cvm/cosmos-cosmwasm-internals.md similarity index 100% rename from code/cvm/cosmwasm/README.md rename to docs/docs/technology/cvm/cosmos-cosmwasm-internals.md diff --git a/code/cvm/cvm.ts b/docs/docs/technology/cvm/cvm.ts similarity index 100% rename from code/cvm/cvm.ts rename to docs/docs/technology/cvm/cvm.ts diff --git a/code/cvm/examples/swap-pica-to-osmosis.json b/docs/docs/technology/cvm/swap-pica-to-osmosis.json similarity index 100% rename from code/cvm/examples/swap-pica-to-osmosis.json rename to docs/docs/technology/cvm/swap-pica-to-osmosis.json diff --git a/docs/docs/technology/cvm/tutorial.md b/docs/docs/technology/cvm/tutorial.md index f8780b779dd..bfe72914eed 100644 --- a/docs/docs/technology/cvm/tutorial.md +++ b/docs/docs/technology/cvm/tutorial.md @@ -329,3 +329,9 @@ You can find types and simple client and CosmWasm JSON schemas in https://www.np Example of usage located in https://github.com/ComposableFi/composable/blob/main/code/cvm/cvm.ts . If you are using React, consider generating React `state` and `query` integrations using the CosmWasm client generator from JSON schemas. + +## Tech Talk + +https://discord.com/channels/828751308060098601/1162324949277622333 + +https://discord.com/channels/828751308060098601/1163404253537247283 \ No newline at end of file diff --git a/code/cvm/mantis.ts b/docs/docs/technology/mantis/mantis.ts similarity index 100% rename from code/cvm/mantis.ts rename to docs/docs/technology/mantis/mantis.ts diff --git a/docs/docs/technology/mantis/tutorial.md b/docs/docs/technology/mantis/tutorial.md index c6d680ad98c..3afd179cfb9 100644 --- a/docs/docs/technology/mantis/tutorial.md +++ b/docs/docs/technology/mantis/tutorial.md @@ -60,4 +60,11 @@ Documentation to run solver node is located in https://github.com/ComposableFi/c Solver observer user orders on chain, and find matches, so they can exchange. -If solver does not find match, formulates cross chain route. \ No newline at end of file +If solver does not find match, formulates cross chain route. + + +## Tech Talk + +https://discord.com/channels/828751308060098601/1162324949277622333 + +https://discord.com/channels/828751308060098601/1163404253537247283 \ No newline at end of file diff --git a/flake.lock b/flake.lock index 30726422c50..10c14804d21 100644 --- a/flake.lock +++ b/flake.lock @@ -631,11 +631,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1700697192, - "narHash": "sha256-TqQWWUPpEp6mffnJR/61xoi8zyLbm6aLANYOj0suVXE=", + "lastModified": 1701198507, + "narHash": "sha256-uWM38VA+n4KWJYfMkAsEh/o0wrLaRwoeqGvqiU4S84U=", "owner": "ComposableFi", "repo": "cvm", - "rev": "416d59568b4c188719ae7b1d6b6de3a896a0e56d", + "rev": "eca2c928633c5baceb76d52a901ce5e23f54d299", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 03e78122c47..580c73d511d 100644 --- a/flake.nix +++ b/flake.nix @@ -125,8 +125,6 @@ ./code/runtimes.nix ./code/services/cmc-api/cmc-api.nix ./code/utils/price-feed/price-feed.nix - ./code/cvm/evm/flake-module.nix - ./code/cvm/flake-module.nix ./docs/flake-module.nix ./flake/all.nix ./flake/bash.nix diff --git a/flake/dev-shells.nix b/flake/dev-shells.nix index d569e13702d..ca1f4eb3f8f 100644 --- a/flake/dev-shells.nix +++ b/flake/dev-shells.nix @@ -99,10 +99,12 @@ DIR = "devnet/.centaurid"; BINARY = "centaurid"; NODE = "tcp://localhost:26657"; - EXECUTOR_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; - GATEWAY_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; + EXECUTOR_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; + GATEWAY_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; }; enterShell = '' rm --force --recursive ~/.centauri @@ -128,10 +130,12 @@ DIR = "testnet/.centaurid"; BINARY = "centaurid"; NODE = "https://rpc-t.composable.nodestake.top:443"; - EXECUTOR_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; - GATEWAY_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; + EXECUTOR_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; + GATEWAY_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; }; }]; }; @@ -142,10 +146,12 @@ modules = [{ packages = [ self'.packages.centaurid ]; env = centauri.env.mainnet // { - EXECUTOR_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; - GATEWAY_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; + EXECUTOR_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; + GATEWAY_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; STAKING_WASM_FILE = "${ self.inputs.instrumental.packages."${system}".staking }/lib/staking.wasm"; @@ -172,10 +178,12 @@ modules = [{ packages = [ self'.packages.osmosisd ]; env = osmosis.env.mainnet // { - EXECUTOR_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; - GATEWAY_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; + EXECUTOR_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; + GATEWAY_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; }; enterShell = '' rm ~/.osmosisd/config/client.toml @@ -190,10 +198,12 @@ modules = [{ packages = [ self'.packages.osmosisd ]; env = osmosis.env.testnet // { - EXECUTOR_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; - GATEWAY_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; + EXECUTOR_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; + GATEWAY_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; FEE = "uatom"; }; }]; @@ -205,10 +215,12 @@ modules = [rec { packages = [ self'.packages.osmosisd ]; env = osmosis.env.testnet // { - EXECUTOR_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; - GATEWAY_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; + EXECUTOR_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; + GATEWAY_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; NODE = "tcp://localhost:36657"; FEE = "uatom"; }; @@ -235,10 +247,12 @@ modules = [rec { packages = [ self'.packages.osmosisd ]; env = osmosis.env.remote-devnet // { - EXECUTOR_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm"; - GATEWAY_WASM_FILE = - "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"; + EXECUTOR_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm"; + GATEWAY_WASM_FILE = "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm"; }; enterShell = '' osmosisd set-env localnet diff --git a/flake/osmosis.nix b/flake/osmosis.nix index 0c0ee79a553..3cde696391f 100644 --- a/flake/osmosis.nix +++ b/flake/osmosis.nix @@ -223,11 +223,15 @@ function init_cvm() { local INSTANTIATE=$1 echo $NETWORK_ID - "$BINARY" tx wasm store "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" + "$BINARY" tx wasm store "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" GATEWAY_CODE_ID=1 sleep "$BLOCK_SECONDS" - "$BINARY" tx wasm store "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" + "$BINARY" tx wasm store "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" INTERPRETER_CODE_ID=2 sleep "$BLOCK_SECONDS" diff --git a/flake/release.nix b/flake/release.nix index 7abe808fc5a..f224367e4cc 100644 --- a/flake/release.nix +++ b/flake/release.nix @@ -96,11 +96,6 @@ subwasm-version packages.composable-testfast-runtime }.wasm - - # CVM - cp ${packages.cw-xc-gateway}/lib/cw_xc_gateway.wasm release-artifacts/to-upload/cw_xc_gateway.wasm - cp ${packages.cw-xc-executor}/lib/cw_xc_executor.wasm release-artifacts/to-upload/cw_xc_executor.wasm - echo "Generate node packages" cp ${ make-bundle "toRPM" packages.composable-node @@ -152,7 +147,7 @@ ADDRESS=$("$BINARY" keys show CI_COSMOS_MNEMONIC --keyring-backend test --home .secret/$DIR --output json | jq -r '.address') echo "$ADDRESS" > .secret/$DIR/ADDRESS - INTERPRETER_WASM_FILE="${packages.xc-cw-contracts}/lib/cw_xc_executor.wasm" + INTERPRETER_WASM_FILE="${packages.cw-cvm-executor}/lib/cw_cvm_executor.wasm" INTERPRETER_WASM_CODE_HASH=$(sha256sum "$INTERPRETER_WASM_FILE" | head -c 64) DESCRIPTION=$(cat ${./release-gov-osmosis-proposal-cvm-upload.md}) @@ -166,7 +161,7 @@ --gas 25000000 --gas-prices 0.025$FEE --node "$NODE" --home .secret/$DIR | tee .secret/$DIR/INTERPRETER_PROPOSAL - GATEWAY_WASM_FILE="${packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm" + GATEWAY_WASM_FILE="${packages.cw-cvm-gateway}/lib/cw_cvm_gateway.wasm" GATEWAY_WASM_CODE_HASH=$(sha256sum "$GATEWAY_WASM_FILE" | head -c 64) sleep "$BLOCK_SECONDS" @@ -197,8 +192,8 @@ rm --force --recursive .secret/$DIR mkdir --parents .secret/$DIR - EXECUTOR="${packages.xc-cw-contracts}/lib/cw_xc_executor.wasm" - GATEWAY="${packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm" + EXECUTOR="${packages.cw-cvm-executor}/lib/cw_cvm_executor.wasm" + GATEWAY="${packages.cw-cvm-gateway}/lib/cw_cvm_gateway.wasm" echo "$CI_COSMOS_MNEMONIC" | "$BINARY" keys add CI_COSMOS_MNEMONIC --recover --keyring-backend test --home .secret/$DIR --output json ADDRESS=$("$BINARY" keys show CI_COSMOS_MNEMONIC --keyring-backend test --home .secret/$DIR --output json | jq -r '.address') diff --git a/inputs/notional-labs/composable-centauri/flake-module.nix b/inputs/notional-labs/composable-centauri/flake-module.nix index c13dd497df5..ad9f5ce687e 100644 --- a/inputs/notional-labs/composable-centauri/flake-module.nix +++ b/inputs/notional-labs/composable-centauri/flake-module.nix @@ -48,8 +48,12 @@ }; centaurid-init = pkgs.writeShellApplication { name = "centaurid-init"; - runtimeInputs = devnetTools.withBaseContainerTools - ++ [ centaurid pkgs.jq self'.packages.xc-cw-contracts ]; + runtimeInputs = devnetTools.withBaseContainerTools ++ [ + centaurid + pkgs.jq + self.inputs.cvm.packages."${system}".cw-cvm-executor + self.inputs.cvm.packages."${system}".cw-cvm-gateway + ]; text = '' CHAIN_DATA="${devnet-root-directory}/.centaurid" @@ -76,8 +80,12 @@ centaurid-cvm-init = pkgs.writeShellApplication { name = "centaurid-cvm-init"; - runtimeInputs = devnetTools.withBaseContainerTools - ++ [ centaurid pkgs.jq self'.packages.xc-cw-contracts ]; + runtimeInputs = devnetTools.withBaseContainerTools ++ [ + centaurid + pkgs.jq + self.inputs.cvm.packages."${system}".cw-cvm-executor + self.inputs.cvm.packages."${system}".cw-cvm-gateway + ]; text = '' CHAIN_DATA="${devnet-root-directory}/.centaurid" @@ -93,17 +101,23 @@ function init_cvm() { local INSTANTIATE=$1 - "$BINARY" tx wasm store "${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" + "$BINARY" tx wasm store "${ + self.inputs.cvm.packages."${system}".cw-cvm-gateway + }/lib/cw_cvm_gateway.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" GATEWAY_CODE_ID=1 sleep $BLOCK_SECONDS - "$BINARY" tx wasm store "${self'.packages.xc-cw-contracts}/lib/cw_xc_executor.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" + "$BINARY" tx wasm store "${ + self.inputs.cvm.packages."${system}".cw-cvm-executor + }/lib/cw_cvm_executor.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" sleep $BLOCK_SECONDS "$BINARY" tx wasm store "${self'.packages.cw20_base}" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" sleep $BLOCK_SECONDS - "$BINARY" tx wasm store "${self'.packages.xc-cw-contracts}/lib/cw_mantis_order.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" + "$BINARY" tx wasm store "${ + self.inputs.cvm.packages."${system}".cw-mantis-order + }/lib/cw_mantis_order.wasm" --chain-id="$CHAIN_ID" --node "tcp://localhost:$PORT" --output json --yes --gas 25000000 --fees 920000166$FEE --log_level info --keyring-backend test --home "$CHAIN_DATA" --from "$KEY" --keyring-dir "$KEYRING_TEST" ORDER_CODE_ID=4 sleep $BLOCK_SECONDS @@ -142,8 +156,12 @@ centaurid-cvm-config = pkgs.writeShellApplication { name = "centaurid-cvm-config"; - runtimeInputs = devnetTools.withBaseContainerTools - ++ [ centaurid pkgs.jq self'.packages.xc-cw-contracts ]; + runtimeInputs = devnetTools.withBaseContainerTools ++ [ + centaurid + pkgs.jq + self.inputs.cvm.packages."${system}".cw-cvm-executor + self.inputs.cvm.packages."${system}".cw-cvm-gateway + ]; text = '' @@ -555,8 +573,12 @@ centauri-exec = pkgs.writeShellApplication { name = "centaurid-cvm-config"; - runtimeInputs = devnetTools.withBaseContainerTools - ++ [ centaurid pkgs.jq self'.packages.xc-cw-contracts ]; + runtimeInputs = devnetTools.withBaseContainerTools ++ [ + centaurid + pkgs.jq + self.inputs.cvm.packages."${system}".cw-cvm-executor + self.inputs.cvm.packages."${system}".cw-cvm-gateway + ]; text = '' CHAIN_DATA="${devnet-root-directory}/.centaurid"