Skip to content

Commit

Permalink
Fixed building issues, fixed getting account deposits, changed FT tok…
Browse files Browse the repository at this point in the history
…ens for the init
  • Loading branch information
sapph1re committed Jan 15, 2024
1 parent 5786da2 commit 0068659
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,11 @@ impl Contract {
// }

pub fn get_account_deposits(&self, account_id: AccountId) -> HashMap<TokenId, Deposit> {
self.deposits.get(&account_id).unwrap().clone()
if let Some(deposit) = self.deposits.get(&account_id) {
deposit.clone()
} else {
HashMap::new()
}
}

// #[payable]
Expand Down

0 comments on commit 0068659

Please sign in to comment.