From b2d80b60602f0aaba850dbadb6cde91837020404 Mon Sep 17 00:00:00 2001 From: Vadim Fadeev Date: Tue, 8 Oct 2024 15:23:32 +0100 Subject: [PATCH 1/4] feat: add new platform fee admin --- Anchor.toml | 6 +++--- package.json | 8 +++++++- programs/libreplex_editions/src/lib.rs | 2 +- programs/libreplex_editions_controls/src/lib.rs | 2 +- programs/libreplex_editions_controls/src/state.rs | 2 +- target/types/libreplex_editions_controls.ts | 10 +++++----- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Anchor.toml b/Anchor.toml index 4cb9714..e24bc5a 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -8,8 +8,8 @@ skip-lint = false libreplex_creator = "78deTr7qycJ6498vSd3pNMhdCKKWxMipniitVHQcM8RM" libreplex_creator_controls = "G9whLiLT9nSkxwWzWvbiKKrTL6yWxvzh2UXqNht5VXqV" libreplex_default_renderer = "EfC2horkE4hCaCruMvoDDWxUhcCgVaufHeG3Hkj69eR8" -libreplex_editions = "6hRLBM1rexUvd64qaBHQJUz4ufRAFbXZXM12ExWd7kYX" -libreplex_editions_controls = "Ady6poZ59kW6rvbad3hiQpf8vun58RzHtNQ5Zvh7aJk3" +libreplex_editions = "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq" +libreplex_editions_controls = "4NY3NbtXX4bEL2KZCbDjmvwB9R2B29A2fGUKCrCXui7U" libreplex_inscriptions = "GAc6iGWe4D8ZDT3xqJXysn3wfARrpz9eLUC1jquvd3Q1" libreplex_legacy_inscribers = "Leg1xVbrpq5gY6mprak3Ud4q4mBwcJi5C9ZruYjWv7n" libreplex_metadata = "LibrQsXf9V1DmTtJLkEghoaF1kjJcAzWiEGoJn8mz7p" @@ -22,7 +22,7 @@ url = "https://api.apr.dev" [provider] cluster = "Localnet" -wallet = "~/.config/solana/id.json" +wallet = "usb://ledger" [scripts] test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 js-tests/**/*.ts" diff --git a/package.json b/package.json index 10aeb93..1409c8b 100644 --- a/package.json +++ b/package.json @@ -41,13 +41,19 @@ "libreplex_editions:deploy:solana-dev-net": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://api.devnet.solana.com --provider.wallet ~/.config/solana/id.json", "libreplex_editions_controls:solana-dev-net": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://api.devnet.solana.com --provider.wallet ~/.config/solana/id.json", + "transfer-program-owner:solana-dev-net": "solana program set-upgrade-authority --skip-new-upgrade-authority-signer-check 6g8ZaBxx2tng8EhVqvaad948Vht9YFJFGG5gvAejrJj9 --new-upgrade-authority 674s1Sap3KVnr8WGrY5KGQ69oTYjjgr1disKJo6GpTYw -k ~/.config/solana/id.json -u https://api.devnet.solana.com", + "transfer-program-owner-back:solana-dev-net": "solana program set-upgrade-authority --skip-new-upgrade-authority-signer-check 6g8ZaBxx2tng8EhVqvaad948Vht9YFJFGG5gvAejrJj9 --new-upgrade-authority QjzRL6VwKGnpco8wx3cPjtq8ZPhewy7ohq7F5mv2eeR -k usb://ledger -u https://api.devnet.solana.com", + "libreplex_editions:deploy:solana-test-net": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://api.testnet.solana.com --provider.wallet ~/.config/solana/id.json", "libreplex_editions_controls:solana-test-net": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://api.testnet.solana.com --provider.wallet ~/.config/solana/id.json", "libreplex_editions:deploy:eclipse-testnet": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://testnet.dev2.eclipsenetwork.xyz --provider.wallet ~/.config/solana/id.json", "libreplex_editions_controls:deploy:eclipse-testnet": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://testnet.dev2.eclipsenetwork.xyz --provider.wallet ~/.config/solana/id.json", - "lint": "next lint" + "lint": "next lint", + + "libreplex_editions:deploy:ledger:solana-dev-net": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://api.devnet.solana.com --provider.wallet usb://ledger", + "libreplex_editions_controls:deploy:ledger:solana-dev-net": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://api.devnet.solana.com --provider.wallet usb://ledger" }, "dependencies": { "@coral-xyz/anchor": "0.30.0", diff --git a/programs/libreplex_editions/src/lib.rs b/programs/libreplex_editions/src/lib.rs index 928ac08..aff9278 100644 --- a/programs/libreplex_editions/src/lib.rs +++ b/programs/libreplex_editions/src/lib.rs @@ -2,7 +2,7 @@ use anchor_lang::prelude::*; pub mod instructions; pub use instructions::*; -declare_id!("6hRLBM1rexUvd64qaBHQJUz4ufRAFbXZXM12ExWd7kYX"); +declare_id!("587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq"); pub mod errors; pub mod state; diff --git a/programs/libreplex_editions_controls/src/lib.rs b/programs/libreplex_editions_controls/src/lib.rs index d2d3112..4ce7622 100644 --- a/programs/libreplex_editions_controls/src/lib.rs +++ b/programs/libreplex_editions_controls/src/lib.rs @@ -5,7 +5,7 @@ pub use logic::*; pub mod instructions; pub use instructions::*; -declare_id!("Ady6poZ59kW6rvbad3hiQpf8vun58RzHtNQ5Zvh7aJk3"); +declare_id!("4NY3NbtXX4bEL2KZCbDjmvwB9R2B29A2fGUKCrCXui7U"); pub mod errors; pub mod state; diff --git a/programs/libreplex_editions_controls/src/state.rs b/programs/libreplex_editions_controls/src/state.rs index a7b1f22..5fd11fb 100644 --- a/programs/libreplex_editions_controls/src/state.rs +++ b/programs/libreplex_editions_controls/src/state.rs @@ -45,7 +45,7 @@ impl Phase { } pub const DEFAULT_PLATFORM_FEE_PRIMARY_ADMIN: &str = "674s1Sap3KVnr8WGrY5KGQ69oTYjjgr1disKJo6GpTYw"; -pub const DEFAULT_PLATFORM_FEE_SECONDARY_ADMIN: &str = "QjzRL6VwKGnpco8wx3cPjtq8ZPhewy7ohq7F5mv2eeR"; +pub const DEFAULT_PLATFORM_FEE_SECONDARY_ADMIN: &str = "9qGioKcyuh1mwXS8MbmMgdtQuBcVS6MBRtvQUas5rMGz"; #[account] pub struct MinterStats { diff --git a/target/types/libreplex_editions_controls.ts b/target/types/libreplex_editions_controls.ts index c5c134e..796e8cb 100644 --- a/target/types/libreplex_editions_controls.ts +++ b/target/types/libreplex_editions_controls.ts @@ -5,7 +5,7 @@ * IDL can be found at `target/idl/libreplex_editions_controls.json`. */ export type LibreplexEditionsControls = { - "address": "Ady6poZ59kW6rvbad3hiQpf8vun58RzHtNQ5Zvh7aJk3", + "address": "6g8ZaBxx2tng8EhVqvaad948Vht9YFJFGG5gvAejrJj9", "metadata": { "name": "libreplexEditionsControls", "version": "0.2.1", @@ -51,7 +51,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6hRLBM1rexUvd64qaBHQJUz4ufRAFbXZXM12ExWd7kYX" + "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" } ], "args": [ @@ -152,7 +152,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6hRLBM1rexUvd64qaBHQJUz4ufRAFbXZXM12ExWd7kYX" + "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" } ], "args": [ @@ -365,7 +365,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6hRLBM1rexUvd64qaBHQJUz4ufRAFbXZXM12ExWd7kYX" + "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" } ], "args": [ @@ -595,7 +595,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6hRLBM1rexUvd64qaBHQJUz4ufRAFbXZXM12ExWd7kYX" + "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" } ], "args": [ From 5dae5d0d07d9ca982dc77af03b4650baacae84e5 Mon Sep 17 00:00:00 2001 From: Vadim Fadeev Date: Tue, 8 Oct 2024 23:43:23 +0100 Subject: [PATCH 2/4] feat: prod deploy --- package.json | 17 ++++++++++++----- target/types/libreplex_editions_controls.ts | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 1409c8b..3de4835 100644 --- a/package.json +++ b/package.json @@ -45,15 +45,22 @@ "transfer-program-owner-back:solana-dev-net": "solana program set-upgrade-authority --skip-new-upgrade-authority-signer-check 6g8ZaBxx2tng8EhVqvaad948Vht9YFJFGG5gvAejrJj9 --new-upgrade-authority QjzRL6VwKGnpco8wx3cPjtq8ZPhewy7ohq7F5mv2eeR -k usb://ledger -u https://api.devnet.solana.com", - "libreplex_editions:deploy:solana-test-net": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://api.testnet.solana.com --provider.wallet ~/.config/solana/id.json", - "libreplex_editions_controls:solana-test-net": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://api.testnet.solana.com --provider.wallet ~/.config/solana/id.json", + "libreplex_editions:deploy:solana-test-net": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://api.testnet.solana.com --provider.wallet ~/.config/solana/prod-keypair.json", + "libreplex_editions_controls:solana-test-net": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://api.testnet.solana.com --provider.wallet ~/.config/solana/prod-keypair.json", - "libreplex_editions:deploy:eclipse-testnet": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://testnet.dev2.eclipsenetwork.xyz --provider.wallet ~/.config/solana/id.json", - "libreplex_editions_controls:deploy:eclipse-testnet": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://testnet.dev2.eclipsenetwork.xyz --provider.wallet ~/.config/solana/id.json", + "libreplex_editions:deploy:eclipse-testnet": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://testnet.dev2.eclipsenetwork.xyz --provider.wallet ~/.config/solana/prod-keypair.json", + "libreplex_editions_controls:deploy:eclipse-testnet": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://testnet.dev2.eclipsenetwork.xyz --provider.wallet ~/.config/solana/prod-keypair.json", "lint": "next lint", "libreplex_editions:deploy:ledger:solana-dev-net": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://api.devnet.solana.com --provider.wallet usb://ledger", - "libreplex_editions_controls:deploy:ledger:solana-dev-net": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://api.devnet.solana.com --provider.wallet usb://ledger" + "libreplex_editions_controls:deploy:ledger:solana-dev-net": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://api.devnet.solana.com --provider.wallet usb://ledger", + + "libreplex_editions:deploy:hot:eclispe-mainnet": "anchor build -p libreplex_editions && anchor deploy -p libreplex_editions --provider.cluster https://mainnetbeta-rpc.eclipse.xyz --provider.wallet ~/.config/solana/prod-keypair.json", + "libreplex_editions:deploy:hot:cli:eclispe-mainnet": "solana program deploy target/deploy/libreplex_editions.so --program-id target/deploy/libreplex_editions-keypair.json --url https://mainnetbeta-rpc.eclipse.xyz", + + "libreplex_editions_controls:deploy:hot:eclispe-mainnet": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://mainnetbeta-rpc.eclipse.xyz --provider.wallet ~/.config/solana/prod-keypair.json", + "transfer-program-owner:eclipse-main-net": "solana program set-upgrade-authority --skip-new-upgrade-authority-signer-check 587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq --new-upgrade-authority 674s1Sap3KVnr8WGrY5KGQ69oTYjjgr1disKJo6GpTYw -k ~/.config/solana/prod-keypair.json -u https://mainnetbeta-rpc.eclipse.xyz", + "libreplex_editions_controls:deploy:hot:cli:eclispe-mainnet": "solana program deploy target/deploy/libreplex_editions_controls.so --program-id target/deploy/libreplex_editions_controls-keypair.json --url https://mainnetbeta-rpc.eclipse.xyz" }, "dependencies": { "@coral-xyz/anchor": "0.30.0", diff --git a/target/types/libreplex_editions_controls.ts b/target/types/libreplex_editions_controls.ts index 796e8cb..ffef33d 100644 --- a/target/types/libreplex_editions_controls.ts +++ b/target/types/libreplex_editions_controls.ts @@ -5,7 +5,7 @@ * IDL can be found at `target/idl/libreplex_editions_controls.json`. */ export type LibreplexEditionsControls = { - "address": "6g8ZaBxx2tng8EhVqvaad948Vht9YFJFGG5gvAejrJj9", + "address": "4NY3NbtXX4bEL2KZCbDjmvwB9R2B29A2fGUKCrCXui7U", "metadata": { "name": "libreplexEditionsControls", "version": "0.2.1", @@ -51,7 +51,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" + "address": "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq" } ], "args": [ @@ -152,7 +152,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" + "address": "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq" } ], "args": [ @@ -365,7 +365,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" + "address": "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq" } ], "args": [ @@ -595,7 +595,7 @@ export type LibreplexEditionsControls = { }, { "name": "libreplexEditionsProgram", - "address": "6Hn7mcPGdx4ABchSuqt8TWAfmhpkFk2VRS115ouz16oQ" + "address": "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq" } ], "args": [ From 25b1199ce8f1264947885fc112a0b1d07bfc3ff1 Mon Sep 17 00:00:00 2001 From: Vadim Fadeev Date: Wed, 9 Oct 2024 21:33:18 +0100 Subject: [PATCH 3/4] feat: add new deploy --- Anchor.toml | 2 +- package.json | 2 +- programs/libreplex_editions_controls/src/lib.rs | 2 +- target/types/libreplex_editions.ts | 2 +- target/types/libreplex_editions_controls.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Anchor.toml b/Anchor.toml index e24bc5a..df40e4d 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -9,7 +9,7 @@ libreplex_creator = "78deTr7qycJ6498vSd3pNMhdCKKWxMipniitVHQcM8RM" libreplex_creator_controls = "G9whLiLT9nSkxwWzWvbiKKrTL6yWxvzh2UXqNht5VXqV" libreplex_default_renderer = "EfC2horkE4hCaCruMvoDDWxUhcCgVaufHeG3Hkj69eR8" libreplex_editions = "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq" -libreplex_editions_controls = "4NY3NbtXX4bEL2KZCbDjmvwB9R2B29A2fGUKCrCXui7U" +libreplex_editions_controls = "5hEa5j38yNJRM9vQA44Q6gXVj4Db8y3mWxkDtQeofKKs" libreplex_inscriptions = "GAc6iGWe4D8ZDT3xqJXysn3wfARrpz9eLUC1jquvd3Q1" libreplex_legacy_inscribers = "Leg1xVbrpq5gY6mprak3Ud4q4mBwcJi5C9ZruYjWv7n" libreplex_metadata = "LibrQsXf9V1DmTtJLkEghoaF1kjJcAzWiEGoJn8mz7p" diff --git a/package.json b/package.json index 3de4835..5753d19 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "libreplex_editions:deploy:hot:cli:eclispe-mainnet": "solana program deploy target/deploy/libreplex_editions.so --program-id target/deploy/libreplex_editions-keypair.json --url https://mainnetbeta-rpc.eclipse.xyz", "libreplex_editions_controls:deploy:hot:eclispe-mainnet": "anchor build -p libreplex_editions_controls && anchor deploy -p libreplex_editions_controls --provider.cluster https://mainnetbeta-rpc.eclipse.xyz --provider.wallet ~/.config/solana/prod-keypair.json", - "transfer-program-owner:eclipse-main-net": "solana program set-upgrade-authority --skip-new-upgrade-authority-signer-check 587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq --new-upgrade-authority 674s1Sap3KVnr8WGrY5KGQ69oTYjjgr1disKJo6GpTYw -k ~/.config/solana/prod-keypair.json -u https://mainnetbeta-rpc.eclipse.xyz", + "transfer-program-owner:eclipse-main-net": "solana program set-upgrade-authority --skip-new-upgrade-authority-signer-check 5hEa5j38yNJRM9vQA44Q6gXVj4Db8y3mWxkDtQeofKKs --new-upgrade-authority 674s1Sap3KVnr8WGrY5KGQ69oTYjjgr1disKJo6GpTYw -k ~/.config/solana/prod-keypair.json -u https://mainnetbeta-rpc.eclipse.xyz", "libreplex_editions_controls:deploy:hot:cli:eclispe-mainnet": "solana program deploy target/deploy/libreplex_editions_controls.so --program-id target/deploy/libreplex_editions_controls-keypair.json --url https://mainnetbeta-rpc.eclipse.xyz" }, "dependencies": { diff --git a/programs/libreplex_editions_controls/src/lib.rs b/programs/libreplex_editions_controls/src/lib.rs index 4ce7622..584e083 100644 --- a/programs/libreplex_editions_controls/src/lib.rs +++ b/programs/libreplex_editions_controls/src/lib.rs @@ -5,7 +5,7 @@ pub use logic::*; pub mod instructions; pub use instructions::*; -declare_id!("4NY3NbtXX4bEL2KZCbDjmvwB9R2B29A2fGUKCrCXui7U"); +declare_id!("5hEa5j38yNJRM9vQA44Q6gXVj4Db8y3mWxkDtQeofKKs"); pub mod errors; pub mod state; diff --git a/target/types/libreplex_editions.ts b/target/types/libreplex_editions.ts index 0b51055..da4a37b 100644 --- a/target/types/libreplex_editions.ts +++ b/target/types/libreplex_editions.ts @@ -5,7 +5,7 @@ * IDL can be found at `target/idl/libreplex_editions.json`. */ export type LibreplexEditions = { - "address": "5hx15GaPPqsYA61v6QpcGPpo125v7rfvEfZQ4dJErG5V", + "address": "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq", "metadata": { "name": "libreplexEditions", "version": "0.2.1", diff --git a/target/types/libreplex_editions_controls.ts b/target/types/libreplex_editions_controls.ts index ffef33d..f2519fa 100644 --- a/target/types/libreplex_editions_controls.ts +++ b/target/types/libreplex_editions_controls.ts @@ -5,7 +5,7 @@ * IDL can be found at `target/idl/libreplex_editions_controls.json`. */ export type LibreplexEditionsControls = { - "address": "4NY3NbtXX4bEL2KZCbDjmvwB9R2B29A2fGUKCrCXui7U", + "address": "5hEa5j38yNJRM9vQA44Q6gXVj4Db8y3mWxkDtQeofKKs", "metadata": { "name": "libreplexEditionsControls", "version": "0.2.1", From c7cc1b7fecf07084bcc946d9cf133839dfd4bd81 Mon Sep 17 00:00:00 2001 From: Vadim Fadeev Date: Wed, 9 Oct 2024 22:06:22 +0100 Subject: [PATCH 4/4] feat: remove unused --- Anchor.toml | 9 - Cargo.lock | 44 ---- .../libreplex_default_renderer/Cargo.toml | 31 --- .../libreplex_default_renderer/Xargo.toml | 2 - programs/libreplex_default_renderer/c.bmp | Bin 251 -> 0 bytes .../src/instructions/canonical.rs | 56 ------ .../src/instructions/input.rs | 27 --- .../src/instructions/mod.rs | 5 - .../libreplex_default_renderer/src/lib.rs | 32 --- .../libreplex_monoswap_deprecated/Cargo.toml | 33 --- .../libreplex_monoswap_deprecated/Xargo.toml | 2 - .../src/constants.rs | 16 -- .../src/errors.rs | 36 ---- .../src/instructions/create_monoswap.rs | 131 ------------ .../src/instructions/mod.rs | 7 - .../src/instructions/swap.rs | 189 ------------------ .../libreplex_monoswap_deprecated/src/lib.rs | 33 --- .../src/state/mod.rs | 3 - .../src/state/swap_marker.rs | 29 --- target/types/libreplex_editions.ts | 2 +- 20 files changed, 1 insertion(+), 686 deletions(-) delete mode 100644 programs/libreplex_default_renderer/Cargo.toml delete mode 100644 programs/libreplex_default_renderer/Xargo.toml delete mode 100644 programs/libreplex_default_renderer/c.bmp delete mode 100644 programs/libreplex_default_renderer/src/instructions/canonical.rs delete mode 100644 programs/libreplex_default_renderer/src/instructions/input.rs delete mode 100644 programs/libreplex_default_renderer/src/instructions/mod.rs delete mode 100644 programs/libreplex_default_renderer/src/lib.rs delete mode 100644 programs/libreplex_monoswap_deprecated/Cargo.toml delete mode 100644 programs/libreplex_monoswap_deprecated/Xargo.toml delete mode 100644 programs/libreplex_monoswap_deprecated/src/constants.rs delete mode 100644 programs/libreplex_monoswap_deprecated/src/errors.rs delete mode 100644 programs/libreplex_monoswap_deprecated/src/instructions/create_monoswap.rs delete mode 100644 programs/libreplex_monoswap_deprecated/src/instructions/mod.rs delete mode 100644 programs/libreplex_monoswap_deprecated/src/instructions/swap.rs delete mode 100644 programs/libreplex_monoswap_deprecated/src/lib.rs delete mode 100644 programs/libreplex_monoswap_deprecated/src/state/mod.rs delete mode 100644 programs/libreplex_monoswap_deprecated/src/state/swap_marker.rs diff --git a/Anchor.toml b/Anchor.toml index df40e4d..056f795 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -5,17 +5,8 @@ resolution = true skip-lint = false [programs.localnet] -libreplex_creator = "78deTr7qycJ6498vSd3pNMhdCKKWxMipniitVHQcM8RM" -libreplex_creator_controls = "G9whLiLT9nSkxwWzWvbiKKrTL6yWxvzh2UXqNht5VXqV" -libreplex_default_renderer = "EfC2horkE4hCaCruMvoDDWxUhcCgVaufHeG3Hkj69eR8" libreplex_editions = "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq" libreplex_editions_controls = "5hEa5j38yNJRM9vQA44Q6gXVj4Db8y3mWxkDtQeofKKs" -libreplex_inscriptions = "GAc6iGWe4D8ZDT3xqJXysn3wfARrpz9eLUC1jquvd3Q1" -libreplex_legacy_inscribers = "Leg1xVbrpq5gY6mprak3Ud4q4mBwcJi5C9ZruYjWv7n" -libreplex_metadata = "LibrQsXf9V1DmTtJLkEghoaF1kjJcAzWiEGoJn8mz7p" -libreplex_monoswap_deprecated = "8Ktjj9tddWm4QM1ywrxgNRyxkNHnhBCwr9Tq3iGbPDxc" -libreplex_nft = "3oR36M1JQ9LHM1xykKTHDvhuYVM5mDAqRmq989zc1Pzi" -libreplex_shop = "ListjawGEdhxuAErSyYwcTEGWQswFoi6FScnGG1RKSB" [registry] url = "https://api.apr.dev" diff --git a/Cargo.lock b/Cargo.lock index bd9f191..500435b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -698,15 +698,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" -[[package]] -name = "bmp" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69985ff4f58085ac696454692d0b646a66ad1f9cc9be294c91dc51bb5df511ae" -dependencies = [ - "byteorder", -] - [[package]] name = "borsh" version = "0.9.3" @@ -2184,19 +2175,6 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" -[[package]] -name = "libreplex_default_renderer" -version = "0.1.2" -dependencies = [ - "anchor-lang", - "assert_matches", - "bmp", - "mocha", - "solana-program", - "solana-program-test", - "solana-sdk", -] - [[package]] name = "libreplex_editions" version = "0.2.1" @@ -2239,22 +2217,6 @@ dependencies = [ "spl-type-length-value 0.3.1", ] -[[package]] -name = "libreplex_monoswap_deprecated" -version = "0.0.0" -dependencies = [ - "anchor-lang", - "anchor-spl", - "assert_matches", - "libreplex_shared", - "mocha", - "mpl-token-metadata", - "solana-program", - "solana-program-test", - "solana-sdk", - "spl-associated-token-account 3.0.2", -] - [[package]] name = "libreplex_shared" version = "0.3.0" @@ -2461,12 +2423,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mocha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0cb102da93ce824d7b0beb84232bf08d90768f1ebb6229be485c0b2e74787f" - [[package]] name = "mockall" version = "0.11.4" diff --git a/programs/libreplex_default_renderer/Cargo.toml b/programs/libreplex_default_renderer/Cargo.toml deleted file mode 100644 index 2aa86ef..0000000 --- a/programs/libreplex_default_renderer/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "libreplex_default_renderer" -version = "0.1.2" -description = "Created with Anchor" -edition = "2021" - -[lib] -crate-type = ["cdylib", "lib"] -name = "libreplex_default_renderer" - -[features] -no-entrypoint = [] -no-idl = [] -no-log-ix-name = [] -cpi = ["no-entrypoint"] -default = [] -idl-build = ["anchor-lang/idl-build"] - -[dependencies] -anchor-lang = {version = "0.30.0", features = ["init-if-needed"]} - -bmp = "0.5.0" - -[dev-dependencies] -mocha = "0.1.1" -assert_matches = "1.5.0" -solana-program-test = "1.17.13" -solana-sdk = "1.17.13" -solana-program = "1.17.13" - - diff --git a/programs/libreplex_default_renderer/Xargo.toml b/programs/libreplex_default_renderer/Xargo.toml deleted file mode 100644 index 475fb71..0000000 --- a/programs/libreplex_default_renderer/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] diff --git a/programs/libreplex_default_renderer/c.bmp b/programs/libreplex_default_renderer/c.bmp deleted file mode 100644 index 83a787fd94029bf8962a16cdebcf93862b3a6ca3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 251 zcmXYrp^n2a5JV?B5*TQ>u+ZpKXcd*5lus}W3|u(yVBkW-gNB8Mg@J{Eg+XoM*>@f3 zt#(JF)jR>5z8-ZpeO3;Y{!Is0H=tDRAOEzw$t@<4vsb`#)ttD^WDrLKSf~ZwQD<-> z0dZoXFh-5=IcW&At;WPT^9$ErK`$>&Gr#Xd6nC{HlcpPem~?${jbl>^1$=C{n3jKJAV!gQMzAW;8iOC diff --git a/programs/libreplex_default_renderer/src/instructions/canonical.rs b/programs/libreplex_default_renderer/src/instructions/canonical.rs deleted file mode 100644 index 66a2ed7..0000000 --- a/programs/libreplex_default_renderer/src/instructions/canonical.rs +++ /dev/null @@ -1,56 +0,0 @@ -use anchor_lang::prelude::*; - -extern crate bmp; -use bmp::{Image, Pixel}; - - -use super::input::{RenderInput, RenderContext}; - - - -const RED_GEN: u8 = 7; -const GREEN_GEN: u8 = 13; -const BLUE_GEN: u8 = 17; - -const RESOLUTION: u32 = 8; - - -pub fn handler(ctx: Context, - _render_input: RenderInput, -) -> anchor_lang::Result> { - - - - let metadata_key = &ctx.accounts.metadata.key(); - let keyref = metadata_key.as_ref(); - msg!("len: {}", keyref.len()); - - let mut img = Image::new(8, 8); - - - - for x in 0..RESOLUTION { - for y in 0..RESOLUTION { - let red = ((RED_GEN as u32).checked_mul(x+7).unwrap().checked_mul( - keyref[x as usize] as u32 - ).unwrap() % 32)*8; - let green = ((GREEN_GEN as u32).checked_mul(x+13).unwrap().checked_mul( - keyref[y as usize] as u32 - ).unwrap() % 32 )* 8; - let blue = ((BLUE_GEN as u32).checked_mul(x+17).unwrap().checked_mul( - keyref[(x.checked_mul(y).unwrap() % 32) as usize] as u32 - ).unwrap() % 256 ) *8; - img.set_pixel(x, y, Pixel::new(red as u8, green as u8, blue as u8)) - } - } - - - // img.set_pixel(0,0, Pixel::new(255,255,255)); - // img.set_pixel(0,0, Pixel::new(255,255,255)); - // img.set_pixel(0,0, Pixel::new(255,255,255)); - - let mut buf = Vec::new(); - img.to_writer(&mut buf)?; - buf.push(1); - Ok(buf) -} diff --git a/programs/libreplex_default_renderer/src/instructions/input.rs b/programs/libreplex_default_renderer/src/instructions/input.rs deleted file mode 100644 index 9e5d55f..0000000 --- a/programs/libreplex_default_renderer/src/instructions/input.rs +++ /dev/null @@ -1,27 +0,0 @@ -use anchor_lang::prelude::*; - - - -#[derive(Clone, AnchorDeserialize, AnchorSerialize)] -pub struct RenderInput { - -} - -#[derive(Accounts)] -pub struct RenderContext<'info> { - /// CHECK: Can be empty - pub metadata: UncheckedAccount<'info>, - - /// CHECK: Can be empty - pub mint: UncheckedAccount<'info>, - - /// CHECK: Can be empty - pub group: UncheckedAccount<'info>, - - /// CHECK: Can be empty - #[account(seeds = [mint.key.as_ref()], bump)] - pub render_state: UncheckedAccount<'info>, - - /// CHECK: Can be empty - pub output_account: UncheckedAccount<'info>, -} \ No newline at end of file diff --git a/programs/libreplex_default_renderer/src/instructions/mod.rs b/programs/libreplex_default_renderer/src/instructions/mod.rs deleted file mode 100644 index d7620a5..0000000 --- a/programs/libreplex_default_renderer/src/instructions/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod canonical; -pub mod input; - -pub use canonical::*; -pub use input::*; diff --git a/programs/libreplex_default_renderer/src/lib.rs b/programs/libreplex_default_renderer/src/lib.rs deleted file mode 100644 index 1a582c2..0000000 --- a/programs/libreplex_default_renderer/src/lib.rs +++ /dev/null @@ -1,32 +0,0 @@ -use anchor_lang::prelude::*; -use instructions::*; - - -use anchor_lang::{AnchorDeserialize, AnchorSerialize}; - - - -pub mod instructions; - - - -declare_id!("EfC2horkE4hCaCruMvoDDWxUhcCgVaufHeG3Hkj69eR8"); - - -#[program] -pub mod libreplex_default_renderer { - - - - - - use super::*; - pub fn canonical( - ctx: Context, - render_input: RenderInput - ) -> Result> { - instructions::canonical::handler(ctx, render_input) - } - - -} diff --git a/programs/libreplex_monoswap_deprecated/Cargo.toml b/programs/libreplex_monoswap_deprecated/Cargo.toml deleted file mode 100644 index f168bab..0000000 --- a/programs/libreplex_monoswap_deprecated/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "libreplex_monoswap_deprecated" -version = "0.0.0" -description = "Created with Anchor" -edition = "2021" -license = "MIT" -repository = "https://github.com/LibrePlex/metadata" - -[lib] -crate-type = ["cdylib", "lib"] -name = "libreplex_monoswap_deprecated" - -[features] -no-entrypoint = [] -no-idl = [] -no-log-ix-name = [] -cpi = ["no-entrypoint"] -default = [] -idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] - -[dependencies] -anchor-lang = {version = "~0.30", features = ["init-if-needed"]} -anchor-spl = {version = "~0.30"} -spl-associated-token-account = "3.0.2" -solana-program = {version = "~1.18"} -libreplex_shared = {version= "0.3.0", features=["no-entrypoint"] } -mpl-token-metadata = { version="~3" } - -[dev-dependencies] -mocha = "0.1.1" -assert_matches = "1.5.0" -solana-program-test = "~1.18" -solana-sdk = "~1.18" diff --git a/programs/libreplex_monoswap_deprecated/Xargo.toml b/programs/libreplex_monoswap_deprecated/Xargo.toml deleted file mode 100644 index 475fb71..0000000 --- a/programs/libreplex_monoswap_deprecated/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] diff --git a/programs/libreplex_monoswap_deprecated/src/constants.rs b/programs/libreplex_monoswap_deprecated/src/constants.rs deleted file mode 100644 index 73cc7ad..0000000 --- a/programs/libreplex_monoswap_deprecated/src/constants.rs +++ /dev/null @@ -1,16 +0,0 @@ -pub const METADATA: &str = "metadata"; -pub const METADATA_EXTENSION: &str = "metadata_extension"; -pub const NFT_OVERRIDE: &str = "nft_override"; -pub const SPL_AUTHORITY: &str = "spl_authority"; -pub const VERIFICATION: &str = "verification"; -pub const COLLECTION: &str = "collection"; -pub const GROUP: &str = "group"; -pub const PERMISSIONS: &str ="permissions"; -pub const OVERRIDE: &str = "override"; -pub const NFT: &str = "nft"; -pub const ADG: &str = "adg"; - - -pub const MAX_NAME_LENGTH: usize = 256; -pub const MAX_SYMBOL_LENGTH: usize = 8; -pub const MAX_URL_LENGTH: usize = 256; diff --git a/programs/libreplex_monoswap_deprecated/src/errors.rs b/programs/libreplex_monoswap_deprecated/src/errors.rs deleted file mode 100644 index c2d19db..0000000 --- a/programs/libreplex_monoswap_deprecated/src/errors.rs +++ /dev/null @@ -1,36 +0,0 @@ -use anchor_lang::prelude::*; - -#[error_code] -pub enum LegacyInscriptionErrorCode { - - #[msg("Metadata has a bad mint")] - BadMint, - - #[msg("Cannot inscribe a fungible asset")] - CannotInscribeFungible, - - #[msg("Bad authority")] - BadAuthority, - - #[msg("Bad authority for holder inscription")] - BadAuthorityForHolderInscription, - - #[msg("Bad authority for update auth inscription")] - BadAuthorityForUpdateAuthInscription, - - #[msg("Multi Signature threshold must be one to create / edit inscriptions")] - MultiSigThresholdMustBeOne, - - #[msg("Not squads member")] - NotSquadsMember, - - #[msg("Inscription V2 key mismatch")] - Inscription2KeyMismatch, - - #[msg("Inscription V3 key mismatch")] - InscriptionV3KeyMismatch, - - #[msg("Metadata data missmatch")] - DataHashMismatch, - -} diff --git a/programs/libreplex_monoswap_deprecated/src/instructions/create_monoswap.rs b/programs/libreplex_monoswap_deprecated/src/instructions/create_monoswap.rs deleted file mode 100644 index 87e647c..0000000 --- a/programs/libreplex_monoswap_deprecated/src/instructions/create_monoswap.rs +++ /dev/null @@ -1,131 +0,0 @@ - - -use anchor_lang::prelude::*; -use anchor_spl::{associated_token::AssociatedToken, token::spl_token, token_interface::{Mint,TokenAccount, spl_token_2022}}; -use libreplex_shared::operations::transfer_generic_spl; - -use crate::SwapMarker; - - -#[derive(Clone, AnchorDeserialize, AnchorSerialize)] -pub struct CreateMonoSwapInput { - pub mint_outgoing_amount: u64, - pub mint_incoming_amount: u64 -} - -#[derive(Accounts)] -pub struct CreateMonoSwapCtx<'info> { - - #[account(init, - payer = payer, - space = SwapMarker::SIZE, - seeds = ["swap_marker".as_bytes(), - namespace.key().as_ref(), - mint_outgoing.key().as_ref(), - mint_incoming.key().as_ref()], // always indexed by the incoming mint - bump,)] - pub swap_marker: Account<'info, SwapMarker>, - - #[account(mut)] - pub mint_incoming: InterfaceAccount<'info, Mint>, - - // each mint has to exist - there must be enough - pub mint_outgoing: InterfaceAccount<'info, Mint>, - - // it is the responsibility of each swapper program to create enough - // of the outgoing mint so that the swap can happen. It is deposited - // from this account - #[account(mut, - associated_token::mint = mint_outgoing, - associated_token::authority = mint_outgoing_owner - )] - pub mint_outgoing_token_account_source: InterfaceAccount<'info, TokenAccount>, - - // escrow holders are organised by namespace + incoming mint - - // that way you can get wallet contents to see what swaps are available to you - /// CHECK: Checked in transfer logic - #[account( - seeds = ["swap_escrow".as_bytes(), - namespace.key().as_ref(), - mint_incoming.key().as_ref()], // always indexed by the incoming mint - bump)] - pub escrow_holder: UncheckedAccount<'info>, - - // ... into this escrow account - #[account(init, - payer = payer, - // yes this is mint_outgoing - associated_token::mint = mint_outgoing, - associated_token::authority = escrow_holder - )] - pub mint_outgoing_token_account_escrow: InterfaceAccount<'info, TokenAccount>, - - - #[account(mut)] - pub payer: Signer<'info>, - - // leave this here for integrations - #[account(mut)] - pub mint_outgoing_owner: Signer<'info>, - - // any account that can sign this. this is useful for grouping swaps - pub namespace: Signer<'info>, - - /// CHECK: Checked in constraint - #[account( - constraint = token_program.key() == spl_token::ID || token_program.key() == spl_token_2022::ID - )] - pub token_program: UncheckedAccount<'info>, - - pub associated_token_program: Program<'info, AssociatedToken>, - - #[account()] - pub system_program: Program<'info, System>, - -} - -pub fn create_swap(ctx: Context, input: CreateMonoSwapInput) -> Result<()> { - - let swap_marker = &mut ctx.accounts.swap_marker; - let mint_outgoing = &mut ctx.accounts.mint_outgoing; - - - swap_marker.namespace = ctx.accounts.namespace.key(); - swap_marker.mint_incoming = ctx.accounts.mint_incoming.key(); - swap_marker.mint_outgoing = mint_outgoing.key(); - swap_marker.mint_incoming_amount = input.mint_incoming_amount; - swap_marker.mint_outgoing_amount = input.mint_outgoing_amount; - - swap_marker.used = false; - - // transfer the outgoing mint into escrow - - let token_program = &ctx.accounts.token_program; - let mint_outgoing_token_account_source = &ctx.accounts.mint_outgoing_token_account_source; - let mint_outgoing_token_account_escrow = &ctx.accounts.mint_outgoing_token_account_escrow; - let associated_token_program = &ctx.accounts.associated_token_program; - let system_program = &ctx.accounts.system_program; - let escrow_holder = &ctx.accounts.escrow_holder; - let payer = &ctx.accounts.payer; - - transfer_generic_spl( - &token_program.to_account_info(), - &mint_outgoing_token_account_source.to_account_info(), - &mint_outgoing_token_account_escrow.to_account_info(), - &payer.to_account_info(), - &mint_outgoing.to_account_info(), - // swap marker outgoing owns this to start with. - // when swapping, this ATA will be emptied - // and a new mint will come in - &escrow_holder.to_account_info(), - &associated_token_program.to_account_info(), - &system_program.to_account_info(), - None, // payer signs - &payer.to_account_info(), - mint_outgoing.decimals, - input.mint_outgoing_amount, - &[] - )?; - - - Ok(()) -} diff --git a/programs/libreplex_monoswap_deprecated/src/instructions/mod.rs b/programs/libreplex_monoswap_deprecated/src/instructions/mod.rs deleted file mode 100644 index d350e33..0000000 --- a/programs/libreplex_monoswap_deprecated/src/instructions/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ - -pub mod create_monoswap; -pub use create_monoswap::*; - - -pub mod swap; -pub use swap::*; \ No newline at end of file diff --git a/programs/libreplex_monoswap_deprecated/src/instructions/swap.rs b/programs/libreplex_monoswap_deprecated/src/instructions/swap.rs deleted file mode 100644 index f0bb38f..0000000 --- a/programs/libreplex_monoswap_deprecated/src/instructions/swap.rs +++ /dev/null @@ -1,189 +0,0 @@ -use anchor_lang::prelude::*; -use anchor_spl::{ - associated_token::AssociatedToken, - token::Token, - token_interface::{Mint, Token2022, TokenAccount}, -}; -use libreplex_shared::operations::transfer_generic_spl; - -use crate::SwapMarker; - -// the swap endpoint is symmetrical. -// it can be used to swap back and forth -#[derive(Accounts)] -pub struct SwapCtx<'info> { - #[account(mut, - close = payer, - constraint = mint_incoming.key() == swap_marker.mint_incoming, - constraint = mint_outgoing.key() == swap_marker.mint_outgoing, - seeds = [ - "swap_marker".as_bytes(), - swap_marker.namespace.as_ref(), - mint_outgoing.key().as_ref(), - mint_incoming.key().as_ref()], - bump,)] - pub swap_marker: Account<'info, SwapMarker>, - - /// swapping always creates a symmetrical swap marker that enables a swap back - #[account(init, - payer = payer, - space = SwapMarker::SIZE, - seeds = ["swap_marker".as_bytes(), - swap_marker.namespace.as_ref(), - mint_incoming.key().as_ref(), - mint_outgoing.key().as_ref()], // always indexed by the incoming mint - bump,)] - pub swap_marker_reverse: Account<'info, SwapMarker>, - - // each mint has to exist. for now we restrict incoming mints to NFTS - // to make sure that each of these marker pairs can only be hit once - // unless the swap is reversed and then called again - #[account()] - pub mint_incoming: InterfaceAccount<'info, Mint>, - - #[account()] - pub mint_outgoing: InterfaceAccount<'info, Mint>, - - // it is the responsibility of each swapper program to create enough - // of the outgoing mint so that the swap can happen. It is deposited - // from this account - #[account(mut, - associated_token::mint = mint_incoming, - associated_token::authority = payer - )] - pub mint_incoming_token_account_source: InterfaceAccount<'info, TokenAccount>, - - /// CHECK: Check in pda derivation - #[account( - seeds = ["swap_escrow".as_bytes(), - swap_marker.namespace.as_ref(), - mint_incoming.key().as_ref()], // always indexed by the incoming mint - bump)] - pub escrow_holder: UncheckedAccount<'info>, - - /// CHECK: Check in pda derivation - #[account( - seeds = ["swap_escrow".as_bytes(), - swap_marker.namespace.as_ref(), - mint_outgoing.key().as_ref()], // always indexed by the incoming mint - bump)] - pub escrow_holder_reverse: UncheckedAccount<'info>, - - // ... into this escrow account - /// CHECK: Checked in transfer logic - #[account(mut)] - pub mint_incoming_token_account_target: UncheckedAccount<'info>, - - - // it is the responsibility of each swapper program to create enough - // of the outgoing mint so that the swap can happen. It is deposited - // from this account - #[account(mut, - associated_token::mint = mint_outgoing, - associated_token::authority = escrow_holder - )] - pub mint_outgoing_token_account_source: InterfaceAccount<'info, TokenAccount>, - - // ... into this escrow account - /// CHECK: Checked in transfer logic - #[account(mut)] - pub mint_outgoing_token_account_target: UncheckedAccount<'info>, - - #[account(mut)] - pub payer: Signer<'info>, - - #[account()] - pub token_program: Program<'info, Token>, - - #[account()] - pub token_program_2022: Program<'info, Token2022>, - - pub associated_token_program: Program<'info, AssociatedToken>, - - - #[account()] - pub system_program: Program<'info, System>, -} - -pub fn swap(ctx: Context) -> Result<()> { - - - let swap_marker_reverse = &mut ctx.accounts.swap_marker_reverse; - let mint_incoming = &mut ctx.accounts.mint_incoming; - let mint_outgoing = &mut ctx.accounts.mint_outgoing; - let escrow_holder_reverse = &ctx.accounts.escrow_holder_reverse; - let swap_marker = &ctx.accounts.swap_marker; - - swap_marker_reverse.set_inner(SwapMarker { - namespace: swap_marker.namespace.key(), - mint_incoming: mint_outgoing.key(), - mint_outgoing: mint_incoming.key(), - mint_incoming_amount: swap_marker.mint_outgoing_amount, - mint_outgoing_amount: swap_marker.mint_incoming_amount, - used: true }); - - // transfer the outgoing mint into escrow - - let token_program = &ctx.accounts.token_program; - let mint_outgoing_token_account_source = &ctx.accounts.mint_outgoing_token_account_source; - let mint_outgoing_token_account_target = &ctx.accounts.mint_outgoing_token_account_target; - - let mint_incoming_token_account_source = &ctx.accounts.mint_incoming_token_account_source; - let mint_incoming_token_account_target = &ctx.accounts.mint_incoming_token_account_target; - - let associated_token_program = &ctx.accounts.associated_token_program; - let system_program = &ctx.accounts.system_program; - let escrow_holder = &ctx.accounts.escrow_holder; - - let mint_incoming_key = mint_incoming.key(); - let authority_seeds = &[ - "swap_escrow".as_bytes(), - swap_marker.namespace.as_ref(), - mint_incoming_key.as_ref(), - &[ctx.bumps.escrow_holder], - ]; - - - let payer = &ctx.accounts.payer; - - // outgoing is going to the payer - transfer_generic_spl( - &token_program.to_account_info(), - &mint_outgoing_token_account_source.to_account_info(), - &mint_outgoing_token_account_target.to_account_info(), - &escrow_holder.to_account_info(), - &mint_outgoing.to_account_info(), - // swap marker outgoing owns this to start with. - // when swapping, this ATA will be emptied - // and a new mint will come in - &payer.to_account_info(), - &associated_token_program.to_account_info(), - &system_program.to_account_info(), - Some(&[authority_seeds]), // payer signs - &payer.to_account_info(), - mint_outgoing.decimals, - swap_marker.mint_outgoing_amount, - &[] - )?; - - transfer_generic_spl( - &token_program.to_account_info(), - &mint_incoming_token_account_source.to_account_info(), - &mint_incoming_token_account_target.to_account_info(), - &payer.to_account_info(), - &mint_incoming.to_account_info(), - // swap marker outgoing owns this to start with. - // when swapping, this ATA will be emptied - // and a new mint will come in - &escrow_holder_reverse.to_account_info(), - &associated_token_program.to_account_info(), - &system_program.to_account_info(), - None, // payer signs - &payer.to_account_info(), - mint_incoming.decimals, - swap_marker.mint_incoming_amount, - &[] - )?; - - - Ok(()) -} diff --git a/programs/libreplex_monoswap_deprecated/src/lib.rs b/programs/libreplex_monoswap_deprecated/src/lib.rs deleted file mode 100644 index 85abec9..0000000 --- a/programs/libreplex_monoswap_deprecated/src/lib.rs +++ /dev/null @@ -1,33 +0,0 @@ -use anchor_lang::prelude::*; - -declare_id!("8Ktjj9tddWm4QM1ywrxgNRyxkNHnhBCwr9Tq3iGbPDxc"); - -pub mod constants; -pub mod errors; -pub mod instructions; -pub mod state; -pub use errors::*; - -pub use constants::*; -pub use state::*; -pub use instructions::*; - -#[program] -pub mod libreplex_monoswap { - use super::*; - - pub fn create_monoswap( - ctx: Context, - input: CreateMonoSwapInput, - ) -> Result<()> { - instructions::create_monoswap::create_swap(ctx, input) - } - - - pub fn swap( - ctx: Context, - ) -> Result<()> { - instructions::swap::swap(ctx) - } - -} diff --git a/programs/libreplex_monoswap_deprecated/src/state/mod.rs b/programs/libreplex_monoswap_deprecated/src/state/mod.rs deleted file mode 100644 index ffd9f08..0000000 --- a/programs/libreplex_monoswap_deprecated/src/state/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub use swap_marker::*; -pub mod swap_marker; \ No newline at end of file diff --git a/programs/libreplex_monoswap_deprecated/src/state/swap_marker.rs b/programs/libreplex_monoswap_deprecated/src/state/swap_marker.rs deleted file mode 100644 index 9fe00b6..0000000 --- a/programs/libreplex_monoswap_deprecated/src/state/swap_marker.rs +++ /dev/null @@ -1,29 +0,0 @@ -use anchor_lang::prelude::*; -use anchor_lang::{AnchorDeserialize, AnchorSerialize}; - -// two of these are made when a mint is introduced -// to the system. allowing for two-way swaps -// PDA is always ["allowed_swap_marker", , ] -// they can never be deleted so the swap links are permanent -#[account] -pub struct SwapMarker { - // namespace can be anything that the caller can sign - pub namespace: Pubkey, - // allows slicing and dicing by incoming mint - pub mint_incoming: Pubkey, - // allows slicing and dicing by outgoing mint - pub mint_outgoing: Pubkey, - pub mint_incoming_amount: u64, - pub mint_outgoing_amount: u64, - // an unused marker can be closed. - // after it has been used, it can not be - // closed to avoid a situation where a - // holder gets trapped into a crappy token - // and cannot go back - pub used: bool -} - -impl SwapMarker { - pub const SIZE: usize = 8 + 32 + 32 + 32 + 8 + 8 + 1; -} - diff --git a/target/types/libreplex_editions.ts b/target/types/libreplex_editions.ts index da4a37b..0b51055 100644 --- a/target/types/libreplex_editions.ts +++ b/target/types/libreplex_editions.ts @@ -5,7 +5,7 @@ * IDL can be found at `target/idl/libreplex_editions.json`. */ export type LibreplexEditions = { - "address": "587DoLBH2H39i5bToWBc6zRgbD2iJZtc4Kb8nYsskYTq", + "address": "5hx15GaPPqsYA61v6QpcGPpo125v7rfvEfZQ4dJErG5V", "metadata": { "name": "libreplexEditions", "version": "0.2.1",