Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
generated wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
shuffledex committed Jan 4, 2019
1 parent 0baf713 commit e5d9aa8
Show file tree
Hide file tree
Showing 27 changed files with 154 additions and 1,150 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ yarn install
To build this package run the following from root directory:

```bash
yarn build
yarn pre_build && yarn build
```

### Clean
Expand Down
43 changes: 0 additions & 43 deletions contract.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -40,49 +40,6 @@ export class {{contractName}}Contract extends BaseContract {
{{> tx contractName=../contractName}}
{{/this.constant}}
{{/each}}
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
{{> typed_params inputs=ctor.inputs}}
): Promise<{{contractName}}Contract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, {{> params inputs=ctor.inputs}});
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
{{> typed_params inputs=ctor.inputs}}
): Promise<{{contractName}}Contract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[{{> params inputs=ctor.inputs}}] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[{{> params inputs=ctor.inputs}}],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]);
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(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new {{contractName}}Contract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('{{contractName}}', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "test"
},
"scripts": {
"build": "yarn pre_build && tsc -b",
"build": "tsc -b",
"build:ci": "yarn build",
"lint": "tslint --format stylish --project .",
"pre_build": "yarn generate_contract_wrappers",
Expand All @@ -30,9 +30,10 @@
},
"homepage": "https://github.com/PolymathNetwork/polymath-abi-wrappers/blob/master/README.md",
"devDependencies": {
"polymath-contract-artifacts": "git://github.com/PolymathNetwork/polymath-contract-artifacts.git#v2.1.0-beta",
"@0x/abi-gen": "^1.0.19",
"@0x/types": "^1.4.1",
"@types/lodash": "^4.14.119",
"polymath-contract-artifacts": "git://github.com/PolymathNetwork/polymath-contract-artifacts.git#v2.1.0-beta",
"shx": "^0.2.2"
},
"dependencies": {
Expand Down
55 changes: 0 additions & 55 deletions src/generated-wrappers/capped_s_t_o.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1596,61 +1596,6 @@ export class CappedSTOContract extends BaseContract {
return resultArray;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_securityToken: string,
_polyAddress: string,
): Promise<CappedSTOContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return CappedSTOContract.deployAsync(bytecode, abi, provider, txDefaults, _securityToken,
_polyAddress
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_securityToken: string,
_polyAddress: string,
): Promise<CappedSTOContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[_securityToken,
_polyAddress
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[_securityToken,
_polyAddress
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [_securityToken,
_polyAddress
]);
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(`CappedSTO successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new CappedSTOContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [_securityToken,
_polyAddress
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('CappedSTO', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
Expand Down
70 changes: 0 additions & 70 deletions src/generated-wrappers/capped_s_t_o_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export enum CappedSTOFactoryEvents {
ChangeSTVersionBound = 'ChangeSTVersionBound',
OwnershipRenounced = 'OwnershipRenounced',
OwnershipTransferred = 'OwnershipTransferred',
GenerateModuleFromFactory = 'GenerateModuleFromFactory',
}

export interface CappedSTOFactoryChangeFactorySetupFeeEventArgs extends DecodedLogArgs {
Expand Down Expand Up @@ -1634,75 +1633,6 @@ export class CappedSTOFactoryContract extends BaseContract {
return resultArray[0];
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_polyAddress: string,
_setupCost: BigNumber,
_usageCost: BigNumber,
_subscriptionCost: BigNumber,
): Promise<CappedSTOFactoryContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return CappedSTOFactoryContract.deployAsync(bytecode, abi, provider, txDefaults, _polyAddress,
_setupCost,
_usageCost,
_subscriptionCost
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_polyAddress: string,
_setupCost: BigNumber,
_usageCost: BigNumber,
_subscriptionCost: BigNumber,
): Promise<CappedSTOFactoryContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[_polyAddress,
_setupCost,
_usageCost,
_subscriptionCost
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[_polyAddress,
_setupCost,
_usageCost,
_subscriptionCost
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [_polyAddress,
_setupCost,
_usageCost,
_subscriptionCost
]);
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(`CappedSTOFactory successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new CappedSTOFactoryContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [_polyAddress,
_setupCost,
_usageCost,
_subscriptionCost
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('CappedSTOFactory', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
Expand Down
55 changes: 0 additions & 55 deletions src/generated-wrappers/erc20_dividend_checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2480,61 +2480,6 @@ export class ERC20DividendCheckpointContract extends BaseContract {
return resultArray;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_securityToken: string,
_polyAddress: string,
): Promise<ERC20DividendCheckpointContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return ERC20DividendCheckpointContract.deployAsync(bytecode, abi, provider, txDefaults, _securityToken,
_polyAddress
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_securityToken: string,
_polyAddress: string,
): Promise<ERC20DividendCheckpointContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[_securityToken,
_polyAddress
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[_securityToken,
_polyAddress
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [_securityToken,
_polyAddress
]);
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(`ERC20DividendCheckpoint successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new ERC20DividendCheckpointContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [_securityToken,
_polyAddress
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('ERC20DividendCheckpoint', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
Expand Down
55 changes: 0 additions & 55 deletions src/generated-wrappers/ether_dividend_checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2298,61 +2298,6 @@ export class EtherDividendCheckpointContract extends BaseContract {
return resultArray;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_securityToken: string,
_polyAddress: string,
): Promise<EtherDividendCheckpointContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return EtherDividendCheckpointContract.deployAsync(bytecode, abi, provider, txDefaults, _securityToken,
_polyAddress
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_securityToken: string,
_polyAddress: string,
): Promise<EtherDividendCheckpointContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[_securityToken,
_polyAddress
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[_securityToken,
_polyAddress
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [_securityToken,
_polyAddress
]);
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(`EtherDividendCheckpoint successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new EtherDividendCheckpointContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [_securityToken,
_polyAddress
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('EtherDividendCheckpoint', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
Expand Down
41 changes: 0 additions & 41 deletions src/generated-wrappers/feature_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,47 +528,6 @@ export class FeatureRegistryContract extends BaseContract {
return resultArray;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<FeatureRegistryContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return FeatureRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, );
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<FeatureRegistryContract> {
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(`FeatureRegistry successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new FeatureRegistryContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('FeatureRegistry', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
Expand Down
Loading

0 comments on commit e5d9aa8

Please sign in to comment.