Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,148 changes: 1,972 additions & 176 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions canister_ids.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"LP_ledger_canister": {
"ic": "yyins-zqaaa-aaaac-ak2ia-cai"
},
"ckbtc": {
"ic": "wpwuj-jyaaa-aaaac-albla-cai"
},
"cketh": {
"ic": "wixs5-eaaaa-aaaac-alblq-cai"
},
"swap": {
"ic": "i5hhh-rqaaa-aaaac-aadba-cai"
},
Expand All @@ -10,5 +16,8 @@
},
"valueswap_frontend": {
"ic": "ibd5w-gqaaa-aaaac-aadda-cai"
},
"xrc": {
"ic": "xfzwt-liaaa-aaaac-albma-cai"
}
}
30 changes: 15 additions & 15 deletions scripts/helper_scripts/approval.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
dfx identity use Harshit
dfx canister call cketh icrc2_approve '(
record {
fee = null;
memo = null;
from_subaccount = null;
created_at_time = null;
amount = 5_000_000_000 : nat;
expected_allowance = null;
expires_at = null;
spender = record {
owner = principal "be2us-64aaa-aaaaa-qaabq-cai";
subaccount = null;
};
},
)'
# dfx canister call cketh icrc2_approve '(
# record {
# fee = null;
# memo = null;
# from_subaccount = null;
# created_at_time = null;
# amount = 5_000_000_000 : nat;
# expected_allowance = null;
# expires_at = null;
# spender = record {
# owner = principal "be2us-64aaa-aaaaa-qaabq-cai";
# subaccount = null;
# };
# },
# )'
dfx canister call ckbtc icrc2_approve '(
record {
fee = null;
Expand Down
5 changes: 4 additions & 1 deletion scripts/helper_scripts/sendBalance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ dfx canister call cketh icrc1_transfer ' (record {to=record {owner = principal "

dfx canister call ckbtc icrc1_transfer ' (record {to=record {owner = principal "um2uc-3w7jg-5lycg-pmjio-is7ms-jjzwo-kvwfa-xdeus-ur2tx-4sbzd-cae"; subaccount=null}; fee=null; memo=null; from_subaccount=null; created_at_time=null; amount=5000000000})'

./approval.sh
# ./approval.sh

# minter=$(dfx canister id swap)
# echo "$minter"
80 changes: 37 additions & 43 deletions scripts/helper_scripts/swap_test.sh
Original file line number Diff line number Diff line change
@@ -1,57 +1,51 @@
# dfx canister call valueswap_backend out_given_in '(
# 500000000 : nat,
# 30 : nat,
# 141000000000000000000 : nat,
# 70 : nat,
# 100000000 : nat
# )'

# INPUT_TOKEN=100000000;
# IDENTITY=$(dfx identity get-principal)
# VALUESWAP_BACKEND=$(dfx canister id valueswap_backend)

dfx canister call valueswap_backend pre_compute_swap '(
record {
token1_name = "ckbtc";
token_amount = 100000000 : nat;
token2_name = "cketh";
ledger_canister_id1 = principal "br5f7-7uaaa-aaaaa-qaaca-cai";
ledger_canister_id2 = principal "bw4dl-smaaa-aaaaa-qaacq-cai";
fee = 30
}
)'

# echo "Approving valueswap_backend to transfer 1000000000 tokens on behalf of DevJourney"

# APPROVE=$(
# dfx --identity Harshit canister call ckbtc icrc2_approve "(record{ amount = 1000000000 ; spender = record { owner = principal \"$VALUESWAP_BACKEND\"}})"
# )
# echo "Approve result: $APPROVE"

# echo "Checking allowance"
# ALLOWANCE=$(
# dfx --identity Harshit canister call ckbtc icrc2_allowance "(record { account = record {owner = principal \"$IDENTITY\"}; spender = record { owner = principal \"$VALUESWAP_BACKEND\"}})"
# )
# echo "Allowance result : $ALLOWANCE"

# # dfx canister call ckbtc icrc1_balance_of "(record {owner=principal\"hyhkx-53cuq-lmkqq-yhjmt-eve7b-j5pyf-3evrj-tncch-ilmtl-nrcee-sqe\"; subaccount=null; memo=null; from_subaccount=null; created_at_time=null;})"
# dfx identity use DevJourney

# dfx canister call ckbtc icrc1_transfer ' (record {to=record {owner = principal "um2uc-3w7jg-5lycg-pmjio-is7ms-jjzwo-kvwfa-xdeus-ur2tx-4sbzd-cae"; subaccount=null}; fee=null; memo=null; from_subaccount=null; created_at_time=null; amount=100000000})'
# dfx canister call ckbtc icrc1_transfer ' (record {to=record {owner = principal "um2uc-3w7jg-5lycg-pmjio-is7ms-jjzwo-kvwfa-xdeus-ur2tx-4sbzd-cae"; subaccount=null}; fee=null; memo=null; from_subaccount=null; created_at_time=null; amount=5000000000})'

# dfx identity use Harshit

# dfx canister call valueswap_backend compute_swap '(
IDENTITY=$(dfx identity get-principal)
VALUESWAP_BACKEND=$(dfx canister id valueswap_backend)

# dfx canister call valueswap_backend pre_compute_swap '(
# record {
# token1_name = "ckbtc";
# token_amount = 100000000 : nat;
# token2_name = "cketh";
# ledger_canister_id1 = principal "br5f7-7uaaa-aaaaa-qaaca-cai";
# ledger_canister_id2 = principal "bw4dl-smaaa-aaaaa-qaacq-cai";
# ledger_canister_id1 = principal "b77ix-eeaaa-aaaaa-qaada-cai";
# ledger_canister_id2 = principal "by6od-j4aaa-aaaaa-qaadq-cai";
# fee = 30;
# }
# )'

