Skip to content

Commit 96da726

Browse files
Merge pull request #309 from invariant-labs/add-fee-tiers
Add new fee tiers
2 parents 39c7ef3 + 3d27cfe commit 96da726

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

sdk/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@invariant-labs/sdk",
3-
"version": "0.9.60",
3+
"version": "0.9.61",
44
"description": "",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

sdk/src/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,16 @@ export const FEE_TIERS: FeeTier[] = [
287287
{ fee: fromFee(new BN(3)), tickSpacing: 1 },
288288
{ fee: fromFee(new BN(5)), tickSpacing: 1 },
289289
{ fee: fromFee(new BN(10)), tickSpacing: 1 },
290+
{ fee: fromFee(new BN(20)), tickSpacing: 5 },
290291
{ fee: fromFee(new BN(50)) },
291292
{ fee: fromFee(new BN(100)) },
292293
{ fee: fromFee(new BN(300)) },
294+
{ fee: fromFee(new BN(500)), tickSpacing: 5 },
293295
{ fee: fromFee(new BN(1000)) },
294296
{ fee: fromFee(new BN(3000)), tickSpacing: 5 },
295297
{ fee: fromFee(new BN(5000)), tickSpacing: 5 },
296298
{ fee: fromFee(new BN(10000)), tickSpacing: 5 },
299+
{ fee: fromFee(new BN(25000)), tickSpacing: 5 },
297300
{ fee: fromFee(new BN(50000)), tickSpacing: 5 }
298301
]
299302

tests/math.spec.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ describe('Math', () => {
105105
assert.ok(result.eq(new BN(24)))
106106
})
107107
it('returns the correct average for 5 numbers', () => {
108-
const result = arithmeticalAvg(new BN(10), new BN(50), new BN(12), new BN(10024), new BN(11479))
108+
const result = arithmeticalAvg(
109+
new BN(10),
110+
new BN(50),
111+
new BN(12),
112+
new BN(10024),
113+
new BN(11479)
114+
)
109115
assert.ok(result.eq(new BN(4315)))
110116
})
111117
})
@@ -1024,7 +1030,7 @@ describe('Math', () => {
10241030

10251031
assert.ok(result.v.eq(expectedResult.v))
10261032
})
1027-
it('2', async () => { })
1033+
it('2', async () => {})
10281034
const price: Decimal = { v: PRICE_DENOMINATOR.mul(new BN('1')) }
10291035
const liquidity: Decimal = { v: LIQUIDITY_DENOMINATOR.mul(new BN('2')) }
10301036
const amount: BN = new BN('3')
@@ -1100,7 +1106,7 @@ describe('Math', () => {
11001106
}
11011107
assert.ok(result.v.eq(expectedResult.v))
11021108
})
1103-
it('2', async () => { })
1109+
it('2', async () => {})
11041110
const price: Decimal = { v: PRICE_DENOMINATOR.mul(new BN('1')) }
11051111
const liquidity: Decimal = { v: LIQUIDITY_DENOMINATOR.mul(new BN('2')) }
11061112
const amount: BN = new BN('3')
@@ -2052,7 +2058,7 @@ describe('Math', () => {
20522058
it('case 1', async () => {
20532059
const volume = 125000
20542060
const tokenXamount = new BN(1000000)
2055-
const feeTier = FEE_TIERS[6] // 0.3%
2061+
const feeTier = FEE_TIERS[7] // 0.3%
20562062

20572063
const result = dailyFactorPool(tokenXamount, volume, feeTier)
20582064
assert.equal(result, 0.00037125)

0 commit comments

Comments
 (0)