@morpho-org/morpho-sdk 10.5.0 → 10.6.0-next.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/README.md +44 -1
- package/lib/cjs/abis.d.ts +794 -1
- package/lib/cjs/abis.js +815 -1
- package/lib/cjs/actions/blue/close.d.ts +169 -0
- package/lib/cjs/actions/blue/close.js +270 -0
- package/lib/cjs/actions/blue/common.js +2 -2
- package/lib/cjs/actions/blue/delever.d.ts +156 -0
- package/lib/cjs/actions/blue/delever.js +223 -0
- package/lib/cjs/actions/blue/index.d.ts +3 -0
- package/lib/cjs/actions/blue/index.js +3 -0
- package/lib/cjs/actions/blue/lever.d.ts +184 -0
- package/lib/cjs/actions/blue/lever.js +272 -0
- package/lib/cjs/actions/blue/leverageIntent.d.ts +65 -0
- package/lib/cjs/actions/blue/leverageIntent.js +103 -0
- package/lib/cjs/actions/requirements/blue/encodeLeverageAuthorization.d.ts +39 -0
- package/lib/cjs/actions/requirements/blue/encodeLeverageAuthorization.js +59 -0
- package/lib/cjs/actions/requirements/blue/getLeverageRequirements.d.ts +104 -0
- package/lib/cjs/actions/requirements/blue/getLeverageRequirements.js +193 -0
- package/lib/cjs/actions/requirements/blue/getLeverageRequirementsApproval.d.ts +45 -0
- package/lib/cjs/actions/requirements/blue/getLeverageRequirementsApproval.js +66 -0
- package/lib/cjs/actions/requirements/blue/index.d.ts +3 -0
- package/lib/cjs/actions/requirements/blue/index.js +17 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +2 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +3 -2
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +11 -6
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +29 -5
- package/lib/cjs/addresses.d.ts +1 -1
- package/lib/cjs/addresses.js +6 -1
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +5 -1
- package/lib/cjs/blue/addresses.d.ts +1 -1
- package/lib/cjs/blue/addresses.js +6 -1
- package/lib/cjs/blue/entities.d.ts +4 -4
- package/lib/cjs/blue/entities.js +3 -1
- package/lib/cjs/blue/errors.d.ts +2 -2
- package/lib/cjs/blue/errors.js +5 -1
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +3 -1
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +2 -1
- package/lib/cjs/constants.d.ts +1 -1
- package/lib/cjs/constants.js +6 -2
- package/lib/cjs/entities/blue/blue.d.ts +486 -2
- package/lib/cjs/entities/blue/blue.js +529 -34
- package/lib/cjs/entities/index.d.ts +5 -5
- package/lib/cjs/entities/index.js +3 -1
- package/lib/cjs/entities/requirements/assertContractCode.d.ts +0 -23
- package/lib/cjs/entities/requirements/assertContractCode.js +3 -28
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +34 -8
- package/lib/cjs/entities/vaultV2/vaultV2.js +39 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +120 -2
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +232 -4
- package/lib/cjs/errors.d.ts +4 -4
- package/lib/cjs/errors.js +7 -5
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +3 -1
- package/lib/cjs/helpers/constant.d.ts +34 -0
- package/lib/cjs/helpers/constant.js +35 -1
- package/lib/cjs/helpers/deadShares.js +3 -0
- package/lib/cjs/helpers/getZeroExLeverageBundle.d.ts +13 -0
- package/lib/cjs/helpers/getZeroExLeverageBundle.js +27 -0
- package/lib/cjs/helpers/index.d.ts +4 -1
- package/lib/cjs/helpers/index.js +28 -1
- package/lib/cjs/helpers/leverage/index.d.ts +1 -0
- package/lib/cjs/helpers/leverage/index.js +11 -0
- package/lib/cjs/helpers/leverage/limits.d.ts +472 -0
- package/lib/cjs/helpers/leverage/limits.js +715 -0
- package/lib/cjs/helpers/leverage/positionMarket.d.ts +17 -0
- package/lib/cjs/helpers/leverage/positionMarket.js +28 -0
- package/lib/cjs/helpers/leverage/reallocations.d.ts +159 -0
- package/lib/cjs/helpers/leverage/reallocations.js +276 -0
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +4 -0
- package/lib/cjs/helpers/zeroExQuote.d.ts +250 -0
- package/lib/cjs/helpers/zeroExQuote.js +763 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +5 -2
- package/lib/cjs/midnight/errors.d.ts +2 -1
- package/lib/cjs/midnight/errors.js +5 -4
- package/lib/cjs/reads/assertContractCode.d.ts +25 -0
- package/lib/cjs/reads/assertContractCode.js +30 -0
- package/lib/cjs/reads/fetchZeroExQuote.d.ts +123 -0
- package/lib/cjs/reads/fetchZeroExQuote.js +330 -0
- package/lib/cjs/types/action.d.ts +130 -1
- package/lib/cjs/types/error.d.ts +59 -0
- package/lib/cjs/types/error.js +82 -3
- package/lib/cjs/types/index.d.ts +2 -0
- package/lib/cjs/types/index.js +2 -0
- package/lib/cjs/types/leverageError.d.ts +1552 -0
- package/lib/cjs/types/leverageError.js +1711 -0
- package/lib/cjs/types/zeroEx.d.ts +171 -0
- package/lib/cjs/types/zeroEx.js +2 -0
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +4 -2
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/abis.d.ts +794 -1
- package/lib/esm/abis.js +810 -1
- package/lib/esm/actions/blue/close.d.ts +169 -0
- package/lib/esm/actions/blue/close.js +266 -0
- package/lib/esm/actions/blue/common.js +3 -3
- package/lib/esm/actions/blue/delever.d.ts +156 -0
- package/lib/esm/actions/blue/delever.js +219 -0
- package/lib/esm/actions/blue/index.d.ts +3 -0
- package/lib/esm/actions/blue/index.js +3 -0
- package/lib/esm/actions/blue/lever.d.ts +184 -0
- package/lib/esm/actions/blue/lever.js +268 -0
- package/lib/esm/actions/blue/leverageIntent.d.ts +65 -0
- package/lib/esm/actions/blue/leverageIntent.js +96 -0
- package/lib/esm/actions/requirements/blue/encodeLeverageAuthorization.d.ts +39 -0
- package/lib/esm/actions/requirements/blue/encodeLeverageAuthorization.js +55 -0
- package/lib/esm/actions/requirements/blue/getLeverageRequirements.d.ts +104 -0
- package/lib/esm/actions/requirements/blue/getLeverageRequirements.js +189 -0
- package/lib/esm/actions/requirements/blue/getLeverageRequirementsApproval.d.ts +45 -0
- package/lib/esm/actions/requirements/blue/getLeverageRequirementsApproval.js +62 -0
- package/lib/esm/actions/requirements/blue/index.d.ts +3 -0
- package/lib/esm/actions/requirements/blue/index.js +3 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +3 -2
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +11 -6
- package/lib/esm/actions/requirements/getRequirementsApproval.js +29 -5
- package/lib/esm/addresses.d.ts +1 -1
- package/lib/esm/addresses.js +1 -1
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/addresses.d.ts +1 -1
- package/lib/esm/blue/addresses.js +1 -1
- package/lib/esm/blue/entities.d.ts +4 -4
- package/lib/esm/blue/entities.js +2 -2
- package/lib/esm/blue/errors.d.ts +2 -2
- package/lib/esm/blue/errors.js +2 -2
- package/lib/esm/blue/fetch.d.ts +2 -2
- package/lib/esm/blue/fetch.js +2 -2
- package/lib/esm/blue/utils.d.ts +1 -1
- package/lib/esm/blue/utils.js +1 -1
- package/lib/esm/constants.d.ts +1 -1
- package/lib/esm/constants.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +486 -2
- package/lib/esm/entities/blue/blue.js +501 -6
- package/lib/esm/entities/index.d.ts +5 -5
- package/lib/esm/entities/index.js +2 -2
- package/lib/esm/entities/requirements/assertContractCode.d.ts +0 -23
- package/lib/esm/entities/requirements/assertContractCode.js +1 -25
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +34 -8
- package/lib/esm/entities/vaultV2/vaultV2.js +40 -2
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +120 -2
- package/lib/esm/entities/vaultV2BlueReallocationData.js +233 -5
- package/lib/esm/errors.d.ts +4 -4
- package/lib/esm/errors.js +4 -4
- package/lib/esm/fetch.d.ts +2 -2
- package/lib/esm/fetch.js +2 -2
- package/lib/esm/helpers/constant.d.ts +34 -0
- package/lib/esm/helpers/constant.js +34 -0
- package/lib/esm/helpers/deadShares.js +4 -1
- package/lib/esm/helpers/getZeroExLeverageBundle.d.ts +13 -0
- package/lib/esm/helpers/getZeroExLeverageBundle.js +23 -0
- package/lib/esm/helpers/index.d.ts +4 -1
- package/lib/esm/helpers/index.js +4 -1
- package/lib/esm/helpers/leverage/index.d.ts +1 -0
- package/lib/esm/helpers/leverage/index.js +1 -0
- package/lib/esm/helpers/leverage/limits.d.ts +472 -0
- package/lib/esm/helpers/leverage/limits.js +705 -0
- package/lib/esm/helpers/leverage/positionMarket.d.ts +17 -0
- package/lib/esm/helpers/leverage/positionMarket.js +24 -0
- package/lib/esm/helpers/leverage/reallocations.d.ts +159 -0
- package/lib/esm/helpers/leverage/reallocations.js +271 -0
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +5 -1
- package/lib/esm/helpers/zeroExQuote.d.ts +250 -0
- package/lib/esm/helpers/zeroExQuote.js +754 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/midnight/errors.d.ts +2 -1
- package/lib/esm/midnight/errors.js +2 -1
- package/lib/esm/reads/assertContractCode.d.ts +25 -0
- package/lib/esm/reads/assertContractCode.js +26 -0
- package/lib/esm/reads/fetchZeroExQuote.d.ts +123 -0
- package/lib/esm/reads/fetchZeroExQuote.js +326 -0
- package/lib/esm/types/action.d.ts +130 -1
- package/lib/esm/types/error.d.ts +59 -0
- package/lib/esm/types/error.js +76 -0
- package/lib/esm/types/index.d.ts +2 -0
- package/lib/esm/types/index.js +2 -0
- package/lib/esm/types/leverageError.d.ts +1552 -0
- package/lib/esm/types/leverageError.js +1660 -0
- package/lib/esm/types/zeroEx.d.ts +171 -0
- package/lib/esm/types/zeroEx.js +1 -0
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +7 -7
package/lib/cjs/abis.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.blueBundlesV1Abi = exports.vaultBundlesV1Abi = exports.vaultExitBundlesV1Abi = exports.midnightSetterRatifierAbi = exports.midnightRateRatifierV1Abi = exports.midnightPriceRatifierV1Abi = exports.midnightEventsAbi = exports.midnightBundlesV2Abi = exports.midnightAbi = exports.midnightEcrecoverRatifierAbi = exports.midnightEcrecoverAuthorizerAbi = exports.midnightBlueBuyCallbackFactoryAbi = exports.midnightBlueBuyCallbackAbi = exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.bluePreLiquidationFactoryAbi = exports.bluePreLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc3643IdentityRegistryAbi = exports.erc3643Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.blueAdaptiveCurveIrmAbi = exports.blueMarketParamsAbi = exports.bundlesPermitParameters = exports.BundlesPermitKind = void 0;
|
|
3
|
+
exports.zeroExSettlerSelectAbi = exports.zeroExSettlerOtherEntryPointsAbi = exports.zeroExSettlerAbi = exports.zeroExAllowanceHolderAbi = exports.zeroExLeverageBundlesV1Abi = exports.blueBundlesV1Abi = exports.vaultBundlesV1Abi = exports.vaultExitBundlesV1Abi = exports.midnightSetterRatifierAbi = exports.midnightRateRatifierV1Abi = exports.midnightPriceRatifierV1Abi = exports.midnightEventsAbi = exports.midnightBundlesV2Abi = exports.midnightAbi = exports.midnightEcrecoverRatifierAbi = exports.midnightEcrecoverAuthorizerAbi = exports.midnightBlueBuyCallbackFactoryAbi = exports.midnightBlueBuyCallbackAbi = exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.bluePreLiquidationFactoryAbi = exports.bluePreLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.midnightAdapterRateRatifierV1Abi = exports.midnightAdapterPriceRatifierV1Abi = exports.midnightAdapterFactoryAbi = exports.midnightAdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc3643IdentityRegistryAbi = exports.erc3643Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.blueAdaptiveCurveIrmAbi = exports.blueMarketParamsAbi = exports.bundlesPermitParameters = exports.BundlesPermitKind = void 0;
|
|
4
|
+
exports.zeroExSettlerRegistryAbi = exports.zeroExSettlerBasicAbi = void 0;
|
|
4
5
|
/** Numeric permit kinds consumed by `TokenLib.pullToken`. */
|
|
5
6
|
exports.BundlesPermitKind = {
|
|
6
7
|
None: 0,
|
|
@@ -33,6 +34,10 @@ Object.defineProperty(exports, "erc3643IdentityRegistryAbi", { enumerable: true,
|
|
|
33
34
|
Object.defineProperty(exports, "erc5267Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.erc5267Abi; } });
|
|
34
35
|
Object.defineProperty(exports, "metaMorphoAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.metaMorphoAbi; } });
|
|
35
36
|
Object.defineProperty(exports, "metaMorphoFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.metaMorphoFactoryAbi; } });
|
|
37
|
+
Object.defineProperty(exports, "midnightAdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterAbi; } });
|
|
38
|
+
Object.defineProperty(exports, "midnightAdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterFactoryAbi; } });
|
|
39
|
+
Object.defineProperty(exports, "midnightAdapterPriceRatifierV1Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterPriceRatifierV1Abi; } });
|
|
40
|
+
Object.defineProperty(exports, "midnightAdapterRateRatifierV1Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterRateRatifierV1Abi; } });
|
|
36
41
|
Object.defineProperty(exports, "morphoMarketV1AdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.morphoMarketV1AdapterAbi; } });
|
|
37
42
|
Object.defineProperty(exports, "morphoMarketV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.morphoMarketV1AdapterFactoryAbi; } });
|
|
38
43
|
Object.defineProperty(exports, "morphoMarketV1AdapterV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.morphoMarketV1AdapterV2Abi; } });
|
|
@@ -1105,3 +1110,812 @@ exports.blueBundlesV1Abi = [
|
|
|
1105
1110
|
outputs: [],
|
|
1106
1111
|
},
|
|
1107
1112
|
];
|
|
1113
|
+
/**
|
|
1114
|
+
* Pinned ABI for the ZeroExLeverageBundlesV1 periphery contract: Morpho Blue lever, delever and close in one
|
|
1115
|
+
* transaction, swapping through 0x AllowanceHolder.
|
|
1116
|
+
*
|
|
1117
|
+
* Generated with `forge inspect` from `morpho-org/bundles` commit `3bf53141455051f8fc7a85cd00cc15bd89459238`,
|
|
1118
|
+
* `src/leverage/ZeroExLeverageBundlesV1.sol`: its constructor, getters, Morpho callbacks, three entry points,
|
|
1119
|
+
* `PublicAllocations` struct and custom errors, including those raised by `TokenLib`.
|
|
1120
|
+
*
|
|
1121
|
+
* @see https://github.com/morpho-org/bundles/blob/3bf53141455051f8fc7a85cd00cc15bd89459238/src/leverage/ZeroExLeverageBundlesV1.sol
|
|
1122
|
+
* @example
|
|
1123
|
+
* ```ts
|
|
1124
|
+
* import { zeroExLeverageBundlesV1Abi } from "@morpho-org/morpho-sdk/abis";
|
|
1125
|
+
*
|
|
1126
|
+
* console.log(zeroExLeverageBundlesV1Abi.length);
|
|
1127
|
+
* ```
|
|
1128
|
+
*/
|
|
1129
|
+
exports.zeroExLeverageBundlesV1Abi = [
|
|
1130
|
+
{
|
|
1131
|
+
type: "constructor",
|
|
1132
|
+
inputs: [
|
|
1133
|
+
{
|
|
1134
|
+
name: "_blue",
|
|
1135
|
+
type: "address",
|
|
1136
|
+
internalType: "address",
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
name: "_publicAllocator",
|
|
1140
|
+
type: "address",
|
|
1141
|
+
internalType: "address",
|
|
1142
|
+
},
|
|
1143
|
+
],
|
|
1144
|
+
stateMutability: "nonpayable",
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
type: "error",
|
|
1148
|
+
name: "ApproveReturnedFalse",
|
|
1149
|
+
inputs: [],
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
type: "error",
|
|
1153
|
+
name: "DeadlinePassed",
|
|
1154
|
+
inputs: [],
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
type: "error",
|
|
1158
|
+
name: "ExcessiveInput",
|
|
1159
|
+
inputs: [],
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
type: "error",
|
|
1163
|
+
name: "InconsistentBorrowInput",
|
|
1164
|
+
inputs: [],
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
type: "error",
|
|
1168
|
+
name: "InconsistentPenaltyAssets",
|
|
1169
|
+
inputs: [],
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
type: "error",
|
|
1173
|
+
name: "InconsistentTokens",
|
|
1174
|
+
inputs: [],
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
type: "error",
|
|
1178
|
+
name: "InsufficientOutput",
|
|
1179
|
+
inputs: [],
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
type: "error",
|
|
1183
|
+
name: "LtvExceeded",
|
|
1184
|
+
inputs: [],
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
type: "error",
|
|
1188
|
+
name: "NoCode",
|
|
1189
|
+
inputs: [],
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
type: "error",
|
|
1193
|
+
name: "Reentrancy",
|
|
1194
|
+
inputs: [],
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
type: "error",
|
|
1198
|
+
name: "TransferFromReturnedFalse",
|
|
1199
|
+
inputs: [],
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
type: "error",
|
|
1203
|
+
name: "TransferReturnedFalse",
|
|
1204
|
+
inputs: [],
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
type: "error",
|
|
1208
|
+
name: "UnauthorizedCallback",
|
|
1209
|
+
inputs: [],
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
type: "error",
|
|
1213
|
+
name: "ZeroMinCollateralToBuy",
|
|
1214
|
+
inputs: [],
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
type: "function",
|
|
1218
|
+
name: "ALLOWANCE_HOLDER",
|
|
1219
|
+
inputs: [],
|
|
1220
|
+
outputs: [
|
|
1221
|
+
{
|
|
1222
|
+
name: "",
|
|
1223
|
+
type: "address",
|
|
1224
|
+
internalType: "address",
|
|
1225
|
+
},
|
|
1226
|
+
],
|
|
1227
|
+
stateMutability: "view",
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
type: "function",
|
|
1231
|
+
name: "BLUE",
|
|
1232
|
+
inputs: [],
|
|
1233
|
+
outputs: [
|
|
1234
|
+
{
|
|
1235
|
+
name: "",
|
|
1236
|
+
type: "address",
|
|
1237
|
+
internalType: "address",
|
|
1238
|
+
},
|
|
1239
|
+
],
|
|
1240
|
+
stateMutability: "view",
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
type: "function",
|
|
1244
|
+
name: "PUBLIC_ALLOCATOR",
|
|
1245
|
+
inputs: [],
|
|
1246
|
+
outputs: [
|
|
1247
|
+
{
|
|
1248
|
+
name: "",
|
|
1249
|
+
type: "address",
|
|
1250
|
+
internalType: "address",
|
|
1251
|
+
},
|
|
1252
|
+
],
|
|
1253
|
+
stateMutability: "view",
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
type: "function",
|
|
1257
|
+
name: "onMorphoFlashLoan",
|
|
1258
|
+
inputs: [
|
|
1259
|
+
{
|
|
1260
|
+
name: "",
|
|
1261
|
+
type: "uint256",
|
|
1262
|
+
internalType: "uint256",
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
name: "flashLoanData",
|
|
1266
|
+
type: "bytes",
|
|
1267
|
+
internalType: "bytes",
|
|
1268
|
+
},
|
|
1269
|
+
],
|
|
1270
|
+
outputs: [],
|
|
1271
|
+
stateMutability: "nonpayable",
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
type: "function",
|
|
1275
|
+
name: "onMorphoRepay",
|
|
1276
|
+
inputs: [
|
|
1277
|
+
{
|
|
1278
|
+
name: "assets",
|
|
1279
|
+
type: "uint256",
|
|
1280
|
+
internalType: "uint256",
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
name: "repayData",
|
|
1284
|
+
type: "bytes",
|
|
1285
|
+
internalType: "bytes",
|
|
1286
|
+
},
|
|
1287
|
+
],
|
|
1288
|
+
outputs: [],
|
|
1289
|
+
stateMutability: "nonpayable",
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
type: "function",
|
|
1293
|
+
name: "onMorphoSupplyCollateral",
|
|
1294
|
+
inputs: [
|
|
1295
|
+
{
|
|
1296
|
+
name: "",
|
|
1297
|
+
type: "uint256",
|
|
1298
|
+
internalType: "uint256",
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
name: "leverData",
|
|
1302
|
+
type: "bytes",
|
|
1303
|
+
internalType: "bytes",
|
|
1304
|
+
},
|
|
1305
|
+
],
|
|
1306
|
+
outputs: [],
|
|
1307
|
+
stateMutability: "nonpayable",
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
type: "function",
|
|
1311
|
+
name: "zeroExLeverageBundlesV1Close",
|
|
1312
|
+
inputs: [
|
|
1313
|
+
{
|
|
1314
|
+
name: "marketParams",
|
|
1315
|
+
type: "tuple",
|
|
1316
|
+
internalType: "struct MarketParams",
|
|
1317
|
+
components: [
|
|
1318
|
+
{
|
|
1319
|
+
name: "loanToken",
|
|
1320
|
+
type: "address",
|
|
1321
|
+
internalType: "address",
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
name: "collateralToken",
|
|
1325
|
+
type: "address",
|
|
1326
|
+
internalType: "address",
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
name: "oracle",
|
|
1330
|
+
type: "address",
|
|
1331
|
+
internalType: "address",
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
name: "irm",
|
|
1335
|
+
type: "address",
|
|
1336
|
+
internalType: "address",
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
name: "lltv",
|
|
1340
|
+
type: "uint256",
|
|
1341
|
+
internalType: "uint256",
|
|
1342
|
+
},
|
|
1343
|
+
],
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
name: "maxCollateralIn",
|
|
1347
|
+
type: "uint256",
|
|
1348
|
+
internalType: "uint256",
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
name: "minLoanOut",
|
|
1352
|
+
type: "uint256",
|
|
1353
|
+
internalType: "uint256",
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
name: "swapData",
|
|
1357
|
+
type: "bytes",
|
|
1358
|
+
internalType: "bytes",
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
name: "deadline",
|
|
1362
|
+
type: "uint256",
|
|
1363
|
+
internalType: "uint256",
|
|
1364
|
+
},
|
|
1365
|
+
],
|
|
1366
|
+
outputs: [],
|
|
1367
|
+
stateMutability: "nonpayable",
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
type: "function",
|
|
1371
|
+
name: "zeroExLeverageBundlesV1Delever",
|
|
1372
|
+
inputs: [
|
|
1373
|
+
{
|
|
1374
|
+
name: "marketParams",
|
|
1375
|
+
type: "tuple",
|
|
1376
|
+
internalType: "struct MarketParams",
|
|
1377
|
+
components: [
|
|
1378
|
+
{
|
|
1379
|
+
name: "loanToken",
|
|
1380
|
+
type: "address",
|
|
1381
|
+
internalType: "address",
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
name: "collateralToken",
|
|
1385
|
+
type: "address",
|
|
1386
|
+
internalType: "address",
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
name: "oracle",
|
|
1390
|
+
type: "address",
|
|
1391
|
+
internalType: "address",
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
name: "irm",
|
|
1395
|
+
type: "address",
|
|
1396
|
+
internalType: "address",
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
name: "lltv",
|
|
1400
|
+
type: "uint256",
|
|
1401
|
+
internalType: "uint256",
|
|
1402
|
+
},
|
|
1403
|
+
],
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
name: "maxCollateralToSell",
|
|
1407
|
+
type: "uint256",
|
|
1408
|
+
internalType: "uint256",
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
name: "minRepayAssets",
|
|
1412
|
+
type: "uint256",
|
|
1413
|
+
internalType: "uint256",
|
|
1414
|
+
},
|
|
1415
|
+
{
|
|
1416
|
+
name: "swapData",
|
|
1417
|
+
type: "bytes",
|
|
1418
|
+
internalType: "bytes",
|
|
1419
|
+
},
|
|
1420
|
+
{
|
|
1421
|
+
name: "maxLtv",
|
|
1422
|
+
type: "uint256",
|
|
1423
|
+
internalType: "uint256",
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
name: "deadline",
|
|
1427
|
+
type: "uint256",
|
|
1428
|
+
internalType: "uint256",
|
|
1429
|
+
},
|
|
1430
|
+
],
|
|
1431
|
+
outputs: [],
|
|
1432
|
+
stateMutability: "nonpayable",
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
type: "function",
|
|
1436
|
+
name: "zeroExLeverageBundlesV1Lever",
|
|
1437
|
+
inputs: [
|
|
1438
|
+
{
|
|
1439
|
+
name: "marketParams",
|
|
1440
|
+
type: "tuple",
|
|
1441
|
+
internalType: "struct MarketParams",
|
|
1442
|
+
components: [
|
|
1443
|
+
{
|
|
1444
|
+
name: "loanToken",
|
|
1445
|
+
type: "address",
|
|
1446
|
+
internalType: "address",
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
name: "collateralToken",
|
|
1450
|
+
type: "address",
|
|
1451
|
+
internalType: "address",
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
name: "oracle",
|
|
1455
|
+
type: "address",
|
|
1456
|
+
internalType: "address",
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
name: "irm",
|
|
1460
|
+
type: "address",
|
|
1461
|
+
internalType: "address",
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
name: "lltv",
|
|
1465
|
+
type: "uint256",
|
|
1466
|
+
internalType: "uint256",
|
|
1467
|
+
},
|
|
1468
|
+
],
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
name: "collateralAssets",
|
|
1472
|
+
type: "uint256",
|
|
1473
|
+
internalType: "uint256",
|
|
1474
|
+
},
|
|
1475
|
+
{
|
|
1476
|
+
name: "loanAssets",
|
|
1477
|
+
type: "uint256",
|
|
1478
|
+
internalType: "uint256",
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
name: "minCollateralToBuy",
|
|
1482
|
+
type: "uint256",
|
|
1483
|
+
internalType: "uint256",
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
name: "maxBorrowAssets",
|
|
1487
|
+
type: "uint256",
|
|
1488
|
+
internalType: "uint256",
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
name: "swapData",
|
|
1492
|
+
type: "bytes",
|
|
1493
|
+
internalType: "bytes",
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
name: "maxLtv",
|
|
1497
|
+
type: "uint256",
|
|
1498
|
+
internalType: "uint256",
|
|
1499
|
+
},
|
|
1500
|
+
{
|
|
1501
|
+
name: "reallocations",
|
|
1502
|
+
type: "tuple[]",
|
|
1503
|
+
internalType: "struct PublicAllocations[]",
|
|
1504
|
+
components: [
|
|
1505
|
+
{
|
|
1506
|
+
name: "vault",
|
|
1507
|
+
type: "address",
|
|
1508
|
+
internalType: "address",
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
name: "adapter",
|
|
1512
|
+
type: "address",
|
|
1513
|
+
internalType: "address",
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
name: "marketParams",
|
|
1517
|
+
type: "tuple",
|
|
1518
|
+
internalType: "struct MarketParams",
|
|
1519
|
+
components: [
|
|
1520
|
+
{
|
|
1521
|
+
name: "loanToken",
|
|
1522
|
+
type: "address",
|
|
1523
|
+
internalType: "address",
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
name: "collateralToken",
|
|
1527
|
+
type: "address",
|
|
1528
|
+
internalType: "address",
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
name: "oracle",
|
|
1532
|
+
type: "address",
|
|
1533
|
+
internalType: "address",
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
name: "irm",
|
|
1537
|
+
type: "address",
|
|
1538
|
+
internalType: "address",
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
name: "lltv",
|
|
1542
|
+
type: "uint256",
|
|
1543
|
+
internalType: "uint256",
|
|
1544
|
+
},
|
|
1545
|
+
],
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
name: "fromIdle",
|
|
1549
|
+
type: "bool",
|
|
1550
|
+
internalType: "bool",
|
|
1551
|
+
},
|
|
1552
|
+
{
|
|
1553
|
+
name: "sourceAdapter",
|
|
1554
|
+
type: "address",
|
|
1555
|
+
internalType: "address",
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
name: "sourceMarketParams",
|
|
1559
|
+
type: "tuple",
|
|
1560
|
+
internalType: "struct MarketParams",
|
|
1561
|
+
components: [
|
|
1562
|
+
{
|
|
1563
|
+
name: "loanToken",
|
|
1564
|
+
type: "address",
|
|
1565
|
+
internalType: "address",
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
name: "collateralToken",
|
|
1569
|
+
type: "address",
|
|
1570
|
+
internalType: "address",
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
name: "oracle",
|
|
1574
|
+
type: "address",
|
|
1575
|
+
internalType: "address",
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
name: "irm",
|
|
1579
|
+
type: "address",
|
|
1580
|
+
internalType: "address",
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
name: "lltv",
|
|
1584
|
+
type: "uint256",
|
|
1585
|
+
internalType: "uint256",
|
|
1586
|
+
},
|
|
1587
|
+
],
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
name: "assets",
|
|
1591
|
+
type: "uint128",
|
|
1592
|
+
internalType: "uint128",
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
name: "penalty",
|
|
1596
|
+
type: "uint64",
|
|
1597
|
+
internalType: "uint64",
|
|
1598
|
+
},
|
|
1599
|
+
],
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
name: "penaltyAssets",
|
|
1603
|
+
type: "uint256",
|
|
1604
|
+
internalType: "uint256",
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
name: "deadline",
|
|
1608
|
+
type: "uint256",
|
|
1609
|
+
internalType: "uint256",
|
|
1610
|
+
},
|
|
1611
|
+
{
|
|
1612
|
+
name: "wrappedNative",
|
|
1613
|
+
type: "address",
|
|
1614
|
+
internalType: "address",
|
|
1615
|
+
},
|
|
1616
|
+
],
|
|
1617
|
+
outputs: [],
|
|
1618
|
+
stateMutability: "payable",
|
|
1619
|
+
},
|
|
1620
|
+
];
|
|
1621
|
+
/**
|
|
1622
|
+
* Pinned ABI fragment for 0x AllowanceHolder `exec`, the call a 0x allowance-holder quote's `transaction.data` encodes.
|
|
1623
|
+
*
|
|
1624
|
+
* Source: `0xProject/0x-settler` commit `f7340e6237146b2dfd40a40b3efeea527e4eb689`,
|
|
1625
|
+
* `src/allowanceholder/IAllowanceHolder.sol`.
|
|
1626
|
+
*
|
|
1627
|
+
* @see https://github.com/0xProject/0x-settler/blob/f7340e6237146b2dfd40a40b3efeea527e4eb689/src/allowanceholder/IAllowanceHolder.sol
|
|
1628
|
+
* @example
|
|
1629
|
+
* ```ts
|
|
1630
|
+
* import { zeroExAllowanceHolderAbi } from "@morpho-org/morpho-sdk/abis";
|
|
1631
|
+
* import { decodeFunctionData, encodeFunctionData, zeroAddress } from "viem";
|
|
1632
|
+
*
|
|
1633
|
+
* // A 0x allowance-holder quote's `transaction.data` has this shape.
|
|
1634
|
+
* const data = encodeFunctionData({
|
|
1635
|
+
* abi: zeroExAllowanceHolderAbi,
|
|
1636
|
+
* functionName: "exec",
|
|
1637
|
+
* args: [zeroAddress, zeroAddress, 1n, zeroAddress, "0x"],
|
|
1638
|
+
* });
|
|
1639
|
+
* const { args } = decodeFunctionData({ abi: zeroExAllowanceHolderAbi, data });
|
|
1640
|
+
* // args: [operator, token, amount, target, data], here [zeroAddress, zeroAddress, 1n, zeroAddress, "0x"]
|
|
1641
|
+
* ```
|
|
1642
|
+
*/
|
|
1643
|
+
exports.zeroExAllowanceHolderAbi = [
|
|
1644
|
+
{
|
|
1645
|
+
type: "function",
|
|
1646
|
+
name: "exec",
|
|
1647
|
+
inputs: [
|
|
1648
|
+
{ name: "operator", type: "address", internalType: "address" },
|
|
1649
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
1650
|
+
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
1651
|
+
{ name: "target", type: "address", internalType: "address payable" },
|
|
1652
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
1653
|
+
],
|
|
1654
|
+
outputs: [{ name: "result", type: "bytes", internalType: "bytes" }],
|
|
1655
|
+
stateMutability: "payable",
|
|
1656
|
+
},
|
|
1657
|
+
];
|
|
1658
|
+
/**
|
|
1659
|
+
* Pinned ABI fragment for the taker-submitted 0x Settler `execute`, the call AllowanceHolder forwards to Settler.
|
|
1660
|
+
*
|
|
1661
|
+
* Source: `0xProject/0x-settler` commit `f7340e6237146b2dfd40a40b3efeea527e4eb689`,
|
|
1662
|
+
* `src/interfaces/ISettlerTakerSubmitted.sol` and the `AllowedSlippage` struct of `src/interfaces/ISettlerBase.sol`.
|
|
1663
|
+
*
|
|
1664
|
+
* @see https://github.com/0xProject/0x-settler/blob/f7340e6237146b2dfd40a40b3efeea527e4eb689/src/interfaces/ISettlerTakerSubmitted.sol
|
|
1665
|
+
* @example
|
|
1666
|
+
* ```ts
|
|
1667
|
+
* import { zeroExSettlerAbi } from "@morpho-org/morpho-sdk/abis";
|
|
1668
|
+
* import { decodeFunctionData, encodeFunctionData, zeroAddress, zeroHash } from "viem";
|
|
1669
|
+
*
|
|
1670
|
+
* // The `data` argument of AllowanceHolder `exec` carries a Settler call of this shape.
|
|
1671
|
+
* const settlerCalldata = encodeFunctionData({
|
|
1672
|
+
* abi: zeroExSettlerAbi,
|
|
1673
|
+
* functionName: "execute",
|
|
1674
|
+
* args: [{ recipient: zeroAddress, buyToken: zeroAddress, minAmountOut: 1n }, [], zeroHash],
|
|
1675
|
+
* });
|
|
1676
|
+
* const { args } = decodeFunctionData({ abi: zeroExSettlerAbi, data: settlerCalldata });
|
|
1677
|
+
* // args[0]: { recipient, buyToken, minAmountOut }, here minAmountOut === 1n
|
|
1678
|
+
* ```
|
|
1679
|
+
*/
|
|
1680
|
+
exports.zeroExSettlerAbi = [
|
|
1681
|
+
{
|
|
1682
|
+
type: "function",
|
|
1683
|
+
name: "execute",
|
|
1684
|
+
inputs: [
|
|
1685
|
+
{
|
|
1686
|
+
name: "slippage",
|
|
1687
|
+
type: "tuple",
|
|
1688
|
+
internalType: "struct ISettlerBase.AllowedSlippage",
|
|
1689
|
+
components: [
|
|
1690
|
+
{
|
|
1691
|
+
name: "recipient",
|
|
1692
|
+
type: "address",
|
|
1693
|
+
internalType: "address payable",
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
name: "buyToken",
|
|
1697
|
+
type: "address",
|
|
1698
|
+
internalType: "contract IERC20",
|
|
1699
|
+
},
|
|
1700
|
+
{ name: "minAmountOut", type: "uint256", internalType: "uint256" },
|
|
1701
|
+
],
|
|
1702
|
+
},
|
|
1703
|
+
{ name: "actions", type: "bytes[]", internalType: "bytes[]" },
|
|
1704
|
+
{ name: "", type: "bytes32", internalType: "bytes32" },
|
|
1705
|
+
],
|
|
1706
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
1707
|
+
stateMutability: "payable",
|
|
1708
|
+
},
|
|
1709
|
+
];
|
|
1710
|
+
/**
|
|
1711
|
+
* Pinned ABI fragments for the 0x Settler entry points ZeroExLeverageBundlesV1 cannot use: `executeWithPermit` and
|
|
1712
|
+
* `executeMetaTxn`. Calldata that decodes as one of them is a decoded inconsistency, which `validateZeroExQuote`
|
|
1713
|
+
* refuses, not an undecodable layer.
|
|
1714
|
+
*
|
|
1715
|
+
* Source: `0xProject/0x-settler` commit `f7340e6237146b2dfd40a40b3efeea527e4eb689`,
|
|
1716
|
+
* `src/interfaces/ISettlerTakerSubmitted.sol` (`executeWithPermit`, implemented at `src/Settler.sol:134`) and
|
|
1717
|
+
* `src/interfaces/ISettlerMetaTxn.sol` (`executeMetaTxn`, implemented at `src/SettlerMetaTxn.sol:155`).
|
|
1718
|
+
*
|
|
1719
|
+
* @see https://github.com/0xProject/0x-settler/blob/f7340e6237146b2dfd40a40b3efeea527e4eb689/src/interfaces/ISettlerMetaTxn.sol
|
|
1720
|
+
* @example
|
|
1721
|
+
* ```ts
|
|
1722
|
+
* import { zeroExSettlerOtherEntryPointsAbi } from "@morpho-org/morpho-sdk/abis";
|
|
1723
|
+
* import { decodeFunctionData, encodeFunctionData, zeroAddress, zeroHash } from "viem";
|
|
1724
|
+
*
|
|
1725
|
+
* const settlerCalldata = encodeFunctionData({
|
|
1726
|
+
* abi: zeroExSettlerOtherEntryPointsAbi,
|
|
1727
|
+
* functionName: "executeWithPermit",
|
|
1728
|
+
* args: [{ recipient: zeroAddress, buyToken: zeroAddress, minAmountOut: 1n }, [], zeroHash, "0x"],
|
|
1729
|
+
* });
|
|
1730
|
+
* const { functionName } = decodeFunctionData({ abi: zeroExSettlerOtherEntryPointsAbi, data: settlerCalldata });
|
|
1731
|
+
* // "executeWithPermit"; calldata for the other entry point decodes as "executeMetaTxn"
|
|
1732
|
+
* ```
|
|
1733
|
+
*/
|
|
1734
|
+
exports.zeroExSettlerOtherEntryPointsAbi = [
|
|
1735
|
+
{
|
|
1736
|
+
type: "function",
|
|
1737
|
+
name: "executeWithPermit",
|
|
1738
|
+
inputs: [
|
|
1739
|
+
{
|
|
1740
|
+
name: "slippage",
|
|
1741
|
+
type: "tuple",
|
|
1742
|
+
internalType: "struct ISettlerBase.AllowedSlippage",
|
|
1743
|
+
components: [
|
|
1744
|
+
{
|
|
1745
|
+
name: "recipient",
|
|
1746
|
+
type: "address",
|
|
1747
|
+
internalType: "address payable",
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
name: "buyToken",
|
|
1751
|
+
type: "address",
|
|
1752
|
+
internalType: "contract IERC20",
|
|
1753
|
+
},
|
|
1754
|
+
{ name: "minAmountOut", type: "uint256", internalType: "uint256" },
|
|
1755
|
+
],
|
|
1756
|
+
},
|
|
1757
|
+
{ name: "actions", type: "bytes[]", internalType: "bytes[]" },
|
|
1758
|
+
{ name: "", type: "bytes32", internalType: "bytes32" },
|
|
1759
|
+
{ name: "permitData", type: "bytes", internalType: "bytes" },
|
|
1760
|
+
],
|
|
1761
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
1762
|
+
stateMutability: "payable",
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
type: "function",
|
|
1766
|
+
name: "executeMetaTxn",
|
|
1767
|
+
inputs: [
|
|
1768
|
+
{
|
|
1769
|
+
name: "slippage",
|
|
1770
|
+
type: "tuple",
|
|
1771
|
+
internalType: "struct ISettlerBase.AllowedSlippage",
|
|
1772
|
+
components: [
|
|
1773
|
+
{
|
|
1774
|
+
name: "recipient",
|
|
1775
|
+
type: "address",
|
|
1776
|
+
internalType: "address payable",
|
|
1777
|
+
},
|
|
1778
|
+
{
|
|
1779
|
+
name: "buyToken",
|
|
1780
|
+
type: "address",
|
|
1781
|
+
internalType: "contract IERC20",
|
|
1782
|
+
},
|
|
1783
|
+
{ name: "minAmountOut", type: "uint256", internalType: "uint256" },
|
|
1784
|
+
],
|
|
1785
|
+
},
|
|
1786
|
+
{ name: "actions", type: "bytes[]", internalType: "bytes[]" },
|
|
1787
|
+
{ name: "", type: "bytes32", internalType: "bytes32" },
|
|
1788
|
+
{ name: "msgSender", type: "address", internalType: "address" },
|
|
1789
|
+
{ name: "sig", type: "bytes", internalType: "bytes" },
|
|
1790
|
+
],
|
|
1791
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
1792
|
+
stateMutability: "nonpayable",
|
|
1793
|
+
},
|
|
1794
|
+
];
|
|
1795
|
+
/**
|
|
1796
|
+
* Pinned ABI fragment for the 0x Settler `SELECT` action, which runs the first of several candidate action lists that
|
|
1797
|
+
* delivers enough. `validateZeroExQuote` decodes it to refuse an RFQ fill in any of its candidates.
|
|
1798
|
+
*
|
|
1799
|
+
* Source: `0xProject/0x-settler` commit `243fb921232caedc27eb84f1f5820e84618dcd8b`, `src/ISettlerActions.sol:274`.
|
|
1800
|
+
*
|
|
1801
|
+
* @see https://github.com/0xProject/0x-settler/blob/243fb921232caedc27eb84f1f5820e84618dcd8b/src/ISettlerActions.sol#L274
|
|
1802
|
+
* @example
|
|
1803
|
+
* ```ts
|
|
1804
|
+
* import { zeroExSettlerSelectAbi } from "@morpho-org/morpho-sdk/abis";
|
|
1805
|
+
* import { decodeFunctionData, encodeFunctionData, zeroAddress } from "viem";
|
|
1806
|
+
*
|
|
1807
|
+
* const action = encodeFunctionData({
|
|
1808
|
+
* abi: zeroExSettlerSelectAbi,
|
|
1809
|
+
* functionName: "SELECT",
|
|
1810
|
+
* args: [500_000n, zeroAddress, [1n], [["0x"]]],
|
|
1811
|
+
* });
|
|
1812
|
+
* const [, , , candidates] = decodeFunctionData({ abi: zeroExSettlerSelectAbi, data: action }).args;
|
|
1813
|
+
* // action starts with "0x42032aef"; candidates is [["0x"]]
|
|
1814
|
+
* ```
|
|
1815
|
+
*/
|
|
1816
|
+
exports.zeroExSettlerSelectAbi = [
|
|
1817
|
+
{
|
|
1818
|
+
type: "function",
|
|
1819
|
+
name: "SELECT",
|
|
1820
|
+
inputs: [
|
|
1821
|
+
{ name: "trialGasLimit", type: "uint256", internalType: "uint256" },
|
|
1822
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
1823
|
+
{ name: "targets", type: "uint256[]", internalType: "uint256[]" },
|
|
1824
|
+
{ name: "candidates", type: "bytes[][]", internalType: "bytes[][]" },
|
|
1825
|
+
],
|
|
1826
|
+
outputs: [],
|
|
1827
|
+
stateMutability: "nonpayable",
|
|
1828
|
+
},
|
|
1829
|
+
];
|
|
1830
|
+
/**
|
|
1831
|
+
* Pinned ABI fragments for the 0x Settler `BASIC` and `BASIC_PUSH` actions, opaque calls to a venue.
|
|
1832
|
+
* `validateZeroExQuote` decodes them to scan the inner call's data for a word that looks like a short deadline.
|
|
1833
|
+
*
|
|
1834
|
+
* Source: `0xProject/0x-settler` commit `243fb921232caedc27eb84f1f5820e84618dcd8b`, `src/ISettlerActions.sol:240`
|
|
1835
|
+
* and `:244`.
|
|
1836
|
+
*
|
|
1837
|
+
* @see https://github.com/0xProject/0x-settler/blob/243fb921232caedc27eb84f1f5820e84618dcd8b/src/ISettlerActions.sol#L240
|
|
1838
|
+
* @example
|
|
1839
|
+
* ```ts
|
|
1840
|
+
* import { zeroExSettlerBasicAbi } from "@morpho-org/morpho-sdk/abis";
|
|
1841
|
+
* import { decodeFunctionData, encodeFunctionData, zeroAddress } from "viem";
|
|
1842
|
+
*
|
|
1843
|
+
* const action = encodeFunctionData({
|
|
1844
|
+
* abi: zeroExSettlerBasicAbi,
|
|
1845
|
+
* functionName: "BASIC",
|
|
1846
|
+
* args: [zeroAddress, 10_000n, zeroAddress, 4n, "0x"],
|
|
1847
|
+
* });
|
|
1848
|
+
* const [, , , , data] = decodeFunctionData({ abi: zeroExSettlerBasicAbi, data: action }).args;
|
|
1849
|
+
* // action starts with "0x38c9c147"; data is "0x"
|
|
1850
|
+
* ```
|
|
1851
|
+
*/
|
|
1852
|
+
exports.zeroExSettlerBasicAbi = [
|
|
1853
|
+
{
|
|
1854
|
+
type: "function",
|
|
1855
|
+
name: "BASIC",
|
|
1856
|
+
inputs: [
|
|
1857
|
+
{ name: "sellToken", type: "address", internalType: "address" },
|
|
1858
|
+
{ name: "ppm", type: "uint256", internalType: "uint256" },
|
|
1859
|
+
{ name: "pool", type: "address", internalType: "address" },
|
|
1860
|
+
{ name: "offset", type: "uint256", internalType: "uint256" },
|
|
1861
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
1862
|
+
],
|
|
1863
|
+
outputs: [],
|
|
1864
|
+
stateMutability: "nonpayable",
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
type: "function",
|
|
1868
|
+
name: "BASIC_PUSH",
|
|
1869
|
+
inputs: [
|
|
1870
|
+
{ name: "sellToken", type: "address", internalType: "address" },
|
|
1871
|
+
{ name: "ppm", type: "uint256", internalType: "uint256" },
|
|
1872
|
+
{ name: "pool", type: "address", internalType: "address" },
|
|
1873
|
+
{ name: "offset", type: "uint256", internalType: "uint256" },
|
|
1874
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
1875
|
+
],
|
|
1876
|
+
outputs: [],
|
|
1877
|
+
stateMutability: "nonpayable",
|
|
1878
|
+
},
|
|
1879
|
+
];
|
|
1880
|
+
/**
|
|
1881
|
+
* Pinned ABI fragment for the 0x Settler deployer and registry: `ownerOf(feature)` returns the current Settler and
|
|
1882
|
+
* reverts while the feature is paused, `prev(feature)` returns the Settler 0x API may still target during a rotation.
|
|
1883
|
+
*
|
|
1884
|
+
* Source: `0xProject/0x-settler` commit `f7340e6237146b2dfd40a40b3efeea527e4eb689`, `src/deployer/IDeployer.sol`,
|
|
1885
|
+
* where `Feature` is a `uint128` user-defined value type.
|
|
1886
|
+
*
|
|
1887
|
+
* @see https://github.com/0xProject/0x-settler/blob/f7340e6237146b2dfd40a40b3efeea527e4eb689/src/deployer/IDeployer.sol
|
|
1888
|
+
* @example
|
|
1889
|
+
* ```ts
|
|
1890
|
+
* import { zeroExSettlerRegistryAbi } from "@morpho-org/morpho-sdk/abis";
|
|
1891
|
+
* import { ZERO_EX_SETTLER_REGISTRY_ADDRESS, ZERO_EX_TAKER_SUBMITTED_SETTLER_FEATURE } from "@morpho-org/morpho-sdk/addresses";
|
|
1892
|
+
* import { createPublicClient, http } from "viem";
|
|
1893
|
+
* import { readContract } from "viem/actions";
|
|
1894
|
+
* import { mainnet } from "viem/chains";
|
|
1895
|
+
*
|
|
1896
|
+
* const client = createPublicClient({ chain: mainnet, transport: http() }); // use your own RPC URL
|
|
1897
|
+
*
|
|
1898
|
+
* const settler = await readContract(client, {
|
|
1899
|
+
* address: ZERO_EX_SETTLER_REGISTRY_ADDRESS,
|
|
1900
|
+
* abi: zeroExSettlerRegistryAbi,
|
|
1901
|
+
* functionName: "ownerOf",
|
|
1902
|
+
* args: [ZERO_EX_TAKER_SUBMITTED_SETTLER_FEATURE],
|
|
1903
|
+
* });
|
|
1904
|
+
* ```
|
|
1905
|
+
*/
|
|
1906
|
+
exports.zeroExSettlerRegistryAbi = [
|
|
1907
|
+
{
|
|
1908
|
+
type: "function",
|
|
1909
|
+
name: "ownerOf",
|
|
1910
|
+
inputs: [{ name: "tokenId", type: "uint256", internalType: "uint256" }],
|
|
1911
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1912
|
+
stateMutability: "view",
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
type: "function",
|
|
1916
|
+
name: "prev",
|
|
1917
|
+
inputs: [{ name: "", type: "uint128", internalType: "Feature" }],
|
|
1918
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1919
|
+
stateMutability: "view",
|
|
1920
|
+
},
|
|
1921
|
+
];
|