@gearbox-protocol/sdk 15.1.0-next.16 → 15.1.0-next.17
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.
|
@@ -11,6 +11,7 @@ let viem = require("viem");
|
|
|
11
11
|
const abi = require_sdk_market_adapters_abi_adapters_iMidasGatewayAdapterV311.iMidasGatewayAdapterV311Abi;
|
|
12
12
|
const protocolAbi = require_sdk_market_adapters_abi_midas_iMidasGatewayV311.iMidasGatewayV311Abi;
|
|
13
13
|
var MidasGatewayAdapterContract = class extends require_sdk_market_adapters_contracts_AbstractAdapter.AbstractAdapterContract {
|
|
14
|
+
#version;
|
|
14
15
|
#gateway;
|
|
15
16
|
#mToken;
|
|
16
17
|
#quoteToken;
|
|
@@ -23,41 +24,76 @@ var MidasGatewayAdapterContract = class extends require_sdk_market_adapters_cont
|
|
|
23
24
|
protocolAbi
|
|
24
25
|
});
|
|
25
26
|
if (args.baseParams.serializedParams) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
27
|
+
const version = Number(args.baseParams.version);
|
|
28
|
+
this.#version = version;
|
|
29
|
+
if (version <= 310) {
|
|
30
|
+
const decoded = (0, viem.decodeAbiParameters)([
|
|
31
|
+
{
|
|
32
|
+
type: "address",
|
|
33
|
+
name: "creditManager"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: "address",
|
|
37
|
+
name: "targetContract"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "address",
|
|
41
|
+
name: "gateway"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "address",
|
|
45
|
+
name: "mToken"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "address",
|
|
49
|
+
name: "quoteToken"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "address",
|
|
53
|
+
name: "phantomToken"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "bytes32",
|
|
57
|
+
name: "referrerId"
|
|
58
|
+
}
|
|
59
|
+
], args.baseParams.serializedParams);
|
|
60
|
+
this.#gateway = decoded[2];
|
|
61
|
+
this.#mToken = decoded[3];
|
|
62
|
+
this.#quoteToken = decoded[4];
|
|
63
|
+
this.#phantomToken = decoded[5];
|
|
64
|
+
this.#referrerId = decoded[6];
|
|
65
|
+
} else {
|
|
66
|
+
const decoded = (0, viem.decodeAbiParameters)([
|
|
67
|
+
{
|
|
68
|
+
type: "address",
|
|
69
|
+
name: "creditManager"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "address",
|
|
73
|
+
name: "targetContract"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "address",
|
|
77
|
+
name: "gateway"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: "address",
|
|
81
|
+
name: "mToken"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "address",
|
|
85
|
+
name: "quoteToken"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: "address",
|
|
89
|
+
name: "phantomToken"
|
|
90
|
+
}
|
|
91
|
+
], args.baseParams.serializedParams);
|
|
92
|
+
this.#gateway = decoded[2];
|
|
93
|
+
this.#mToken = decoded[3];
|
|
94
|
+
this.#quoteToken = decoded[4];
|
|
95
|
+
this.#phantomToken = decoded[5];
|
|
96
|
+
}
|
|
61
97
|
}
|
|
62
98
|
}
|
|
63
99
|
get gateway() {
|
|
@@ -81,6 +117,8 @@ var MidasGatewayAdapterContract = class extends require_sdk_market_adapters_cont
|
|
|
81
117
|
return this.#phantomToken;
|
|
82
118
|
}
|
|
83
119
|
get referrerId() {
|
|
120
|
+
if (!this.#version) throw new require_sdk_base_errors.MissingSerializedParamsError("version");
|
|
121
|
+
if (this.#version > 310) return void 0;
|
|
84
122
|
if (this.#referrerId === void 0) throw new require_sdk_base_errors.MissingSerializedParamsError("referrerId");
|
|
85
123
|
return this.#referrerId;
|
|
86
124
|
}
|
|
@@ -10,6 +10,7 @@ import { decodeAbiParameters, decodeFunctionData, isAddressEqual, zeroAddress }
|
|
|
10
10
|
const abi = iMidasGatewayAdapterV311Abi;
|
|
11
11
|
const protocolAbi = iMidasGatewayV311Abi;
|
|
12
12
|
var MidasGatewayAdapterContract = class extends AbstractAdapterContract {
|
|
13
|
+
#version;
|
|
13
14
|
#gateway;
|
|
14
15
|
#mToken;
|
|
15
16
|
#quoteToken;
|
|
@@ -22,41 +23,76 @@ var MidasGatewayAdapterContract = class extends AbstractAdapterContract {
|
|
|
22
23
|
protocolAbi
|
|
23
24
|
});
|
|
24
25
|
if (args.baseParams.serializedParams) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
26
|
+
const version = Number(args.baseParams.version);
|
|
27
|
+
this.#version = version;
|
|
28
|
+
if (version <= 310) {
|
|
29
|
+
const decoded = decodeAbiParameters([
|
|
30
|
+
{
|
|
31
|
+
type: "address",
|
|
32
|
+
name: "creditManager"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "address",
|
|
36
|
+
name: "targetContract"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "address",
|
|
40
|
+
name: "gateway"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "address",
|
|
44
|
+
name: "mToken"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "address",
|
|
48
|
+
name: "quoteToken"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "address",
|
|
52
|
+
name: "phantomToken"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "bytes32",
|
|
56
|
+
name: "referrerId"
|
|
57
|
+
}
|
|
58
|
+
], args.baseParams.serializedParams);
|
|
59
|
+
this.#gateway = decoded[2];
|
|
60
|
+
this.#mToken = decoded[3];
|
|
61
|
+
this.#quoteToken = decoded[4];
|
|
62
|
+
this.#phantomToken = decoded[5];
|
|
63
|
+
this.#referrerId = decoded[6];
|
|
64
|
+
} else {
|
|
65
|
+
const decoded = decodeAbiParameters([
|
|
66
|
+
{
|
|
67
|
+
type: "address",
|
|
68
|
+
name: "creditManager"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "address",
|
|
72
|
+
name: "targetContract"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "address",
|
|
76
|
+
name: "gateway"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "address",
|
|
80
|
+
name: "mToken"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: "address",
|
|
84
|
+
name: "quoteToken"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: "address",
|
|
88
|
+
name: "phantomToken"
|
|
89
|
+
}
|
|
90
|
+
], args.baseParams.serializedParams);
|
|
91
|
+
this.#gateway = decoded[2];
|
|
92
|
+
this.#mToken = decoded[3];
|
|
93
|
+
this.#quoteToken = decoded[4];
|
|
94
|
+
this.#phantomToken = decoded[5];
|
|
95
|
+
}
|
|
60
96
|
}
|
|
61
97
|
}
|
|
62
98
|
get gateway() {
|
|
@@ -80,6 +116,8 @@ var MidasGatewayAdapterContract = class extends AbstractAdapterContract {
|
|
|
80
116
|
return this.#phantomToken;
|
|
81
117
|
}
|
|
82
118
|
get referrerId() {
|
|
119
|
+
if (!this.#version) throw new MissingSerializedParamsError("version");
|
|
120
|
+
if (this.#version > 310) return void 0;
|
|
83
121
|
if (this.#referrerId === void 0) throw new MissingSerializedParamsError("referrerId");
|
|
84
122
|
return this.#referrerId;
|
|
85
123
|
}
|
|
@@ -624,7 +624,7 @@ declare class MidasGatewayAdapterContract extends AbstractAdapterContract<abi, p
|
|
|
624
624
|
* without delayed withdrawals
|
|
625
625
|
*/
|
|
626
626
|
get phantomToken(): Address;
|
|
627
|
-
get referrerId(): string;
|
|
627
|
+
get referrerId(): string | undefined;
|
|
628
628
|
stateHuman(raw?: boolean): {
|
|
629
629
|
address: string;
|
|
630
630
|
version: number;
|