Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions scripts/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { writeFile } from "node:fs/promises";
import { pino } from "pino";

import { AccountsCounterPlugin } from "../src/plugins/accounts-counter/index.js";
import { AdaptersPlugin } from "../src/plugins/adapters/AdaptersPlugin.js";
import { BotsPlugin } from "../src/plugins/bots/index.js";
import { DegenDistributorsPlugin } from "../src/plugins/degen-distributors/index.js";
import { Pools7DAgoPlugin } from "../src/plugins/pools-history/index.js";
Expand Down Expand Up @@ -30,14 +31,15 @@ async function example(): Promise<void> {
const sdk = await GearboxSDK.attach({
rpcURLs: [RPC],
timeout: 480_000,
// blockNumber: 22118452, // 21977000, // 22118452
blockNumber: 23928400,
// redstoneHistoricTimestamp: true,
// addressProvider: ADDRESS_PROVIDER,
// marketConfigurators: [],
logger,
// ignoreUpdateablePrices: true,
strictContractTypes: true,
plugins: {
adapters: new AdaptersPlugin(true),
zappers: new ZappersPlugin([], true),
bots: new BotsPlugin(true),
degen: new DegenDistributorsPlugin(true),
Expand All @@ -47,9 +49,11 @@ async function example(): Promise<void> {
},
redstone: {
ignoreMissingFeeds: true,
historicTimestamp: true,
},
pyth: {
ignoreMissingFeeds: true,
historicTimestamp: true,
},
});

Expand Down Expand Up @@ -80,11 +84,11 @@ async function example(): Promise<void> {
const prefix = RPC.includes("127.0.0.1") ? "anvil_" : "";
const net = sdk.networkType;
await writeFile(
`tmp/state_${kind}_human_${net}_${prefix}${sdk.currentBlock}.json`,
`tmp/state_next_${kind}_human_${net}_${prefix}${sdk.currentBlock}.json`,
json_stringify(sdk.stateHuman()),
);
await writeFile(
`tmp/state_${kind}_${net}_${prefix}${sdk.currentBlock}.json`,
`tmp/state_next_${kind}_${net}_${prefix}${sdk.currentBlock}.json`,
json_stringify(sdk.state),
);

Expand Down
4 changes: 2 additions & 2 deletions src/dev/create2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { getCode, sendTransaction } from "viem/actions";

import type { GearboxSDK, ILogger } from "../sdk/index.js";
import { SDKConstruct } from "../sdk/index.js";
import { Construct } from "../sdk/index.js";

export const PUBLIC_CREATE2_FACTORY: Address =
"0x4e59b44847b379578588920ca78fbf26c0b4956c";
Expand Down Expand Up @@ -69,7 +69,7 @@ export class Create2Deployer<
transport extends Transport = Transport,
chain extends Chain = Chain,
account extends Account = Account,
> extends SDKConstruct {
> extends Construct {
#walletClient: WalletClient<transport, chain, account>;
#logger?: ILogger;

Expand Down
14 changes: 4 additions & 10 deletions src/dev/mint/AbstractMinter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { type Address, parseEther } from "viem";
import { ierc20Abi } from "../../abi/iERC20.js";
import {
type GearboxSDK,
type ILogger,
SDKConstruct,
} from "../../sdk/index.js";
import { type GearboxSDK, SDKConstruct } from "../../sdk/index.js";
import { iOwnableAbi } from "../abi.js";
import type { AnvilClient } from "../createAnvilClient.js";
import type { IMinter } from "./types.js";
Expand All @@ -14,14 +10,12 @@ export default abstract class AbstractMinter
implements IMinter
{
protected readonly anvil: AnvilClient;
protected readonly logger?: ILogger;
public readonly name: string;
public name: string;

constructor(sdk: GearboxSDK, anvil: AnvilClient, name = "Minter") {
constructor(sdk: GearboxSDK, anvil: AnvilClient) {
super(sdk);
this.anvil = anvil;
this.name = name;
this.logger = sdk.logger?.child?.({ name }) ?? sdk.logger;
this.name = this.constructor.name;
}

public async tryMint(
Expand Down
6 changes: 0 additions & 6 deletions src/dev/mint/DealMinter.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import type { Address, TestClient } from "viem";
import type { GearboxSDK } from "../../sdk/index.js";
import type { AnvilClient } from "../createAnvilClient.js";
import AbstractMinter from "./AbstractMinter.js";
import type { IMinter } from "./types.js";

export class DealMinter extends AbstractMinter implements IMinter {
constructor(sdk: GearboxSDK, anvil: AnvilClient) {
super(sdk, anvil, "DealMinter");
}

public override async mint(
token: Address,
dest: Address,
Expand Down
6 changes: 0 additions & 6 deletions src/dev/mint/DirectMinter.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { type Address, parseAbi } from "viem";
import type { GearboxSDK } from "../../sdk/index.js";
import type { AnvilClient } from "../createAnvilClient.js";
import AbstractMinter from "./AbstractMinter.js";
import type { IMinter } from "./types.js";

export class DirectMinter extends AbstractMinter implements IMinter {
constructor(sdk: GearboxSDK, anvil: AnvilClient) {
super(sdk, anvil, "DirectMinter");
}

public override async mint(
token: Address,
dest: Address,
Expand Down
2 changes: 1 addition & 1 deletion src/dev/mint/FallbackMinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class FallbackMinter extends AbstractMinter implements IMinter {
#minters: IMinter[];

constructor(sdk: GearboxSDK, anvil: AnvilClient, minters: IMinter[]) {
super(sdk, anvil, "FallbackMinter");
super(sdk, anvil);
this.#minters = minters;
}

Expand Down
6 changes: 0 additions & 6 deletions src/dev/mint/TransferMinter.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { type Address, parseAbi } from "viem";
import { ierc20Abi } from "../../abi/iERC20.js";
import type { GearboxSDK } from "../../sdk/index.js";
import type { AnvilClient } from "../createAnvilClient.js";
import AbstractMinter from "./AbstractMinter.js";
import type { IMinter } from "./types.js";

export class TransferMinter extends AbstractMinter implements IMinter {
constructor(sdk: GearboxSDK, anvil: AnvilClient) {
super(sdk, anvil, "TransferMinter");
}

public override async mint(
token: Address,
dest: Address,
Expand Down
19 changes: 11 additions & 8 deletions src/permissionless/bindings/address-provider.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { type Address, type PublicClient, stringToHex } from "viem";
import { iAddressProviderV310Abi } from "../../abi/310/generated.js";
import { BaseContract } from "./base-contract.js";
import {
type Address,
type Chain,
type PublicClient,
stringToHex,
type Transport,
} from "viem";
import { AddressProviderV310Contract } from "../../sdk/index.js";

const abi = iAddressProviderV310Abi;

export class AddressProviderContract extends BaseContract<typeof abi> {
constructor(address: Address, client: PublicClient) {
super(abi, address, client, "AddressProvider");
export class AddressProviderContract extends AddressProviderV310Contract {
constructor(addr: Address, client: PublicClient<Transport, Chain>) {
super({ client }, addr);
}

async getAddressOrRevert(key: string, version = 0n): Promise<Address> {
Expand Down
220 changes: 0 additions & 220 deletions src/permissionless/bindings/base-contract.ts

This file was deleted.

Loading
Loading