Skip to content

Commit

Permalink
refactor: clean memecoin impl
Browse files Browse the repository at this point in the history
feat: make transfer_limit_delay a parameter
feat: PercentageMath library

refactor: clean erc20 entrypoints tests

refactor: clean erc20 entrypoints tests

refactor: clean memecoin tests
  • Loading branch information
enitrat committed Jan 1, 2024
1 parent ab75dd2 commit 6521177
Show file tree
Hide file tree
Showing 7 changed files with 483 additions and 1,228 deletions.
4 changes: 3 additions & 1 deletion contracts/src/amm/amm.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ struct AMM {
#[derive(Drop, Copy, Serde)]
enum AMMV2 {
JediSwap,
Ekubo // Unsupported
}

#[generate_trait]
impl AMMImpl of AMMTrait {
fn to_string(self: AMMV2) -> felt252 {
match self {
AMMV2::JediSwap => 'JediSwap'
AMMV2::JediSwap => 'JediSwap',
AMMV2::Ekubo => 'Ekubo'
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions contracts/src/tests/test_factory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,18 @@ fn test_create_memecoin() {
assert(memecoin.name() == NAME(), 'wrong memecoin name');
assert(memecoin.symbol() == SYMBOL(), 'wrong memecoin symbol');
// initial supply - initial holder balance
let holders_sum = *INITIAL_HOLDERS_AMOUNTS()[0] + *INITIAL_HOLDERS_AMOUNTS()[1];
assert(
memecoin.balanceOf(memecoin_address) == DEFAULT_INITIAL_SUPPLY() - 100,
memecoin.balanceOf(memecoin_address) == DEFAULT_INITIAL_SUPPLY() - holders_sum,
'wrong initial supply'
);
assert(memecoin.balanceOf(*INITIAL_HOLDERS()[0]) == 50, 'wrong initial_holder_1 balance');
assert(memecoin.balanceOf(*INITIAL_HOLDERS()[1]) == 50, 'wrong initial_holder_2 balance');
assert(
memecoin.balanceOf(*INITIAL_HOLDERS()[0]) == *INITIAL_HOLDERS_AMOUNTS()[0],
'wrong initial_holder_1 balance'
);
assert(
memecoin.balanceOf(*INITIAL_HOLDERS()[1]) == *INITIAL_HOLDERS_AMOUNTS()[1],
'wrong initial_holder_2 balance'
);
}

Loading

0 comments on commit 6521177

Please sign in to comment.