Refactor to support multiple contracts in the registry

This allows to manage different contracts (Token, Collaborator, etc.)
with one registry.
The registry serves as main source for all contracts and versions.
Versions are independently deployed and added to the registry. From
there the proxy contract's implementation can be upgraded to the new
version.
Currently no access control is implemented.
This commit is contained in:
2018-03-14 19:12:03 +01:00
parent 4051093f72
commit 6cbfc88159
8 changed files with 80 additions and 39 deletions

View File

@@ -0,0 +1,5 @@
var Registry = artifacts.require('./upgradeable/Registry.sol');
module.exports = function(deployer) {
deployer.deploy(Registry);
};

View File

@@ -1,20 +1,12 @@
var Registry = artifacts.require('./upgradeable/Registry.sol');
var Registry = artifacts.require('./Registry.sol');
var Token = artifacts.require('./Token1.sol');
module.exports = function(deployer) {
deployer.deploy(Registry).then(function() {
return Registry.deployed();
}).then(function(registry) {
return deployer.deploy(Token);
}).then(function(token) {
deployer.deploy(Token).then(function(token) {
console.log('Registry address: ', Registry.address);
console.log('Token address: ', Token.address);
Registry.deployed().then(function(registry) {
registry.addVersion('Token_1.0', Token.address);
registry.createProxy('Token_1.0').then(function(r) {
console.log(r.logs[0]);
});
registry.addVersion('Token', Token.address);
});
});
};

View File

@@ -8,7 +8,7 @@ module.exports = function(deployer) {
}).then(function(token) {
Registry.deployed().then(function(registry) {
console.log('Token address: ', Token.address);
registry.addVersion('Token_2.0', Token.address);
registry.addVersion('Token', Token.address);
});
})
};