From 88d15dd21471e89659151a80e19bb704332d0fae Mon Sep 17 00:00:00 2001 From: benk10 Date: Sun, 29 Dec 2019 15:20:19 +0200 Subject: [PATCH] Update ProxyCreated event (#701) * Update ProxyCreated event * Add test * fix * Fix new version test --- contracts/utils/DAOFactory.sol | 4 ++-- package-lock.json | 2 +- package.json | 2 +- test/daofactory.js | 8 +++++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/contracts/utils/DAOFactory.sol b/contracts/utils/DAOFactory.sol index 419baec5..e89a8c9d 100644 --- a/contracts/utils/DAOFactory.sol +++ b/contracts/utils/DAOFactory.sol @@ -22,7 +22,7 @@ contract DAOFactory is Initializable { * @param _proxy Address of the created proxy. * @param _version of the created proxy. */ - event ProxyCreated(address _proxy, uint64[3] _version); + event ProxyCreated(address _proxy, address _implementation, string _contractName, uint64[3] _version); struct Locks { address sender; @@ -162,7 +162,7 @@ contract DAOFactory is Initializable { ImplementationProvider provider = ImplementationProvider(package.getContract(_packageVersion)); address implementation = provider.getImplementation(_contractName); AdminUpgradeabilityProxy proxy = (new AdminUpgradeabilityProxy).value(msg.value)(implementation, _admin, _data); - emit ProxyCreated(address(proxy), _packageVersion); + emit ProxyCreated(address(proxy), implementation, _contractName, _packageVersion); return proxy; } diff --git a/package-lock.json b/package-lock.json index fed5221f..d76f7b08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@daostack/arc-experimental", - "version": "0.1.1-rc.1", + "version": "0.1.1-rc.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 820e53cc..70ed992b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@daostack/arc-experimental", - "version": "0.1.1-rc.1", + "version": "0.1.1-rc.2", "description": "A platform for building DAOs", "files": [ "contracts/", diff --git a/test/daofactory.js b/test/daofactory.js index 9d6cda17..65e74698 100644 --- a/test/daofactory.js +++ b/test/daofactory.js @@ -291,7 +291,9 @@ contract('DaoFactory', function(accounts) { var amountToMint = 10; await setup(accounts,amountToMint,amountToMint); var newVer = [0,2,0]; + const oldAvatarImplementation = registration.avatar.address; await helpers.registrationAddVersionToPackege(registration,newVer); + nativeTokenData = await new web3.eth.Contract(registration.daoToken.abi) .methods .initialize("TEST","TST",0,registration.daoFactory.address) @@ -302,13 +304,17 @@ contract('DaoFactory', function(accounts) { var avatarAddress = tx.logs[4].args._avatar; assert.equal(tx.logs[2].event, "ProxyCreated"); assert.equal(tx.logs[2].args._proxy, avatarAddress); + assert.equal(tx.logs[2].args._implementation, oldAvatarImplementation); + assert.equal(tx.logs[2].args._contractName, "Avatar"); assert.equal(tx.logs[2].args._version[1].toNumber(),1); - tx = await registration.daoFactory.forgeOrg("testOrg",nativeTokenData,[accounts[0]],[amountToMint],[amountToMint],[0,0,0],{gas:constants.ARC_GAS_LIMIT}); + tx = await registration.daoFactory.forgeOrg("testOrg",nativeTokenData,[accounts[0]],[amountToMint],[amountToMint],[0,2,0],{gas:constants.ARC_GAS_LIMIT}); assert.equal(tx.logs.length, 5); avatarAddress = tx.logs[4].args._avatar; assert.equal(tx.logs[2].event, "ProxyCreated"); assert.equal(tx.logs[2].args._proxy, avatarAddress); + assert.equal(tx.logs[2].args._implementation, registration.avatar.address); + assert.equal(tx.logs[2].args._contractName, "Avatar"); assert.equal(tx.logs[2].args._version[1].toNumber(),2); });