Skip to content

Commit 5667528

Browse files
authored
Merge pull request #78 from invariant-labs/fix-get-positions-and-allow-none-on-empty-single-withdraw
fix get-positions and allow none on empty single withdraw
2 parents 48aeb03 + 83a2560 commit 5667528

25 files changed

+256
-216
lines changed

scripts/package-lock.json

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

scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"description": "",
2020
"dependencies": {
2121
"@polkadot/api": "^10.11.2",
22-
"@invariant-labs/vara-sdk": "0.1.11",
22+
"@invariant-labs/vara-sdk": "0.1.14",
2323
"dotenv": "^16.4.5"
2424
},
2525
"devDependencies": {

scripts/src/setup.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ const main = async () => {
3737
const BTCAddress = await FungibleToken.deploy(api, account, 'Bitcoin', 'BTC', 8n)
3838
const ETHAddress = await FungibleToken.deploy(api, account, 'Ether', 'ETH', 12n)
3939
const USDCAddress = await FungibleToken.deploy(api, account, 'USDC', 'USDC', 6n)
40+
const SOLAddress = await FungibleToken.deploy(api, account, 'Solana', 'SOL', 9n)
41+
const AZEROAddress = await FungibleToken.deploy(api, account, 'Aleph Zero', 'AZERO', 12n)
42+
4043
const decimals = {
4144
[BTCAddress]: 8n,
4245
[ETHAddress]: 12n,
4346
[USDCAddress]: 6n
4447
}
45-
console.log(`BTC: ${BTCAddress}, ETH: ${ETHAddress}, USDC: ${USDCAddress}`)
48+
49+
console.log(
50+
`BTC: ${BTCAddress}, ETH: ${ETHAddress}, USDC: ${USDCAddress}, SOL ${SOLAddress}, AZEROAddress ${AZEROAddress}`
51+
)
4652

4753
const response = await fetch(
48-
'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=bitcoin,ethereum,aleph-zero'
54+
'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=bitcoin,ethereum'
4955
)
5056
const data = await response.json()
5157
const prices = {
-31 Bytes
Binary file not shown.

sdk/contracts/invariant/invariant.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ service Service {
178178
query GetPosition : (owner_id: actor_id, index: u32) -> result (Position, InvariantError);
179179
query GetPositionTicks : (owner: actor_id, offset: u32) -> vec PositionTick;
180180
query GetPositionWithAssociates : (owner: actor_id, index: u32) -> result (struct { Position, Pool, Tick, Tick }, InvariantError);
181-
query GetPositions : (owner_id: actor_id, size: u32, offset: u32) -> result (struct { vec struct { Pool, vec Position }, u32 }, InvariantError);
181+
query GetPositions : (owner_id: actor_id, size: u32, offset: u32) -> result (struct { vec struct { Pool, vec struct { Position, u32 } }, u32 }, InvariantError);
182182
query GetProtocolFee : () -> Percentage;
183183
query GetTick : (key: PoolKey, index: i32) -> result (Tick, InvariantError);
184184
query GetTickmap : (pool_key: PoolKey) -> vec struct { u16, u64 };
595 Bytes
Binary file not shown.

sdk/package-lock.json

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

sdk/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@invariant-labs/vara-sdk",
3-
"version": "0.1.13",
3+
"version": "0.1.14",
44
"collaborators": [
55
"Invariant Labs"
66
],
@@ -29,7 +29,7 @@
2929
"node:local:stop": "pkill -9 gear",
3030
"start": "npm run build && node --experimental-wasm-modules --trace-uncaught target/index.js",
3131
"wasm:build": "cd ./src/wasm && wasm-pack build --features tsify/js && rm ./pkg/.gitignore",
32-
"test:local": "npm run test:fungible-token && npm run test:deposits && npm run test:vara-deposits && npm run test:invariant && npm run test:example && npm run test:protocol-fee && npm run test:position && npm run test:math && npm run test:events && npm run test:get-liquidity-ticks && npm run test:query-sizes && npm run test:batch",
32+
"test:local": "npm run test:fungible-token && npm run test:deposits && npm run test:vara-deposits && npm run test:invariant && npm run test:example && npm run test:protocol-fee && npm run test:position && npm run test:math && npm run test:events && npm run test:get-liquidity-ticks && npm run test:get-positions && npm run test:query-sizes && npm run test:batch",
3333
"test:fungible-token": "npx mocha --config mocharc.json ./tests/fungible-token.test.ts",
3434
"test:invariant": "npx mocha --config mocharc.json ./tests/invariant.test.ts",
3535
"test:protocol-fee": "npx mocha --config mocharc.json ./tests/protocol-fee.test.ts",
@@ -56,7 +56,7 @@
5656
},
5757
"dependencies": {
5858
"@gear-js/api": "0.38.1",
59-
"@invariant-labs/vara-sdk-wasm": "0.1.0",
59+
"@invariant-labs/vara-sdk-wasm": "0.1.1",
6060
"@polkadot/api": "11.0.2",
6161
"@polkadot/types": "11.0.2",
6262
"sails-js": "0.1.4"

sdk/src/consts.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@ export const CONCENTRATION_FACTOR = 1.00001526069123
6666
export const VARA_ADDRESS: HexString =
6767
'0x0000000000000000000000000000000000000000000000000000000000000000'
6868
export const TESTNET_INVARIANT_ADDRESS: HexString =
69-
'0x9c98ea19282e70f2848b0c37c2890f8f0e66396f86ddd2fb2dbd207c8028b7b7'
69+
'0xbe6b7d437dafbbdd983a153ca594ae32abebcd42450b4914a01fcbd6d7a59264'
7070
export const TESTNET_BTC_ADDRESS: HexString =
71-
'0x1377048f231254dd7e83fc466a63d921527f65545a8cc56b3b45b8f89d225741'
71+
'0x3d35d6eee42ee2b89490295e591d205ac94f01446b4a27a8ba21522f474caffc'
7272
export const TESTNET_ETH_ADDRESS: HexString =
73-
'0x0b88ed5b7501f337ae3671cba3bfabb2407a6341d3f7966fbb8a1dbd79070265'
73+
'0xbbef6ca66fd7ec80bd7800b0c1b5b67dbef041931c5e76a0f318ef3025868711'
7474
export const TESTNET_USDC_ADDRESS: HexString =
75-
'0xafcbcb7c910a55d1b00edb01f28deb1e4d8b80cfc6406388115947c749f5628d'
75+
'0x79973b6c7cec41ea24101d604d2d33d9aa3d9482581dd57701a50773c8822cfc'
76+
export const TESTNET_SOL_ADDRESS: HexString =
77+
'0x41c273ed8b4eb1d559bd709fba24608730f83b0225d58b55ee6bd067fc3b40aa'
78+
export const TESTNET_AZERO_ADDRESS: HexString =
79+
'0x7e0bf68153c2444c762b9cd9fec0e8ff4f8f48c733db64dbdf9336354af6ffa4'
80+

sdk/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export {
1010
TESTNET_BTC_ADDRESS,
1111
TESTNET_ETH_ADDRESS,
1212
TESTNET_USDC_ADDRESS,
13+
TESTNET_AZERO_ADDRESS,
14+
TESTNET_SOL_ADDRESS,
1315
TESTNET_INVARIANT_ADDRESS,
1416
PERCENTAGE_SCALE,
1517
SQRT_PRICE_SCALE

0 commit comments

Comments
 (0)