1329 lines
54 KiB
TypeScript
Generated
1329 lines
54 KiB
TypeScript
Generated
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
|
|
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
|
|
// tslint:disable:no-unused-variable
|
|
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
|
import { schemas } from '@0x/json-schemas';
|
|
import {
|
|
BlockParam,
|
|
BlockParamLiteral,
|
|
CallData,
|
|
ContractAbi,
|
|
ContractArtifact,
|
|
DecodedLogArgs,
|
|
MethodAbi,
|
|
TransactionReceiptWithDecodedLogs,
|
|
TxData,
|
|
TxDataPayable,
|
|
SupportedProvider,
|
|
} from 'ethereum-types';
|
|
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
|
import { SimpleContractArtifact } from '@0x/types';
|
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
|
import { assert } from '@0x/assert';
|
|
import * as ethers from 'ethers';
|
|
// tslint:enable:no-unused-variable
|
|
|
|
export type WETH9EventArgs =
|
|
| WETH9ApprovalEventArgs
|
|
| WETH9TransferEventArgs
|
|
| WETH9DepositEventArgs
|
|
| WETH9WithdrawalEventArgs;
|
|
|
|
export enum WETH9Events {
|
|
Approval = 'Approval',
|
|
Transfer = 'Transfer',
|
|
Deposit = 'Deposit',
|
|
Withdrawal = 'Withdrawal',
|
|
}
|
|
|
|
export interface WETH9ApprovalEventArgs extends DecodedLogArgs {
|
|
_owner: string;
|
|
_spender: string;
|
|
_value: BigNumber;
|
|
}
|
|
|
|
export interface WETH9TransferEventArgs extends DecodedLogArgs {
|
|
_from: string;
|
|
_to: string;
|
|
_value: BigNumber;
|
|
}
|
|
|
|
export interface WETH9DepositEventArgs extends DecodedLogArgs {
|
|
_owner: string;
|
|
_value: BigNumber;
|
|
}
|
|
|
|
export interface WETH9WithdrawalEventArgs extends DecodedLogArgs {
|
|
_owner: string;
|
|
_value: BigNumber;
|
|
}
|
|
|
|
/* istanbul ignore next */
|
|
// tslint:disable:no-parameter-reassignment
|
|
// tslint:disable-next-line:class-name
|
|
export class WETH9Contract extends BaseContract {
|
|
public name = {
|
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('name()', []);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('name()');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(): string {
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('name()', []);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public approve = {
|
|
async sendTransactionAsync(guy: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
self.approve.estimateGasAsync.bind(self, guy, wad),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
return txHash;
|
|
},
|
|
awaitTransactionSuccessAsync(
|
|
guy: string,
|
|
wad: BigNumber,
|
|
txData?: Partial<TxData>,
|
|
pollingIntervalMs?: number,
|
|
timeoutMs?: number,
|
|
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
|
assert.isString('guy', guy);
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), wad, txData);
|
|
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
|
txHashPromise,
|
|
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
|
// When the transaction hash resolves, wait for it to be mined.
|
|
return self._web3Wrapper.awaitTransactionSuccessAsync(
|
|
await txHashPromise,
|
|
pollingIntervalMs,
|
|
timeoutMs,
|
|
);
|
|
})(),
|
|
);
|
|
},
|
|
async estimateGasAsync(guy: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
return gas;
|
|
},
|
|
async callAsync(
|
|
guy: string,
|
|
wad: BigNumber,
|
|
callData: Partial<CallData> = {},
|
|
defaultBlock?: BlockParam,
|
|
): Promise<boolean> {
|
|
assert.isString('guy', guy);
|
|
assert.isBigNumber('wad', wad);
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(guy: string, wad: BigNumber): string {
|
|
assert.isString('guy', guy);
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [
|
|
guy.toLowerCase(),
|
|
wad,
|
|
]);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public totalSupply = {
|
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('totalSupply()', []);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(): string {
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public transferFrom = {
|
|
async sendTransactionAsync(
|
|
src: string,
|
|
dst: string,
|
|
wad: BigNumber,
|
|
txData?: Partial<TxData> | undefined,
|
|
): Promise<string> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
self.transferFrom.estimateGasAsync.bind(self, src, dst, wad),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
return txHash;
|
|
},
|
|
awaitTransactionSuccessAsync(
|
|
src: string,
|
|
dst: string,
|
|
wad: BigNumber,
|
|
txData?: Partial<TxData>,
|
|
pollingIntervalMs?: number,
|
|
timeoutMs?: number,
|
|
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
|
assert.isString('src', src);
|
|
assert.isString('dst', dst);
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const txHashPromise = self.transferFrom.sendTransactionAsync(
|
|
src.toLowerCase(),
|
|
dst.toLowerCase(),
|
|
wad,
|
|
txData,
|
|
);
|
|
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
|
txHashPromise,
|
|
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
|
// When the transaction hash resolves, wait for it to be mined.
|
|
return self._web3Wrapper.awaitTransactionSuccessAsync(
|
|
await txHashPromise,
|
|
pollingIntervalMs,
|
|
timeoutMs,
|
|
);
|
|
})(),
|
|
);
|
|
},
|
|
async estimateGasAsync(
|
|
src: string,
|
|
dst: string,
|
|
wad: BigNumber,
|
|
txData?: Partial<TxData> | undefined,
|
|
): Promise<number> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
return gas;
|
|
},
|
|
async callAsync(
|
|
src: string,
|
|
dst: string,
|
|
wad: BigNumber,
|
|
callData: Partial<CallData> = {},
|
|
defaultBlock?: BlockParam,
|
|
): Promise<boolean> {
|
|
assert.isString('src', src);
|
|
assert.isString('dst', dst);
|
|
assert.isBigNumber('wad', wad);
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
|
src.toLowerCase(),
|
|
dst.toLowerCase(),
|
|
wad,
|
|
]);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(src: string, dst: string, wad: BigNumber): string {
|
|
assert.isString('src', src);
|
|
assert.isString('dst', dst);
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
|
src.toLowerCase(),
|
|
dst.toLowerCase(),
|
|
wad,
|
|
]);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public withdraw = {
|
|
async sendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
self.withdraw.estimateGasAsync.bind(self, wad),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
return txHash;
|
|
},
|
|
awaitTransactionSuccessAsync(
|
|
wad: BigNumber,
|
|
txData?: Partial<TxData>,
|
|
pollingIntervalMs?: number,
|
|
timeoutMs?: number,
|
|
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData);
|
|
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
|
txHashPromise,
|
|
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
|
// When the transaction hash resolves, wait for it to be mined.
|
|
return self._web3Wrapper.awaitTransactionSuccessAsync(
|
|
await txHashPromise,
|
|
pollingIntervalMs,
|
|
timeoutMs,
|
|
);
|
|
})(),
|
|
);
|
|
},
|
|
async estimateGasAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
return gas;
|
|
},
|
|
async callAsync(wad: BigNumber, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
|
assert.isBigNumber('wad', wad);
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(wad: BigNumber): string {
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad]);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public decimals = {
|
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<number> {
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('decimals()', []);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('decimals()');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<number>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(): string {
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public balanceOf = {
|
|
async callAsync(
|
|
index_0: string,
|
|
callData: Partial<CallData> = {},
|
|
defaultBlock?: BlockParam,
|
|
): Promise<BigNumber> {
|
|
assert.isString('index_0', index_0);
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase()]);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(index_0: string): string {
|
|
assert.isString('index_0', index_0);
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [
|
|
index_0.toLowerCase(),
|
|
]);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public symbol = {
|
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('symbol()', []);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('symbol()');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(): string {
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public transfer = {
|
|
async sendTransactionAsync(dst: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
self.transfer.estimateGasAsync.bind(self, dst, wad),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
return txHash;
|
|
},
|
|
awaitTransactionSuccessAsync(
|
|
dst: string,
|
|
wad: BigNumber,
|
|
txData?: Partial<TxData>,
|
|
pollingIntervalMs?: number,
|
|
timeoutMs?: number,
|
|
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
|
assert.isString('dst', dst);
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), wad, txData);
|
|
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
|
txHashPromise,
|
|
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
|
// When the transaction hash resolves, wait for it to be mined.
|
|
return self._web3Wrapper.awaitTransactionSuccessAsync(
|
|
await txHashPromise,
|
|
pollingIntervalMs,
|
|
timeoutMs,
|
|
);
|
|
})(),
|
|
);
|
|
},
|
|
async estimateGasAsync(dst: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad]);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
return gas;
|
|
},
|
|
async callAsync(
|
|
dst: string,
|
|
wad: BigNumber,
|
|
callData: Partial<CallData> = {},
|
|
defaultBlock?: BlockParam,
|
|
): Promise<boolean> {
|
|
assert.isString('dst', dst);
|
|
assert.isBigNumber('wad', wad);
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(dst: string, wad: BigNumber): string {
|
|
assert.isString('dst', dst);
|
|
assert.isBigNumber('wad', wad);
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [
|
|
dst.toLowerCase(),
|
|
wad,
|
|
]);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public deposit = {
|
|
async sendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('deposit()', []);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
self.deposit.estimateGasAsync.bind(self),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
return txHash;
|
|
},
|
|
awaitTransactionSuccessAsync(
|
|
txData?: Partial<TxData>,
|
|
pollingIntervalMs?: number,
|
|
timeoutMs?: number,
|
|
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const txHashPromise = self.deposit.sendTransactionAsync(txData);
|
|
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
|
txHashPromise,
|
|
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
|
// When the transaction hash resolves, wait for it to be mined.
|
|
return self._web3Wrapper.awaitTransactionSuccessAsync(
|
|
await txHashPromise,
|
|
pollingIntervalMs,
|
|
timeoutMs,
|
|
);
|
|
})(),
|
|
);
|
|
},
|
|
async estimateGasAsync(txData?: Partial<TxData> | undefined): Promise<number> {
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('deposit()', []);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...txData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
if (txDataWithDefaults.from !== undefined) {
|
|
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
|
}
|
|
try {
|
|
return await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
} catch (err) {
|
|
// Try to decode ganache transaction revert Errors.
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
|
return gas;
|
|
},
|
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('deposit()', []);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('deposit()');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(): string {
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public allowance = {
|
|
async callAsync(
|
|
index_0: string,
|
|
index_1: string,
|
|
callData: Partial<CallData> = {},
|
|
defaultBlock?: BlockParam,
|
|
): Promise<BigNumber> {
|
|
assert.isString('index_0', index_0);
|
|
assert.isString('index_1', index_1);
|
|
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (defaultBlock !== undefined) {
|
|
assert.isBlockParam('defaultBlock', defaultBlock);
|
|
}
|
|
const self = (this as any) as WETH9Contract;
|
|
const encodedData = self._strictEncodeArguments('allowance(address,address)', [
|
|
index_0.toLowerCase(),
|
|
index_1.toLowerCase(),
|
|
]);
|
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{
|
|
to: self.address,
|
|
...callData,
|
|
data: encodedData,
|
|
},
|
|
self._web3Wrapper.getContractDefaults(),
|
|
);
|
|
callDataWithDefaults.from = callDataWithDefaults.from
|
|
? callDataWithDefaults.from.toLowerCase()
|
|
: callDataWithDefaults.from;
|
|
let rawCallResult;
|
|
try {
|
|
rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
|
} catch (err) {
|
|
BaseContract._throwIfThrownErrorIsRevertError(err);
|
|
throw err;
|
|
}
|
|
BaseContract._throwIfCallResultIsRevertError(rawCallResult);
|
|
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
|
|
// tslint:disable boolean-naming
|
|
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
|
// tslint:enable boolean-naming
|
|
return result;
|
|
},
|
|
getABIEncodedTransactionData(index_0: string, index_1: string): string {
|
|
assert.isString('index_0', index_0);
|
|
assert.isString('index_1', index_1);
|
|
const self = (this as any) as WETH9Contract;
|
|
const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [
|
|
index_0.toLowerCase(),
|
|
index_1.toLowerCase(),
|
|
]);
|
|
return abiEncodedTransactionData;
|
|
},
|
|
};
|
|
public static async deployFrom0xArtifactAsync(
|
|
artifact: ContractArtifact | SimpleContractArtifact,
|
|
supportedProvider: SupportedProvider,
|
|
txDefaults: Partial<TxData>,
|
|
): Promise<WETH9Contract> {
|
|
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
if (artifact.compilerOutput === undefined) {
|
|
throw new Error('Compiler output not found in the artifact file');
|
|
}
|
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
|
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
|
const abi = artifact.compilerOutput.abi;
|
|
return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults);
|
|
}
|
|
public static async deployAsync(
|
|
bytecode: string,
|
|
abi: ContractAbi,
|
|
supportedProvider: SupportedProvider,
|
|
txDefaults: Partial<TxData>,
|
|
): Promise<WETH9Contract> {
|
|
assert.isHexString('bytecode', bytecode);
|
|
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
|
schemas.addressSchema,
|
|
schemas.numberSchema,
|
|
schemas.jsNumber,
|
|
]);
|
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
|
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
|
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
|
const iface = new ethers.utils.Interface(abi);
|
|
const deployInfo = iface.deployFunction;
|
|
const txData = deployInfo.encode(bytecode, []);
|
|
const web3Wrapper = new Web3Wrapper(provider);
|
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
|
{ data: txData },
|
|
txDefaults,
|
|
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
|
);
|
|
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
|
logUtils.log(`transactionHash: ${txHash}`);
|
|
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
|
logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`);
|
|
const contractInstance = new WETH9Contract(txReceipt.contractAddress as string, provider, txDefaults);
|
|
contractInstance.constructorArgs = [];
|
|
return contractInstance;
|
|
}
|
|
|
|
/**
|
|
* @returns The contract ABI
|
|
*/
|
|
public static ABI(): ContractAbi {
|
|
const abi = [
|
|
{
|
|
constant: true,
|
|
inputs: [],
|
|
name: 'name',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'string',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'view',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: false,
|
|
inputs: [
|
|
{
|
|
name: 'guy',
|
|
type: 'address',
|
|
},
|
|
{
|
|
name: 'wad',
|
|
type: 'uint256',
|
|
},
|
|
],
|
|
name: 'approve',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'bool',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'nonpayable',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: true,
|
|
inputs: [],
|
|
name: 'totalSupply',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'uint256',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'view',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: false,
|
|
inputs: [
|
|
{
|
|
name: 'src',
|
|
type: 'address',
|
|
},
|
|
{
|
|
name: 'dst',
|
|
type: 'address',
|
|
},
|
|
{
|
|
name: 'wad',
|
|
type: 'uint256',
|
|
},
|
|
],
|
|
name: 'transferFrom',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'bool',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'nonpayable',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: false,
|
|
inputs: [
|
|
{
|
|
name: 'wad',
|
|
type: 'uint256',
|
|
},
|
|
],
|
|
name: 'withdraw',
|
|
outputs: [],
|
|
payable: false,
|
|
stateMutability: 'nonpayable',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: true,
|
|
inputs: [],
|
|
name: 'decimals',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'uint8',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'view',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: true,
|
|
inputs: [
|
|
{
|
|
name: 'index_0',
|
|
type: 'address',
|
|
},
|
|
],
|
|
name: 'balanceOf',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'uint256',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'view',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: true,
|
|
inputs: [],
|
|
name: 'symbol',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'string',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'view',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: false,
|
|
inputs: [
|
|
{
|
|
name: 'dst',
|
|
type: 'address',
|
|
},
|
|
{
|
|
name: 'wad',
|
|
type: 'uint256',
|
|
},
|
|
],
|
|
name: 'transfer',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'bool',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'nonpayable',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: false,
|
|
inputs: [],
|
|
name: 'deposit',
|
|
outputs: [],
|
|
payable: true,
|
|
stateMutability: 'payable',
|
|
type: 'function',
|
|
},
|
|
{
|
|
constant: true,
|
|
inputs: [
|
|
{
|
|
name: 'index_0',
|
|
type: 'address',
|
|
},
|
|
{
|
|
name: 'index_1',
|
|
type: 'address',
|
|
},
|
|
],
|
|
name: 'allowance',
|
|
outputs: [
|
|
{
|
|
name: '',
|
|
type: 'uint256',
|
|
},
|
|
],
|
|
payable: false,
|
|
stateMutability: 'view',
|
|
type: 'function',
|
|
},
|
|
{
|
|
inputs: [],
|
|
outputs: [],
|
|
payable: true,
|
|
stateMutability: 'payable',
|
|
type: 'fallback',
|
|
},
|
|
{
|
|
anonymous: false,
|
|
inputs: [
|
|
{
|
|
name: '_owner',
|
|
type: 'address',
|
|
indexed: true,
|
|
},
|
|
{
|
|
name: '_spender',
|
|
type: 'address',
|
|
indexed: true,
|
|
},
|
|
{
|
|
name: '_value',
|
|
type: 'uint256',
|
|
indexed: false,
|
|
},
|
|
],
|
|
name: 'Approval',
|
|
outputs: [],
|
|
type: 'event',
|
|
},
|
|
{
|
|
anonymous: false,
|
|
inputs: [
|
|
{
|
|
name: '_from',
|
|
type: 'address',
|
|
indexed: true,
|
|
},
|
|
{
|
|
name: '_to',
|
|
type: 'address',
|
|
indexed: true,
|
|
},
|
|
{
|
|
name: '_value',
|
|
type: 'uint256',
|
|
indexed: false,
|
|
},
|
|
],
|
|
name: 'Transfer',
|
|
outputs: [],
|
|
type: 'event',
|
|
},
|
|
{
|
|
anonymous: false,
|
|
inputs: [
|
|
{
|
|
name: '_owner',
|
|
type: 'address',
|
|
indexed: true,
|
|
},
|
|
{
|
|
name: '_value',
|
|
type: 'uint256',
|
|
indexed: false,
|
|
},
|
|
],
|
|
name: 'Deposit',
|
|
outputs: [],
|
|
type: 'event',
|
|
},
|
|
{
|
|
anonymous: false,
|
|
inputs: [
|
|
{
|
|
name: '_owner',
|
|
type: 'address',
|
|
indexed: true,
|
|
},
|
|
{
|
|
name: '_value',
|
|
type: 'uint256',
|
|
indexed: false,
|
|
},
|
|
],
|
|
name: 'Withdrawal',
|
|
outputs: [],
|
|
type: 'event',
|
|
},
|
|
] as ContractAbi;
|
|
return abi;
|
|
}
|
|
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
|
super('WETH9', WETH9Contract.ABI(), address, supportedProvider, txDefaults);
|
|
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
|
}
|
|
}
|
|
|
|
// tslint:disable:max-file-line-count
|
|
// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align
|
|
// tslint:enable:trailing-comma whitespace no-trailing-whitespace
|