@allbridge/bridge-core-sdk 3.27.0-beta.6 → 3.27.0
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/dist/browser/index.js +1 -6
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +1 -6
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +1 -6
- package/dist/esm/index.js.map +4 -4
- package/dist/src/chains/chain.enums.d.ts +2 -12
- package/dist/src/chains/chain.enums.js +0 -10
- package/dist/src/chains/chain.enums.js.map +1 -1
- package/dist/src/chains/index.js +0 -12
- package/dist/src/chains/index.js.map +1 -1
- package/dist/src/client/core-api/api-client.js +0 -1
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.js +0 -33
- package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
- package/dist/src/client/core-api/core-api.model.d.ts +2 -14
- package/dist/src/client/core-api/core-api.model.js.map +1 -1
- package/dist/src/configs/mainnet.js +0 -1
- package/dist/src/configs/mainnet.js.map +1 -1
- package/dist/src/index.d.ts +4 -12
- package/dist/src/index.js +11 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/index.d.ts +4 -12
- package/dist/src/models/index.js +0 -4
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/bridge/evm/index.d.ts +0 -1
- package/dist/src/services/bridge/evm/index.js +33 -103
- package/dist/src/services/bridge/evm/index.js.map +1 -1
- package/dist/src/services/bridge/index.d.ts +2 -2
- package/dist/src/services/bridge/index.js +4 -31
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.model.d.ts +4 -13
- package/dist/src/services/bridge/models/bridge.model.js.map +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js.map +1 -1
- package/dist/src/services/bridge/srb/index.js +28 -36
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/sui/index.js +138 -166
- package/dist/src/services/bridge/sui/index.js.map +1 -1
- package/dist/src/services/bridge/trx/index.js +70 -98
- package/dist/src/services/bridge/trx/index.js.map +1 -1
- package/dist/src/services/bridge/utils.d.ts +1 -5
- package/dist/src/services/bridge/utils.js +23 -164
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/liquidity-pool/index.js +0 -21
- package/dist/src/services/liquidity-pool/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/sui/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/trx/index.js.map +1 -1
- package/dist/src/services/models/index.d.ts +5 -7
- package/dist/src/services/models/index.js.map +1 -1
- package/dist/src/services/token/index.js +2 -23
- package/dist/src/services/token/index.js.map +1 -1
- package/dist/src/services/token/models/token.model.d.ts +4 -4
- package/dist/src/services/token/models/token.model.js.map +1 -1
- package/dist/src/services/token/sui/index.js.map +1 -1
- package/dist/src/services/utils/trx/index.js.map +1 -1
- package/dist/src/services/yield/index.js +0 -8
- package/dist/src/services/yield/index.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +0 -25
- package/dist/src/tokens-info/tokens-info.model.js.map +1 -1
- package/dist/src/utils/index.d.ts +0 -3
- package/dist/src/utils/index.js +0 -3
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/utils.d.ts +0 -2
- package/dist/src/utils/utils.js +0 -11
- package/dist/src/utils/utils.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +2 -9
- package/dist/src/services/bridge/alg/index.d.ts +0 -16
- package/dist/src/services/bridge/alg/index.js +0 -191
- package/dist/src/services/bridge/alg/index.js.map +0 -1
- package/dist/src/services/bridge/stx/index.d.ts +0 -16
- package/dist/src/services/bridge/stx/index.js +0 -136
- package/dist/src/services/bridge/stx/index.js.map +0 -1
- package/dist/src/services/liquidity-pool/alg/index.d.ts +0 -19
- package/dist/src/services/liquidity-pool/alg/index.js +0 -135
- package/dist/src/services/liquidity-pool/alg/index.js.map +0 -1
- package/dist/src/services/liquidity-pool/stx/index.d.ts +0 -21
- package/dist/src/services/liquidity-pool/stx/index.js +0 -141
- package/dist/src/services/liquidity-pool/stx/index.js.map +0 -1
- package/dist/src/services/models/abi/PayerWithAbr.d.ts +0 -203
- package/dist/src/services/models/abi/PayerWithAbr.js +0 -266
- package/dist/src/services/models/abi/PayerWithAbr.js.map +0 -1
- package/dist/src/services/models/alg/BridgeClient.d.ts +0 -2751
- package/dist/src/services/models/alg/BridgeClient.js +0 -2685
- package/dist/src/services/models/alg/BridgeClient.js.map +0 -1
- package/dist/src/services/models/alg/PaddingUtilClient.d.ts +0 -654
- package/dist/src/services/models/alg/PaddingUtilClient.js +0 -425
- package/dist/src/services/models/alg/PaddingUtilClient.js.map +0 -1
- package/dist/src/services/models/alg/PoolClient.d.ts +0 -2276
- package/dist/src/services/models/alg/PoolClient.js +0 -2195
- package/dist/src/services/models/alg/PoolClient.js.map +0 -1
- package/dist/src/services/models/stx/clarigen-types.d.ts +0 -657
- package/dist/src/services/models/stx/clarigen-types.js +0 -2296
- package/dist/src/services/models/stx/clarigen-types.js.map +0 -1
- package/dist/src/services/token/alg/index.d.ts +0 -17
- package/dist/src/services/token/alg/index.js +0 -47
- package/dist/src/services/token/alg/index.js.map +0 -1
- package/dist/src/services/token/stx/index.d.ts +0 -20
- package/dist/src/services/token/stx/index.js +0 -59
- package/dist/src/services/token/stx/index.js.map +0 -1
- package/dist/src/services/utils/alg/index.d.ts +0 -9
- package/dist/src/services/utils/alg/index.js +0 -74
- package/dist/src/services/utils/alg/index.js.map +0 -1
- package/dist/src/services/utils/stx/get-token-name.d.ts +0 -2
- package/dist/src/services/utils/stx/get-token-name.js +0 -15
- package/dist/src/services/utils/stx/get-token-name.js.map +0 -1
- package/dist/src/services/utils/stx/post-conditions.d.ts +0 -3
- package/dist/src/services/utils/stx/post-conditions.js +0 -27
- package/dist/src/services/utils/stx/post-conditions.js.map +0 -1
- package/dist/src/utils/alg/index.d.ts +0 -21
- package/dist/src/utils/alg/index.js +0 -71
- package/dist/src/utils/alg/index.js.map +0 -1
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StxPoolService = void 0;
|
|
4
|
-
const core_1 = require("@clarigen/core");
|
|
5
|
-
const network_1 = require("@stacks/network");
|
|
6
|
-
const transactions_1 = require("@stacks/transactions");
|
|
7
|
-
const big_js_1 = require("big.js");
|
|
8
|
-
const chain_enums_1 = require("../../../chains/chain.enums");
|
|
9
|
-
const exceptions_1 = require("../../../exceptions");
|
|
10
|
-
const calculation_1 = require("../../../utils/calculation");
|
|
11
|
-
const clarigen_types_1 = require("../../models/stx/clarigen-types");
|
|
12
|
-
const get_token_name_1 = require("../../utils/stx/get-token-name");
|
|
13
|
-
const post_conditions_1 = require("../../utils/stx/post-conditions");
|
|
14
|
-
const models_1 = require("../models");
|
|
15
|
-
class StxPoolService extends models_1.ChainPoolService {
|
|
16
|
-
nodeRpcUrl;
|
|
17
|
-
params;
|
|
18
|
-
api;
|
|
19
|
-
chainType = chain_enums_1.ChainType.STX;
|
|
20
|
-
P = 48;
|
|
21
|
-
A = "20";
|
|
22
|
-
client;
|
|
23
|
-
constructor(nodeRpcUrl, params, api) {
|
|
24
|
-
super();
|
|
25
|
-
this.nodeRpcUrl = nodeRpcUrl;
|
|
26
|
-
this.params = params;
|
|
27
|
-
this.api = api;
|
|
28
|
-
const network = (0, network_1.createNetwork)({
|
|
29
|
-
network: this.params.stxIsTestnet ? "testnet" : "mainnet",
|
|
30
|
-
client: { baseUrl: this.nodeRpcUrl },
|
|
31
|
-
apiKey: this.params.stxHeroApiKey,
|
|
32
|
-
});
|
|
33
|
-
this.client = new core_1.ClarigenClient(network, this.params.stxHeroApiKey);
|
|
34
|
-
}
|
|
35
|
-
async getUserBalanceInfo(accountAddress, token) {
|
|
36
|
-
const pool = (0, core_1.contractFactory)(clarigen_types_1.stacksContracts.pool, token.poolAddress);
|
|
37
|
-
const lpAmount = await this.client.ro(pool.getLpBalance({ user: accountAddress }));
|
|
38
|
-
const rewardDebt = await this.client.ro(pool.getUserRewardDebt({ user: accountAddress }));
|
|
39
|
-
return new models_1.UserBalance({ lpAmount: lpAmount.toString(), rewardDebt: rewardDebt.toString() });
|
|
40
|
-
}
|
|
41
|
-
async getPoolInfoFromChain(token) {
|
|
42
|
-
const pool = (0, core_1.contractFactory)(clarigen_types_1.stacksContracts.pool, token.poolAddress);
|
|
43
|
-
const [dValueRaw, tokenBalanceRaw, vUsdBalanceRaw, totalLpAmountRaw, accRewardPerSharePRaw] = await Promise.all([
|
|
44
|
-
this.client.ro(pool.getD()),
|
|
45
|
-
this.client.ro(pool.getTokenBalance()),
|
|
46
|
-
this.client.ro(pool.getVusdBalance()),
|
|
47
|
-
this.client.ro(pool.getLpTotalSupply()),
|
|
48
|
-
this.client.ro(pool.getAccRewardPerShareP()),
|
|
49
|
-
]);
|
|
50
|
-
const dValue = dValueRaw.toString();
|
|
51
|
-
const tokenBalance = tokenBalanceRaw.toString();
|
|
52
|
-
const vUsdBalance = vUsdBalanceRaw.toString();
|
|
53
|
-
const totalLpAmount = totalLpAmountRaw.toString();
|
|
54
|
-
const accRewardPerShareP = accRewardPerSharePRaw.toString();
|
|
55
|
-
if (dValue && tokenBalance && vUsdBalance && totalLpAmount && accRewardPerShareP) {
|
|
56
|
-
const imbalance = (0, calculation_1.calculatePoolInfoImbalance)({ tokenBalance, vUsdBalance });
|
|
57
|
-
return {
|
|
58
|
-
aValue: this.A,
|
|
59
|
-
dValue,
|
|
60
|
-
tokenBalance,
|
|
61
|
-
vUsdBalance,
|
|
62
|
-
totalLpAmount,
|
|
63
|
-
accRewardPerShareP,
|
|
64
|
-
p: this.P,
|
|
65
|
-
imbalance,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
throw new exceptions_1.SdkError("Unable to pool info from chain");
|
|
69
|
-
}
|
|
70
|
-
async buildRawTransactionDeposit(params) {
|
|
71
|
-
const pool = (0, core_1.contractFactory)(clarigen_types_1.stacksContracts.pool, params.token.poolAddress);
|
|
72
|
-
const { contractAddress, contractName, functionName, functionArgs } = pool.deposit({
|
|
73
|
-
amount: BigInt(params.amount),
|
|
74
|
-
ftRef: params.token.tokenAddress,
|
|
75
|
-
});
|
|
76
|
-
const privateKey = (0, transactions_1.makeRandomPrivKey)();
|
|
77
|
-
const publicKey = (0, transactions_1.privateKeyToPublic)(privateKey);
|
|
78
|
-
const userPostFungibleCondition = (0, post_conditions_1.getFungiblePostCondition)(params.amount, "lte", params.accountAddress, params.token.tokenAddress, (0, get_token_name_1.getTokenName)(params.token));
|
|
79
|
-
const claimRewardsPostFungibleCondition = (0, post_conditions_1.getFungiblePostCondition)(0, "gte", params.token.poolAddress, params.token.tokenAddress, (0, get_token_name_1.getTokenName)(params.token));
|
|
80
|
-
const txOptions = {
|
|
81
|
-
contractAddress,
|
|
82
|
-
contractName,
|
|
83
|
-
functionName,
|
|
84
|
-
functionArgs,
|
|
85
|
-
publicKey,
|
|
86
|
-
validateWithAbi: true,
|
|
87
|
-
network: this.client.network,
|
|
88
|
-
postConditions: [userPostFungibleCondition, claimRewardsPostFungibleCondition],
|
|
89
|
-
postConditionMode: transactions_1.PostConditionMode.Deny,
|
|
90
|
-
};
|
|
91
|
-
const transaction = await (0, transactions_1.makeUnsignedContractCall)(txOptions);
|
|
92
|
-
return transaction.serialize();
|
|
93
|
-
}
|
|
94
|
-
async buildRawTransactionWithdraw(params) {
|
|
95
|
-
const pool = (0, core_1.contractFactory)(clarigen_types_1.stacksContracts.pool, params.token.poolAddress);
|
|
96
|
-
const { contractAddress, contractName, functionName, functionArgs } = pool.withdraw({
|
|
97
|
-
amountLp: BigInt(params.amount),
|
|
98
|
-
ftRef: params.token.tokenAddress,
|
|
99
|
-
});
|
|
100
|
-
const privateKey = (0, transactions_1.makeRandomPrivKey)();
|
|
101
|
-
const publicKey = (0, transactions_1.privateKeyToPublic)(privateKey);
|
|
102
|
-
const poolPostFungibleCondition = (0, post_conditions_1.getFungiblePostCondition)((0, calculation_1.fromSystemPrecision)(params.amount, params.token.decimals).toFixed(0, big_js_1.Big.roundDown), "gte", params.token.poolAddress, params.token.tokenAddress, (0, get_token_name_1.getTokenName)(params.token));
|
|
103
|
-
const txOptions = {
|
|
104
|
-
contractAddress,
|
|
105
|
-
contractName,
|
|
106
|
-
functionName,
|
|
107
|
-
functionArgs,
|
|
108
|
-
publicKey,
|
|
109
|
-
validateWithAbi: true,
|
|
110
|
-
network: this.client.network,
|
|
111
|
-
postConditions: [poolPostFungibleCondition],
|
|
112
|
-
postConditionMode: transactions_1.PostConditionMode.Deny,
|
|
113
|
-
};
|
|
114
|
-
const transaction = await (0, transactions_1.makeUnsignedContractCall)(txOptions);
|
|
115
|
-
return transaction.serialize();
|
|
116
|
-
}
|
|
117
|
-
async buildRawTransactionClaimRewards(params) {
|
|
118
|
-
const pool = (0, core_1.contractFactory)(clarigen_types_1.stacksContracts.pool, params.token.poolAddress);
|
|
119
|
-
const { contractAddress, contractName, functionName, functionArgs } = pool.claimRewards({
|
|
120
|
-
ftRef: params.token.tokenAddress,
|
|
121
|
-
});
|
|
122
|
-
const privateKey = (0, transactions_1.makeRandomPrivKey)();
|
|
123
|
-
const publicKey = (0, transactions_1.privateKeyToPublic)(privateKey);
|
|
124
|
-
const poolPostFungibleCondition = (0, post_conditions_1.getFungiblePostCondition)(0, "gte", params.token.poolAddress, params.token.tokenAddress, (0, get_token_name_1.getTokenName)(params.token));
|
|
125
|
-
const txOptions = {
|
|
126
|
-
contractAddress,
|
|
127
|
-
contractName,
|
|
128
|
-
functionName,
|
|
129
|
-
functionArgs,
|
|
130
|
-
publicKey,
|
|
131
|
-
validateWithAbi: true,
|
|
132
|
-
network: this.client.network,
|
|
133
|
-
postConditions: [poolPostFungibleCondition],
|
|
134
|
-
postConditionMode: transactions_1.PostConditionMode.Deny,
|
|
135
|
-
};
|
|
136
|
-
const transaction = await (0, transactions_1.makeUnsignedContractCall)(txOptions);
|
|
137
|
-
return transaction.serialize();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
exports.StxPoolService = StxPoolService;
|
|
141
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/liquidity-pool/stx/index.ts"],"names":[],"mappings":";;;AAAA,yCAAiE;AACjE,6CAAgD;AAChD,uDAK8B;AAC9B,mCAA6B;AAC7B,6DAAwD;AAExD,oDAA+C;AAG/C,4DAA6F;AAE7F,oEAA+E;AAC/E,mEAA8D;AAC9D,qEAA2E;AAC3E,sCAMmB;AAEnB,MAAa,cAAe,SAAQ,yBAAgB;IAQzC;IACA;IACA;IATT,SAAS,GAAkB,uBAAS,CAAC,GAAG,CAAC;IAEjC,CAAC,GAAG,EAAE,CAAC;IACP,CAAC,GAAG,IAAI,CAAC;IACT,MAAM,CAAiB;IAE/B,YACS,UAAkB,EAClB,MAA+B,EAC/B,GAAwB;QAE/B,KAAK,EAAE,CAAC;QAJD,eAAU,GAAV,UAAU,CAAQ;QAClB,WAAM,GAAN,MAAM,CAAyB;QAC/B,QAAG,GAAH,GAAG,CAAqB;QAG/B,MAAM,OAAO,GAAG,IAAA,uBAAa,EAAC;YAC5B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACzD,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;SAClC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAc,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,cAAsB,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,MAAM,CAAC,KAAK,CAAC,CAC3B,CAAC;QACF,MAAM,SAAS,GAAG;YAChB,eAAe;YACf,YAAY;YACZ,YAAY;YACZ,YAAY;YACZ,SAAS;YACT,eAAe,EAAE,IAAI;YACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,cAAc,EAAE,CAAC,yBAAyB,CAAC;YAC3C,iBAAiB,EAAE,gCAAiB,CAAC,IAAI;SAC1C,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,IAAA,uCAAwB,EAAC,SAAS,CAAC,CAAC;QAC9D,OAAO,WAAW,CAAC,SAAS,EAAE,CAAC;IACjC,CAAC;CACF;AAxKD,wCAwKC","sourcesContent":["import { ClarigenClient, contractFactory } from \"@clarigen/core\";\nimport { createNetwork } from \"@stacks/network\";\nimport {\n makeRandomPrivKey,\n makeUnsignedContractCall,\n PostConditionMode,\n privateKeyToPublic,\n} from \"@stacks/transactions\";\nimport { Big } from \"big.js\";\nimport { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { SdkError } from \"../../../exceptions\";\nimport { AllbridgeCoreSdkOptions } from \"../../../index\";\nimport { PoolInfo, TokenWithChainDetails } from \"../../../tokens-info\";\nimport { calculatePoolInfoImbalance, fromSystemPrecision } from \"../../../utils/calculation\";\nimport { RawStxTransaction } from \"../../models\";\nimport { stacksContracts as contracts } from \"../../models/stx/clarigen-types\";\nimport { getTokenName } from \"../../utils/stx/get-token-name\";\nimport { getFungiblePostCondition } from \"../../utils/stx/post-conditions\";\nimport {\n ChainPoolService,\n LiquidityPoolsParams,\n LiquidityPoolsParamsWithAmount,\n UserBalance,\n UserBalanceInfo,\n} from \"../models\";\n\nexport class StxPoolService extends ChainPoolService {\n chainType: ChainType.STX = ChainType.STX;\n\n private P = 48;\n private A = \"20\";\n private client: ClarigenClient;\n\n constructor(\n public nodeRpcUrl: string,\n public params: AllbridgeCoreSdkOptions,\n public api: AllbridgeCoreClient\n ) {\n super();\n const network = createNetwork({\n network: this.params.stxIsTestnet ? \"testnet\" : \"mainnet\",\n client: { baseUrl: this.nodeRpcUrl },\n apiKey: this.params.stxHeroApiKey,\n });\n this.client = new ClarigenClient(network, this.params.stxHeroApiKey);\n }\n\n async getUserBalanceInfo(accountAddress: string, token: TokenWithChainDetails): Promise<UserBalanceInfo> {\n const pool = contractFactory(contracts.pool, token.poolAddress);\n\n const lpAmount = await this.client.ro(pool.getLpBalance({ user: accountAddress }));\n const rewardDebt = await this.client.ro(pool.getUserRewardDebt({ user: accountAddress }));\n\n return new UserBalance({ lpAmount: lpAmount.toString(), rewardDebt: rewardDebt.toString() });\n }\n\n async getPoolInfoFromChain(token: TokenWithChainDetails): Promise<PoolInfo> {\n const pool = contractFactory(contracts.pool, token.poolAddress);\n\n const [dValueRaw, tokenBalanceRaw, vUsdBalanceRaw, totalLpAmountRaw, accRewardPerSharePRaw] = await Promise.all([\n this.client.ro(pool.getD()),\n this.client.ro(pool.getTokenBalance()),\n this.client.ro(pool.getVusdBalance()),\n this.client.ro(pool.getLpTotalSupply()),\n this.client.ro(pool.getAccRewardPerShareP()),\n ]);\n\n const dValue = dValueRaw.toString();\n const tokenBalance = tokenBalanceRaw.toString();\n const vUsdBalance = vUsdBalanceRaw.toString();\n const totalLpAmount = totalLpAmountRaw.toString();\n const accRewardPerShareP = accRewardPerSharePRaw.toString();\n if (dValue && tokenBalance && vUsdBalance && totalLpAmount && accRewardPerShareP) {\n const imbalance = calculatePoolInfoImbalance({ tokenBalance, vUsdBalance });\n return {\n aValue: this.A,\n dValue,\n tokenBalance,\n vUsdBalance,\n totalLpAmount,\n accRewardPerShareP,\n p: this.P,\n imbalance,\n };\n }\n throw new SdkError(\"Unable to pool info from chain\");\n }\n\n async buildRawTransactionDeposit(params: LiquidityPoolsParamsWithAmount): Promise<RawStxTransaction> {\n const pool = contractFactory(contracts.pool, params.token.poolAddress);\n\n const { contractAddress, contractName, functionName, functionArgs } = pool.deposit({\n amount: BigInt(params.amount),\n ftRef: params.token.tokenAddress,\n });\n\n const privateKey = makeRandomPrivKey();\n const publicKey = privateKeyToPublic(privateKey);\n\n const userPostFungibleCondition = getFungiblePostCondition(\n params.amount,\n \"lte\",\n params.accountAddress,\n params.token.tokenAddress,\n getTokenName(params.token)\n );\n\n const claimRewardsPostFungibleCondition = getFungiblePostCondition(\n 0,\n \"gte\",\n params.token.poolAddress,\n params.token.tokenAddress,\n getTokenName(params.token)\n );\n\n const txOptions = {\n contractAddress,\n contractName,\n functionName,\n functionArgs,\n publicKey,\n validateWithAbi: true,\n network: this.client.network,\n postConditions: [userPostFungibleCondition, claimRewardsPostFungibleCondition],\n postConditionMode: PostConditionMode.Deny,\n };\n const transaction = await makeUnsignedContractCall(txOptions);\n return transaction.serialize();\n }\n\n async buildRawTransactionWithdraw(params: LiquidityPoolsParamsWithAmount): Promise<RawStxTransaction> {\n const pool = contractFactory(contracts.pool, params.token.poolAddress);\n\n const { contractAddress, contractName, functionName, functionArgs } = pool.withdraw({\n amountLp: BigInt(params.amount),\n ftRef: params.token.tokenAddress,\n });\n\n const privateKey = makeRandomPrivKey();\n const publicKey = privateKeyToPublic(privateKey);\n\n const poolPostFungibleCondition = getFungiblePostCondition(\n fromSystemPrecision(params.amount, params.token.decimals).toFixed(0, Big.roundDown),\n \"gte\",\n params.token.poolAddress,\n params.token.tokenAddress,\n getTokenName(params.token)\n );\n const txOptions = {\n contractAddress,\n contractName,\n functionName,\n functionArgs,\n publicKey,\n validateWithAbi: true,\n network: this.client.network,\n postConditions: [poolPostFungibleCondition],\n postConditionMode: PostConditionMode.Deny,\n };\n const transaction = await makeUnsignedContractCall(txOptions);\n return transaction.serialize();\n }\n\n async buildRawTransactionClaimRewards(params: LiquidityPoolsParams): Promise<RawStxTransaction> {\n const pool = contractFactory(contracts.pool, params.token.poolAddress);\n\n const { contractAddress, contractName, functionName, functionArgs } = pool.claimRewards({\n ftRef: params.token.tokenAddress,\n });\n\n const privateKey = makeRandomPrivKey();\n const publicKey = privateKeyToPublic(privateKey);\n\n const poolPostFungibleCondition = getFungiblePostCondition(\n 0,\n \"gte\",\n params.token.poolAddress,\n params.token.tokenAddress,\n getTokenName(params.token)\n );\n const txOptions = {\n contractAddress,\n contractName,\n functionName,\n functionArgs,\n publicKey,\n validateWithAbi: true,\n network: this.client.network,\n postConditions: [poolPostFungibleCondition],\n postConditionMode: PostConditionMode.Deny,\n };\n const transaction = await makeUnsignedContractCall(txOptions);\n return transaction.serialize();\n }\n}\n"]}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
declare const artifact: {
|
|
2
|
-
readonly abi: readonly [{
|
|
3
|
-
readonly inputs: readonly [{
|
|
4
|
-
readonly internalType: "address";
|
|
5
|
-
readonly name: "_abrTokenAddress";
|
|
6
|
-
readonly type: "address";
|
|
7
|
-
}, {
|
|
8
|
-
readonly internalType: "uint256";
|
|
9
|
-
readonly name: "_chainPrecision";
|
|
10
|
-
readonly type: "uint256";
|
|
11
|
-
}];
|
|
12
|
-
readonly stateMutability: "nonpayable";
|
|
13
|
-
readonly type: "constructor";
|
|
14
|
-
}, {
|
|
15
|
-
readonly anonymous: false;
|
|
16
|
-
readonly inputs: readonly [{
|
|
17
|
-
readonly indexed: true;
|
|
18
|
-
readonly internalType: "address";
|
|
19
|
-
readonly name: "previousOwner";
|
|
20
|
-
readonly type: "address";
|
|
21
|
-
}, {
|
|
22
|
-
readonly indexed: true;
|
|
23
|
-
readonly internalType: "address";
|
|
24
|
-
readonly name: "newOwner";
|
|
25
|
-
readonly type: "address";
|
|
26
|
-
}];
|
|
27
|
-
readonly name: "OwnershipTransferred";
|
|
28
|
-
readonly type: "event";
|
|
29
|
-
}, {
|
|
30
|
-
readonly stateMutability: "payable";
|
|
31
|
-
readonly type: "fallback";
|
|
32
|
-
}, {
|
|
33
|
-
readonly inputs: readonly [];
|
|
34
|
-
readonly name: "abrToken";
|
|
35
|
-
readonly outputs: readonly [{
|
|
36
|
-
readonly internalType: "contract IERC20Metadata";
|
|
37
|
-
readonly name: "";
|
|
38
|
-
readonly type: "address";
|
|
39
|
-
}];
|
|
40
|
-
readonly stateMutability: "view";
|
|
41
|
-
readonly type: "function";
|
|
42
|
-
}, {
|
|
43
|
-
readonly inputs: readonly [{
|
|
44
|
-
readonly internalType: "address";
|
|
45
|
-
readonly name: "_tokenAddress";
|
|
46
|
-
readonly type: "address";
|
|
47
|
-
}, {
|
|
48
|
-
readonly internalType: "address";
|
|
49
|
-
readonly name: "_bridge";
|
|
50
|
-
readonly type: "address";
|
|
51
|
-
}];
|
|
52
|
-
readonly name: "approveBridgeToken";
|
|
53
|
-
readonly outputs: readonly [];
|
|
54
|
-
readonly stateMutability: "nonpayable";
|
|
55
|
-
readonly type: "function";
|
|
56
|
-
}, {
|
|
57
|
-
readonly inputs: readonly [];
|
|
58
|
-
readonly name: "exchangeRate";
|
|
59
|
-
readonly outputs: readonly [{
|
|
60
|
-
readonly internalType: "uint256";
|
|
61
|
-
readonly name: "";
|
|
62
|
-
readonly type: "uint256";
|
|
63
|
-
}];
|
|
64
|
-
readonly stateMutability: "view";
|
|
65
|
-
readonly type: "function";
|
|
66
|
-
}, {
|
|
67
|
-
readonly inputs: readonly [{
|
|
68
|
-
readonly internalType: "uint256";
|
|
69
|
-
readonly name: "_amount";
|
|
70
|
-
readonly type: "uint256";
|
|
71
|
-
}];
|
|
72
|
-
readonly name: "nativeTokensToAbr";
|
|
73
|
-
readonly outputs: readonly [{
|
|
74
|
-
readonly internalType: "uint256";
|
|
75
|
-
readonly name: "";
|
|
76
|
-
readonly type: "uint256";
|
|
77
|
-
}];
|
|
78
|
-
readonly stateMutability: "view";
|
|
79
|
-
readonly type: "function";
|
|
80
|
-
}, {
|
|
81
|
-
readonly inputs: readonly [];
|
|
82
|
-
readonly name: "owner";
|
|
83
|
-
readonly outputs: readonly [{
|
|
84
|
-
readonly internalType: "address";
|
|
85
|
-
readonly name: "";
|
|
86
|
-
readonly type: "address";
|
|
87
|
-
}];
|
|
88
|
-
readonly stateMutability: "view";
|
|
89
|
-
readonly type: "function";
|
|
90
|
-
}, {
|
|
91
|
-
readonly inputs: readonly [{
|
|
92
|
-
readonly internalType: "uint256";
|
|
93
|
-
readonly name: "_id";
|
|
94
|
-
readonly type: "uint256";
|
|
95
|
-
}, {
|
|
96
|
-
readonly internalType: "address";
|
|
97
|
-
readonly name: "_target";
|
|
98
|
-
readonly type: "address";
|
|
99
|
-
}, {
|
|
100
|
-
readonly internalType: "string";
|
|
101
|
-
readonly name: "_signature";
|
|
102
|
-
readonly type: "string";
|
|
103
|
-
}];
|
|
104
|
-
readonly name: "registerTarget";
|
|
105
|
-
readonly outputs: readonly [];
|
|
106
|
-
readonly stateMutability: "nonpayable";
|
|
107
|
-
readonly type: "function";
|
|
108
|
-
}, {
|
|
109
|
-
readonly inputs: readonly [];
|
|
110
|
-
readonly name: "renounceOwnership";
|
|
111
|
-
readonly outputs: readonly [];
|
|
112
|
-
readonly stateMutability: "nonpayable";
|
|
113
|
-
readonly type: "function";
|
|
114
|
-
}, {
|
|
115
|
-
readonly inputs: readonly [{
|
|
116
|
-
readonly internalType: "uint256";
|
|
117
|
-
readonly name: "_newExchangeRate";
|
|
118
|
-
readonly type: "uint256";
|
|
119
|
-
}];
|
|
120
|
-
readonly name: "setExchangeRate";
|
|
121
|
-
readonly outputs: readonly [];
|
|
122
|
-
readonly stateMutability: "nonpayable";
|
|
123
|
-
readonly type: "function";
|
|
124
|
-
}, {
|
|
125
|
-
readonly inputs: readonly [{
|
|
126
|
-
readonly internalType: "uint256";
|
|
127
|
-
readonly name: "id";
|
|
128
|
-
readonly type: "uint256";
|
|
129
|
-
}];
|
|
130
|
-
readonly name: "targets";
|
|
131
|
-
readonly outputs: readonly [{
|
|
132
|
-
readonly internalType: "address";
|
|
133
|
-
readonly name: "target";
|
|
134
|
-
readonly type: "address";
|
|
135
|
-
}, {
|
|
136
|
-
readonly internalType: "bytes4";
|
|
137
|
-
readonly name: "selector";
|
|
138
|
-
readonly type: "bytes4";
|
|
139
|
-
}];
|
|
140
|
-
readonly stateMutability: "view";
|
|
141
|
-
readonly type: "function";
|
|
142
|
-
}, {
|
|
143
|
-
readonly inputs: readonly [{
|
|
144
|
-
readonly internalType: "address";
|
|
145
|
-
readonly name: "newOwner";
|
|
146
|
-
readonly type: "address";
|
|
147
|
-
}];
|
|
148
|
-
readonly name: "transferOwnership";
|
|
149
|
-
readonly outputs: readonly [];
|
|
150
|
-
readonly stateMutability: "nonpayable";
|
|
151
|
-
readonly type: "function";
|
|
152
|
-
}, {
|
|
153
|
-
readonly inputs: readonly [{
|
|
154
|
-
readonly internalType: "address";
|
|
155
|
-
readonly name: "_token";
|
|
156
|
-
readonly type: "address";
|
|
157
|
-
}, {
|
|
158
|
-
readonly internalType: "uint256";
|
|
159
|
-
readonly name: "_amount";
|
|
160
|
-
readonly type: "uint256";
|
|
161
|
-
}, {
|
|
162
|
-
readonly internalType: "uint256";
|
|
163
|
-
readonly name: "_abrAmount";
|
|
164
|
-
readonly type: "uint256";
|
|
165
|
-
}, {
|
|
166
|
-
readonly internalType: "uint256";
|
|
167
|
-
readonly name: "_targetId";
|
|
168
|
-
readonly type: "uint256";
|
|
169
|
-
}, {
|
|
170
|
-
readonly internalType: "bytes";
|
|
171
|
-
readonly name: "_params";
|
|
172
|
-
readonly type: "bytes";
|
|
173
|
-
}];
|
|
174
|
-
readonly name: "transferTokensAndCallTarget";
|
|
175
|
-
readonly outputs: readonly [];
|
|
176
|
-
readonly stateMutability: "payable";
|
|
177
|
-
readonly type: "function";
|
|
178
|
-
}, {
|
|
179
|
-
readonly inputs: readonly [{
|
|
180
|
-
readonly internalType: "uint256";
|
|
181
|
-
readonly name: "amount";
|
|
182
|
-
readonly type: "uint256";
|
|
183
|
-
}];
|
|
184
|
-
readonly name: "withdrawGas";
|
|
185
|
-
readonly outputs: readonly [];
|
|
186
|
-
readonly stateMutability: "nonpayable";
|
|
187
|
-
readonly type: "function";
|
|
188
|
-
}, {
|
|
189
|
-
readonly inputs: readonly [{
|
|
190
|
-
readonly internalType: "address";
|
|
191
|
-
readonly name: "tokenAddress";
|
|
192
|
-
readonly type: "address";
|
|
193
|
-
}];
|
|
194
|
-
readonly name: "withdrawTokens";
|
|
195
|
-
readonly outputs: readonly [];
|
|
196
|
-
readonly stateMutability: "nonpayable";
|
|
197
|
-
readonly type: "function";
|
|
198
|
-
}, {
|
|
199
|
-
readonly stateMutability: "payable";
|
|
200
|
-
readonly type: "receive";
|
|
201
|
-
}];
|
|
202
|
-
};
|
|
203
|
-
export default artifact;
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const artifact = {
|
|
4
|
-
abi: [
|
|
5
|
-
{
|
|
6
|
-
inputs: [
|
|
7
|
-
{
|
|
8
|
-
internalType: "address",
|
|
9
|
-
name: "_abrTokenAddress",
|
|
10
|
-
type: "address",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
internalType: "uint256",
|
|
14
|
-
name: "_chainPrecision",
|
|
15
|
-
type: "uint256",
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
stateMutability: "nonpayable",
|
|
19
|
-
type: "constructor",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
anonymous: false,
|
|
23
|
-
inputs: [
|
|
24
|
-
{
|
|
25
|
-
indexed: true,
|
|
26
|
-
internalType: "address",
|
|
27
|
-
name: "previousOwner",
|
|
28
|
-
type: "address",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
indexed: true,
|
|
32
|
-
internalType: "address",
|
|
33
|
-
name: "newOwner",
|
|
34
|
-
type: "address",
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
name: "OwnershipTransferred",
|
|
38
|
-
type: "event",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
stateMutability: "payable",
|
|
42
|
-
type: "fallback",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
inputs: [],
|
|
46
|
-
name: "abrToken",
|
|
47
|
-
outputs: [
|
|
48
|
-
{
|
|
49
|
-
internalType: "contract IERC20Metadata",
|
|
50
|
-
name: "",
|
|
51
|
-
type: "address",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
stateMutability: "view",
|
|
55
|
-
type: "function",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
inputs: [
|
|
59
|
-
{
|
|
60
|
-
internalType: "address",
|
|
61
|
-
name: "_tokenAddress",
|
|
62
|
-
type: "address",
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
internalType: "address",
|
|
66
|
-
name: "_bridge",
|
|
67
|
-
type: "address",
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
name: "approveBridgeToken",
|
|
71
|
-
outputs: [],
|
|
72
|
-
stateMutability: "nonpayable",
|
|
73
|
-
type: "function",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
inputs: [],
|
|
77
|
-
name: "exchangeRate",
|
|
78
|
-
outputs: [
|
|
79
|
-
{
|
|
80
|
-
internalType: "uint256",
|
|
81
|
-
name: "",
|
|
82
|
-
type: "uint256",
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
stateMutability: "view",
|
|
86
|
-
type: "function",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
inputs: [
|
|
90
|
-
{
|
|
91
|
-
internalType: "uint256",
|
|
92
|
-
name: "_amount",
|
|
93
|
-
type: "uint256",
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
name: "nativeTokensToAbr",
|
|
97
|
-
outputs: [
|
|
98
|
-
{
|
|
99
|
-
internalType: "uint256",
|
|
100
|
-
name: "",
|
|
101
|
-
type: "uint256",
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
stateMutability: "view",
|
|
105
|
-
type: "function",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
inputs: [],
|
|
109
|
-
name: "owner",
|
|
110
|
-
outputs: [
|
|
111
|
-
{
|
|
112
|
-
internalType: "address",
|
|
113
|
-
name: "",
|
|
114
|
-
type: "address",
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
stateMutability: "view",
|
|
118
|
-
type: "function",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
inputs: [
|
|
122
|
-
{
|
|
123
|
-
internalType: "uint256",
|
|
124
|
-
name: "_id",
|
|
125
|
-
type: "uint256",
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
internalType: "address",
|
|
129
|
-
name: "_target",
|
|
130
|
-
type: "address",
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
internalType: "string",
|
|
134
|
-
name: "_signature",
|
|
135
|
-
type: "string",
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
name: "registerTarget",
|
|
139
|
-
outputs: [],
|
|
140
|
-
stateMutability: "nonpayable",
|
|
141
|
-
type: "function",
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
inputs: [],
|
|
145
|
-
name: "renounceOwnership",
|
|
146
|
-
outputs: [],
|
|
147
|
-
stateMutability: "nonpayable",
|
|
148
|
-
type: "function",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
inputs: [
|
|
152
|
-
{
|
|
153
|
-
internalType: "uint256",
|
|
154
|
-
name: "_newExchangeRate",
|
|
155
|
-
type: "uint256",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
name: "setExchangeRate",
|
|
159
|
-
outputs: [],
|
|
160
|
-
stateMutability: "nonpayable",
|
|
161
|
-
type: "function",
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
inputs: [
|
|
165
|
-
{
|
|
166
|
-
internalType: "uint256",
|
|
167
|
-
name: "id",
|
|
168
|
-
type: "uint256",
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
name: "targets",
|
|
172
|
-
outputs: [
|
|
173
|
-
{
|
|
174
|
-
internalType: "address",
|
|
175
|
-
name: "target",
|
|
176
|
-
type: "address",
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
internalType: "bytes4",
|
|
180
|
-
name: "selector",
|
|
181
|
-
type: "bytes4",
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
stateMutability: "view",
|
|
185
|
-
type: "function",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
inputs: [
|
|
189
|
-
{
|
|
190
|
-
internalType: "address",
|
|
191
|
-
name: "newOwner",
|
|
192
|
-
type: "address",
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
name: "transferOwnership",
|
|
196
|
-
outputs: [],
|
|
197
|
-
stateMutability: "nonpayable",
|
|
198
|
-
type: "function",
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
inputs: [
|
|
202
|
-
{
|
|
203
|
-
internalType: "address",
|
|
204
|
-
name: "_token",
|
|
205
|
-
type: "address",
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
internalType: "uint256",
|
|
209
|
-
name: "_amount",
|
|
210
|
-
type: "uint256",
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
internalType: "uint256",
|
|
214
|
-
name: "_abrAmount",
|
|
215
|
-
type: "uint256",
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
internalType: "uint256",
|
|
219
|
-
name: "_targetId",
|
|
220
|
-
type: "uint256",
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
internalType: "bytes",
|
|
224
|
-
name: "_params",
|
|
225
|
-
type: "bytes",
|
|
226
|
-
},
|
|
227
|
-
],
|
|
228
|
-
name: "transferTokensAndCallTarget",
|
|
229
|
-
outputs: [],
|
|
230
|
-
stateMutability: "payable",
|
|
231
|
-
type: "function",
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
inputs: [
|
|
235
|
-
{
|
|
236
|
-
internalType: "uint256",
|
|
237
|
-
name: "amount",
|
|
238
|
-
type: "uint256",
|
|
239
|
-
},
|
|
240
|
-
],
|
|
241
|
-
name: "withdrawGas",
|
|
242
|
-
outputs: [],
|
|
243
|
-
stateMutability: "nonpayable",
|
|
244
|
-
type: "function",
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
inputs: [
|
|
248
|
-
{
|
|
249
|
-
internalType: "address",
|
|
250
|
-
name: "tokenAddress",
|
|
251
|
-
type: "address",
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
name: "withdrawTokens",
|
|
255
|
-
outputs: [],
|
|
256
|
-
stateMutability: "nonpayable",
|
|
257
|
-
type: "function",
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
stateMutability: "payable",
|
|
261
|
-
type: "receive",
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
};
|
|
265
|
-
exports.default = artifact;
|
|
266
|
-
//# sourceMappingURL=PayerWithAbr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PayerWithAbr.js","sourceRoot":"","sources":["../../../../../src/services/models/abi/PayerWithAbr.ts"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG;IACf,GAAG,EAAE;QACH;YACE,MAAM,EAAE;gBACN;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,SAAS;iBAChB;aACF;YACD,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,aAAa;SACpB;QACD;YACE,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE;gBACN;oBACE,OAAO,EAAE,IAAI;oBACb,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,eAAe;oBACrB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,OAAO,EAAE,IAAI;oBACb,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,UAAU;oBAChB,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AAE,YAAY;YAC7B,IAAI,EAAE,UAAU;SACjB;QACD;YACE,eAAe,EAAE,SAAS;YAC1B,IAAI,EAAE,SAAS;SAChB;KACF;CACO,CAAC;AACX,kBAAe,QAAQ,CAAC","sourcesContent":["const artifact = {\n abi: [\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"_abrTokenAddress\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"_chainPrecision\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"constructor\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"previousOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n stateMutability: \"payable\",\n type: \"fallback\",\n },\n {\n inputs: [],\n name: \"abrToken\",\n outputs: [\n {\n internalType: \"contract IERC20Metadata\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"_tokenAddress\",\n type: \"address\",\n },\n {\n internalType: \"address\",\n name: \"_bridge\",\n type: \"address\",\n },\n ],\n name: \"approveBridgeToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"exchangeRate\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"_amount\",\n type: \"uint256\",\n },\n ],\n name: \"nativeTokensToAbr\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [\n {\n internalType: \"address\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"_id\",\n type: \"uint256\",\n },\n {\n internalType: \"address\",\n name: \"_target\",\n type: \"address\",\n },\n {\n internalType: \"string\",\n name: \"_signature\",\n type: \"string\",\n },\n ],\n name: \"registerTarget\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"_newExchangeRate\",\n type: \"uint256\",\n },\n ],\n name: \"setExchangeRate\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"id\",\n type: \"uint256\",\n },\n ],\n name: \"targets\",\n outputs: [\n {\n internalType: \"address\",\n name: \"target\",\n type: \"address\",\n },\n {\n internalType: \"bytes4\",\n name: \"selector\",\n type: \"bytes4\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"_token\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"_amount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"_abrAmount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"_targetId\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"_params\",\n type: \"bytes\",\n },\n ],\n name: \"transferTokensAndCallTarget\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"withdrawGas\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"tokenAddress\",\n type: \"address\",\n },\n ],\n name: \"withdrawTokens\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n stateMutability: \"payable\",\n type: \"receive\",\n },\n ],\n} as const;\nexport default artifact;\n"]}
|