-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// pnpm test ./test/stableMath.test.ts | ||
|
||
import { _computeBalance, _computeInvariant, _computeInGivenExactOut, _computeOutGivenExactIn } from 'src/stable/stableMath.ts'; | ||
import { describe, expect, test } from 'vitest'; | ||
|
||
describe('test stableMath', () => { | ||
test('_computeBalance', () => { | ||
// based on this sim | ||
// https://dashboard.tenderly.co/mcquardt/project/simulator/f174cf82-3525-4376-b13d-9e61bad1649c?trace=0.4.0 | ||
const finalBalances = _computeBalance( | ||
1000000n, | ||
[20099500000000000000000n,20000000000000000000000n], | ||
40000000000000000000000n, | ||
1 | ||
) | ||
expect(finalBalances).toEqual(19900500494527739566845n) | ||
Check failure on line 16 in typescript/test/stableMath.test.ts GitHub Actions / checkstest/stableMath.test.ts > test stableMath > _computeBalance
|
||
}) | ||
test('_computeInvariant', () => { | ||
// based on this sim | ||
// https://dashboard.tenderly.co/mcquardt/project/simulator/f174cf82-3525-4376-b13d-9e61bad1649c?trace=0.4.0 | ||
const invariant = _computeInvariant( | ||
1000000n, | ||
[20000000000000000000000n,20000000000000000000000n] | ||
) | ||
expect(invariant).toEqual(40000000000000000000000n) | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters