diff options
Diffstat (limited to 'contracts')
-rw-r--r-- | contracts/core/test/multisig/asset_proxy_owner.ts | 76 | ||||
-rw-r--r-- | contracts/core/test/utils/asset_proxy_owner_wrapper.ts (renamed from contracts/core/test/utils/multi_sig_wrapper.ts) | 26 |
2 files changed, 55 insertions, 47 deletions
diff --git a/contracts/core/test/multisig/asset_proxy_owner.ts b/contracts/core/test/multisig/asset_proxy_owner.ts index f9ff9fe1e..c4ea3813f 100644 --- a/contracts/core/test/multisig/asset_proxy_owner.ts +++ b/contracts/core/test/multisig/asset_proxy_owner.ts @@ -27,7 +27,7 @@ import { import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable'; import { TestAssetProxyOwnerContract } from '../../generated-wrappers/test_asset_proxy_owner'; import { artifacts } from '../../src/artifacts'; -import { MultiSigWrapper } from '../utils/multi_sig_wrapper'; +import { AssetProxyOwnerWrapper } from '../utils/asset_proxy_owner_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -43,7 +43,7 @@ describe('AssetProxyOwner', () => { let erc20Proxy: MixinAuthorizableContract; let erc721Proxy: MixinAuthorizableContract; let testAssetProxyOwner: TestAssetProxyOwnerContract; - let multiSigWrapper: MultiSigWrapper; + let assetProxyOwnerWrapper: AssetProxyOwnerWrapper; before(async () => { await blockchainLifecycle.startAsync(); @@ -77,7 +77,7 @@ describe('AssetProxyOwner', () => { REQUIRED_APPROVALS, SECONDS_TIME_LOCKED, ); - multiSigWrapper = new MultiSigWrapper(testAssetProxyOwner, provider); + assetProxyOwnerWrapper = new AssetProxyOwnerWrapper(testAssetProxyOwner, provider); await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.transferOwnership.sendTransactionAsync(testAssetProxyOwner.address, { from: initialOwner, @@ -174,7 +174,7 @@ describe('AssetProxyOwner', () => { addressToRegister, isRegistered, ); - const submitTxRes = await multiSigWrapper.submitTransactionAsync( + const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync( testAssetProxyOwner.address, registerAssetProxyData, owners[0], @@ -183,10 +183,10 @@ describe('AssetProxyOwner', () => { const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>; const txId = log.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]); await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber()); - const executeTxRes = await multiSigWrapper.executeTransactionAsync(txId, owners[0]); + const executeTxRes = await assetProxyOwnerWrapper.executeTransactionAsync(txId, owners[0]); const registerLog = executeTxRes.logs[0] as LogWithDecodedArgs< AssetProxyOwnerAssetProxyRegistrationEventArgs >; @@ -206,7 +206,7 @@ describe('AssetProxyOwner', () => { addressToRegister, isRegistered, ); - const submitTxRes = await multiSigWrapper.submitTransactionAsync( + const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync( testAssetProxyOwner.address, registerAssetProxyData, owners[0], @@ -214,10 +214,10 @@ describe('AssetProxyOwner', () => { const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>; const txId = log.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]); await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber()); - const executeTxRes = await multiSigWrapper.executeTransactionAsync(txId, owners[0]); + const executeTxRes = await assetProxyOwnerWrapper.executeTransactionAsync(txId, owners[0]); const failureLog = executeTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerExecutionFailureEventArgs>; expect(failureLog.args.transactionId).to.be.bignumber.equal(txId); @@ -239,7 +239,7 @@ describe('AssetProxyOwner', () => { addressToRegister, isRegistered, ); - const registerAssetProxySubmitRes = await multiSigWrapper.submitTransactionAsync( + const registerAssetProxySubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync( testAssetProxyOwner.address, registerAssetProxyData, owners[0], @@ -249,12 +249,12 @@ describe('AssetProxyOwner', () => { >; const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(authorized); - const erc20AddAuthorizedAddressSubmitRes = await multiSigWrapper.submitTransactionAsync( + const erc20AddAuthorizedAddressSubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, addAuthorizedAddressData, owners[0], ); - const erc721AddAuthorizedAddressSubmitRes = await multiSigWrapper.submitTransactionAsync( + const erc721AddAuthorizedAddressSubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc721Proxy.address, addAuthorizedAddressData, owners[0], @@ -269,15 +269,15 @@ describe('AssetProxyOwner', () => { const erc20AddAuthorizedAddressTxId = erc20AddAuthorizedAddressSubmitLog.args.transactionId; const erc721AddAuthorizedAddressTxId = erc721AddAuthorizedAddressSubmitLog.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(registerAssetProxyTxId, owners[1]); - await multiSigWrapper.confirmTransactionAsync(erc20AddAuthorizedAddressTxId, owners[1]); - await multiSigWrapper.confirmTransactionAsync(erc721AddAuthorizedAddressTxId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(registerAssetProxyTxId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(erc20AddAuthorizedAddressTxId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(erc721AddAuthorizedAddressTxId, owners[1]); await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber()); - await multiSigWrapper.executeTransactionAsync(registerAssetProxyTxId, owners[0]); - await multiSigWrapper.executeTransactionAsync(erc20AddAuthorizedAddressTxId, owners[0], { + await assetProxyOwnerWrapper.executeTransactionAsync(registerAssetProxyTxId, owners[0]); + await assetProxyOwnerWrapper.executeTransactionAsync(erc20AddAuthorizedAddressTxId, owners[0], { gas: constants.MAX_EXECUTE_TRANSACTION_GAS, }); - await multiSigWrapper.executeTransactionAsync(erc721AddAuthorizedAddressTxId, owners[0], { + await assetProxyOwnerWrapper.executeTransactionAsync(erc721AddAuthorizedAddressTxId, owners[0], { gas: constants.MAX_EXECUTE_TRANSACTION_GAS, }); }); @@ -287,7 +287,7 @@ describe('AssetProxyOwner', () => { const notRemoveAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData( authorized, ); - const submitTxRes = await multiSigWrapper.submitTransactionAsync( + const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, notRemoveAuthorizedAddressData, owners[0], @@ -305,7 +305,7 @@ describe('AssetProxyOwner', () => { authorized, erc20Index, ); - const submitTxRes = await multiSigWrapper.submitTransactionAsync( + const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, removeAuthorizedAddressAtIndexData, owners[0], @@ -323,7 +323,7 @@ describe('AssetProxyOwner', () => { authorized, erc721Index, ); - const submitTxRes = await multiSigWrapper.submitTransactionAsync( + const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc721Proxy.address, removeAuthorizedAddressAtIndexData, owners[0], @@ -343,7 +343,7 @@ describe('AssetProxyOwner', () => { authorized, erc20Index, ); - const res = await multiSigWrapper.submitTransactionAsync( + const res = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, removeAuthorizedAddressAtIndexData, owners[0], @@ -364,7 +364,7 @@ describe('AssetProxyOwner', () => { authorized, erc721Index, ); - const res = await multiSigWrapper.submitTransactionAsync( + const res = await assetProxyOwnerWrapper.submitTransactionAsync( erc721Proxy.address, removeAuthorizedAddressAtIndexData, owners[0], @@ -372,7 +372,7 @@ describe('AssetProxyOwner', () => { const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>; const txId = log.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]); return expectTransactionFailedAsync( testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, { @@ -387,7 +387,7 @@ describe('AssetProxyOwner', () => { const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData( newAuthorized, ); - const res = await multiSigWrapper.submitTransactionAsync( + const res = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, addAuthorizedAddressData, owners[0], @@ -395,7 +395,7 @@ describe('AssetProxyOwner', () => { const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>; const txId = log.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]); return expectTransactionFailedAsync( testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, { @@ -413,7 +413,7 @@ describe('AssetProxyOwner', () => { authorized, erc20Index, ); - const submitRes = await multiSigWrapper.submitTransactionAsync( + const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, removeAuthorizedAddressAtIndexData, owners[0], @@ -421,9 +421,12 @@ describe('AssetProxyOwner', () => { const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>; const txId = submitLog.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]); - const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, owners[0]); + const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync( + txId, + owners[0], + ); const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>; expect(execLog.args.transactionId).to.be.bignumber.equal(txId); @@ -443,7 +446,7 @@ describe('AssetProxyOwner', () => { authorized, erc20Index, ); - const submitRes = await multiSigWrapper.submitTransactionAsync( + const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, removeAuthorizedAddressAtIndexData, owners[0], @@ -451,9 +454,9 @@ describe('AssetProxyOwner', () => { const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>; const txId = submitLog.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]); - const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, notOwner); + const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, notOwner); const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>; expect(execLog.args.transactionId).to.be.bignumber.equal(txId); @@ -470,7 +473,7 @@ describe('AssetProxyOwner', () => { authorized, erc20Index, ); - const submitRes = await multiSigWrapper.submitTransactionAsync( + const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync( erc20Proxy.address, removeAuthorizedAddressAtIndexData, owners[0], @@ -478,9 +481,12 @@ describe('AssetProxyOwner', () => { const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>; const txId = submitLog.args.transactionId; - await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); + await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]); - const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, owners[0]); + const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync( + txId, + owners[0], + ); const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>; expect(execLog.args.transactionId).to.be.bignumber.equal(txId); diff --git a/contracts/core/test/utils/multi_sig_wrapper.ts b/contracts/core/test/utils/asset_proxy_owner_wrapper.ts index 34c9c2578..d5aaaf519 100644 --- a/contracts/core/test/utils/multi_sig_wrapper.ts +++ b/contracts/core/test/utils/asset_proxy_owner_wrapper.ts @@ -5,15 +5,14 @@ import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner'; -import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet'; import { artifacts } from '../../src/artifacts'; -export class MultiSigWrapper { - private readonly _multiSig: MultiSigWalletContract; +export class AssetProxyOwnerWrapper { + private readonly _assetProxyOwner: AssetProxyOwnerContract; private readonly _web3Wrapper: Web3Wrapper; private readonly _logDecoder: LogDecoder; - constructor(multiSigContract: MultiSigWalletContract, provider: Provider) { - this._multiSig = multiSigContract; + constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Provider) { + this._assetProxyOwner = assetproxyOwnerContract; this._web3Wrapper = new Web3Wrapper(provider); this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts); } @@ -24,19 +23,19 @@ export class MultiSigWrapper { opts: { value?: BigNumber } = {}, ): Promise<TransactionReceiptWithDecodedLogs> { const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value; - const txHash = await this._multiSig.submitTransaction.sendTransactionAsync(destination, value, data, { + const txHash = await this._assetProxyOwner.submitTransaction.sendTransactionAsync(destination, value, data, { from, }); const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } public async confirmTransactionAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> { - const txHash = await this._multiSig.confirmTransaction.sendTransactionAsync(txId, { from }); + const txHash = await this._assetProxyOwner.confirmTransaction.sendTransactionAsync(txId, { from }); const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } public async revokeConfirmationAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> { - const txHash = await this._multiSig.revokeConfirmation.sendTransactionAsync(txId, { from }); + const txHash = await this._assetProxyOwner.revokeConfirmation.sendTransactionAsync(txId, { from }); const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } @@ -45,7 +44,7 @@ export class MultiSigWrapper { from: string, opts: { gas?: number } = {}, ): Promise<TransactionReceiptWithDecodedLogs> { - const txHash = await this._multiSig.executeTransaction.sendTransactionAsync(txId, { + const txHash = await this._assetProxyOwner.executeTransaction.sendTransactionAsync(txId, { from, gas: opts.gas, }); @@ -58,9 +57,12 @@ export class MultiSigWrapper { ): Promise<TransactionReceiptWithDecodedLogs> { // tslint:disable-next-line:no-unnecessary-type-assertion const txHash = await (this - ._multiSig as AssetProxyOwnerContract).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, { - from, - }); + ._assetProxyOwner as AssetProxyOwnerContract).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync( + txId, + { + from, + }, + ); const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } |