Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyabukalov committed Jun 25, 2022
1 parent eb8d09e commit 8537df7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
19 changes: 5 additions & 14 deletions tests/futures-market-basic_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ const gas_fee = 1;

const block_mining_time = 600; // in seconds

// in order to be able to update that whole chunk of created positions,
// we need to skip the following amount of blocks
// (for example per day it would be 144 blocks)
const blocks_in_an_update_cooldown = POSITION_UPDATE_COOLDOWN / block_mining_time;

const futures_market_contract = "futures-market";
const token_contract = "token";

Expand Down Expand Up @@ -769,9 +774,6 @@ Clarinet.test({

read_only_call.result.expectOk().expectBool(false);

// 144 blocks for passing an update cooldown
const blocks_in_an_update_cooldown = POSITION_UPDATE_COOLDOWN / block_mining_time;

chain.mineEmptyBlock(blocks_in_an_update_cooldown);

read_only_call = chain.callReadOnlyFn(
Expand Down Expand Up @@ -960,9 +962,6 @@ Clarinet.test({

call.receipts[0].result.expectOk().expectUint(position_index);

// 144 blocks for passing an update cooldown
const blocks_in_an_update_cooldown = POSITION_UPDATE_COOLDOWN / block_mining_time;

chain.mineEmptyBlock(blocks_in_an_update_cooldown);

call = chain.mineBlock([
Expand Down Expand Up @@ -1014,10 +1013,6 @@ Clarinet.test({

const opened_positions = positions_to_open;

// in order to be able to update that whole chunk of created positions,
// we need to skip the following amount of blocks, which happens to be 144 blocks
const blocks_in_an_update_cooldown = POSITION_UPDATE_COOLDOWN / block_mining_time;

chain.mineEmptyBlock(blocks_in_an_update_cooldown);

let call = chain.mineBlock([
Expand Down Expand Up @@ -1058,10 +1053,6 @@ Clarinet.test({

const opened_positions = positions_to_open;

// in order to be able to update that whole chunk of created positions,
// we need to skip the following amount of blocks, which happens to be 144 blocks
const blocks_in_an_update_cooldown = POSITION_UPDATE_COOLDOWN / block_mining_time;

chain.mineEmptyBlock(blocks_in_an_update_cooldown);

const call = chain.mineBlock([
Expand Down
10 changes: 6 additions & 4 deletions tests/futures-market-simulations_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ const INDEX_CHUNK_SIZE =

const block_mining_time = 600; // in seconds


// in order to be able to update that whole chunk of created positions,
// we need to skip the following amount of blocks
// (for example per day it would be 144 blocks)
const blocks_in_an_update_cooldown = POSITION_UPDATE_COOLDOWN / block_mining_time;

const futures_market_contract = "futures-market";
const token_contract = "token";

Expand Down Expand Up @@ -118,10 +124,6 @@ Clarinet.test({

const opened_positions = positions_to_open;

// in order to be able to update that whole chunk of created positions,
// we need to skip the following amount of blocks, which happens to be 144 blocks
const blocks_in_an_update_cooldown = POSITION_UPDATE_COOLDOWN / block_mining_time;

chain.mineEmptyBlock(blocks_in_an_update_cooldown);

const call = chain.mineBlock([
Expand Down

0 comments on commit 8537df7

Please sign in to comment.