@leofcoin/contracts 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/test/liquidity-pool.js +6 -2
package/package.json
CHANGED
package/test/liquidity-pool.js
CHANGED
|
@@ -87,7 +87,10 @@ describe('LiquidityPool', () => {
|
|
|
87
87
|
assert.equal(balanceOf(token1, bob), 80_000n)
|
|
88
88
|
})
|
|
89
89
|
|
|
90
|
-
it('swaps with a constant-product fee and enforces slippage', async () => {
|
|
90
|
+
it('swaps with a constant-product fee and enforces slippage', async (t) => {
|
|
91
|
+
// Contract VM time is fixed for a transaction. Do not race a wall-clock
|
|
92
|
+
// deadline against the async lock before the slippage check.
|
|
93
|
+
t.mock.method(Date, 'now', () => 1_700_000_000_000)
|
|
91
94
|
await pool.addLiquidity(10_000n, 10_000n)
|
|
92
95
|
global.msg.sender = bob
|
|
93
96
|
|
|
@@ -105,7 +108,8 @@ describe('LiquidityPool', () => {
|
|
|
105
108
|
assert.equal(balanceOf(token1, bob), 100_906n)
|
|
106
109
|
})
|
|
107
110
|
|
|
108
|
-
it('rejects expired swaps', async () => {
|
|
111
|
+
it('rejects expired swaps', async (t) => {
|
|
112
|
+
t.mock.method(Date, 'now', () => 1_700_000_000_000)
|
|
109
113
|
await pool.addLiquidity(10_000n, 10_000n)
|
|
110
114
|
await assert.rejects(pool.swapExactTokensForTokens(token0, 1_000n, 1n, alice, Date.now() - 1), {
|
|
111
115
|
message: 'swap expired'
|