@gearbox-protocol/sdk 14.11.14 → 14.11.15
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/cjs/plugins/adapters/abi/actionAbi.js +4 -2
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +4 -2
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +47 -21
- package/dist/esm/plugins/adapters/abi/actionAbi.js +4 -2
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +4 -2
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +47 -21
- package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +8 -5
- package/package.json +1 -1
|
@@ -64,10 +64,12 @@ const adapterActionSignatures = {
|
|
|
64
64
|
310: "function setVaultStatusBatch((address,bool)[])"
|
|
65
65
|
},
|
|
66
66
|
[import_types.AdapterType.MIDAS_ISSUANCE_VAULT]: {
|
|
67
|
-
310: "function setTokenAllowedStatusBatch(address[],bool[])"
|
|
67
|
+
310: "function setTokenAllowedStatusBatch(address[],bool[])",
|
|
68
|
+
311: "function setInputTokenStatusBatch(address[],bool[])"
|
|
68
69
|
},
|
|
69
70
|
[import_types.AdapterType.MIDAS_REDEMPTION_VAULT]: {
|
|
70
|
-
310: "function setTokenAllowedStatusBatch((address,address,bool)[])"
|
|
71
|
+
310: "function setTokenAllowedStatusBatch((address,address,bool)[])",
|
|
72
|
+
311: "function setOutputTokenStatusBatch(address[],bool[])"
|
|
71
73
|
},
|
|
72
74
|
[import_types.AdapterType.PENDLE_ROUTER]: {
|
|
73
75
|
310: "function setPairStatusBatch((address,address,address,uint8)[])",
|
|
@@ -63,7 +63,8 @@ const adapterConstructorAbi = {
|
|
|
63
63
|
310: import_conctructorAbiPatterns.BASIC_ADAPTER_ABI
|
|
64
64
|
},
|
|
65
65
|
[import_types.AdapterType.MIDAS_REDEMPTION_VAULT]: {
|
|
66
|
-
310: import_conctructorAbiPatterns.BASIC_ADAPTER_ABI
|
|
66
|
+
310: import_conctructorAbiPatterns.BASIC_ADAPTER_ABI,
|
|
67
|
+
311: import_conctructorAbiPatterns.BASIC_ADAPTER_ABI
|
|
67
68
|
},
|
|
68
69
|
[import_types.AdapterType.PENDLE_ROUTER]: {
|
|
69
70
|
310: import_conctructorAbiPatterns.BASIC_ADAPTER_ABI,
|
|
@@ -193,7 +194,8 @@ const adapterConstructorAbi = {
|
|
|
193
194
|
312: import_conctructorAbiPatterns.STAKING_REWARDS_ADAPTER_ABI
|
|
194
195
|
},
|
|
195
196
|
[import_types.AdapterType.MIDAS_ISSUANCE_VAULT]: {
|
|
196
|
-
310: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
|
|
197
|
+
310: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI,
|
|
198
|
+
311: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
|
|
197
199
|
},
|
|
198
200
|
[import_types.AdapterType.MIDAS_GATEWAY]: {
|
|
199
201
|
311: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
|
|
@@ -28,32 +28,51 @@ var import_AbstractAdapter = require("./AbstractAdapter.js");
|
|
|
28
28
|
const abi = import_integrations_v3.iMidasRedemptionVaultAdapterAbi;
|
|
29
29
|
const protocolAbi = import_integrations_v3.iMidasRedemptionVaultGatewayAbi;
|
|
30
30
|
class MidasRedemptionVaultAdapterContract extends import_AbstractAdapter.AbstractAdapterContract {
|
|
31
|
+
#version;
|
|
31
32
|
#gateway;
|
|
32
33
|
#mToken;
|
|
33
34
|
#allowedTokens;
|
|
34
35
|
constructor(options, args) {
|
|
35
36
|
super(options, { ...args, abi, protocolAbi });
|
|
36
37
|
if (args.baseParams.serializedParams) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
const version = Number(args.baseParams.version);
|
|
39
|
+
this.#version = version;
|
|
40
|
+
if (version <= 310) {
|
|
41
|
+
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
42
|
+
[
|
|
43
|
+
{ type: "address", name: "creditManager" },
|
|
44
|
+
{ type: "address", name: "targetContract" },
|
|
45
|
+
{ type: "address", name: "gateway" },
|
|
46
|
+
{ type: "address", name: "mToken" },
|
|
47
|
+
{ type: "address[]", name: "allowedTokens" },
|
|
48
|
+
{ type: "address[]", name: "allowedPhantomTokens" }
|
|
49
|
+
],
|
|
50
|
+
args.baseParams.serializedParams
|
|
51
|
+
);
|
|
52
|
+
this.#gateway = decoded[2];
|
|
53
|
+
this.#mToken = decoded[3];
|
|
54
|
+
this.#allowedTokens = decoded[4].map((token, index) => ({
|
|
55
|
+
token,
|
|
56
|
+
phantomToken: decoded[5][index]
|
|
57
|
+
}));
|
|
58
|
+
} else {
|
|
59
|
+
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
60
|
+
[
|
|
61
|
+
{ type: "address", name: "creditManager" },
|
|
62
|
+
{ type: "address", name: "targetContract" },
|
|
63
|
+
{ type: "address", name: "mToken" },
|
|
64
|
+
{ type: "address[]", name: "supportedInputTokens" }
|
|
65
|
+
],
|
|
66
|
+
args.baseParams.serializedParams
|
|
67
|
+
);
|
|
68
|
+
this.#mToken = decoded[2];
|
|
69
|
+
this.#allowedTokens = [...decoded[3]];
|
|
70
|
+
}
|
|
54
71
|
}
|
|
55
72
|
}
|
|
56
73
|
get gateway() {
|
|
74
|
+
if (!this.#version) throw new import_sdk.MissingSerializedParamsError("version");
|
|
75
|
+
if (this.#version > 310) return void 0;
|
|
57
76
|
if (!this.#gateway) throw new import_sdk.MissingSerializedParamsError("gateway");
|
|
58
77
|
return this.#gateway;
|
|
59
78
|
}
|
|
@@ -71,10 +90,17 @@ class MidasRedemptionVaultAdapterContract extends import_AbstractAdapter.Abstrac
|
|
|
71
90
|
...super.stateHuman(raw),
|
|
72
91
|
gateway: this.#gateway ? this.labelAddress(this.#gateway) : void 0,
|
|
73
92
|
mToken: this.#mToken ? this.labelAddress(this.#mToken) : void 0,
|
|
74
|
-
allowedTokens: this.#allowedTokens?.map((t) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
93
|
+
allowedTokens: this.#allowedTokens?.map((t) => {
|
|
94
|
+
if (typeof t === "object") {
|
|
95
|
+
return {
|
|
96
|
+
token: this.labelAddress(t.token),
|
|
97
|
+
phantomToken: this.labelAddress(t.phantomToken)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
token: this.labelAddress(t)
|
|
102
|
+
};
|
|
103
|
+
})
|
|
78
104
|
};
|
|
79
105
|
}
|
|
80
106
|
}
|
|
@@ -39,10 +39,12 @@ const adapterActionSignatures = {
|
|
|
39
39
|
310: "function setVaultStatusBatch((address,bool)[])"
|
|
40
40
|
},
|
|
41
41
|
[AdapterType.MIDAS_ISSUANCE_VAULT]: {
|
|
42
|
-
310: "function setTokenAllowedStatusBatch(address[],bool[])"
|
|
42
|
+
310: "function setTokenAllowedStatusBatch(address[],bool[])",
|
|
43
|
+
311: "function setInputTokenStatusBatch(address[],bool[])"
|
|
43
44
|
},
|
|
44
45
|
[AdapterType.MIDAS_REDEMPTION_VAULT]: {
|
|
45
|
-
310: "function setTokenAllowedStatusBatch((address,address,bool)[])"
|
|
46
|
+
310: "function setTokenAllowedStatusBatch((address,address,bool)[])",
|
|
47
|
+
311: "function setOutputTokenStatusBatch(address[],bool[])"
|
|
46
48
|
},
|
|
47
49
|
[AdapterType.PENDLE_ROUTER]: {
|
|
48
50
|
310: "function setPairStatusBatch((address,address,address,uint8)[])",
|
|
@@ -54,7 +54,8 @@ const adapterConstructorAbi = {
|
|
|
54
54
|
310: BASIC_ADAPTER_ABI
|
|
55
55
|
},
|
|
56
56
|
[AdapterType.MIDAS_REDEMPTION_VAULT]: {
|
|
57
|
-
310: BASIC_ADAPTER_ABI
|
|
57
|
+
310: BASIC_ADAPTER_ABI,
|
|
58
|
+
311: BASIC_ADAPTER_ABI
|
|
58
59
|
},
|
|
59
60
|
[AdapterType.PENDLE_ROUTER]: {
|
|
60
61
|
310: BASIC_ADAPTER_ABI,
|
|
@@ -184,7 +185,8 @@ const adapterConstructorAbi = {
|
|
|
184
185
|
312: STAKING_REWARDS_ADAPTER_ABI
|
|
185
186
|
},
|
|
186
187
|
[AdapterType.MIDAS_ISSUANCE_VAULT]: {
|
|
187
|
-
310: REFERER_ID_ADAPTER_ABI
|
|
188
|
+
310: REFERER_ID_ADAPTER_ABI,
|
|
189
|
+
311: REFERER_ID_ADAPTER_ABI
|
|
188
190
|
},
|
|
189
191
|
[AdapterType.MIDAS_GATEWAY]: {
|
|
190
192
|
311: REFERER_ID_ADAPTER_ABI
|
|
@@ -10,32 +10,51 @@ import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
|
10
10
|
const abi = iMidasRedemptionVaultAdapterAbi;
|
|
11
11
|
const protocolAbi = iMidasRedemptionVaultGatewayAbi;
|
|
12
12
|
class MidasRedemptionVaultAdapterContract extends AbstractAdapterContract {
|
|
13
|
+
#version;
|
|
13
14
|
#gateway;
|
|
14
15
|
#mToken;
|
|
15
16
|
#allowedTokens;
|
|
16
17
|
constructor(options, args) {
|
|
17
18
|
super(options, { ...args, abi, protocolAbi });
|
|
18
19
|
if (args.baseParams.serializedParams) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
const version = Number(args.baseParams.version);
|
|
21
|
+
this.#version = version;
|
|
22
|
+
if (version <= 310) {
|
|
23
|
+
const decoded = decodeAbiParameters(
|
|
24
|
+
[
|
|
25
|
+
{ type: "address", name: "creditManager" },
|
|
26
|
+
{ type: "address", name: "targetContract" },
|
|
27
|
+
{ type: "address", name: "gateway" },
|
|
28
|
+
{ type: "address", name: "mToken" },
|
|
29
|
+
{ type: "address[]", name: "allowedTokens" },
|
|
30
|
+
{ type: "address[]", name: "allowedPhantomTokens" }
|
|
31
|
+
],
|
|
32
|
+
args.baseParams.serializedParams
|
|
33
|
+
);
|
|
34
|
+
this.#gateway = decoded[2];
|
|
35
|
+
this.#mToken = decoded[3];
|
|
36
|
+
this.#allowedTokens = decoded[4].map((token, index) => ({
|
|
37
|
+
token,
|
|
38
|
+
phantomToken: decoded[5][index]
|
|
39
|
+
}));
|
|
40
|
+
} else {
|
|
41
|
+
const decoded = decodeAbiParameters(
|
|
42
|
+
[
|
|
43
|
+
{ type: "address", name: "creditManager" },
|
|
44
|
+
{ type: "address", name: "targetContract" },
|
|
45
|
+
{ type: "address", name: "mToken" },
|
|
46
|
+
{ type: "address[]", name: "supportedInputTokens" }
|
|
47
|
+
],
|
|
48
|
+
args.baseParams.serializedParams
|
|
49
|
+
);
|
|
50
|
+
this.#mToken = decoded[2];
|
|
51
|
+
this.#allowedTokens = [...decoded[3]];
|
|
52
|
+
}
|
|
36
53
|
}
|
|
37
54
|
}
|
|
38
55
|
get gateway() {
|
|
56
|
+
if (!this.#version) throw new MissingSerializedParamsError("version");
|
|
57
|
+
if (this.#version > 310) return void 0;
|
|
39
58
|
if (!this.#gateway) throw new MissingSerializedParamsError("gateway");
|
|
40
59
|
return this.#gateway;
|
|
41
60
|
}
|
|
@@ -53,10 +72,17 @@ class MidasRedemptionVaultAdapterContract extends AbstractAdapterContract {
|
|
|
53
72
|
...super.stateHuman(raw),
|
|
54
73
|
gateway: this.#gateway ? this.labelAddress(this.#gateway) : void 0,
|
|
55
74
|
mToken: this.#mToken ? this.labelAddress(this.#mToken) : void 0,
|
|
56
|
-
allowedTokens: this.#allowedTokens?.map((t) =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
allowedTokens: this.#allowedTokens?.map((t) => {
|
|
76
|
+
if (typeof t === "object") {
|
|
77
|
+
return {
|
|
78
|
+
token: this.labelAddress(t.token),
|
|
79
|
+
phantomToken: this.labelAddress(t.phantomToken)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
token: this.labelAddress(t)
|
|
84
|
+
};
|
|
85
|
+
})
|
|
60
86
|
};
|
|
61
87
|
}
|
|
62
88
|
}
|
|
@@ -460,19 +460,22 @@ type protocolAbi = typeof protocolAbi;
|
|
|
460
460
|
export declare class MidasRedemptionVaultAdapterContract extends AbstractAdapterContract<abi, protocolAbi> {
|
|
461
461
|
#private;
|
|
462
462
|
constructor(options: ConstructOptions, args: ConcreteAdapterContractOptions);
|
|
463
|
-
get gateway(): Address;
|
|
463
|
+
get gateway(): Address | undefined;
|
|
464
464
|
get mToken(): Address;
|
|
465
465
|
get allowedTokens(): {
|
|
466
466
|
token: Address;
|
|
467
|
-
phantomToken
|
|
468
|
-
}[];
|
|
467
|
+
phantomToken?: Address;
|
|
468
|
+
}[] | Address[];
|
|
469
469
|
stateHuman(raw?: boolean): {
|
|
470
470
|
gateway: string | undefined;
|
|
471
471
|
mToken: string | undefined;
|
|
472
|
-
allowedTokens: {
|
|
472
|
+
allowedTokens: ({
|
|
473
473
|
token: string;
|
|
474
474
|
phantomToken: string;
|
|
475
|
-
}
|
|
475
|
+
} | {
|
|
476
|
+
token: string;
|
|
477
|
+
phantomToken?: undefined;
|
|
478
|
+
})[] | undefined;
|
|
476
479
|
creditManager?: string;
|
|
477
480
|
targetContract?: string;
|
|
478
481
|
address: string;
|