diff --git a/contracts/icp/context-config/.cargo/config.toml b/contracts/icp/context-config/.cargo/config.toml deleted file mode 100644 index a6b014e95..000000000 --- a/contracts/icp/context-config/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target-dir = "target" diff --git a/contracts/icp/context-config/src/error.rs b/contracts/icp/context-config/src/error.rs deleted file mode 100644 index 42e5f2a9d..000000000 --- a/contracts/icp/context-config/src/error.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::fmt; -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum ContractError { - #[error("Unauthorized access")] - Unauthorized, - - #[error("Context not found")] - ContextNotFound, - - #[error("Context already exists")] - ContextExists, - - #[error("Request expired")] - RequestExpired, - - #[error("Invalid signature")] - InvalidSignature, - - #[error("Proxy code not set")] - ProxyCodeNotSet, - - #[error("Proxy update failed: {0}")] - ProxyUpdateFailed(String), - - #[error("Internal error: {0}")] - Internal(String), -} - -impl From for String { - fn from(error: ContractError) -> Self { - error.to_string() - } -} \ No newline at end of file diff --git a/contracts/icp/proxy-contract/.cargo/config.toml b/contracts/icp/proxy-contract/.cargo/config.toml deleted file mode 100644 index a6b014e95..000000000 --- a/contracts/icp/proxy-contract/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target-dir = "target" diff --git a/contracts/icp/proxy-contract/build_mock_contracts.sh b/contracts/icp/proxy-contract/build_mock_contracts.sh deleted file mode 100755 index 3fa07632d..000000000 --- a/contracts/icp/proxy-contract/build_mock_contracts.sh +++ /dev/null @@ -1,10 +0,0 @@ -cd "mock/ledger" -cargo build --target wasm32-unknown-unknown --release -candid-extractor target/wasm32-unknown-unknown/release/mock_ledger.wasm > mock_ledger.did - -cd ../.. - -cd "mock/external" -cargo build --target wasm32-unknown-unknown --release -candid-extractor target/wasm32-unknown-unknown/release/mock_external.wasm > mock_external.did - diff --git a/contracts/icp/proxy-contract/mock/.gitignore b/contracts/icp/proxy-contract/mock/.gitignore deleted file mode 100644 index 549ebc6b8..000000000 --- a/contracts/icp/proxy-contract/mock/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -# Various IDEs and Editors -.vscode/ -.idea/ -**/*~ - -# Mac OSX temporary files -.DS_Store -**/.DS_Store - -# dfx temporary files -.dfx/ - -# generated files -**/target/ - -# rust -target/ - -# frontend code -node_modules/ -dist/ -.svelte-kit/ - diff --git a/contracts/icp/proxy-contract/mock/Cargo.lock b/contracts/icp/proxy-contract/mock/Cargo.lock deleted file mode 100644 index c4d9f75f2..000000000 --- a/contracts/icp/proxy-contract/mock/Cargo.lock +++ /dev/null @@ -1,553 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "anyhow" -version = "1.0.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "binread" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16598dfc8e6578e9b597d9910ba2e73618385dc9f4b1d43dd92c349d6be6418f" -dependencies = [ - "binread_derive", - "lazy_static", - "rustversion", -] - -[[package]] -name = "binread_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d9672209df1714ee804b1f4d4f68c8eb2a90b1f7a07acf472f88ce198ef1fed" -dependencies = [ - "either", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "candid" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c30ee7f886f296b6422c0ff017e89dd4f831521dfdcc76f3f71aae1ce817222" -dependencies = [ - "anyhow", - "binread", - "byteorder", - "candid_derive", - "hex", - "ic_principal", - "leb128", - "num-bigint", - "num-traits", - "paste", - "pretty", - "serde", - "serde_bytes", - "stacker", - "thiserror", -] - -[[package]] -name = "candid_derive" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3de398570c386726e7a59d9887b68763c481477f9a043fb998a2e09d428df1a9" -dependencies = [ - "lazy_static", - "proc-macro2", - "quote", - "syn 2.0.89", -] - -[[package]] -name = "cc" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cpufeatures" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "ic-cdk" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8ecacd682fa05a985253592963306cb9799622d7b1cce4b1edb89c6ec85be1" -dependencies = [ - "candid", - "ic-cdk-macros", - "ic0", - "serde", - "serde_bytes", -] - -[[package]] -name = "ic-cdk-macros" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4d857135deef20cc7ea8f3869a30cd9cfeb1392b3a81043790b2cd82adc3e0" -dependencies = [ - "candid", - "proc-macro2", - "quote", - "serde", - "serde_tokenstream", - "syn 2.0.89", -] - -[[package]] -name = "ic0" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de254dd67bbd58073e23dc1c8553ba12fa1dc610a19de94ad2bbcd0460c067f" - -[[package]] -name = "ic_principal" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1762deb6f7c8d8c2bdee4b6c5a47b60195b74e9b5280faa5ba29692f8e17429c" -dependencies = [ - "crc32fast", - "data-encoding", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "libc" -version = "0.2.167" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" - -[[package]] -name = "mock_external" -version = "0.1.0" -dependencies = [ - "candid", - "ic-cdk", - "ic-cdk-macros", -] - -[[package]] -name = "mock_ledger" -version = "0.1.0" -dependencies = [ - "candid", - "ic-cdk", - "ic-cdk-macros", - "serde", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", - "serde", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pretty" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55c4d17d994b637e2f4daf6e5dc5d660d209d5642377d675d7a1c3ab69fa579" -dependencies = [ - "arrayvec", - "typed-arena", - "unicode-width", -] - -[[package]] -name = "proc-macro2" -version = "1.0.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "psm" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" -dependencies = [ - "cc", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustversion" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" - -[[package]] -name = "serde" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - -[[package]] -name = "serde_tokenstream" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64060d864397305347a78851c51588fd283767e7e7589829e8121d65512340f1" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 2.0.89", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "stacker" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" -dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "windows-sys", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - -[[package]] -name = "typed-arena" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/contracts/icp/proxy-contract/mock/Cargo.toml b/contracts/icp/proxy-contract/mock/Cargo.toml deleted file mode 100644 index 9baa199d1..000000000 --- a/contracts/icp/proxy-contract/mock/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[workspace] -members = [ - "ledger", - "external" -] -resolver = "2" diff --git a/contracts/icp/proxy-contract/mock/dfx.json b/contracts/icp/proxy-contract/mock/dfx.json deleted file mode 100644 index 7b9eb80b8..000000000 --- a/contracts/icp/proxy-contract/mock/dfx.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "canisters": { - "mock_ledger": { - "type": "rust", - "package": "mock_ledger", - "candid": "ledger/ledger.did", - "path": "ledger" - }, - "mock_external": { - "type": "rust", - "package": "mock_external", - "candid": "external/external.did", - "path": "external" - } - }, - "defaults": { - "build": { - "packtool": "", - "args": "" - } - }, - "version": 1 -} \ No newline at end of file diff --git a/contracts/icp/proxy-contract/mock/external/.cargo/config.toml b/contracts/icp/proxy-contract/mock/external/.cargo/config.toml deleted file mode 100644 index a6b014e95..000000000 --- a/contracts/icp/proxy-contract/mock/external/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target-dir = "target" diff --git a/contracts/icp/proxy-contract/mock/external/Cargo.toml b/contracts/icp/proxy-contract/mock/external/Cargo.toml deleted file mode 100644 index 4b14dd556..000000000 --- a/contracts/icp/proxy-contract/mock/external/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "mock_external" -version = "0.1.0" -edition = "2021" - -[lib] -crate-type = ["cdylib"] - -[dependencies] -candid = "0.10" -ic-cdk = "0.16" -ic-cdk-macros = "0.16" \ No newline at end of file diff --git a/contracts/icp/proxy-contract/mock/external/build.sh b/contracts/icp/proxy-contract/mock/external/build.sh deleted file mode 100755 index cbf636c21..000000000 --- a/contracts/icp/proxy-contract/mock/external/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -e - -cd "$(dirname $0)" - -TARGET="${CARGO_TARGET_DIR:-../../../../../target}" - -rustup target add wasm32-unknown-unknown - -cargo build --target wasm32-unknown-unknown --profile app-release - -mkdir -p res - -cp $TARGET/wasm32-unknown-unknown/app-release/mock_external.wasm ./res/ - -if command -v wasm-opt > /dev/null; then - wasm-opt -Oz ./res/mock_external.wasm -o ./res/mock_external.wasm -fi \ No newline at end of file diff --git a/contracts/icp/proxy-contract/mock/external/mock_external.did b/contracts/icp/proxy-contract/mock/external/mock_external.did deleted file mode 100644 index 608f976b7..000000000 --- a/contracts/icp/proxy-contract/mock/external/mock_external.did +++ /dev/null @@ -1 +0,0 @@ -service : { get_calls : () -> (vec blob) query; test_method : (blob) -> () } diff --git a/contracts/icp/proxy-contract/mock/external/src/lib.rs b/contracts/icp/proxy-contract/mock/external/src/lib.rs deleted file mode 100644 index ca10b9152..000000000 --- a/contracts/icp/proxy-contract/mock/external/src/lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -use std::cell::RefCell; - -thread_local! { - static CALLS: RefCell>> = RefCell::new(Vec::new()); -} - -#[ic_cdk::update] -fn test_method(args: Vec) -> Vec { - CALLS.with(|calls| { - calls.borrow_mut().push(args.clone()); - args // Return the same args back - }) -} - -#[ic_cdk::query] -fn get_calls() -> Vec> { - CALLS.with(|calls| calls.borrow().clone()) -} - -ic_cdk::export_candid!(); diff --git a/contracts/icp/proxy-contract/mock/ledger/.cargo/config.toml b/contracts/icp/proxy-contract/mock/ledger/.cargo/config.toml deleted file mode 100644 index a6b014e95..000000000 --- a/contracts/icp/proxy-contract/mock/ledger/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target-dir = "target" diff --git a/contracts/icp/proxy-contract/mock/ledger/Cargo.toml b/contracts/icp/proxy-contract/mock/ledger/Cargo.toml deleted file mode 100644 index 3736d2fff..000000000 --- a/contracts/icp/proxy-contract/mock/ledger/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "mock_ledger" -version = "0.1.0" -edition = "2021" - -[lib] -crate-type = ["cdylib"] - -[dependencies] -candid = "0.10" -serde = { version = "1.0", features = ["derive"] } -ic-cdk = "0.16" -ic-cdk-macros = "0.16" -ic-ledger-types = "0.14.0" diff --git a/contracts/icp/proxy-contract/mock/ledger/build.sh b/contracts/icp/proxy-contract/mock/ledger/build.sh deleted file mode 100755 index d5e056364..000000000 --- a/contracts/icp/proxy-contract/mock/ledger/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -e - -cd "$(dirname $0)" - -TARGET="${CARGO_TARGET_DIR:-../../../../../target}" - -rustup target add wasm32-unknown-unknown - -cargo build --target wasm32-unknown-unknown --profile app-release - -mkdir -p res - -cp $TARGET/wasm32-unknown-unknown/app-release/mock_ledger.wasm ./res/ - -if command -v wasm-opt > /dev/null; then - wasm-opt -Oz ./res/mock_ledger.wasm -o ./res/mock_ledger.wasm -fi diff --git a/contracts/icp/proxy-contract/mock/ledger/mock_ledger.did b/contracts/icp/proxy-contract/mock/ledger/mock_ledger.did deleted file mode 100644 index 20313456b..000000000 --- a/contracts/icp/proxy-contract/mock/ledger/mock_ledger.did +++ /dev/null @@ -1 +0,0 @@ -service : { balance : () -> (nat) query; transfer : (blob) -> () } diff --git a/contracts/icp/proxy-contract/mock/ledger/src/lib.rs b/contracts/icp/proxy-contract/mock/ledger/src/lib.rs deleted file mode 100644 index ca175156e..000000000 --- a/contracts/icp/proxy-contract/mock/ledger/src/lib.rs +++ /dev/null @@ -1,60 +0,0 @@ -use std::cell::RefCell; - -use candid::{CandidType, Deserialize}; -use ic_ledger_types::{AccountIdentifier, BlockIndex, Tokens, TransferArgs, TransferError}; - -thread_local! { - static BALANCE: RefCell = RefCell::new(1_000_000_000); -} - -type TransferResult = Result; - -#[ic_cdk::update] -fn transfer(args: TransferArgs) -> TransferResult { - ic_cdk::println!( - "Mock ledger received transfer: to={:?}, amount={}", - args.to, - args.amount - ); - - // Verify fee - if args.fee.e8s() != 10_000 { - return Err(TransferError::BadFee { - expected_fee: Tokens::from_e8s(10_000), - }); - } - - let amount_e8s = args.amount.e8s(); - - BALANCE.with(|balance| { - let mut bal = balance.borrow_mut(); - - // Check if we have enough balance - if amount_e8s > *bal { - return Err(TransferError::InsufficientFunds { - balance: Tokens::from_e8s(*bal), - }); - } - - // Subtract amount and fee - *bal = bal.saturating_sub(amount_e8s); - *bal = bal.saturating_sub(args.fee.e8s()); - - ic_cdk::println!("New balance: {}", *bal); - - // Return mock block index - Ok(1) - }) -} - -#[ic_cdk::query] -fn account_balance(args: AccountBalanceArgs) -> Tokens { - BALANCE.with(|balance| Tokens::from_e8s(*balance.borrow())) -} - -#[derive(CandidType, Deserialize)] -struct AccountBalanceArgs { - account: AccountIdentifier, -} - -ic_cdk::export_candid!();