@defisaver/automation-sdk 1.2.21 → 1.2.23
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.
|
@@ -239,11 +239,11 @@ function parseLiquityBondProtection(position, parseData) {
|
|
|
239
239
|
};
|
|
240
240
|
return _position;
|
|
241
241
|
}
|
|
242
|
-
function parseExchangeDca(position, parseData) {
|
|
242
|
+
function parseExchangeDca(position, parseData, chainId) {
|
|
243
243
|
const _position = cloneDeep(position);
|
|
244
244
|
const { subStruct } = parseData.subscriptionEventData;
|
|
245
245
|
_position.strategyData.decoded.triggerData = triggerService.exchangeTimestampTrigger.decode(subStruct.triggerData);
|
|
246
|
-
_position.strategyData.decoded.subData = subDataService.exchangeDcaSubData.decode(subStruct.subData);
|
|
246
|
+
_position.strategyData.decoded.subData = subDataService.exchangeDcaSubData.decode(subStruct.subData, chainId);
|
|
247
247
|
return _position;
|
|
248
248
|
}
|
|
249
249
|
function parseExchangeLimitOrder(position, parseData, chainId) {
|
|
@@ -75,7 +75,7 @@ export declare const liquityPaybackUsingChickenBondSubData: {
|
|
|
75
75
|
};
|
|
76
76
|
export declare const exchangeDcaSubData: {
|
|
77
77
|
encode: (fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, interval: number) => string[];
|
|
78
|
-
decode: (subData: string[]) => {
|
|
78
|
+
decode: (subData: string[], chainId: ChainId) => {
|
|
79
79
|
fromToken: string;
|
|
80
80
|
toToken: string;
|
|
81
81
|
amount: string;
|
|
@@ -188,10 +188,10 @@ export const exchangeDcaSubData = {
|
|
|
188
188
|
const intervalEncoded = mockedWeb3.eth.abi.encodeParameter('uint256', interval);
|
|
189
189
|
return [sellTokenEncoded, buyTokenEncoded, amountEncoded, intervalEncoded];
|
|
190
190
|
},
|
|
191
|
-
decode: (subData) => {
|
|
191
|
+
decode: (subData, chainId) => {
|
|
192
192
|
const fromToken = mockedWeb3.eth.abi.decodeParameter('address', subData[0]).toString();
|
|
193
193
|
const toToken = mockedWeb3.eth.abi.decodeParameter('address', subData[1]).toString();
|
|
194
|
-
const amount = assetAmountInEth(mockedWeb3.eth.abi.decodeParameter('uint256', subData[2]).toString(), getAssetInfoByAddress(fromToken).symbol);
|
|
194
|
+
const amount = assetAmountInEth(mockedWeb3.eth.abi.decodeParameter('uint256', subData[2]).toString(), getAssetInfoByAddress(fromToken, chainId).symbol);
|
|
195
195
|
const interval = mockedWeb3.eth.abi.decodeParameter('uint256', subData[3]).toString();
|
|
196
196
|
return {
|
|
197
197
|
fromToken,
|
package/package.json
CHANGED
|
@@ -330,13 +330,13 @@ function parseLiquityBondProtection(position: Position.Automated, parseData: Par
|
|
|
330
330
|
return _position;
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
function parseExchangeDca(position: Position.Automated, parseData: ParseData): Position.Automated {
|
|
333
|
+
function parseExchangeDca(position: Position.Automated, parseData: ParseData, chainId: ChainId): Position.Automated {
|
|
334
334
|
const _position = cloneDeep(position);
|
|
335
335
|
|
|
336
336
|
const { subStruct } = parseData.subscriptionEventData;
|
|
337
337
|
|
|
338
338
|
_position.strategyData.decoded.triggerData = triggerService.exchangeTimestampTrigger.decode(subStruct.triggerData);
|
|
339
|
-
_position.strategyData.decoded.subData = subDataService.exchangeDcaSubData.decode(subStruct.subData);
|
|
339
|
+
_position.strategyData.decoded.subData = subDataService.exchangeDcaSubData.decode(subStruct.subData, chainId);
|
|
340
340
|
|
|
341
341
|
return _position;
|
|
342
342
|
}
|
|
@@ -262,10 +262,10 @@ export const exchangeDcaSubData = {
|
|
|
262
262
|
|
|
263
263
|
return [sellTokenEncoded, buyTokenEncoded, amountEncoded, intervalEncoded];
|
|
264
264
|
},
|
|
265
|
-
decode: (subData: SubData) => {
|
|
265
|
+
decode: (subData: SubData, chainId: ChainId) => {
|
|
266
266
|
const fromToken = mockedWeb3.eth.abi.decodeParameter('address', subData[0]).toString();
|
|
267
267
|
const toToken = mockedWeb3.eth.abi.decodeParameter('address', subData[1]).toString();
|
|
268
|
-
const amount = assetAmountInEth(mockedWeb3.eth.abi.decodeParameter('uint256', subData[2]).toString(), getAssetInfoByAddress(fromToken).symbol);
|
|
268
|
+
const amount = assetAmountInEth(mockedWeb3.eth.abi.decodeParameter('uint256', subData[2]).toString(), getAssetInfoByAddress(fromToken, chainId).symbol);
|
|
269
269
|
const interval = mockedWeb3.eth.abi.decodeParameter('uint256', subData[3]).toString();
|
|
270
270
|
return {
|
|
271
271
|
fromToken,
|