# dfx canister call ckbtc icrc1_balance_of "(record {owner=principal\"um2uc-3w7jg-5lycg-pmjio-is7ms-jjzwo-kvwfa-xdeus-ur2tx-4sbzd-cae\"; subaccount=null; memo=null; from_subaccount=null; created_at_time=null;})"
# dfx canister call cketh icrc1_balance_of "(record {owner=principal\"um2uc-3w7jg-5lycg-pmjio-is7ms-jjzwo-kvwfa-xdeus-ur2tx-4sbzd-cae\"; subaccount=null; memo=null; from_subaccount=null; created_at_time=null;})"
# echo "Approving valueswap_backend to transfer 1000000000 tokens on behalf of DevJourney"
dfx identity use Harshit

APPROVE=$(
dfx --identity Harshit canister call ckbtc icrc2_approve "(record{ amount = 1000000000 ; spender = record { owner = principal \"$VALUESWAP_BACKEND\"}})"
)
echo "Approve result: $APPROVE"

echo "Checking allowance"
ALLOWANCE=$(
dfx --identity Harshit canister call ckbtc icrc2_allowance "(record { account = record {owner = principal \"$IDENTITY\"}; spender = record { owner = principal \"$VALUESWAP_BACKEND\"}})"
)
echo "Allowance result : $ALLOWANCE"


dfx canister call valueswap_backend compute_swap '(
record {
token1_name = "ckbtc";
token_amount = 100000000 : nat;
token2_name = "cketh";
ledger_canister_id1 = principal "b77ix-eeaaa-aaaaa-qaada-cai";
ledger_canister_id2 = principal "by6od-j4aaa-aaaaa-qaadq-cai";
fee = 30;
}
)'

dfx canister call ckbtc icrc1_balance_of "(record {owner=principal\"um2uc-3w7jg-5lycg-pmjio-is7ms-jjzwo-kvwfa-xdeus-ur2tx-4sbzd-cae\"; subaccount=null; memo=null; from_subaccount=null; created_at_time=null;})"
dfx canister call cketh icrc1_balance_of "(record {owner=principal\"um2uc-3w7jg-5lycg-pmjio-is7ms-jjzwo-kvwfa-xdeus-ur2tx-4sbzd-cae\"; subaccount=null; memo=null; from_subaccount=null; created_at_time=null;})"



Expand Down
6 changes: 3 additions & 3 deletions scripts/helper_scripts/swap_test2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# 100000000 : nat
# )'

INPUT_TOKEN=100000000;
IDENTITY=$(dfx identity get-principal)
VALUESWAP_BACKEND=$(dfx canister id valueswap_backend)
# INPUT_TOKEN=100000000;
# IDENTITY=$(dfx identity get-principal)
# VALUESWAP_BACKEND=$(dfx canister id valueswap_backend)

# dfx canister call valueswap_backend pre_compute_swap '(
# record {
Expand Down
3 changes: 2 additions & 1 deletion scripts/local_deploy/LP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -e


# Get the principal ID for the minter account
export MINTER="b77ix-eeaaa-aaaaa-qaada-cai"
minter=$(dfx canister id valueswap_backend)
export MINTER="$minter"
echo "MINTER principal: $MINTER"

# Set token details
Expand Down
4 changes: 3 additions & 1 deletion scripts/local_deploy/deploy_ckbtc.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
dfx deploy swap
dfx deploy valueswap_backend
./LP.sh
set -e

Expand All @@ -11,7 +12,8 @@ set -e
# dfx build --all

# Get the principal ID for the minter account
export MINTER="b77ix-eeaaa-aaaaa-qaada-cai"
minter=$(dfx canister id valueswap_backend)
export MINTER="$minter"
echo "MINTER principal: $MINTER"

# Set token details
Expand Down
3 changes: 2 additions & 1 deletion scripts/local_deploy/deploy_cketh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ set -e
# dfx build --all

# Get the principal ID for the minter account
export MINTER="b77ix-eeaaa-aaaaa-qaada-cai"
minter=$(dfx canister id valueswap_backend)
export MINTER="$minter"
echo "MINTER principal: $MINTER"

# Set token details
Expand Down
24 changes: 16 additions & 8 deletions scripts/pool_creation_scripts/valid.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
#!/bin/bash

# Load environment variables from the correct path
if [ -f "/home/ray/valueswap/.env" ]; then
export $(grep -v '^#' /home/ray/valueswap/.env | xargs)
else
echo "Error: .env file not found!"
exit 1
fi

# Define base command for dfx canister call
base_command="dfx canister call valueswap_backend create_pools"

# Ledger IDs for cketh and ckbtc
cketh_ledger_id="b77ix-eeaaa-aaaaa-qaada-cai"
ckbtc_ledger_id="bw4dl-smaaa-aaaaa-qaacq-cai"
# Fetch ledger IDs from environment variables
cketh_ledger_id=$CANISTER_ID_CKETH
ckbtc_ledger_id=$CANISTER_ID_CKBTC

# Correct and valid pool data
token_name="ValidToken"
balance="100 : nat" # Valid balance
weight="10 : nat" # Valid weight
value="100 : nat" # Valid value
image_url="https://example.com/valid-image.png"
swap_fee="5 : nat" # Valid swap fee
balance="100000 : nat" # Valid balance
weight="10 : nat" # Valid weight
value="100 : nat" # Valid value
image_url="img"
swap_fee="5 : nat" # Valid swap fee

# Create pools using valid ledger IDs alternately for diversity
echo "Creating pool with ledger ID for cketh..."
Expand Down
Loading