@gearbox-protocol/sdk 14.5.6 → 14.5.8
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/history/assembleOperations.js +18 -4
- package/dist/cjs/history/classifyMulticallOperations.js +20 -4
- package/dist/cjs/history/errors.js +12 -2
- package/dist/cjs/history/extractTransfers.js +12 -1
- package/dist/cjs/history/parseCreditAccountTransaction.js +3 -1
- package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeOnRamp.js +73 -0
- package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeOnRampAdapter.js +98 -0
- package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeRedemptionGateway.js +149 -0
- package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.js +144 -0
- package/dist/cjs/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +4 -2
- package/dist/cjs/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +4 -2
- package/dist/esm/history/assembleOperations.js +18 -4
- package/dist/esm/history/classifyMulticallOperations.js +25 -5
- package/dist/esm/history/errors.js +10 -1
- package/dist/esm/history/extractTransfers.js +12 -1
- package/dist/esm/history/parseCreditAccountTransaction.js +3 -1
- package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeOnRamp.js +49 -0
- package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeOnRampAdapter.js +74 -0
- package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeRedemptionGateway.js +125 -0
- package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.js +120 -0
- package/dist/esm/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +4 -2
- package/dist/esm/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +4 -2
- package/dist/types/history/assembleOperations.d.ts +2 -0
- package/dist/types/history/classifyMulticallOperations.d.ts +2 -0
- package/dist/types/history/errors.d.ts +3 -0
- package/dist/types/history/extractTransfers.d.ts +19 -0
- package/dist/types/plugins/adapters/abi/securitize/iSecuritizeOnRamp.d.ts +67 -0
- package/dist/types/plugins/adapters/abi/securitize/iSecuritizeOnRampAdapter.d.ts +107 -0
- package/dist/types/plugins/adapters/abi/securitize/iSecuritizeRedemptionGateway.d.ts +183 -0
- package/dist/types/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.d.ts +185 -0
- package/dist/types/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.d.ts +174 -2
- package/dist/types/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +368 -2
- package/package.json +1 -1
|
@@ -23,9 +23,11 @@ __export(SecuritizeRedemptionGatewayAdapterContract_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(SecuritizeRedemptionGatewayAdapterContract_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
25
|
var import_sdk = require("../../../sdk/index.js");
|
|
26
|
+
var import_iSecuritizeRedemptionGateway = require("../abi/securitize/iSecuritizeRedemptionGateway.js");
|
|
27
|
+
var import_iSecuritizeRedemptionGatewayAdapter = require("../abi/securitize/iSecuritizeRedemptionGatewayAdapter.js");
|
|
26
28
|
var import_AbstractAdapter = require("./AbstractAdapter.js");
|
|
27
|
-
const abi =
|
|
28
|
-
const protocolAbi =
|
|
29
|
+
const abi = import_iSecuritizeRedemptionGatewayAdapter.iSecuritizeRedemptionGatewayAdapterAbi;
|
|
30
|
+
const protocolAbi = import_iSecuritizeRedemptionGateway.iSecuritizeRedemptionGatewayAbi;
|
|
29
31
|
class SecuritizeRedemptionGatewayAdapterContract extends import_AbstractAdapter.AbstractAdapterContract {
|
|
30
32
|
#dsToken;
|
|
31
33
|
#stableCoinToken;
|
|
@@ -9,16 +9,24 @@ function assembleOperations(input) {
|
|
|
9
9
|
underlying,
|
|
10
10
|
liquidationRemainingFunds,
|
|
11
11
|
phantomTokens,
|
|
12
|
+
withdrawCollateralEvents = [],
|
|
12
13
|
strict
|
|
13
14
|
} = input;
|
|
14
|
-
let
|
|
15
|
+
let executeOffset = 0;
|
|
16
|
+
let withdrawOffset = 0;
|
|
15
17
|
return facadeCalls.map((fc) => {
|
|
16
18
|
if (fc.operation === "PartiallyLiquidateCreditAccount") {
|
|
17
19
|
return assemblePartialLiquidation(fc);
|
|
18
20
|
}
|
|
19
21
|
const count = countAdapterCalls(fc.innerCalls, register);
|
|
20
|
-
const sliced = executeResults.slice(
|
|
21
|
-
|
|
22
|
+
const sliced = executeResults.slice(executeOffset, executeOffset + count);
|
|
23
|
+
executeOffset += count;
|
|
24
|
+
const withdrawCount = countWithdrawCollateralCalls(fc.innerCalls);
|
|
25
|
+
const slicedWithdrawEvents = withdrawCollateralEvents.slice(
|
|
26
|
+
withdrawOffset,
|
|
27
|
+
withdrawOffset + withdrawCount
|
|
28
|
+
);
|
|
29
|
+
withdrawOffset += withdrawCount;
|
|
22
30
|
const protocolCalldatas = extractProtocolCalls(fc.trace, sliced);
|
|
23
31
|
const multicall = classifyMulticallOperations({
|
|
24
32
|
innerCalls: fc.innerCalls,
|
|
@@ -28,7 +36,8 @@ function assembleOperations(input) {
|
|
|
28
36
|
creditAccount: fc.creditAccount,
|
|
29
37
|
underlying,
|
|
30
38
|
strict,
|
|
31
|
-
phantomTokens
|
|
39
|
+
phantomTokens,
|
|
40
|
+
withdrawCollateralEvents: slicedWithdrawEvents
|
|
32
41
|
});
|
|
33
42
|
switch (fc.operation) {
|
|
34
43
|
case "OpenCreditAccount":
|
|
@@ -63,6 +72,11 @@ function countAdapterCalls(innerCalls, register) {
|
|
|
63
72
|
return !contract || contract instanceof AbstractAdapterContract;
|
|
64
73
|
}).length;
|
|
65
74
|
}
|
|
75
|
+
function countWithdrawCollateralCalls(innerCalls) {
|
|
76
|
+
return innerCalls.filter(
|
|
77
|
+
(call) => call.functionName.startsWith("withdrawCollateral")
|
|
78
|
+
).length;
|
|
79
|
+
}
|
|
66
80
|
function assemblePartialLiquidation(fc) {
|
|
67
81
|
const { rawArgs } = fc.parsed;
|
|
68
82
|
return {
|
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
swapFromTransfers,
|
|
5
5
|
toNetTransfers
|
|
6
6
|
} from "../plugins/adapters/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
TransferAlignmentError,
|
|
9
|
+
UnknownAdapterError,
|
|
10
|
+
WithdrawCollateralAlignmentError
|
|
11
|
+
} from "./errors.js";
|
|
8
12
|
function classifyMulticallOperations(input) {
|
|
9
13
|
const {
|
|
10
14
|
innerCalls,
|
|
@@ -14,9 +18,11 @@ function classifyMulticallOperations(input) {
|
|
|
14
18
|
creditAccount,
|
|
15
19
|
underlying,
|
|
16
20
|
strict,
|
|
17
|
-
phantomTokens
|
|
21
|
+
phantomTokens,
|
|
22
|
+
withdrawCollateralEvents
|
|
18
23
|
} = input;
|
|
19
24
|
let transferIdx = 0;
|
|
25
|
+
let withdrawIdx = 0;
|
|
20
26
|
const result = [];
|
|
21
27
|
for (const call of innerCalls) {
|
|
22
28
|
const contract = register.getContract(call.target);
|
|
@@ -39,7 +45,14 @@ function classifyMulticallOperations(input) {
|
|
|
39
45
|
continue;
|
|
40
46
|
}
|
|
41
47
|
if (contract !== void 0) {
|
|
42
|
-
const
|
|
48
|
+
const isWithdraw = call.functionName.startsWith("withdrawCollateral");
|
|
49
|
+
const withdrawEvent = isWithdraw ? withdrawCollateralEvents?.[withdrawIdx++] : void 0;
|
|
50
|
+
const op = classifyFacadeInnerCall(
|
|
51
|
+
call,
|
|
52
|
+
underlying,
|
|
53
|
+
phantomTokens,
|
|
54
|
+
withdrawEvent
|
|
55
|
+
);
|
|
43
56
|
if (op) result.push(op);
|
|
44
57
|
continue;
|
|
45
58
|
}
|
|
@@ -74,9 +87,15 @@ function classifyMulticallOperations(input) {
|
|
|
74
87
|
if (transferIdx !== executeResults.length) {
|
|
75
88
|
throw new TransferAlignmentError(executeResults.length, transferIdx);
|
|
76
89
|
}
|
|
90
|
+
if (withdrawCollateralEvents && withdrawCollateralEvents.length > 0 && withdrawIdx !== withdrawCollateralEvents.length) {
|
|
91
|
+
throw new WithdrawCollateralAlignmentError(
|
|
92
|
+
withdrawCollateralEvents.length,
|
|
93
|
+
withdrawIdx
|
|
94
|
+
);
|
|
95
|
+
}
|
|
77
96
|
return result;
|
|
78
97
|
}
|
|
79
|
-
function classifyFacadeInnerCall(call, underlying, phantomTokens) {
|
|
98
|
+
function classifyFacadeInnerCall(call, underlying, phantomTokens, withdrawEvent) {
|
|
80
99
|
const { functionName: sig, rawArgs } = call;
|
|
81
100
|
const functionName = sig.split("(")[0];
|
|
82
101
|
switch (functionName) {
|
|
@@ -105,10 +124,11 @@ function classifyFacadeInnerCall(call, underlying, phantomTokens) {
|
|
|
105
124
|
calldataToken,
|
|
106
125
|
phantomTokens
|
|
107
126
|
);
|
|
127
|
+
const amount = withdrawEvent ? withdrawEvent.amount : rawArgs.amount;
|
|
108
128
|
return {
|
|
109
129
|
operation: "WithdrawCollateral",
|
|
110
130
|
token: depositedToken ?? calldataToken,
|
|
111
|
-
amount
|
|
131
|
+
amount,
|
|
112
132
|
to: rawArgs.to,
|
|
113
133
|
...depositedToken ? { phantomToken: calldataToken } : {}
|
|
114
134
|
};
|
|
@@ -14,6 +14,14 @@ class TransferAlignmentError extends Error {
|
|
|
14
14
|
this.name = "TransferAlignmentError";
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
class WithdrawCollateralAlignmentError extends Error {
|
|
18
|
+
constructor(expected, actual) {
|
|
19
|
+
super(
|
|
20
|
+
`withdrawCollateral event alignment mismatch: expected ${expected} events, consumed ${actual}`
|
|
21
|
+
);
|
|
22
|
+
this.name = "WithdrawCollateralAlignmentError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
17
25
|
class ProtocolCallNotFoundError extends Error {
|
|
18
26
|
targetContract;
|
|
19
27
|
executeIndex;
|
|
@@ -60,5 +68,6 @@ export {
|
|
|
60
68
|
TransferAlignmentError,
|
|
61
69
|
UnexpectedFacadeEventOrderError,
|
|
62
70
|
UnknownAdapterError,
|
|
63
|
-
UnknownFacadeCallError
|
|
71
|
+
UnknownFacadeCallError,
|
|
72
|
+
WithdrawCollateralAlignmentError
|
|
64
73
|
};
|
|
@@ -13,6 +13,7 @@ function extractTransfers(logs, creditAccount, pool, creditFacade) {
|
|
|
13
13
|
const executeResults = [];
|
|
14
14
|
const directTransfers = [];
|
|
15
15
|
const phantomTokens = new AddressMap();
|
|
16
|
+
const withdrawCollateralEvents = [];
|
|
16
17
|
let liquidationRemainingFunds;
|
|
17
18
|
for (const log of logs) {
|
|
18
19
|
const facadeEvent = tryDecodeFacadeEvent(log, creditFacade);
|
|
@@ -43,6 +44,12 @@ function extractTransfers(logs, creditAccount, pool, creditFacade) {
|
|
|
43
44
|
facadeEvent.args.token,
|
|
44
45
|
getAddress(rawDeposit.token)
|
|
45
46
|
);
|
|
47
|
+
} else if (isWithdrawCollateral(facadeEvent, creditAccount)) {
|
|
48
|
+
withdrawCollateralEvents.push({
|
|
49
|
+
token: getAddress(facadeEvent.args.token),
|
|
50
|
+
amount: facadeEvent.args.amount,
|
|
51
|
+
to: getAddress(facadeEvent.args.to)
|
|
52
|
+
});
|
|
46
53
|
}
|
|
47
54
|
currentEntries = [];
|
|
48
55
|
continue;
|
|
@@ -67,7 +74,8 @@ function extractTransfers(logs, creditAccount, pool, creditFacade) {
|
|
|
67
74
|
executeResults,
|
|
68
75
|
directTransfers,
|
|
69
76
|
liquidationRemainingFunds,
|
|
70
|
-
phantomTokens
|
|
77
|
+
phantomTokens,
|
|
78
|
+
withdrawCollateralEvents
|
|
71
79
|
};
|
|
72
80
|
}
|
|
73
81
|
function buildOperationRanges(logs, facadeAddress, creditAccount) {
|
|
@@ -143,6 +151,9 @@ function isLiquidation(e, creditAccount) {
|
|
|
143
151
|
function isWithdrawPhantomToken(e, creditAccount) {
|
|
144
152
|
return e.eventName === "WithdrawPhantomToken" && isAddressEqual(e.args.creditAccount, creditAccount);
|
|
145
153
|
}
|
|
154
|
+
function isWithdrawCollateral(e, creditAccount) {
|
|
155
|
+
return e.eventName === "WithdrawCollateral" && isAddressEqual(e.args.creditAccount, creditAccount);
|
|
156
|
+
}
|
|
146
157
|
export {
|
|
147
158
|
extractTransfers
|
|
148
159
|
};
|
|
@@ -28,7 +28,8 @@ function parseCreditAccountTransaction(input) {
|
|
|
28
28
|
executeResults,
|
|
29
29
|
directTransfers,
|
|
30
30
|
liquidationRemainingFunds,
|
|
31
|
-
phantomTokens
|
|
31
|
+
phantomTokens,
|
|
32
|
+
withdrawCollateralEvents
|
|
32
33
|
} = extractTransfers(logs, creditAccount, pool, creditFacade);
|
|
33
34
|
const meta = {
|
|
34
35
|
creditManager,
|
|
@@ -44,6 +45,7 @@ function parseCreditAccountTransaction(input) {
|
|
|
44
45
|
underlying,
|
|
45
46
|
liquidationRemainingFunds,
|
|
46
47
|
phantomTokens,
|
|
48
|
+
withdrawCollateralEvents,
|
|
47
49
|
strict
|
|
48
50
|
}).map((o) => ({ ...o, ...meta }));
|
|
49
51
|
const directOps = directTransfers.map((dt) => ({
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const iSecuritizeOnRampAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "calculateDsTokenAmount",
|
|
5
|
+
inputs: [
|
|
6
|
+
{ name: "_liquidityAmount", type: "uint256", internalType: "uint256" }
|
|
7
|
+
],
|
|
8
|
+
outputs: [
|
|
9
|
+
{ name: "dsTokenAmount", type: "uint256", internalType: "uint256" },
|
|
10
|
+
{ name: "rate", type: "uint256", internalType: "uint256" },
|
|
11
|
+
{ name: "fee", type: "uint256", internalType: "uint256" }
|
|
12
|
+
],
|
|
13
|
+
stateMutability: "view"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: "function",
|
|
17
|
+
name: "dsToken",
|
|
18
|
+
inputs: [],
|
|
19
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
20
|
+
stateMutability: "view"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: "function",
|
|
24
|
+
name: "liquidityToken",
|
|
25
|
+
inputs: [],
|
|
26
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
27
|
+
stateMutability: "view"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "function",
|
|
31
|
+
name: "navProvider",
|
|
32
|
+
inputs: [],
|
|
33
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
34
|
+
stateMutability: "view"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "function",
|
|
38
|
+
name: "swap",
|
|
39
|
+
inputs: [
|
|
40
|
+
{ name: "_liquidityAmount", type: "uint256", internalType: "uint256" },
|
|
41
|
+
{ name: "_minOutAmount", type: "uint256", internalType: "uint256" }
|
|
42
|
+
],
|
|
43
|
+
outputs: [],
|
|
44
|
+
stateMutability: "nonpayable"
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
export {
|
|
48
|
+
iSecuritizeOnRampAbi
|
|
49
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const iSecuritizeOnRampAdapterAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "contractType",
|
|
5
|
+
inputs: [],
|
|
6
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
7
|
+
stateMutability: "view"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: "function",
|
|
11
|
+
name: "creditManager",
|
|
12
|
+
inputs: [],
|
|
13
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
14
|
+
stateMutability: "view"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: "function",
|
|
18
|
+
name: "dsToken",
|
|
19
|
+
inputs: [],
|
|
20
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
21
|
+
stateMutability: "view"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: "function",
|
|
25
|
+
name: "liquidityToken",
|
|
26
|
+
inputs: [],
|
|
27
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
28
|
+
stateMutability: "view"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "function",
|
|
32
|
+
name: "serialize",
|
|
33
|
+
inputs: [],
|
|
34
|
+
outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
|
|
35
|
+
stateMutability: "view"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: "function",
|
|
39
|
+
name: "swap",
|
|
40
|
+
inputs: [
|
|
41
|
+
{ name: "liquidityAmount", type: "uint256", internalType: "uint256" },
|
|
42
|
+
{ name: "minOutAmount", type: "uint256", internalType: "uint256" }
|
|
43
|
+
],
|
|
44
|
+
outputs: [{ name: "success", type: "bool", internalType: "bool" }],
|
|
45
|
+
stateMutability: "nonpayable"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "function",
|
|
49
|
+
name: "swapDiff",
|
|
50
|
+
inputs: [
|
|
51
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" },
|
|
52
|
+
{ name: "rateMinRAY", type: "uint256", internalType: "uint256" }
|
|
53
|
+
],
|
|
54
|
+
outputs: [{ name: "success", type: "bool", internalType: "bool" }],
|
|
55
|
+
stateMutability: "nonpayable"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "function",
|
|
59
|
+
name: "targetContract",
|
|
60
|
+
inputs: [],
|
|
61
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
62
|
+
stateMutability: "view"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "function",
|
|
66
|
+
name: "version",
|
|
67
|
+
inputs: [],
|
|
68
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
69
|
+
stateMutability: "view"
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
export {
|
|
73
|
+
iSecuritizeOnRampAdapterAbi
|
|
74
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const iSecuritizeRedemptionGatewayAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "claim",
|
|
5
|
+
inputs: [
|
|
6
|
+
{ name: "redeemers", type: "address[]", internalType: "address[]" }
|
|
7
|
+
],
|
|
8
|
+
outputs: [],
|
|
9
|
+
stateMutability: "nonpayable"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: "function",
|
|
13
|
+
name: "contractType",
|
|
14
|
+
inputs: [],
|
|
15
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
16
|
+
stateMutability: "view"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: "function",
|
|
20
|
+
name: "dsToken",
|
|
21
|
+
inputs: [],
|
|
22
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
23
|
+
stateMutability: "view"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "function",
|
|
27
|
+
name: "getRedeemers",
|
|
28
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
29
|
+
outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
|
|
30
|
+
stateMutability: "view"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "function",
|
|
34
|
+
name: "getRedemptionAmount",
|
|
35
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
36
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
37
|
+
stateMutability: "view"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "function",
|
|
41
|
+
name: "getUnclaimedRedeemers",
|
|
42
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
43
|
+
outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
|
|
44
|
+
stateMutability: "view"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "function",
|
|
48
|
+
name: "masterRedeemer",
|
|
49
|
+
inputs: [],
|
|
50
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
51
|
+
stateMutability: "view"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "function",
|
|
55
|
+
name: "navProvider",
|
|
56
|
+
inputs: [],
|
|
57
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
58
|
+
stateMutability: "view"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: "function",
|
|
62
|
+
name: "redeem",
|
|
63
|
+
inputs: [
|
|
64
|
+
{ name: "dsTokenAmount", type: "uint256", internalType: "uint256" }
|
|
65
|
+
],
|
|
66
|
+
outputs: [],
|
|
67
|
+
stateMutability: "nonpayable"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: "function",
|
|
71
|
+
name: "redemptionAccount",
|
|
72
|
+
inputs: [],
|
|
73
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
74
|
+
stateMutability: "view"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "function",
|
|
78
|
+
name: "securitizeWhitelister",
|
|
79
|
+
inputs: [],
|
|
80
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
81
|
+
stateMutability: "view"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "function",
|
|
85
|
+
name: "stableCoinToken",
|
|
86
|
+
inputs: [],
|
|
87
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
88
|
+
stateMutability: "view"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: "function",
|
|
92
|
+
name: "transferMaster",
|
|
93
|
+
inputs: [],
|
|
94
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
95
|
+
stateMutability: "view"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: "function",
|
|
99
|
+
name: "transferRedeemer",
|
|
100
|
+
inputs: [
|
|
101
|
+
{ name: "redeemer", type: "address", internalType: "address" },
|
|
102
|
+
{ name: "newAccount", type: "address", internalType: "address" }
|
|
103
|
+
],
|
|
104
|
+
outputs: [],
|
|
105
|
+
stateMutability: "nonpayable"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "function",
|
|
109
|
+
name: "version",
|
|
110
|
+
inputs: [],
|
|
111
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
112
|
+
stateMutability: "view"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
type: "error",
|
|
116
|
+
name: "MaxUnclaimedRedeemersPerAccountException",
|
|
117
|
+
inputs: []
|
|
118
|
+
},
|
|
119
|
+
{ type: "error", name: "NewAccountNotRegisteredException", inputs: [] },
|
|
120
|
+
{ type: "error", name: "RedeemerNotOwnedByAccountException", inputs: [] },
|
|
121
|
+
{ type: "error", name: "RedeemerTransferNotAllowedException", inputs: [] }
|
|
122
|
+
];
|
|
123
|
+
export {
|
|
124
|
+
iSecuritizeRedemptionGatewayAbi
|
|
125
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
const iSecuritizeRedemptionGatewayAdapterAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "claim",
|
|
5
|
+
inputs: [
|
|
6
|
+
{ name: "redeemers", type: "address[]", internalType: "address[]" }
|
|
7
|
+
],
|
|
8
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
9
|
+
stateMutability: "nonpayable"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: "function",
|
|
13
|
+
name: "contractType",
|
|
14
|
+
inputs: [],
|
|
15
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
16
|
+
stateMutability: "view"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: "function",
|
|
20
|
+
name: "creditManager",
|
|
21
|
+
inputs: [],
|
|
22
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
23
|
+
stateMutability: "view"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "function",
|
|
27
|
+
name: "depositPhantomToken",
|
|
28
|
+
inputs: [
|
|
29
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
30
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
31
|
+
],
|
|
32
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
33
|
+
stateMutability: "nonpayable"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: "function",
|
|
37
|
+
name: "dsToken",
|
|
38
|
+
inputs: [],
|
|
39
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
40
|
+
stateMutability: "view"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "function",
|
|
44
|
+
name: "redeem",
|
|
45
|
+
inputs: [
|
|
46
|
+
{ name: "dsTokenAmount", type: "uint256", internalType: "uint256" }
|
|
47
|
+
],
|
|
48
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
49
|
+
stateMutability: "nonpayable"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "function",
|
|
53
|
+
name: "redeemDiff",
|
|
54
|
+
inputs: [
|
|
55
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" }
|
|
56
|
+
],
|
|
57
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
58
|
+
stateMutability: "nonpayable"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: "function",
|
|
62
|
+
name: "redemptionPhantomToken",
|
|
63
|
+
inputs: [],
|
|
64
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
65
|
+
stateMutability: "view"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "function",
|
|
69
|
+
name: "serialize",
|
|
70
|
+
inputs: [],
|
|
71
|
+
outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
|
|
72
|
+
stateMutability: "view"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "function",
|
|
76
|
+
name: "stableCoinToken",
|
|
77
|
+
inputs: [],
|
|
78
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
79
|
+
stateMutability: "view"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "function",
|
|
83
|
+
name: "targetContract",
|
|
84
|
+
inputs: [],
|
|
85
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
86
|
+
stateMutability: "view"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "function",
|
|
90
|
+
name: "transferRedeemer",
|
|
91
|
+
inputs: [
|
|
92
|
+
{ name: "redeemer", type: "address", internalType: "address" },
|
|
93
|
+
{ name: "newAccount", type: "address", internalType: "address" }
|
|
94
|
+
],
|
|
95
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
96
|
+
stateMutability: "nonpayable"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "function",
|
|
100
|
+
name: "version",
|
|
101
|
+
inputs: [],
|
|
102
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
103
|
+
stateMutability: "view"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "function",
|
|
107
|
+
name: "withdrawPhantomToken",
|
|
108
|
+
inputs: [
|
|
109
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
110
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
111
|
+
],
|
|
112
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
113
|
+
stateMutability: "nonpayable"
|
|
114
|
+
},
|
|
115
|
+
{ type: "error", name: "IncorrectStakedPhantomTokenException", inputs: [] },
|
|
116
|
+
{ type: "error", name: "InvalidRedemptionGatewayException", inputs: [] }
|
|
117
|
+
];
|
|
118
|
+
export {
|
|
119
|
+
iSecuritizeRedemptionGatewayAdapterAbi
|
|
120
|
+
};
|
|
@@ -2,9 +2,11 @@ import { decodeAbiParameters } from "viem";
|
|
|
2
2
|
import {
|
|
3
3
|
MissingSerializedParamsError
|
|
4
4
|
} from "../../../sdk/index.js";
|
|
5
|
+
import { iSecuritizeOnRampAbi } from "../abi/securitize/iSecuritizeOnRamp.js";
|
|
6
|
+
import { iSecuritizeOnRampAdapterAbi } from "../abi/securitize/iSecuritizeOnRampAdapter.js";
|
|
5
7
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
6
|
-
const abi =
|
|
7
|
-
const protocolAbi =
|
|
8
|
+
const abi = iSecuritizeOnRampAdapterAbi;
|
|
9
|
+
const protocolAbi = iSecuritizeOnRampAbi;
|
|
8
10
|
class SecuritizeOnRampAdapterContract extends AbstractAdapterContract {
|
|
9
11
|
#dsToken;
|
|
10
12
|
#liquidityToken;
|
|
@@ -2,9 +2,11 @@ import { decodeAbiParameters } from "viem";
|
|
|
2
2
|
import {
|
|
3
3
|
MissingSerializedParamsError
|
|
4
4
|
} from "../../../sdk/index.js";
|
|
5
|
+
import { iSecuritizeRedemptionGatewayAbi } from "../abi/securitize/iSecuritizeRedemptionGateway.js";
|
|
6
|
+
import { iSecuritizeRedemptionGatewayAdapterAbi } from "../abi/securitize/iSecuritizeRedemptionGatewayAdapter.js";
|
|
5
7
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
6
|
-
const abi =
|
|
7
|
-
const protocolAbi =
|
|
8
|
+
const abi = iSecuritizeRedemptionGatewayAdapterAbi;
|
|
9
|
+
const protocolAbi = iSecuritizeRedemptionGatewayAbi;
|
|
8
10
|
class SecuritizeRedemptionGatewayAdapterContract extends AbstractAdapterContract {
|
|
9
11
|
#dsToken;
|
|
10
12
|
#stableCoinToken;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { AddressMap, ChainContractsRegister } from "../sdk/index.js";
|
|
3
|
+
import type { WithdrawCollateralEventInfo } from "./extractTransfers.js";
|
|
3
4
|
import type { ExecuteResult, FacadeParsedCall } from "./internal-types.js";
|
|
4
5
|
import type { FacadeOperationMetadata, OuterFacadeOperation } from "./types.js";
|
|
5
6
|
export interface AssembleOperationsInput {
|
|
@@ -9,6 +10,7 @@ export interface AssembleOperationsInput {
|
|
|
9
10
|
underlying: Address;
|
|
10
11
|
liquidationRemainingFunds?: bigint;
|
|
11
12
|
phantomTokens?: AddressMap<Address>;
|
|
13
|
+
withdrawCollateralEvents?: WithdrawCollateralEventInfo[];
|
|
12
14
|
strict?: boolean;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
2
|
import type { AddressMap, ChainContractsRegister, ParsedCallV2 } from "../sdk/index.js";
|
|
3
|
+
import type { WithdrawCollateralEventInfo } from "./extractTransfers.js";
|
|
3
4
|
import type { InnerOperation } from "./inner-operations.js";
|
|
4
5
|
import type { ExecuteResult } from "./internal-types.js";
|
|
5
6
|
export interface ClassifyMulticallOperationsInput {
|
|
@@ -11,6 +12,7 @@ export interface ClassifyMulticallOperationsInput {
|
|
|
11
12
|
underlying: Address;
|
|
12
13
|
strict?: boolean;
|
|
13
14
|
phantomTokens?: AddressMap<Address>;
|
|
15
|
+
withdrawCollateralEvents?: WithdrawCollateralEventInfo[];
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Classifies each multicall inner call into a {@link InnerOperation}:
|
|
@@ -6,6 +6,9 @@ export declare class UnknownAdapterError extends Error {
|
|
|
6
6
|
export declare class TransferAlignmentError extends Error {
|
|
7
7
|
constructor(expected: number, actual: number);
|
|
8
8
|
}
|
|
9
|
+
export declare class WithdrawCollateralAlignmentError extends Error {
|
|
10
|
+
constructor(expected: number, actual: number);
|
|
11
|
+
}
|
|
9
12
|
export declare class ProtocolCallNotFoundError extends Error {
|
|
10
13
|
readonly targetContract: Address;
|
|
11
14
|
readonly executeIndex: number;
|