aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts')
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts228
1 files changed, 52 insertions, 176 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
index ab208cbf5..5070111e1 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
@@ -43,16 +43,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [_spender,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -77,13 +68,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [_spender,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
- _value
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -102,13 +87,7 @@ export class ERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [_spender,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
- _value
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
return abiEncodedTransactionData;
@@ -121,18 +100,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'approve(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_spender,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
- _value
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
- const encodedData = ethersFunction.encode([_spender,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -145,11 +113,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(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];
+ const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public totalSupply = {
@@ -159,12 +128,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'totalSupply()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('totalSupply()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -175,11 +139,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(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];
+ const abiEncoder = self._lookupAbiEncoder('totalSupply()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferFrom = {
@@ -190,19 +155,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
- _to,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
- _to,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -230,15 +183,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
- _to,
- _value
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -259,15 +204,7 @@ export class ERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
- _to,
- _value
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -282,21 +219,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC20TokenContract;
- 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));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
- _to,
- _value
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
- const encodedData = ethersFunction.encode([_from,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -310,11 +233,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(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];
+ const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public balanceOf = {
@@ -325,15 +249,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'balanceOf(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_owner
- ] = BaseContract._formatABIDataItemList(inputAbi, [_owner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
- const encodedData = ethersFunction.encode([_owner
+ const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -345,11 +261,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(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];
+ const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transfer = {
@@ -359,16 +276,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [_to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -393,13 +301,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [_to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _value
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -418,13 +320,7 @@ export class ERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [_to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _value
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
return abiEncodedTransactionData;
@@ -437,18 +333,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'transfer(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
- _value
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
- const encodedData = ethersFunction.encode([_to,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -461,11 +346,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(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];
+ const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public allowance = {
@@ -477,18 +363,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'allowance(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_owner,
- _spender
- ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
- _spender
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
- _spender
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
- const encodedData = ethersFunction.encode([_owner,
+ const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner,
_spender
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -501,11 +376,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(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];
+ const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -551,7 +427,7 @@ export class ERC20TokenContract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('ERC20Token', abi, address, provider, txDefaults);
- classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count
// tslint:enable:no-unbound-method