Skip to content

Commit

Permalink
Update ProxyCreated event (#701)
Browse files Browse the repository at this point in the history
* Update ProxyCreated event

* Add test

* fix

* Fix new version test
  • Loading branch information
ben-kaufman authored and orenyodfat committed Dec 29, 2019
1 parent fb14319 commit 88d15dd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions contracts/utils/DAOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
8 changes: 7 additions & 1 deletion test/daofactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);

});
Expand Down

0 comments on commit 88d15dd

Please sign in to comment.