mirror of
https://github.com/alexgo-io/alex-sdk.git
synced 2026-05-07 05:10:36 +08:00
feat: add new tokens
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"clarity-codegen": "^0.2.6"
|
||||
"clarity-codegen": "^0.3.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@stacks/network": "*",
|
||||
|
||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -6,8 +6,8 @@ settings:
|
||||
|
||||
dependencies:
|
||||
clarity-codegen:
|
||||
specifier: ^0.2.6
|
||||
version: 0.2.6(@stacks/transactions@6.5.0)
|
||||
specifier: ^0.3.5
|
||||
version: 0.3.5(@stacks/transactions@6.5.0)
|
||||
|
||||
devDependencies:
|
||||
'@size-limit/preset-small-lib':
|
||||
@@ -2720,8 +2720,8 @@ packages:
|
||||
resolution: {integrity: sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==}
|
||||
dev: true
|
||||
|
||||
/clarity-codegen@0.2.6(@stacks/transactions@6.5.0):
|
||||
resolution: {integrity: sha512-1ZZoPO4VcqPkOaOPaj0OxgVeAJAjpga2nbbMTVynrYBEwN77hrWIwYfnICR0K3XFoyeW+mzxnYw9CpOvEA9eWQ==}
|
||||
/clarity-codegen@0.3.5(@stacks/transactions@6.5.0):
|
||||
resolution: {integrity: sha512-tMYXP0lyZ/WViR2vRHCdv/vD+VLhzguawa+GyGRhwMTaYzBRzgyvaZf1qipEf8tIhd8wQGI+3e9KGaWC8TRcaA==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@stacks/transactions': '*'
|
||||
|
||||
@@ -10,7 +10,7 @@ const contracts = [
|
||||
'amm-swap-pool',
|
||||
'amm-swap-pool-v1-1',
|
||||
'token-amm-swap-pool',
|
||||
|
||||
'swap-helper-bridged',
|
||||
'swap-helper-bridged-v1-1',
|
||||
];
|
||||
|
||||
|
||||
@@ -90,6 +90,26 @@ const NATIVE_TOKEN_MAPPING: {
|
||||
decimals: 1e8,
|
||||
assetIdentifier: `SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.brc20-chax::brc20-chax`,
|
||||
},
|
||||
[Currency.LEO]: {
|
||||
decimals: 1e6,
|
||||
assetIdentifier: 'SP1AY6K3PQV5MRT6R4S671NWW2FRVPKM0BR162CT6.leo-token::leo',
|
||||
},
|
||||
[Currency.MEGA]: {
|
||||
decimals: 1e2,
|
||||
assetIdentifier: 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.mega::mega',
|
||||
},
|
||||
[Currency.GUS]: {
|
||||
decimals: 1e6,
|
||||
assetIdentifier: 'SP1JFFSYTSH7VBM54K29ZFS9H4SVB67EA8VT2MYJ9.gus-token::gus',
|
||||
},
|
||||
[Currency.BRC20_ORMM]: {
|
||||
decimals: 1e8,
|
||||
assetIdentifier: `SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.brc20-ormm::brc20-ormm`,
|
||||
},
|
||||
[Currency.BRC20_ORDG]: {
|
||||
decimals: 1e8,
|
||||
assetIdentifier: `SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.brc20-ordg::brc20-ordg`,
|
||||
},
|
||||
};
|
||||
|
||||
export const configs = {
|
||||
|
||||
@@ -17,4 +17,9 @@ export enum Currency {
|
||||
aBTC = 'token-abtc',
|
||||
sLUNR = 'token-slunr',
|
||||
BRC20_CHAX = 'brc20-chax',
|
||||
LEO = "token-wleo",
|
||||
MEGA = "token-wmega-v2",
|
||||
GUS = "token-wgus",
|
||||
BRC20_ORDG = "brc20-ordg",
|
||||
BRC20_ORMM = "brc20-ormm",
|
||||
}
|
||||
|
||||
142
src/generated/smartContract/contract_swap-helper-bridged.ts
Normal file
142
src/generated/smartContract/contract_swap-helper-bridged.ts
Normal file
@@ -0,0 +1,142 @@
|
||||
|
||||
import {
|
||||
defineContract,
|
||||
principalT,
|
||||
uintT,
|
||||
optionalT,
|
||||
responseSimpleT,
|
||||
listT
|
||||
} from "../smartContractHelpers/codegenImport"
|
||||
|
||||
export const swapHelperBridged = defineContract({
|
||||
"swap-helper-bridged": {
|
||||
'swap-helper-from-amm': {
|
||||
input: [
|
||||
{ name: 'token-x-trait', type: principalT },
|
||||
{ name: 'token-y-trait', type: principalT },
|
||||
{ name: 'token-z-trait', type: principalT },
|
||||
{ name: 'factor-x', type: uintT },
|
||||
{ name: 'dx', type: uintT },
|
||||
{ name: 'min-dz', type: optionalT(uintT, ) }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'public'
|
||||
},
|
||||
'swap-helper-to-amm': {
|
||||
input: [
|
||||
{ name: 'token-x-trait', type: principalT },
|
||||
{ name: 'token-y-trait', type: principalT },
|
||||
{ name: 'token-z-trait', type: principalT },
|
||||
{ name: 'factor-y', type: uintT },
|
||||
{ name: 'dx', type: uintT },
|
||||
{ name: 'min-dz', type: optionalT(uintT, ) }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'public'
|
||||
},
|
||||
'fee-helper-from-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-x', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'fee-helper-to-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-y', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'get-helper-from-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-x', type: uintT },
|
||||
{ name: 'dx', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'get-helper-to-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-y', type: uintT },
|
||||
{ name: 'dx', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'oracle-instant-helper-from-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-x', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'oracle-instant-helper-to-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-y', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'oracle-resilient-helper-from-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-x', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'oracle-resilient-helper-to-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-y', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(uintT, ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'route-helper-from-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-x', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(listT(principalT, ), ),
|
||||
mode: 'readonly'
|
||||
},
|
||||
'route-helper-to-amm': {
|
||||
input: [
|
||||
{ name: 'token-x', type: principalT },
|
||||
{ name: 'token-y', type: principalT },
|
||||
{ name: 'token-z', type: principalT },
|
||||
{ name: 'factor-y', type: uintT }
|
||||
],
|
||||
output: responseSimpleT(listT(principalT, ), ),
|
||||
mode: 'readonly'
|
||||
}
|
||||
}
|
||||
} as const)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { swapHelperV103 } from "./contract_swap-helper-v1-03"
|
||||
import { ammSwapPool } from "./contract_amm-swap-pool"
|
||||
import { ammSwapPoolV11 } from "./contract_amm-swap-pool-v1-1"
|
||||
import { tokenAmmSwapPool } from "./contract_token-amm-swap-pool"
|
||||
import { swapHelperBridged } from "./contract_swap-helper-bridged"
|
||||
import { swapHelperBridgedV11 } from "./contract_swap-helper-bridged-v1-1"
|
||||
|
||||
export const AlexContracts = defineContract({
|
||||
@@ -12,6 +13,7 @@ export const AlexContracts = defineContract({
|
||||
...ammSwapPool,
|
||||
...ammSwapPoolV11,
|
||||
...tokenAmmSwapPool,
|
||||
...swapHelperBridged,
|
||||
...swapHelperBridgedV11
|
||||
});
|
||||
|
||||
|
||||
@@ -28,6 +28,11 @@ export namespace AMMSwapPool {
|
||||
AMM_SWAP_POOL_V1_1_WSTX_LUNAR = 'token-amm-swap-pool-v1-1:token-wstx,token-slunr,1e8',
|
||||
AMM_SWAP_POOL_V1_1_SUSDT_CHAX = 'token-amm-swap-pool-v1-1:token-susdt,brc20-chax,1e8',
|
||||
AMM_SWAP_POOL_V1_1_WSTX_ABTC = 'token-amm-swap-pool-v1-1:token-wstx,token-abtc,1e8',
|
||||
AMM_SWAP_POOL_V1_1_WSTX_WLEO = 'token-amm-swap-pool-v1-1:token-wstx,token-wleo,1e8',
|
||||
AMM_SWAP_POOL_V1_1_WSTX_WMEGA = 'token-amm-swap-pool-v1-1:token-wstx,token-wmega-v2,1e8',
|
||||
AMM_SWAP_POOL_V1_1_ABTC_BRC20ORDG = 'token-amm-swap-pool-v1-1:token-abtc,brc20-ordg,1e8',
|
||||
AMM_SWAP_POOL_V1_1_ABTC_BRC20ORMM = 'token-amm-swap-pool-v1-1:token-abtc,brc20-ormm,1e8',
|
||||
AMM_SWAP_POOL_V1_1_WSTX_WGUS = 'token-amm-swap-pool-v1-1:token-wstx,token-wgues,1e8',
|
||||
}
|
||||
|
||||
export type SwapTokens = Currency;
|
||||
@@ -70,6 +75,11 @@ export namespace AMMSwapPool {
|
||||
Pool.AMM_SWAP_POOL_V1_1_WSTX_LUNAR,
|
||||
Pool.AMM_SWAP_POOL_V1_1_SUSDT_CHAX,
|
||||
Pool.AMM_SWAP_POOL_V1_1_WSTX_ABTC,
|
||||
Pool.AMM_SWAP_POOL_V1_1_WSTX_WLEO,
|
||||
Pool.AMM_SWAP_POOL_V1_1_WSTX_WMEGA,
|
||||
Pool.AMM_SWAP_POOL_V1_1_ABTC_BRC20ORDG,
|
||||
Pool.AMM_SWAP_POOL_V1_1_ABTC_BRC20ORMM,
|
||||
Pool.AMM_SWAP_POOL_V1_1_WSTX_WGUS,
|
||||
];
|
||||
|
||||
export type PoolTokens = Pool;
|
||||
@@ -94,7 +104,13 @@ export namespace AMMSwapPool {
|
||||
export function breakDown(
|
||||
poolToken: AMMSwapPool.PoolTokens
|
||||
): [
|
||||
Currency.STX | Currency.ALEX | Currency.XUSD | Currency.sUSDT,
|
||||
(
|
||||
| Currency.STX
|
||||
| Currency.ALEX
|
||||
| Currency.XUSD
|
||||
| Currency.sUSDT
|
||||
| Currency.aBTC
|
||||
),
|
||||
AMMSwapPool.SwapTokens
|
||||
] {
|
||||
switch (poolToken) {
|
||||
@@ -137,6 +153,16 @@ export namespace AMMSwapPool {
|
||||
return [Currency.sUSDT, Currency.BRC20_CHAX];
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_ABTC:
|
||||
return [Currency.STX, Currency.aBTC];
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_WLEO:
|
||||
return [Currency.STX, Currency.LEO];
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_WMEGA:
|
||||
return [Currency.STX, Currency.MEGA];
|
||||
case Pool.AMM_SWAP_POOL_V1_1_ABTC_BRC20ORDG:
|
||||
return [Currency.aBTC, Currency.BRC20_ORDG];
|
||||
case Pool.AMM_SWAP_POOL_V1_1_ABTC_BRC20ORMM:
|
||||
return [Currency.aBTC, Currency.BRC20_ORMM];
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_WGUS:
|
||||
return [Currency.STX, Currency.GUS];
|
||||
default:
|
||||
assertNever(poolToken);
|
||||
}
|
||||
@@ -165,6 +191,11 @@ export namespace AMMSwapPool {
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_LUNAR:
|
||||
case Pool.AMM_SWAP_POOL_V1_1_SUSDT_CHAX:
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_ABTC:
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_WLEO:
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_WMEGA:
|
||||
case Pool.AMM_SWAP_POOL_V1_1_ABTC_BRC20ORDG:
|
||||
case Pool.AMM_SWAP_POOL_V1_1_ABTC_BRC20ORMM:
|
||||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_WGUS:
|
||||
return BigInt(1e8);
|
||||
case Pool.AMM_SWAP_POOL_V1_1_SUSDT_XUSD:
|
||||
return BigInt(0.05e8);
|
||||
|
||||
Reference in New Issue
Block a user