diff options
Diffstat (limited to 'packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts')
-rw-r--r-- | packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts | 621 |
1 files changed, 621 insertions, 0 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts b/packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts new file mode 100644 index 000000000..df95ba937 --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts @@ -0,0 +1,621 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. + */ +// tslint:disable:no-consecutive-blank-lines +// tslint:disable-next-line:no-unused-variable +import { BaseContract } from '@0xproject/base-contract'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + DataItem, + MethodAbi, + Provider, + TxData, + TxDataPayable, +} from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethers from 'ethers'; +import * as _ from 'lodash'; + +export type EtherTokenContractEventArgs = + | TransferContractEventArgs + | ApprovalContractEventArgs + | DepositContractEventArgs + | WithdrawalContractEventArgs; + +export enum EtherTokenEvents { + Transfer = 'Transfer', + Approval = 'Approval', + Deposit = 'Deposit', + Withdrawal = 'Withdrawal', +} + +export interface TransferContractEventArgs { + _from: string; + _to: string; + _value: BigNumber; +} + +export interface ApprovalContractEventArgs { + _owner: string; + _spender: string; + _value: BigNumber; +} + +export interface DepositContractEventArgs { + _owner: string; + _value: BigNumber; +} + +export interface WithdrawalContractEventArgs { + _owner: string; + _value: BigNumber; +} + +// tslint:disable:no-parameter-reassignment +export class EtherTokenContract extends BaseContract { + public name = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'name()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.name() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'name' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public approve = { + async sendTransactionAsync(_spender: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.approve.estimateGasAsync.bind(self, _spender, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_spender: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _spender: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'approve(address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.approve(_spender, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'approve' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public totalSupply = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'totalSupply()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.totalSupply() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'totalSupply' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public transferFrom = { + async sendTransactionAsync( + _from: string, + _to: string, + _value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transferFrom.estimateGasAsync.bind(self, _from, _to, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + _from: string, + _to: string, + _value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _from: string, + _to: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'transferFrom(address,address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.transferFrom(_from, _to, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'transferFrom' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public withdraw = { + async sendTransactionAsync(amount: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; + [amount] = BaseContract._formatABIDataItemList( + inputAbi, + [amount], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw(amount).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.withdraw.estimateGasAsync.bind(self, amount), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(amount: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; + [amount] = BaseContract._formatABIDataItemList( + inputAbi, + [amount], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw(amount).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(amount: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; + [amount] = BaseContract._formatABIDataItemList( + inputAbi, + [amount], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('withdraw(uint256)') + .functions.withdraw(amount).data; + return abiEncodedTransactionData; + }, + }; + public decimals = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<number> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'decimals()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.decimals() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'decimals' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public balanceOf = { + async callAsync( + _owner: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'balanceOf(address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_owner] = BaseContract._formatABIDataItemList( + inputAbi, + [_owner], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.balanceOf(_owner) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'balanceOf' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public symbol = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'symbol()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.symbol() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'symbol' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public transfer = { + async sendTransactionAsync(_to: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer(_to, _value) + .data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transfer.estimateGasAsync.bind(self, _to, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_to: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer(_to, _value) + .data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transfer(address,uint256)') + .functions.transfer(_to, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _to: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'transfer(address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.transfer(_to, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'transfer' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public deposit = { + async sendTransactionAsync(txData: Partial<TxDataPayable> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('deposit()').inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const encodedData = self._lookupEthersInterface('deposit()').functions.deposit().data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.deposit.estimateGasAsync.bind(self), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('deposit()').inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(this)); + const encodedData = self._lookupEthersInterface('deposit()').functions.deposit().data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('deposit()').inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const abiEncodedTransactionData = self._lookupEthersInterface('deposit()').functions.deposit().data; + return abiEncodedTransactionData; + }, + }; + public allowance = { + async callAsync( + _owner: string, + _spender: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'allowance(address,address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_owner, _spender] = BaseContract._formatABIDataItemList( + inputAbi, + [_owner, _spender], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.allowance(_owner, _spender) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'allowance' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) { + super(abi, address, provider, defaults); + classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + } +} // tslint:disable:max-file-line-count |