Skip to content

Commit

Permalink
Merge pull request #280 from invariant-labs/get-all-pool-keys/positions
Browse files Browse the repository at this point in the history
refactor get all pool keys and get all positions
  • Loading branch information
zielvna authored Jul 8, 2024
2 parents 26ea723 + 3966f86 commit 46c6cde
Show file tree
Hide file tree
Showing 19 changed files with 457 additions and 153 deletions.
45 changes: 8 additions & 37 deletions sdk-usage/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk-usage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@invariant-labs/a0-sdk": "^0.2.8",
"@invariant-labs/a0-sdk": "../sdk",
"dotenv": "^16.4.5"
},
"devDependencies": {
Expand Down
14 changes: 6 additions & 8 deletions sdk/contracts/invariant/invariant.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"source": {
"hash": "0x86f442ed070586bbb8157cda6fdc259b84f953e62727d779806988f81937cd1f",
"hash": "0xba8d2adeacedf76483f1b5e50843cdf9e09f979a0be15def9c09711cd6821c4e",
"language": "ink! 5.0.0",
"compiler": "rustc 1.77.0",
"build_info": {
Expand Down Expand Up @@ -1400,9 +1400,9 @@
"label": "size",
"type": {
"displayName": [
"u8"
"u16"
],
"type": 4
"type": 10
}
},
{
Expand All @@ -1417,7 +1417,7 @@
],
"default": false,
"docs": [],
"label": "InvariantTrait::get_pools",
"label": "InvariantTrait::get_pool_keys",
"mutates": false,
"payable": false,
"returnType": {
Expand All @@ -1427,7 +1427,7 @@
],
"type": 92
},
"selector": "0x6dd2d776"
"selector": "0x57d47dcb"
},
{
"args": [],
Expand Down Expand Up @@ -4649,9 +4649,7 @@
"def": {
"tuple": [
15,
25,
36,
36
25
]
}
}
Expand Down
Binary file modified sdk/contracts/invariant/invariant.wasm
Binary file not shown.
12 changes: 6 additions & 6 deletions sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@invariant-labs/a0-sdk",
"version": "0.2.9",
"version": "0.2.10",
"collaborators": [
"Invariant Labs"
],
Expand Down Expand Up @@ -36,7 +36,7 @@
"docs:copy": "cp ../README.md README.md",
"build:copy-wasm": "cd target && mkdir wasm && cp -r ../src/wasm/pkg ./wasm/pkg",
"test:all": "ts-mocha",
"test:local": "npm run test:utils && npm run test:wazero && npm run test:psp22 && npm run test:protocol-fee && npm run test:math && npm run test:invariant && npm run test:example && npm run test:events && npm run test:tx && npm run test:position && npm run test:get-positions && npm run test:query-on-pair && npm run test:get-liquidity-ticks",
"test:local": "npm run test:utils && npm run test:wazero && npm run test:psp22 && npm run test:protocol-fee && npm run test:math && npm run test:invariant && npm run test:example && npm run test:events && npm run test:tx && npm run test:position && npm run test:get-positions && npm run test:query-on-pair && npm run test:get-all && npm run test:get-liquidity-ticks",
"test:utils": "mocha ./tests/utils.test.ts -g utils",
"test:wazero": "mocha ./tests/wrapped-azero.test.ts -g wrapped-azero",
"test:psp22": "mocha ./tests/psp22.test.ts -g psp22",
Expand All @@ -54,13 +54,14 @@
"test:crosses": "mocha ./tests/crosses-testnet.test.ts -g testnet-crosses-limitations",
"test:tx": "mocha ./tests/tx.test.ts -g tx",
"test:simulate-invariant-swap": "mocha ./tests/simulate-invariant-swap.test.ts -g simulateInvariantSwap",
"test:query-on-pair": "mocha ./tests/query-on-pair.test.ts -g query-on-pair"
"test:query-on-pair": "mocha ./tests/query-on-pair.test.ts -g query-on-pair",
"test:get-all": "mocha ./tests/get-all.test.ts -g get-all"
},
"dependencies": {
"@polkadot/api": "^10.12.4",
"@polkadot/api-contract": "^10.12.4",
"@scio-labs/use-inkathon": "^0.6.3",
"@invariant-labs/a0-sdk-wasm": "^0.1.20",
"@invariant-labs/a0-sdk-wasm": "^0.1.21",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
Expand Down
14 changes: 6 additions & 8 deletions sdk/src/abis/invariant.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const abi = `
{
"source": {
"hash": "0x86f442ed070586bbb8157cda6fdc259b84f953e62727d779806988f81937cd1f",
"hash": "0xba8d2adeacedf76483f1b5e50843cdf9e09f979a0be15def9c09711cd6821c4e",
"language": "ink! 5.0.0",
"compiler": "rustc 1.77.0",
"build_info": {
Expand Down Expand Up @@ -1401,9 +1401,9 @@ export const abi = `
"label": "size",
"type": {
"displayName": [
"u8"
"u16"
],
"type": 4
"type": 10
}
},
{
Expand All @@ -1418,7 +1418,7 @@ export const abi = `
],
"default": false,
"docs": [],
"label": "InvariantTrait::get_pools",
"label": "InvariantTrait::get_pool_keys",
"mutates": false,
"payable": false,
"returnType": {
Expand All @@ -1428,7 +1428,7 @@ export const abi = `
],
"type": 92
},
"selector": "0x6dd2d776"
"selector": "0x57d47dcb"
},
{
"args": [],
Expand Down Expand Up @@ -4650,9 +4650,7 @@ export const abi = `
"def": {
"tuple": [
15,
25,
36,
36
25
]
}
}
Expand Down
10 changes: 6 additions & 4 deletions sdk/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getMaxTickmapQuerySize,
getPercentageDenominator,
getPercentageScale,
getPositionsEntriesLimit,
getPriceDenominator,
getPriceScale,
getSecondsPerLiquidityDenominator,
Expand All @@ -36,10 +37,10 @@ export const DEFAULT_LOCAL = 'ws://127.0.0.1:9944'

export const TESTNET_WAZERO_ADDRESS = '5EFDb7mKbougLtr5dnwd5KDfZ3wK55JPGPLiryKq4uRMPR46'

export const TESTNET_INVARIANT_ADDRESS = '5DwKDnzBTy3REu87qyygeLygCqNHmBApiK2FfJif2GvRFRrN'
export const TESTNET_BTC_ADDRESS = '5CwK99HSSankDPFR3hAeW7CX95VGVtYy2Fy864eon54Lx4AX'
export const TESTNET_ETH_ADDRESS = '5E4Cd4Z76ZfTFxbV8yrKjGwyJ5h1NLNxog2zFTAh49w52Phy'
export const TESTNET_USDC_ADDRESS = '5Cju3x5gMDos4ALNJxQ3QUb955NQZhSYZgQ1t9TEH9kBfwAr'
export const TESTNET_INVARIANT_ADDRESS = '5FxTEpmxrqr8Nwx7u1Y7heTFJiSe8xU1zZMfWmuC5f1UJMbf'
export const TESTNET_BTC_ADDRESS = '5DPvVudq6bCZ84jwFSsRwD7hDh4aaGh7XzpJUKXWDDHMHXaL'
export const TESTNET_ETH_ADDRESS = '5GmqniLhEcZCsn7vrer6yHzn7giapNG6N4fHx9exXHn29MvC'
export const TESTNET_USDC_ADDRESS = '5Cr6gjWk5cUavkbo9d6GTZBGjf4XavQf6WpiLkgT9UCmGQYP'

export const FEE_GROWTH_DENOMINATOR = getFeeGrowthDenominator()
export const FIXED_POINT_DENOMINATOR = getFixedPointDenominator()
Expand Down Expand Up @@ -67,3 +68,4 @@ export const MAX_TICK_CROSS = getMaxTickCross()
export const LIQUIDITY_TICKS_LIMIT = getLiquidityTicksLimit()
export const MAX_POOL_KEYS_RETURNED = getMaxPoolKeysReturned()
export const MAX_POOL_PAIRS_RETURNED = getMaxPoolPairsReturned()
export const POSITIONS_ENTRIES_LIMIT = getPositionsEntriesLimit()
Loading

0 comments on commit 46c6cde

Please sign in to comment.