Skip to content

Commit f78e8d1

Browse files
authored
test: AMM TXE tests (#16458)
Fixes #10289 Just like my [other recent PR](#16451) decided to add TXE tests for AMM. ## On using AI here The only thing I did manually here is to merge a few test cases because they were too long-running as setting up the initial state is costly. I also told it to not have precise ratio in the second call to `add_liquidity` to test the refund. Other than this AI pretty much managed to nail it. ### Update on AI Code quality was not great and had to redo quite a lot of stuff. That could be improved though if we had a proper reference (plenty of the style issues were present in the rest of our codebase).
2 parents 24844de + 077fdb4 commit f78e8d1

File tree

4 files changed

+742
-2
lines changed

4 files changed

+742
-2
lines changed

noir-projects/noir-contracts/contracts/app/amm_contract/src/main.nr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
mod lib;
22
mod config;
3+
mod test;
34

45
use dep::aztec::macros::aztec;
56

@@ -54,9 +55,9 @@ pub contract AMM {
5455

5556
/// Amount of liquidity which gets locked when liquidity is provided for the first time. Its purpose is to prevent
5657
/// the pool from ever emptying which could lead to undefined behavior.
57-
global MINIMUM_LIQUIDITY: u128 = 1000;
58+
pub global MINIMUM_LIQUIDITY: u128 = 1000;
5859
/// We set it to 99 times the minimum liquidity. That way the first LP gets 99% of the value of their deposit.
59-
global INITIAL_LIQUIDITY: u128 = 99000;
60+
pub global INITIAL_LIQUIDITY: u128 = 99000;
6061

6162
// TODO(#9480): Either deploy the liquidity contract in the constructor or verify it that it corresponds to what
6263
// this contract expects (i.e. that the AMM has permission to mint and burn).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mod test;
2+
pub(crate) mod utils;

0 commit comments

Comments
 (0)