Skip to content
This repository has been archived by the owner on Sep 27, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' into ethereumWithoutExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
vrolland committed Feb 1, 2018
2 parents 39d254f + b035afa commit eb7c1ea
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 36 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 RequestNetwork

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
83 changes: 47 additions & 36 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,60 @@ var RequestCore = artifacts.require("./RequestCore.sol");
var RequestEthereum = artifacts.require("./RequestEthereum.sol");
var RequestBurnManagerSimple = artifacts.require("./RequestBurnManagerSimple.sol");

// Copy & Paste this
Date.prototype.getUnixTime = function() { return this.getTime()/1000|0 };
if(!Date.now) Date.now = function() { return new Date(); }
Date.time = function() { return Date.now().getUnixTime(); }


var addressContractBurner = 0;
var feesPerTenThousand = 10; // 0.1 %


var requestCoreContract;
var requestCore;
var requestEthereum;
var requestBurnManagerSimple;

module.exports = function(deployer) {
return RequestCore.new().then(function(result){
requestCoreContract = result;
console.log("requestCore: "+requestCoreContract.address);
RequestEthereum.new(requestCoreContract.address).then(function(result){
requestEthereum=result;
console.log("requestEthereum: "+result.address);

RequestBurnManagerSimple.new(addressContractBurner).then(function(result){
requestBurnManagerSimple=result;
console.log("requestBurnManagerSimple: "+result.address);

requestBurnManagerSimple.setFeesPerTenThousand(feesPerTenThousand).then(function(result){
requestCoreContract.setBurnManager(requestBurnManagerSimple.address).then(function(result){
requestCoreContract.adminAddTrustedCurrencyContract(requestEthereum.address).then(function(r) {
requestCoreContract.getStatusContract(requestEthereum.address).then(function(d) {
console.log("getStatusContract: " + requestEthereum.address + " => " + d)
})
requestBurnManagerSimple.feesPer10000().then(function(d) {
console.log("trustedNewBurnManager %% => " + d);
})
requestCoreContract.trustedNewBurnManager().then(function(d) {
console.log("trustedNewBurnManager manager => " + d);
})
});
});
});
});
});
});
deployer.deploy(RequestCore).then(function() {
return deployer.deploy(RequestEthereum, RequestCore.address).then(function() {
return deployer.deploy(RequestBurnManagerSimple, addressContractBurner).then(function() {
createInstances().then(function() {
setupContracts().then(function() {
checks()
});
});
});
});
});
};

var createInstances = function() {
return RequestCore.deployed().then(function(instance) {
requestCore = instance;
return RequestEthereum.deployed().then(function(instance) {
requestEthereum = instance;
return RequestBurnManagerSimple.deployed().then(function(instance) {
requestBurnManagerSimple = instance;
console.log("Instances set.")
});
});
});
}

var setupContracts = function() {
return requestBurnManagerSimple.setFeesPerTenThousand(feesPerTenThousand).then(function() {
return requestCore.setBurnManager(requestBurnManagerSimple.address).then(function() {
return requestCore.adminAddTrustedCurrencyContract(requestEthereum.address).then(function() {
console.log("Contracts set up.")
});
});
});
}

var checks = function() {
requestCore.getStatusContract(requestEthereum.address).then(function(d) {
console.log("getStatusContract: " + requestEthereum.address + " => " + d)
});
requestBurnManagerSimple.feesPer10000().then(function(d) {
console.log("trustedNewBurnManager %% => " + d);
});
requestCore.trustedNewBurnManager().then(function(d) {
console.log("trustedNewBurnManager manager => " + d);
console.log("Checks complete")
});
}

0 comments on commit eb7c1ea

Please sign in to comment.