Upgradable experiments
This commit is contained in:
22
migrations/1520798600_setup.js
Normal file
22
migrations/1520798600_setup.js
Normal file
@@ -0,0 +1,22 @@
|
||||
var Registry = artifacts.require('./upgradeable/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) {
|
||||
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]);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
14
migrations/1520802793_upgrade.js
Normal file
14
migrations/1520802793_upgrade.js
Normal file
@@ -0,0 +1,14 @@
|
||||
var Token = artifacts.require('./Token2.sol');
|
||||
var Registry = artifacts.require('./upgradeable/Registry');
|
||||
var UpgradeabilityProxy = artifacts.require('./upgradeable/UpgradeabilityProxy');
|
||||
|
||||
module.exports = function(deployer) {
|
||||
deployer.deploy(Token).then(function(t) {
|
||||
return Token.deployed();
|
||||
}).then(function(token) {
|
||||
Registry.deployed().then(function(registry) {
|
||||
console.log('Token address: ', Token.address);
|
||||
registry.addVersion('Token_2.0', Token.address);
|
||||
});
|
||||
})
|
||||
};
|
||||
5
migrations/1_initial_migration.js
Normal file
5
migrations/1_initial_migration.js
Normal file
@@ -0,0 +1,5 @@
|
||||
var Migrations = artifacts.require("./Migrations.sol");
|
||||
|
||||
module.exports = function(deployer) {
|
||||
deployer.deploy(Migrations);
|
||||
};
|
||||
Reference in New Issue
Block a user