Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
psorinionut committed Jun 27, 2024
1 parent abf386a commit 2231e50
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Pair constants

pub const PAIR_WASM_PATH: &'static str = "pair/output/pair.wasm";
pub const PAIR_WASM_PATH: &str = "pair/output/pair.wasm";
pub const WEGLD_TOKEN_ID: &[u8] = b"WEGLD-abcdef";
pub const RIDE_TOKEN_ID: &[u8] = b"RIDE-abcdef";
pub const LP_TOKEN_ID: &[u8] = b"LPTOK-abcdef"; // also farming token ID for LP farm
Expand All @@ -15,7 +15,7 @@ pub const BLOCK_NONCE_AFTER_PAIR_SETUP: u64 = 100;

// LP farm constants

pub const FARM_WASM_PATH: &'static str = "farm/output/farm.wasm";
pub const FARM_WASM_PATH: &str = "farm/output/farm.wasm";
pub const LP_FARM_TOKEN_ID: &[u8] = b"LPFARM-abcdef";
pub const DIVISION_SAFETY_CONSTANT: u64 = 1_000_000_000_000;
pub const MIN_FARMING_EPOCHS: u8 = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ fn test_unstake_from_legacy_proxy() {
1,
dual_yield_token_amount,
expected_token_amount,
0,
0,
expected_token_amount,
30,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ where
b_mock.create_sc_account(&rust_zero, Some(owner_addr), pair_builder, PAIR_WASM_PATH);

b_mock
.execute_tx(&owner_addr, &pair_wrapper, &rust_zero, |sc| {
.execute_tx(owner_addr, &pair_wrapper, &rust_zero, |sc| {
let first_token_id = managed_token_id!(WEGLD_TOKEN_ID);
let second_token_id = managed_token_id!(RIDE_TOKEN_ID);
let router_address = managed_address!(&owner_addr);
let router_owner_address = managed_address!(&owner_addr);
let initial_liquidity_adder = managed_address!(&owner_addr);
let router_address = managed_address!(owner_addr);
let router_owner_address = managed_address!(owner_addr);
let initial_liquidity_adder = managed_address!(owner_addr);
let total_fee_percent = 300u64;
let special_fee_percent = 50u64;

Expand All @@ -66,25 +66,25 @@ where

// set user balance
b_mock.set_esdt_balance(
&user_addr,
user_addr,
WEGLD_TOKEN_ID,
&rust_biguint!(USER_TOTAL_WEGLD_TOKENS),
);
b_mock.set_esdt_balance(
&user_addr,
user_addr,
RIDE_TOKEN_ID,
&rust_biguint!(USER_TOTAL_RIDE_TOKENS),
);

b_mock.set_block_nonce(BLOCK_NONCE_FIRST_ADD_LIQ);

b_mock.set_esdt_balance(
&owner_addr,
owner_addr,
WEGLD_TOKEN_ID,
&rust_biguint!(USER_TOTAL_WEGLD_TOKENS),
);
b_mock.set_esdt_balance(
&owner_addr,
owner_addr,
RIDE_TOKEN_ID,
&rust_biguint!(USER_TOTAL_RIDE_TOKENS),
);
Expand All @@ -102,15 +102,15 @@ where
},
];
b_mock
.execute_esdt_multi_transfer(&owner_addr, &pair_wrapper, &payments, |sc| {
.execute_esdt_multi_transfer(owner_addr, &pair_wrapper, &payments, |sc| {
sc.add_initial_liquidity();
})
.assert_ok();

b_mock.set_block_nonce(BLOCK_NONCE_SECOND_ADD_LIQ);

b_mock
.execute_esdt_multi_transfer(&owner_addr, &pair_wrapper, &payments, |sc| {
.execute_esdt_multi_transfer(owner_addr, &pair_wrapper, &payments, |sc| {
sc.add_liquidity(managed_biguint!(1u64), managed_biguint!(1u64));
})
.assert_ok();
Expand All @@ -131,12 +131,12 @@ where
{
let rust_zero = rust_biguint!(0u64);
let farm_wrapper =
b_mock.create_sc_account(&rust_zero, Some(&owner_addr), farm_builder, FARM_WASM_PATH);
b_mock.create_sc_account(&rust_zero, Some(owner_addr), farm_builder, FARM_WASM_PATH);

// init farm contract

b_mock
.execute_tx(&owner_addr, &farm_wrapper, &rust_zero, |sc| {
.execute_tx(owner_addr, &farm_wrapper, &rust_zero, |sc| {
let reward_token_id = managed_token_id!(RIDE_TOKEN_ID);
let farming_token_id = managed_token_id!(LP_TOKEN_ID);
let division_safety_constant = managed_biguint!(DIVISION_SAFETY_CONSTANT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ use crate::{
},
};

pub struct NonceAmountPair {
pub nonce: u64,
pub amount: u64,
}

pub struct FarmStakingSetup<
PairObjBuilder,
FarmObjBuilder,
Expand Down Expand Up @@ -133,8 +128,6 @@ where
dual_yield_token_nonce: u64,
dual_yield_token_amount: u64,
expected_wegld_amount: u64,
expected_lp_farm_rewards: u64,
expected_staking_rewards: u64,
expected_unbond_token_amount: u64,
expected_unbond_token_unlock_epoch: u64,
) -> u64 {
Expand All @@ -160,20 +153,6 @@ where
vec_index += 1;
}

if expected_lp_farm_rewards > 0 {
let lp_farm_rewards = received_tokens.get(vec_index);
assert_eq!(lp_farm_rewards.amount, expected_lp_farm_rewards);

vec_index += 1;
}

if expected_staking_rewards > 0 {
let staking_rewards = received_tokens.get(vec_index);
assert_eq!(staking_rewards.amount, expected_staking_rewards);

vec_index += 1;
}

let unbond_tokens = received_tokens.get(vec_index);
assert_eq!(unbond_tokens.amount, expected_unbond_token_amount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ where
b_mock.create_sc_account(&rust_zero, Some(owner_addr), builder, PROXY_WASM_PATH);

b_mock
.execute_tx(&owner_addr, &proxy_wrapper, &rust_zero, |sc| {
.execute_tx(owner_addr, &proxy_wrapper, &rust_zero, |sc| {
sc.init();

sc.pair_address().set(managed_address!(pair_address));
Expand Down

0 comments on commit 2231e50

Please sign in to comment.