Skip to content

Commit fa764f2

Browse files
committed
fix: mellow adapter
1 parent b93ab4b commit fa764f2

File tree

3 files changed

+298
-0
lines changed

3 files changed

+298
-0
lines changed

src/sdk/abi/generated.ts

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18473,3 +18473,278 @@ export const yearnV2AdapterAbi = [
1847318473
{ type: "error", inputs: [], name: "CallerNotCreditFacadeException" },
1847418474
{ type: "error", inputs: [], name: "ZeroAddressException" },
1847518475
] as const;
18476+
18477+
export const iMellowVaultAdapterAbi = [
18478+
{
18479+
type: "function",
18480+
name: "_gearboxAdapterType",
18481+
inputs: [],
18482+
outputs: [
18483+
{
18484+
name: "",
18485+
type: "uint8",
18486+
internalType: "enum AdapterType",
18487+
},
18488+
],
18489+
stateMutability: "view",
18490+
},
18491+
{
18492+
type: "function",
18493+
name: "_gearboxAdapterVersion",
18494+
inputs: [],
18495+
outputs: [
18496+
{
18497+
name: "",
18498+
type: "uint16",
18499+
internalType: "uint16",
18500+
},
18501+
],
18502+
stateMutability: "view",
18503+
},
18504+
{
18505+
type: "function",
18506+
name: "addressProvider",
18507+
inputs: [],
18508+
outputs: [
18509+
{
18510+
name: "",
18511+
type: "address",
18512+
internalType: "address",
18513+
},
18514+
],
18515+
stateMutability: "view",
18516+
},
18517+
{
18518+
type: "function",
18519+
name: "creditManager",
18520+
inputs: [],
18521+
outputs: [
18522+
{
18523+
name: "",
18524+
type: "address",
18525+
internalType: "address",
18526+
},
18527+
],
18528+
stateMutability: "view",
18529+
},
18530+
{
18531+
type: "function",
18532+
name: "deposit",
18533+
inputs: [
18534+
{
18535+
name: "",
18536+
type: "address",
18537+
internalType: "address",
18538+
},
18539+
{
18540+
name: "amounts",
18541+
type: "uint256[]",
18542+
internalType: "uint256[]",
18543+
},
18544+
{
18545+
name: "minLpAmount",
18546+
type: "uint256",
18547+
internalType: "uint256",
18548+
},
18549+
{
18550+
name: "deadline",
18551+
type: "uint256",
18552+
internalType: "uint256",
18553+
},
18554+
],
18555+
outputs: [
18556+
{
18557+
name: "tokensToEnable",
18558+
type: "uint256",
18559+
internalType: "uint256",
18560+
},
18561+
{
18562+
name: "tokensToDisable",
18563+
type: "uint256",
18564+
internalType: "uint256",
18565+
},
18566+
],
18567+
stateMutability: "nonpayable",
18568+
},
18569+
{
18570+
type: "function",
18571+
name: "depositOneAsset",
18572+
inputs: [
18573+
{
18574+
name: "asset",
18575+
type: "address",
18576+
internalType: "address",
18577+
},
18578+
{
18579+
name: "amount",
18580+
type: "uint256",
18581+
internalType: "uint256",
18582+
},
18583+
{
18584+
name: "minLpAmount",
18585+
type: "uint256",
18586+
internalType: "uint256",
18587+
},
18588+
{
18589+
name: "deadline",
18590+
type: "uint256",
18591+
internalType: "uint256",
18592+
},
18593+
],
18594+
outputs: [
18595+
{
18596+
name: "tokensToEnable",
18597+
type: "uint256",
18598+
internalType: "uint256",
18599+
},
18600+
{
18601+
name: "tokensToDisable",
18602+
type: "uint256",
18603+
internalType: "uint256",
18604+
},
18605+
],
18606+
stateMutability: "nonpayable",
18607+
},
18608+
{
18609+
type: "function",
18610+
name: "depositOneAssetDiff",
18611+
inputs: [
18612+
{
18613+
name: "asset",
18614+
type: "address",
18615+
internalType: "address",
18616+
},
18617+
{
18618+
name: "leftoverAmount",
18619+
type: "uint256",
18620+
internalType: "uint256",
18621+
},
18622+
{
18623+
name: "rateMinRAY",
18624+
type: "uint256",
18625+
internalType: "uint256",
18626+
},
18627+
{
18628+
name: "deadline",
18629+
type: "uint256",
18630+
internalType: "uint256",
18631+
},
18632+
],
18633+
outputs: [
18634+
{
18635+
name: "tokensToEnable",
18636+
type: "uint256",
18637+
internalType: "uint256",
18638+
},
18639+
{
18640+
name: "tokensToDisable",
18641+
type: "uint256",
18642+
internalType: "uint256",
18643+
},
18644+
],
18645+
stateMutability: "nonpayable",
18646+
},
18647+
{
18648+
type: "function",
18649+
name: "isUnderlyingAllowed",
18650+
inputs: [
18651+
{
18652+
name: "token",
18653+
type: "address",
18654+
internalType: "address",
18655+
},
18656+
],
18657+
outputs: [
18658+
{
18659+
name: "",
18660+
type: "bool",
18661+
internalType: "bool",
18662+
},
18663+
],
18664+
stateMutability: "view",
18665+
},
18666+
{
18667+
type: "function",
18668+
name: "setUnderlyingStatusBatch",
18669+
inputs: [
18670+
{
18671+
name: "underlyings",
18672+
type: "tuple[]",
18673+
internalType: "struct MellowUnderlyingStatus[]",
18674+
components: [
18675+
{
18676+
name: "underlying",
18677+
type: "address",
18678+
internalType: "address",
18679+
},
18680+
{
18681+
name: "allowed",
18682+
type: "bool",
18683+
internalType: "bool",
18684+
},
18685+
],
18686+
},
18687+
],
18688+
outputs: [],
18689+
stateMutability: "nonpayable",
18690+
},
18691+
{
18692+
type: "function",
18693+
name: "targetContract",
18694+
inputs: [],
18695+
outputs: [
18696+
{
18697+
name: "",
18698+
type: "address",
18699+
internalType: "address",
18700+
},
18701+
],
18702+
stateMutability: "view",
18703+
},
18704+
{
18705+
type: "event",
18706+
name: "SetUnderlyingStatus",
18707+
inputs: [
18708+
{
18709+
name: "token",
18710+
type: "address",
18711+
indexed: true,
18712+
internalType: "address",
18713+
},
18714+
{
18715+
name: "newStatus",
18716+
type: "bool",
18717+
indexed: false,
18718+
internalType: "bool",
18719+
},
18720+
],
18721+
anonymous: false,
18722+
},
18723+
{
18724+
type: "error",
18725+
name: "IncorrectArrayLengthException",
18726+
inputs: [],
18727+
},
18728+
{
18729+
type: "error",
18730+
name: "UnderlyingNotAllowedException",
18731+
inputs: [
18732+
{
18733+
name: "asset",
18734+
type: "address",
18735+
internalType: "address",
18736+
},
18737+
],
18738+
},
18739+
{
18740+
type: "error",
18741+
name: "UnderlyingNotFoundException",
18742+
inputs: [
18743+
{
18744+
name: "asset",
18745+
type: "address",
18746+
internalType: "address",
18747+
},
18748+
],
18749+
},
18750+
] as const;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { iMellowVaultAdapterAbi } from "../../abi";
2+
import type { GearboxSDK } from "../../GearboxSDK";
3+
import type { AbstractAdapterContractOptions } from "./AbstractAdapter";
4+
import { AbstractAdapterContract } from "./AbstractAdapter";
5+
6+
const abi = iMellowVaultAdapterAbi;
7+
8+
export class MellowVaultAdapterContract extends AbstractAdapterContract<
9+
typeof abi
10+
> {
11+
constructor(
12+
sdk: GearboxSDK,
13+
args: Omit<AbstractAdapterContractOptions<typeof abi>, "abi">,
14+
) {
15+
super(sdk, {
16+
...args,
17+
abi,
18+
});
19+
}
20+
}

src/sdk/market/adapters/factory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { CurveV1AdapterStableNGContract } from "./CurveV1AdapterStableNGContract
1414
import { CurveV1AdapterStETHContract } from "./CurveV1AdapterStETHContract";
1515
import { CurveV1StableNGAdapterContract } from "./CurveV1StableNGAdapterContract";
1616
import { ERC4626AdapterContract } from "./ERC4626AdapterContract";
17+
import { MellowVaultAdapterContract } from "./MellowVaultAdapterContract";
1718
import type { AdapterContractType, IAdapterContract } from "./types";
1819
import { UniswapV2AdapterContract } from "./UniswapV2AdapterContract";
1920
import { UniswapV3AdapterContract } from "./UniswapV3AdapterContract";
@@ -61,6 +62,8 @@ export function createAdapter(
6162
return new CamelotV3AdapterContract(sdk, args);
6263
case "AD_YEARN_V2":
6364
return new YearnV2RouterAdapterContract(sdk, args);
65+
case "AD_MELLOW_LRT_VAULT":
66+
return new MellowVaultAdapterContract(sdk, args);
6467
default:
6568
throw new Error(`adapter for ${adapterType} is not implemented`);
6669
}

0 commit comments

Comments
 (0)