Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
manlikeHB committed Oct 5, 2024
1 parent fdd8b65 commit 4c5c464
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions onchain/cairo/src/tests/launchpad_tests.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ mod launchpad_tests {
launchpad.sell_coin(token_address, amount_quote);
}

fn calculate_slope(total_supply: u256) -> u256 {
let liquidity_supply = total_supply / LIQUIDITY_RATIO;
let liquidity_available = total_supply - liquidity_supply;
let slope = (2 * THRESHOLD_LIQUIDITY) / (liquidity_available * (liquidity_available - 1));
slope
}

#[test]
fn launchpad_buy_with_amount() {
println!("launchpad_buy_with_amount");
Expand Down Expand Up @@ -662,19 +669,12 @@ mod launchpad_tests {
spy.assert_emitted(@array![(launchpad.contract_address, expected_event)]);
}

fn claculate_slope(total_supply: u256) -> u256 {
let liquidity_supply = total_supply / LIQUIDITY_RATIO;
let liquidity_available = total_supply - liquidity_supply;
let slope = (2 * THRESHOLD_LIQUIDITY) / (liquidity_available * (liquidity_available - 1));
slope
}

#[test]
fn test_create_and_launch_token() {
let (_, erc20, launchpad) = request_fixture();
let mut spy = spy_events(SpyOn::One(launchpad.contract_address));
let initial_key_price = THRESHOLD_LIQUIDITY / DEFAULT_INITIAL_SUPPLY();
let slope = claculate_slope(DEFAULT_INITIAL_SUPPLY());
let slope = calculate_slope(DEFAULT_INITIAL_SUPPLY());

start_cheat_caller_address(launchpad.contract_address, OWNER());

Expand Down Expand Up @@ -751,7 +751,7 @@ mod launchpad_tests {
let (_, erc20, launchpad) = request_fixture();
let mut spy = spy_events(SpyOn::One(launchpad.contract_address));
let initial_key_price = THRESHOLD_LIQUIDITY / DEFAULT_INITIAL_SUPPLY();
let slope = claculate_slope(DEFAULT_INITIAL_SUPPLY());
let slope = calculate_slope(DEFAULT_INITIAL_SUPPLY());

start_cheat_caller_address(launchpad.contract_address, OWNER());

Expand Down Expand Up @@ -874,7 +874,7 @@ mod launchpad_tests {
assert(launched_token.liquidity_raised == 0_u256, 'wrong liquidation raised');
assert(launched_token.token_holded == 0_u256, 'wrong token holded');
assert(
launched_token.token_quote.token_address == erc20.contract_address, 'wrong token qoute'
launched_token.token_quote.token_address == erc20.contract_address, 'wrong token quote'
);
}

Expand Down Expand Up @@ -1222,7 +1222,7 @@ mod launchpad_tests {

#[test]
#[should_panic(expected: ("pool_update.liquidity_raised <= quote_amount",))]
fn test_sell_coin_when_qoute_amount_is_greaterthan_liquidity_raised() {
fn test_sell_coin_when_quote_amount_is_greaterthan_liquidity_raised() {
let (sender_address, erc20, launchpad) = request_fixture();

start_cheat_caller_address(launchpad.contract_address, sender_address);
Expand All @@ -1246,7 +1246,7 @@ mod launchpad_tests {
fn test_launchpad_end_to_end() {
let (sender_address, erc20, launchpad) = request_fixture();
let initial_key_price = THRESHOLD_LIQUIDITY / DEFAULT_INITIAL_SUPPLY();
let slope = claculate_slope(DEFAULT_INITIAL_SUPPLY());
let slope = calculate_slope(DEFAULT_INITIAL_SUPPLY());
let mut spy = spy_events(SpyOn::One(launchpad.contract_address));

// cheat_caller_address_global(sender_address);
Expand Down

0 comments on commit 4c5c464

Please sign in to comment.