Skip to content

Commit

Permalink
Merge pull request #113 from abhayks1/proxy_factory_refactor
Browse files Browse the repository at this point in the history
ProxyFactory address refactoring from createCompanyWallet method
  • Loading branch information
Pro authored Feb 20, 2019
2 parents cc2e083 + 5687ad5 commit 7bd288b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
16 changes: 3 additions & 13 deletions lib/helper/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,26 +312,17 @@ class User {
* Method for creation and configuration of token holder proxy contract for company
* with hardware wallet as it's owner.
*
* @param proxyFactory proxyFactory contract address.
* @param owner TokenHolder proxy owner address. It could be hardware wallet address.
* @param sessionKeys Session key addresses to authorize.
* @param sessionKeysSpendingLimits Session key's spending limits.
* @param sessionKeysExpirationHeights Session key's expiration heights.
*
* @returns Promise object.
*/
async createCompanyWallet(
proxyFactory,
owner,
sessionKeys,
sessionKeysSpendingLimits,
sessionKeysExpirationHeights,
txOptions
) {
async createCompanyWallet(owner, sessionKeys, sessionKeysSpendingLimits, sessionKeysExpirationHeights, txOptions) {
const oThis = this;

const txObject = oThis._createCompanyWalletRawTx(
proxyFactory,
owner,
sessionKeys,
sessionKeysSpendingLimits,
Expand Down Expand Up @@ -399,15 +390,14 @@ class User {
* Private method used for creation and configuration of token holder proxy contract for company
* with hardware wallet as it's owner.
*
* @param proxyFactory proxyFactory contract address.
* @param owner TokenHolder proxy owner address. It could be hardware wallet address.
* @param sessionKeys Session key addresses to authorize.
* @param sessionKeysSpendingLimits Session key's spending limits.
* @param sessionKeysExpirationHeights Session key's expiration heights.
*
* @returns Promise object.
*/
_createCompanyWalletRawTx(proxyFactory, owner, sessionKeys, sessionKeysSpendingLimits, sessionKeysExpirationHeights) {
_createCompanyWalletRawTx(owner, sessionKeys, sessionKeysSpendingLimits, sessionKeysExpirationHeights) {
const oThis = this;

const thSetupExecutableData = oThis.getTokenHolderSetupExecutableData(
Expand All @@ -419,7 +409,7 @@ class User {

const jsonInterface = oThis.abiBinProvider.getABI(ProxyFactoryContractName);

const contract = new oThis.auxiliaryWeb3.eth.Contract(jsonInterface, proxyFactory);
const contract = new oThis.auxiliaryWeb3.eth.Contract(jsonInterface, oThis.proxyFactory);

return contract.methods.createProxy(oThis.tokenHolderMasterCopy, thSetupExecutableData);
}
Expand Down
3 changes: 1 addition & 2 deletions test/integration/DirectTransfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ describe('Direct transfers between TH contracts', async function() {
mockToken,
tokenRulesAddress,
userWalletFactoryAddress,
null, // proxy factory address
proxyFactoryAddress, // proxy factory address
auxiliaryWeb3
);

Expand All @@ -319,7 +319,6 @@ describe('Direct transfers between TH contracts', async function() {
const sessionKeys = [sessionKey];

const response = await userInstance.createCompanyWallet(
proxyFactoryAddress,
thMasterCopyAddress,
sessionKeys,
[config.sessionKeySpendingLimit],
Expand Down

0 comments on commit 7bd288b

Please sign in to comment.