From c8b03e9731a7d5b362e28af3eba6de7d9ba106ba Mon Sep 17 00:00:00 2001 From: Mark Grothe Date: Tue, 21 Nov 2023 21:23:00 -0600 Subject: [PATCH] fix: cleanup --- packages/contract-helpers/src/index.ts | 1 - .../src/sdai-wrapper/index.ts | 161 ----- .../src/sdai-wrapper/sdai-wrapper.test.ts | 110 ---- .../typechain/SavingsDaiTokenWrapper.d.ts | 573 ------------------ .../SavingsDaiTokenWrapper_factory.ts | 429 ------------- 5 files changed, 1274 deletions(-) delete mode 100644 packages/contract-helpers/src/sdai-wrapper/index.ts delete mode 100644 packages/contract-helpers/src/sdai-wrapper/sdai-wrapper.test.ts delete mode 100644 packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper.d.ts delete mode 100644 packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper_factory.ts diff --git a/packages/contract-helpers/src/index.ts b/packages/contract-helpers/src/index.ts index 02edb0c0..c0198350 100644 --- a/packages/contract-helpers/src/index.ts +++ b/packages/contract-helpers/src/index.ts @@ -30,7 +30,6 @@ export * from './v3-migration-contract'; export * from './erc20-2612'; export * from './paraswap-debtSwitch-contract'; export * from './paraswap-withdrawAndSwitchAdapter-contract'; -export * from './sdai-wrapper'; export * from './token-wrapper'; // commons diff --git a/packages/contract-helpers/src/sdai-wrapper/index.ts b/packages/contract-helpers/src/sdai-wrapper/index.ts deleted file mode 100644 index 1745b87c..00000000 --- a/packages/contract-helpers/src/sdai-wrapper/index.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { Signature, SignatureLike, splitSignature } from '@ethersproject/bytes'; -import { BigNumber, PopulatedTransaction, providers } from 'ethers'; -import BaseService from '../commons/BaseService'; -import { - IBaseTokenWrapper, - SavingsDaiTokenWrapper, - SavingsDaiTokenWrapperInterface, -} from './typechain/SavingsDaiTokenWrapper'; -import { SavingsDaiTokenWrapper__factory } from './typechain/SavingsDaiTokenWrapper_factory'; - -interface SupplyTokenWithPermitParams { - amount: string; - onBehalfOf: string; - referralCode: string; - deadline: string; - signature: SignatureLike; -} - -export interface SavingsDaiTokenWrapperServiceInterface { - getTokenInForTokenOut: (amount: string) => Promise; - getTokenOutForTokenIn: (amount: string) => Promise; - supplyToken: ( - amount: string, - onBehalfOf: string, - referralCode: string, - ) => PopulatedTransaction; - supplyTokenWithPermit: ({ - amount, - onBehalfOf, - referralCode, - deadline, - signature, - }: SupplyTokenWithPermitParams) => PopulatedTransaction; - withdrawToken: (amount: string, user: string) => PopulatedTransaction; - withdrawTokenWithPermit: ( - amount: string, - user: string, - deadline: string, - signature: SignatureLike, - ) => PopulatedTransaction; -} - -export class SavingsDaiTokenWrapperService - extends BaseService - implements SavingsDaiTokenWrapperServiceInterface -{ - readonly savingsDaiTokenWrapperAddress: string; - readonly contractInterface: SavingsDaiTokenWrapperInterface; - - private readonly _contract: SavingsDaiTokenWrapper; - - constructor( - provider: providers.Provider, - savingsDaiTokenWrapperAddress: string, - ) { - super(provider, SavingsDaiTokenWrapper__factory); - this.savingsDaiTokenWrapperAddress = savingsDaiTokenWrapperAddress; - this.contractInterface = SavingsDaiTokenWrapper__factory.createInterface(); - this._contract = SavingsDaiTokenWrapper__factory.connect( - savingsDaiTokenWrapperAddress, - provider, - ); - - this.getTokenInForTokenOut = this.getTokenInForTokenOut.bind(this); - this.getTokenOutForTokenIn = this.getTokenOutForTokenIn.bind(this); - this.supplyToken = this.supplyToken.bind(this); - this.supplyTokenWithPermit = this.supplyTokenWithPermit.bind(this); - this.withdrawToken = this.withdrawToken.bind(this); - this.withdrawTokenWithPermit = this.withdrawTokenWithPermit.bind(this); - } - - public async getTokenInForTokenOut(amount: string): Promise { - return this._contract.getTokenInForTokenOut(amount); - } - - public async getTokenOutForTokenIn(amount: string): Promise { - return this._contract.getTokenOutForTokenIn(amount); - } - - public supplyToken(amount: string, onBehalfOf: string, referralCode: string) { - const data = this.contractInterface.encodeFunctionData('supplyToken', [ - amount, - onBehalfOf, - referralCode, - ]); - - return { - to: this.savingsDaiTokenWrapperAddress, - from: onBehalfOf, - data, - }; - } - - public supplyTokenWithPermit({ - amount, - onBehalfOf, - referralCode, - deadline, - signature, - }: SupplyTokenWithPermitParams) { - const sig: Signature = splitSignature(signature); - - const permitStruct: IBaseTokenWrapper.PermitSignatureStruct = { - deadline, - v: sig.v, - r: sig.r, - s: sig.s, - }; - - const data = this.contractInterface.encodeFunctionData( - 'supplyTokenWithPermit', - [amount, onBehalfOf, referralCode, permitStruct], - ); - - return { - to: this.savingsDaiTokenWrapperAddress, - from: onBehalfOf, - data, - }; - } - - public withdrawToken(amount: string, user: string) { - const data = this.contractInterface.encodeFunctionData('withdrawToken', [ - amount, - user, - ]); - - return { - to: this.savingsDaiTokenWrapperAddress, - from: user, - data, - }; - } - - public withdrawTokenWithPermit( - amount: string, - user: string, - deadline: string, - signature: SignatureLike, - ) { - const sig: Signature = splitSignature(signature); - - const permitStruct: IBaseTokenWrapper.PermitSignatureStruct = { - deadline, - v: sig.v, - r: sig.r, - s: sig.s, - }; - - const data = this.contractInterface.encodeFunctionData( - 'withdrawTokenWithPermit', - [amount, user, permitStruct], - ); - - return { - to: this.savingsDaiTokenWrapperAddress, - from: user, - data, - }; - } -} diff --git a/packages/contract-helpers/src/sdai-wrapper/sdai-wrapper.test.ts b/packages/contract-helpers/src/sdai-wrapper/sdai-wrapper.test.ts deleted file mode 100644 index f048a379..00000000 --- a/packages/contract-helpers/src/sdai-wrapper/sdai-wrapper.test.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { providers } from 'ethers'; -import { SavingsDaiTokenWrapperService } from './index'; - -describe('SavingsDaiTokenWrapperService', () => { - const savingsDaiTokenWrapperAddress = - '0x0000000000000000000000000000000000000001'; - const provider = new providers.JsonRpcProvider(); - describe('Initialization', () => { - it('should initialize SavingsDaiTokenWrapperService', () => { - expect( - () => - new SavingsDaiTokenWrapperService( - provider, - savingsDaiTokenWrapperAddress, - ), - ).not.toThrow(); - }); - it('generates supply token tx', () => { - const onBehalfOf = '0x0000000000000000000000000000000000000004'; - const savingsDaiTokenWrapperService = new SavingsDaiTokenWrapperService( - provider, - savingsDaiTokenWrapperAddress, - ); - const tx = savingsDaiTokenWrapperService.supplyToken( - '10000000000000000000', - onBehalfOf, - '0', - ); - expect(tx.to).toEqual(savingsDaiTokenWrapperAddress); - expect(tx.from).toEqual(onBehalfOf); - expect(tx.data).toEqual( - '0x1461e2160000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000', - ); - }); - it('generates supply with permit tx', () => { - const onBehalfOf = '0x0000000000000000000000000000000000000004'; - const savingsDaiTokenWrapperService = new SavingsDaiTokenWrapperService( - provider, - savingsDaiTokenWrapperAddress, - ); - const tx = savingsDaiTokenWrapperService.supplyTokenWithPermit({ - amount: '10000000000000000000', - onBehalfOf, - referralCode: '0', - deadline: '10000', - signature: - '0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c', - }); - expect(tx.to).toEqual(savingsDaiTokenWrapperAddress); - expect(tx.from).toEqual(onBehalfOf); - expect(tx.data).toEqual( - '0x4f4663a10000000000000000000000000000000000000000000000008ac7230489e80000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000001c532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb4', - ); - }); - it('generates withdraw token tx', () => { - const user = '0x0000000000000000000000000000000000000004'; - const savingsDaiTokenWrapperService = new SavingsDaiTokenWrapperService( - provider, - savingsDaiTokenWrapperAddress, - ); - const tx = savingsDaiTokenWrapperService.withdrawToken( - '10000000000000000000', - user, - ); - expect(tx.to).toEqual(savingsDaiTokenWrapperAddress); - expect(tx.from).toEqual(user); - expect(tx.data).toEqual( - '0xbe4b17720000000000000000000000000000000000000000000000008ac7230489e800000000000000000000000000000000000000000000000000000000000000000004', - ); - }); - it('generates withdraw token with permit tx', () => { - const user = '0x0000000000000000000000000000000000000004'; - const savingsDaiTokenWrapperService = new SavingsDaiTokenWrapperService( - provider, - savingsDaiTokenWrapperAddress, - ); - const tx = savingsDaiTokenWrapperService.withdrawTokenWithPermit( - '10000000000000000000', - user, - '10000', - '0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c', - ); - expect(tx.to).toEqual(savingsDaiTokenWrapperAddress); - expect(tx.from).toEqual(user); - expect(tx.data).toEqual( - '0xe94875ca0000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000001c532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb4', - ); - }); - }); - describe('get token preview', () => { - it('should not throw for token in', async () => { - const service = new SavingsDaiTokenWrapperService( - provider, - savingsDaiTokenWrapperAddress, - ); - await expect( - service.getTokenInForTokenOut('10000000000000000000'), - ).rejects.toThrow(); - }); - it('should not throw for token out', async () => { - const service = new SavingsDaiTokenWrapperService( - provider, - savingsDaiTokenWrapperAddress, - ); - await expect( - service.getTokenOutForTokenIn('10000000000000000000'), - ).rejects.toThrow(); - }); - }); -}); diff --git a/packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper.d.ts b/packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper.d.ts deleted file mode 100644 index ef4bad99..00000000 --- a/packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper.d.ts +++ /dev/null @@ -1,573 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { - FunctionFragment, - Result, - EventFragment, -} from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, -} from './common'; - -export declare namespace IBaseTokenWrapper { - export type PermitSignatureStruct = { - deadline: BigNumberish; - v: BigNumberish; - r: BytesLike; - s: BytesLike; - }; - - export type PermitSignatureStructOutput = [ - BigNumber, - number, - string, - string, - ] & { deadline: BigNumber; v: number; r: string; s: string }; -} - -export interface SavingsDaiTokenWrapperInterface extends utils.Interface { - functions: { - 'POOL()': FunctionFragment; - 'TOKEN_IN()': FunctionFragment; - 'TOKEN_OUT()': FunctionFragment; - 'getTokenInForTokenOut(uint256)': FunctionFragment; - 'getTokenOutForTokenIn(uint256)': FunctionFragment; - 'owner()': FunctionFragment; - 'renounceOwnership()': FunctionFragment; - 'rescueETH(address,uint256)': FunctionFragment; - 'rescueTokens(address,address,uint256)': FunctionFragment; - 'supplyToken(uint256,address,uint16)': FunctionFragment; - 'supplyTokenWithPermit(uint256,address,uint16,(uint256,uint8,bytes32,bytes32))': FunctionFragment; - 'transferOwnership(address)': FunctionFragment; - 'withdrawToken(uint256,address)': FunctionFragment; - 'withdrawTokenWithPermit(uint256,address,(uint256,uint8,bytes32,bytes32))': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'POOL' - | 'TOKEN_IN' - | 'TOKEN_OUT' - | 'getTokenInForTokenOut' - | 'getTokenOutForTokenIn' - | 'owner' - | 'renounceOwnership' - | 'rescueETH' - | 'rescueTokens' - | 'supplyToken' - | 'supplyTokenWithPermit' - | 'transferOwnership' - | 'withdrawToken' - | 'withdrawTokenWithPermit', - ): FunctionFragment; - - encodeFunctionData(functionFragment: 'POOL', values?: undefined): string; - encodeFunctionData(functionFragment: 'TOKEN_IN', values?: undefined): string; - encodeFunctionData(functionFragment: 'TOKEN_OUT', values?: undefined): string; - encodeFunctionData( - functionFragment: 'getTokenInForTokenOut', - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'getTokenOutForTokenIn', - values: [BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'owner', values?: undefined): string; - encodeFunctionData( - functionFragment: 'renounceOwnership', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'rescueETH', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'rescueTokens', - values: [string, string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'supplyToken', - values: [BigNumberish, string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'supplyTokenWithPermit', - values: [ - BigNumberish, - string, - BigNumberish, - IBaseTokenWrapper.PermitSignatureStruct, - ], - ): string; - encodeFunctionData( - functionFragment: 'transferOwnership', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'withdrawToken', - values: [BigNumberish, string], - ): string; - encodeFunctionData( - functionFragment: 'withdrawTokenWithPermit', - values: [BigNumberish, string, IBaseTokenWrapper.PermitSignatureStruct], - ): string; - - decodeFunctionResult(functionFragment: 'POOL', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'TOKEN_IN', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'TOKEN_OUT', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'getTokenInForTokenOut', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getTokenOutForTokenIn', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'owner', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'renounceOwnership', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'rescueETH', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'rescueTokens', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'supplyToken', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'supplyTokenWithPermit', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'transferOwnership', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'withdrawToken', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'withdrawTokenWithPermit', - data: BytesLike, - ): Result; - - events: { - 'OwnershipTransferred(address,address)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'OwnershipTransferred'): EventFragment; -} - -export interface OwnershipTransferredEventObject { - previousOwner: string; - newOwner: string; -} -export type OwnershipTransferredEvent = TypedEvent< - [string, string], - OwnershipTransferredEventObject ->; - -export type OwnershipTransferredEventFilter = - TypedEventFilter; - -export interface SavingsDaiTokenWrapper extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: SavingsDaiTokenWrapperInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter, - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - POOL(overrides?: CallOverrides): Promise<[string]>; - - TOKEN_IN(overrides?: CallOverrides): Promise<[string]>; - - TOKEN_OUT(overrides?: CallOverrides): Promise<[string]>; - - getTokenInForTokenOut( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - getTokenOutForTokenIn( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - owner(overrides?: CallOverrides): Promise<[string]>; - - renounceOwnership( - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueETH( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueTokens( - token: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyToken( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyTokenWithPermit( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawToken( - amount: BigNumberish, - to: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawTokenWithPermit( - amount: BigNumberish, - to: string, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - }; - - POOL(overrides?: CallOverrides): Promise; - - TOKEN_IN(overrides?: CallOverrides): Promise; - - TOKEN_OUT(overrides?: CallOverrides): Promise; - - getTokenInForTokenOut( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - getTokenOutForTokenIn( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership( - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueETH( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueTokens( - token: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyToken( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyTokenWithPermit( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawToken( - amount: BigNumberish, - to: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawTokenWithPermit( - amount: BigNumberish, - to: string, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - - callStatic: { - POOL(overrides?: CallOverrides): Promise; - - TOKEN_IN(overrides?: CallOverrides): Promise; - - TOKEN_OUT(overrides?: CallOverrides): Promise; - - getTokenInForTokenOut( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - getTokenOutForTokenIn( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership(overrides?: CallOverrides): Promise; - - rescueETH( - to: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - rescueTokens( - token: string, - to: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - supplyToken( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - supplyTokenWithPermit( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: CallOverrides, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: CallOverrides, - ): Promise; - - withdrawToken( - amount: BigNumberish, - to: string, - overrides?: CallOverrides, - ): Promise; - - withdrawTokenWithPermit( - amount: BigNumberish, - to: string, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: CallOverrides, - ): Promise; - }; - - filters: { - 'OwnershipTransferred(address,address)'( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipTransferredEventFilter; - OwnershipTransferred( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipTransferredEventFilter; - }; - - estimateGas: { - POOL(overrides?: CallOverrides): Promise; - - TOKEN_IN(overrides?: CallOverrides): Promise; - - TOKEN_OUT(overrides?: CallOverrides): Promise; - - getTokenInForTokenOut( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - getTokenOutForTokenIn( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership( - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueETH( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueTokens( - token: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyToken( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyTokenWithPermit( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawToken( - amount: BigNumberish, - to: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawTokenWithPermit( - amount: BigNumberish, - to: string, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - }; - - populateTransaction: { - POOL(overrides?: CallOverrides): Promise; - - TOKEN_IN(overrides?: CallOverrides): Promise; - - TOKEN_OUT(overrides?: CallOverrides): Promise; - - getTokenInForTokenOut( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - getTokenOutForTokenIn( - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership( - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueETH( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - rescueTokens( - token: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyToken( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - supplyTokenWithPermit( - amount: BigNumberish, - onBehalfOf: string, - referralCode: BigNumberish, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawToken( - amount: BigNumberish, - to: string, - overrides?: Overrides & { from?: string }, - ): Promise; - - withdrawTokenWithPermit( - amount: BigNumberish, - to: string, - signature: IBaseTokenWrapper.PermitSignatureStruct, - overrides?: Overrides & { from?: string }, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper_factory.ts b/packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper_factory.ts deleted file mode 100644 index 5cd12a21..00000000 --- a/packages/contract-helpers/src/sdai-wrapper/typechain/SavingsDaiTokenWrapper_factory.ts +++ /dev/null @@ -1,429 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import { Signer, utils, Contract, ContractFactory, Overrides } from 'ethers'; -import type { Provider, TransactionRequest } from '@ethersproject/providers'; -import type { - SavingsDaiTokenWrapper, - SavingsDaiTokenWrapperInterface, -} from './SavingsDaiTokenWrapper'; - -const _abi = [ - { - inputs: [ - { - internalType: 'address', - name: 'tokenIn', - type: 'address', - }, - { - internalType: 'address', - name: 'tokenOut', - type: 'address', - }, - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'owner', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - inputs: [], - name: 'POOL', - outputs: [ - { - internalType: 'contract IPool', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'TOKEN_IN', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'TOKEN_OUT', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'getTokenInForTokenOut', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'getTokenOutForTokenIn', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'renounceOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'rescueETH', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'rescueTokens', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'address', - name: 'onBehalfOf', - type: 'address', - }, - { - internalType: 'uint16', - name: 'referralCode', - type: 'uint16', - }, - ], - name: 'supplyToken', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'address', - name: 'onBehalfOf', - type: 'address', - }, - { - internalType: 'uint16', - name: 'referralCode', - type: 'uint16', - }, - { - components: [ - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'uint8', - name: 'v', - type: 'uint8', - }, - { - internalType: 'bytes32', - name: 'r', - type: 'bytes32', - }, - { - internalType: 'bytes32', - name: 's', - type: 'bytes32', - }, - ], - internalType: 'struct IBaseTokenWrapper.PermitSignature', - name: 'signature', - type: 'tuple', - }, - ], - name: 'supplyTokenWithPermit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - ], - name: 'withdrawToken', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'uint8', - name: 'v', - type: 'uint8', - }, - { - internalType: 'bytes32', - name: 'r', - type: 'bytes32', - }, - { - internalType: 'bytes32', - name: 's', - type: 'bytes32', - }, - ], - internalType: 'struct IBaseTokenWrapper.PermitSignature', - name: 'signature', - type: 'tuple', - }, - ], - name: 'withdrawTokenWithPermit', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, -] as const; - -const _bytecode = - '0x60e06040523480156200001157600080fd5b5060405162001a0938038062001a098339810160408190526200003491620002bb565b600080546001600160a01b03191633908117825560405186928692869286928291600080516020620019e9833981519152908290a3506001600160a01b0380851660805283811660a052821660c0526200008e816200018d565b60405163095ea7b360e01b81526001600160a01b038381166004830152600019602483015284169063095ea7b3906044016020604051808303816000875af1158015620000df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000105919062000318565b505060405163095ea7b360e01b81526001600160a01b03878116600483015260001960248301528816935063095ea7b3925060440190506020604051808303816000875af11580156200015c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000182919062000318565b505050505062000343565b6000546001600160a01b03163314620001ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620002545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401620001e4565b600080546040516001600160a01b0380851693921691600080516020620019e983398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b80516001600160a01b0381168114620002b657600080fd5b919050565b60008060008060808587031215620002d257600080fd5b620002dd856200029e565b9350620002ed602086016200029e565b9250620002fd604086016200029e565b91506200030d606086016200029e565b905092959194509250565b6000602082840312156200032b57600080fd5b815180151581146200033c57600080fd5b9392505050565b60805160a05160c05161160e620003db6000396000818161017b015281816104b6015281816105be015281816109da0152610d0401526000818160f40152818161048901528181610591015281816107ca0152818161085d0152818161099901528181610ccc01528181610f6a0152610fe20152600081816101fa01528181610355015281816108f10152610dec015261160e6000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063be4b17721161008c578063f00c202a11610066578063f00c202a146101f5578063f2fde38b1461021c578063f823b07b1461022f578063fe6568501461024257600080fd5b8063be4b1772146101ae578063cea9d26f146101cf578063e94875ca146101e257600080fd5b80634f4663a1116100c85780634f4663a11461015b578063715018a61461016e5780637535d246146101765780638da5cb5b1461019d57600080fd5b80630392ef94146100ef578063099a04e5146101335780631461e21614610148575b600080fd5b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101466101413660046110da565b610255565b005b610146610156366004611116565b610340565b61014661016936600461116a565b61034b565b6101466103fe565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b0316610116565b6101c16101bc3660046111bc565b610472565b60405190815260200161012a565b6101466101dd3660046111ec565b61053c565b6101c16101f036600461122d565b61057a565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b61014661022a36600461126c565b6106c7565b6101c161023d366004611290565b6107b1565b6101c1610250366004611290565b610844565b6000546001600160a01b031633146102885760405162461bcd60e51b815260040161027f906112a9565b60405180910390fd5b604080516000808252602082019092526001600160a01b0384169083906040516102b291906112de565b60006040518083038185875af1925050503d80600081146102ef576040519150601f19603f3d011682016040523d82523d6000602084013e6102f4565b606091505b505090508061033b5760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b604482015260640161027f565b505050565b61033b838383610894565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d505accf333087853561038f6040880160208901611319565b876040013588606001356040518863ffffffff1660e01b81526004016103bb979695949392919061133c565b600060405180830381600087803b1580156103d557600080fd5b505af11580156103e9573d6000803e3d6000fd5b505050506103f8848484610894565b50505050565b6000546001600160a01b031633146104285760405162461bcd60e51b815260040161027f906112a9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6040516335ea6a7560e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260009182917f000000000000000000000000000000000000000000000000000000000000000016906335ea6a75906024016101e060405180830381865afa1580156104fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105229190611455565b61010001519050610534848483610a3c565b949350505050565b6000546001600160a01b031633146105665760405162461bcd60e51b815260040161027f906112a9565b61033b6001600160a01b0384168383610e1e565b6040516335ea6a7560e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260009182917f000000000000000000000000000000000000000000000000000000000000000016906335ea6a75906024016101e060405180830381865afa158015610606573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062a9190611455565b610100015190506001600160a01b03811663d505accf333088873561065560408a0160208b01611319565b89604001358a606001356040518863ffffffff1660e01b8152600401610681979695949392919061133c565b600060405180830381600087803b15801561069b57600080fd5b505af11580156106af573d6000803e3d6000fd5b505050506106be858583610a3c565b95945050505050565b6000546001600160a01b031633146106f15760405162461bcd60e51b815260040161027f906112a9565b6001600160a01b0381166107565760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161027f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60405163266d6a8360e11b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634cdad506906024015b602060405180830381865afa15801561081a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083e9190611578565b92915050565b60405163ef8b30f760e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ef8b30f7906024016107fd565b600083116108e45760405162461bcd60e51b815260206004820152601d60248201527f494e53554646494349454e545f414d4f554e545f544f5f535550504c59000000604482015260640161027f565b6109196001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333086610ea9565b600061092484610f4b565b9050600081116109825760405162461bcd60e51b815260206004820152602360248201527f494e53554646494349454e545f575241505045445f544f4b454e5f524543454960448201526215915160ea1b606482015260840161027f565b60405163617ba03760e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260248201839052848116604483015261ffff841660648301527f0000000000000000000000000000000000000000000000000000000000000000169063617ba03790608401600060405180830381600087803b158015610a1e57600080fd5b505af1158015610a32573d6000803e3d6000fd5b5050505050505050565b6000808411610a8d5760405162461bcd60e51b815260206004820152601f60248201527f494e53554646494349454e545f414d4f554e545f544f5f574954484452415700604482015260640161027f565b6040516370a0823160e01b81523360048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190611578565b9050600019851415610b08578094505b80851115610b585760405162461bcd60e51b815260206004820181905260248201527f494e53554646494349454e545f42414c414e43455f544f5f5749544844524157604482015260640161027f565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190611578565b6040516323b872dd60e01b8152336004820152306024820152604481018890529091506001600160a01b038516906323b872dd906064016020604051808303816000875af1158015610c19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3d9190611591565b506040516370a0823160e01b815230600482015260009082906001600160a01b038716906370a0823190602401602060405180830381865afa158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab9190611578565b610cb591906115b3565b604051631a4ca37b60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390523060448301529192507f0000000000000000000000000000000000000000000000000000000000000000909116906369328dec906064016020604051808303816000875af1158015610d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d739190611578565b506000610d7f82610fbc565b905060008111610ddf5760405162461bcd60e51b815260206004820152602560248201527f494e53554646494349454e545f554e575241505045445f544f4b454e5f524543604482015264115255915160da1b606482015260840161027f565b610e136001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168883610e1e565b979650505050505050565b60405163a9059cbb60e01b8082526001600160a01b0384166004830152602482018390529060008060448382895af1610e5b573d6000803e3d6000fd5b50610e6584611019565b6103f85760405162461bcd60e51b815260206004820152601560248201527423a83b191d103330b4b632b2103a3930b739b332b960591b604482015260640161027f565b6040516323b872dd60e01b8082526001600160a01b038581166004840152841660248301526044820183905290600080606483828a5af1610eee573d6000803e3d6000fd5b50610ef885611019565b610f445760405162461bcd60e51b815260206004820152601960248201527f475076323a206661696c6564207472616e7366657246726f6d00000000000000604482015260640161027f565b5050505050565b604051636e553f6560e01b8152600481018290523060248201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636e553f65906044015b6020604051808303816000875af115801561081a573d6000803e3d6000fd5b604051635d043b2960e11b815260048101829052306024820181905260448201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ba08765290606401610f9d565b600061103f565b62461bcd60e51b60005260206004528060245250806044525060646000fd5b3d801561107e57602081146110af576110797f475076323a206d616c666f726d6564207472616e7366657220726573756c7400601f611020565b6110bc565b823b6110a6576110a67311d41d8c8e881b9bdd08184818dbdb9d1c9858dd60621b6014611020565b600191506110bc565b3d6000803e600051151591505b50919050565b6001600160a01b03811681146110d757600080fd5b50565b600080604083850312156110ed57600080fd5b82356110f8816110c2565b946020939093013593505050565b61ffff811681146110d757600080fd5b60008060006060848603121561112b57600080fd5b83359250602084013561113d816110c2565b9150604084013561114d81611106565b809150509250925092565b6000608082840312156110bc57600080fd5b60008060008060e0858703121561118057600080fd5b843593506020850135611192816110c2565b925060408501356111a281611106565b91506111b18660608701611158565b905092959194509250565b600080604083850312156111cf57600080fd5b8235915060208301356111e1816110c2565b809150509250929050565b60008060006060848603121561120157600080fd5b833561120c816110c2565b9250602084013561121c816110c2565b929592945050506040919091013590565b600080600060c0848603121561124257600080fd5b833592506020840135611254816110c2565b91506112638560408601611158565b90509250925092565b60006020828403121561127e57600080fd5b8135611289816110c2565b9392505050565b6000602082840312156112a257600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000825160005b818110156112ff57602081860181015185830152016112e5565b8181111561130e576000828501525b509190910192915050565b60006020828403121561132b57600080fd5b813560ff8116811461128957600080fd5b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6040516101e0810167ffffffffffffffff811182821017156113af57634e487b7160e01b600052604160045260246000fd5b60405290565b6000602082840312156113c757600080fd5b6040516020810181811067ffffffffffffffff821117156113f857634e487b7160e01b600052604160045260246000fd5b6040529151825250919050565b80516fffffffffffffffffffffffffffffffff8116811461142557600080fd5b919050565b805164ffffffffff8116811461142557600080fd5b805161142581611106565b8051611425816110c2565b60006101e0828403121561146857600080fd5b61147061137d565b61147a84846113b5565b815261148860208401611405565b602082015261149960408401611405565b60408201526114aa60608401611405565b60608201526114bb60808401611405565b60808201526114cc60a08401611405565b60a08201526114dd60c0840161142a565b60c08201526114ee60e0840161143f565b60e082015261010061150181850161144a565b9082015261012061151384820161144a565b9082015261014061152584820161144a565b9082015261016061153784820161144a565b90820152610180611549848201611405565b908201526101a061155b848201611405565b908201526101c061156d848201611405565b908201529392505050565b60006020828403121561158a57600080fd5b5051919050565b6000602082840312156115a357600080fd5b8151801515811461128957600080fd5b6000828210156115d357634e487b7160e01b600052601160045260246000fd5b50039056fea26469706673582212205320d4cc032d032dd4cecc8ece4248d6c4ab4f9302229682d954ce7a460baacf64736f6c634300080a00338be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0'; - -type SavingsDaiTokenWrapperConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: SavingsDaiTokenWrapperConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class SavingsDaiTokenWrapper__factory extends ContractFactory { - constructor(...args: SavingsDaiTokenWrapperConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override deploy( - tokenIn: string, - tokenOut: string, - pool: string, - owner: string, - overrides?: Overrides & { from?: string }, - ): Promise { - return super.deploy( - tokenIn, - tokenOut, - pool, - owner, - overrides || {}, - ) as Promise; - } - override getDeployTransaction( - tokenIn: string, - tokenOut: string, - pool: string, - owner: string, - overrides?: Overrides & { from?: string }, - ): TransactionRequest { - return super.getDeployTransaction( - tokenIn, - tokenOut, - pool, - owner, - overrides || {}, - ); - } - override attach(address: string): SavingsDaiTokenWrapper { - return super.attach(address) as SavingsDaiTokenWrapper; - } - override connect(signer: Signer): SavingsDaiTokenWrapper__factory { - return super.connect(signer) as SavingsDaiTokenWrapper__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): SavingsDaiTokenWrapperInterface { - return new utils.Interface(_abi) as SavingsDaiTokenWrapperInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): SavingsDaiTokenWrapper { - return new Contract( - address, - _abi, - signerOrProvider, - ) as SavingsDaiTokenWrapper; - } -}