From 006865965dc5c7f8d2bb77eefccf1eac6988c9a9 Mon Sep 17 00:00:00 2001 From: sapph1re Date: Sun, 14 Jan 2024 20:01:35 -0500 Subject: [PATCH] Fixed building issues, fixed getting account deposits, changed FT tokens for the init --- Cargo.toml | 4 ++-- init.sh | 6 +++--- src/lib.rs | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 631ddc6..b8490ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,8 @@ near-sdk = "3.1.0" serde = "0.9.0-rc2" near-contract-standards = "3.1.0" -[dev-dependencies] -near-sdk-sim = "3.1.0" +[patch.crates-io] +parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } [profile.release] codegen-units = 1 diff --git a/init.sh b/init.sh index 8936fd9..16af514 100755 --- a/init.sh +++ b/init.sh @@ -12,13 +12,13 @@ echo ">> Initializing the contract" near call $CONTRACT new '{"owner_id": "'$MASTER_ACCOUNT'"}' --accountId $MASTER_ACCOUNT echo ">> Creating the pools" -near call $CONTRACT create_pool '{"token1": "usdn.testnet", "token2": "usdc.fakes.testnet", "initial_price": 0.000000000001, "protocol_fee": 1, "rewards": 1}' --accountId $CONTRACT -near call $CONTRACT create_pool '{"token1": "wrap.testnet", "token2": "usdc.fakes.testnet", "initial_price": 0.0000000000000001, "protocol_fee": 1, "rewards": 1}' --accountId $CONTRACT +near call $CONTRACT create_pool '{"token1": "usdt.fakes.testnet", "token2": "usdc.fakes.testnet", "initial_price": 1.0, "protocol_fee": 1, "rewards": 1}' --accountId $CONTRACT +near call $CONTRACT create_pool '{"token1": "wrap.testnet", "token2": "usdt.fakes.testnet", "initial_price": 0.0000000000000001, "protocol_fee": 1, "rewards": 1}' --accountId $CONTRACT echo ">> Pools created:" near view $CONTRACT get_pools '{}' echo ">> Creating reserves" -near call $CONTRACT create_reserve '{"reserve_token": "'usdn.testnet'"}' --accountId $CONTRACT +near call $CONTRACT create_reserve '{"reserve_token": "'usdt.fakes.testnet'"}' --accountId $CONTRACT near call $CONTRACT create_reserve '{"reserve_token": "usdc.fakes.testnet"}' --accountId $CONTRACT near call $CONTRACT create_reserve '{"reserve_token": "wrap.testnet"}' --accountId $CONTRACT diff --git a/src/lib.rs b/src/lib.rs index 3e725f2..559e3be 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -561,7 +561,11 @@ impl Contract { // } pub fn get_account_deposits(&self, account_id: AccountId) -> HashMap { - self.deposits.get(&account_id).unwrap().clone() + if let Some(deposit) = self.deposits.get(&account_id) { + deposit.clone() + } else { + HashMap::new() + } } // #[payable]