aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract_templates
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-04-11 18:00:30 +0800
committerFabio Berger <me@fabioberger.com>2018-04-11 18:00:30 +0800
commit29dc22e208080fa8ff0871b98b530a2deb251a73 (patch)
treedb372a34e85ac8caf4a3f3ed9d7591452df9cb1a /packages/contract_templates
parent6f72fed8b5b37fac5096413b363b533e0a29f7b5 (diff)
parentc44f9e56ada898ffd0d0e57aa228006977fb238c (diff)
downloaddexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar
dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.gz
dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.bz2
dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.lz
dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.xz
dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.zst
dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.zip
Merge branch 'development' into removeMigrateStep
* development: Fix lint error Fix documentation links in some READMEs Fix relative link Add step to publishing that upload staging doc jsons, deploys staging website, opens every docs page and asks the dev to confirm that each one renders properly before publishing Fix web3Wrapper build command Add top-level `yarn lerna:stage_docs` to upload docJsons to the staging S3 bucket for all packages with a docs page Added a detailed description of `renameOverloadedMethods` (special thanks to @fabioberger). Updated Javascript styles in the Abi-Gen and Utils packages, around support for function overloading. Updated deployer to accept a list of contract directories as input. Contract directories are namespaced to a void clashes. Also in this commit is a fix for overloading contract functions. Refactor publish script to have it's main execution body be lean and discrete steps # Conflicts: # packages/contracts/package.json # packages/deployer/package.json
Diffstat (limited to 'packages/contract_templates')
-rw-r--r--packages/contract_templates/contract.handlebars2
-rw-r--r--packages/contract_templates/partials/callAsync.handlebars4
-rw-r--r--packages/contract_templates/partials/tx.handlebars22
3 files changed, 14 insertions, 14 deletions
diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars
index 3e3f87f10..472452d74 100644
--- a/packages/contract_templates/contract.handlebars
+++ b/packages/contract_templates/contract.handlebars
@@ -41,6 +41,6 @@ export class {{contractName}}Contract extends BaseContract {
{{/each}}
constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) {
super(abi, address, provider, defaults);
- classUtils.bindAll(this, ['_ethersInterface', 'address', 'abi', '_web3Wrapper']);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count
diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars
index 8de69203e..a6f4abdf2 100644
--- a/packages/contract_templates/partials/callAsync.handlebars
+++ b/packages/contract_templates/partials/callAsync.handlebars
@@ -5,9 +5,9 @@ async callAsync(
defaultBlock?: BlockParam,
): Promise<{{> return_type outputs=outputs}}> {
const self = this as any as {{contractName}}Contract;
- const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
+ const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
- const encodedData = self._ethersInterface.functions.{{this.name}}(
+ const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
{{> params inputs=inputs}}
).data;
const callDataWithDefaults = await self._applyDefaultsToTxDataAsync(
diff --git a/packages/contract_templates/partials/tx.handlebars b/packages/contract_templates/partials/tx.handlebars
index 41ba6d3f7..22fe0c597 100644
--- a/packages/contract_templates/partials/tx.handlebars
+++ b/packages/contract_templates/partials/tx.handlebars
@@ -1,4 +1,4 @@
-public {{this.name}} = {
+public {{this.tsName}} = {
async sendTransactionAsync(
{{> typed_params inputs=inputs}}
{{#this.payable}}
@@ -9,17 +9,17 @@ public {{this.name}} = {
{{/this.payable}}
): Promise<string> {
const self = this as any as {{contractName}}Contract;
- const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
+ const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
- const encodedData = self._ethersInterface.functions.{{this.name}}(
+ const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
{{> params inputs=inputs}}
- ).data
+ ).data;
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
{
...txData,
data: encodedData,
},
- self.{{this.name}}.estimateGasAsync.bind(
+ self.{{this.tsName}}.estimateGasAsync.bind(
self,
{{> params inputs=inputs}}
),
@@ -32,11 +32,11 @@ public {{this.name}} = {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as {{contractName}}Contract;
- const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
+ const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(this));
- const encodedData = self._ethersInterface.functions.{{this.name}}(
+ const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
{{> params inputs=inputs}}
- ).data
+ ).data;
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
{
...txData,
@@ -50,11 +50,11 @@ public {{this.name}} = {
{{> typed_params inputs=inputs}}
): string {
const self = this as any as {{contractName}}Contract;
- const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
+ const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
- const abiEncodedTransactionData = self._ethersInterface.functions.{{this.name}}(
+ const abiEncodedTransactionData = self._lookupEthersInterface('{{this.name}}').functions.{{this.name}}(
{{> params inputs=inputs}}
- ).data
+ ).data;
return abiEncodedTransactionData;
},
{{> callAsync}}