Skip to content

Commit

Permalink
Fix USDT amounts in 2-asset RAMM volatility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rockbmb committed Apr 20, 2024
1 parent 2bd6d26 commit 9a94b02
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ramm-sui/tests/volatility2_tests.move
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module ramm_sui::volatility2_tests {
test_utils::assert_eq(ramm::get_balance<ETH>(&ramm), 500 * test_util::eth_factor());
test_utils::assert_eq(ramm::get_typed_balance<ETH>(&ramm), 500 * test_util::eth_factor());

let total_usdt: u256 = 900000_00000000;
let total_usdt: u256 = 900000_000000;
test_utils::assert_eq(ramm::get_balance<USDT>(&ramm), total_usdt);
test_utils::assert_eq(ramm::get_typed_balance<USDT>(&ramm), total_usdt);

Expand Down Expand Up @@ -174,9 +174,9 @@ module ramm_sui::volatility2_tests {
test_utils::assert_eq(ramm::get_typed_balance<ETH>(&ramm), 495_50542655);

// Recall that the RAMM uses 12 decimal places for internal calculations, and that
// test USDT has 8 decimal places of precision - hence, the correction below by 10^4,
// or 10_000.
let total_trade_fee: u256 = ramm::mul3(PROTOCOL_FEE, BASE_FEE + 10 * ONE / 100, 10_000 * ONE) / 10_000;
// test USDT has 6 decimal places of precision - hence, the correction below by 10^6,
// or 1_000_000.
let total_trade_fee: u256 = ramm::mul3(PROTOCOL_FEE, BASE_FEE + 10 * ONE / 100, 10_000 * ONE) / 1_000_000;
test_utils::assert_eq(ramm::get_balance<USDT>(&ramm), total_usdt + (usdt_trade_amount - total_trade_fee));
test_utils::assert_eq(ramm::get_typed_balance<USDT>(&ramm), total_usdt + (usdt_trade_amount - total_trade_fee));

Expand Down Expand Up @@ -285,7 +285,7 @@ module ramm_sui::volatility2_tests {
// The trader sends 12k USDT to the RAMM
let usdt_trade_amount: u256 = 12_000 * test_util::usdt_factor();

let total_usdt: u256 = 900000_00000000;
let total_usdt: u256 = 900000_000000;
// Second part of the test: a trader, Alice, wishes to buy 5 ETH
// from the ETH/USDT RAMM, with the new price of 2100 USDT per ETH.
test_scenario::next_tx(scenario, ALICE);
Expand Down

0 comments on commit 9a94b02

Please sign in to comment.