Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #66 from tellor-io/deploy
Browse files Browse the repository at this point in the history
dipute update
  • Loading branch information
themandalore authored Nov 13, 2019
2 parents 68a4820 + 8afad18 commit 1382040
Show file tree
Hide file tree
Showing 11 changed files with 4,176 additions and 2,247 deletions.
35 changes: 22 additions & 13 deletions contracts/libraries/TellorDispute.sol
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,33 @@ library TellorDispute {
//If the vote for disputing a value is succesful(disp.tally >0) then unstake the reported
// miner and transfer the stakeAmount and dispute fee to the reporting party
if (disp.tally > 0) {
//Changing the currentStatus and startDate unstakes the reported miner and allows for the
//transfer of the stakeAmount
stakes.currentStatus = 0;
stakes.startDate = now - (now % 86400);

//Decreases the stakerCount since the miner's stake is being slashed
self.uintVars[keccak256("stakerCount")]--;
updateDisputeFee(self);

//Transfers the StakeAmount from the reporded miner to the reporting party
TellorTransfer.doTransfer(self, disp.reportedMiner, disp.reportingParty, self.uintVars[keccak256("stakeAmount")]);

//Returns the dispute fee to the reportingParty
TellorTransfer.doTransfer(self, address(this), disp.reportingParty, disp.disputeUintVars[keccak256("fee")]);
//if reported miner stake has not been slashed yet, slash them and return the fee to reporting party
if (stakes.currentStatus == 3) {
//Changing the currentStatus and startDate unstakes the reported miner and allows for the
//transfer of the stakeAmount
stakes.currentStatus = 0;
stakes.startDate = now - (now % 86400);

//Decreases the stakerCount since the miner's stake is being slashed
self.uintVars[keccak256("stakerCount")]--;
updateDisputeFee(self);

//Transfers the StakeAmount from the reporded miner to the reporting party
TellorTransfer.doTransfer(self, disp.reportedMiner, disp.reportingParty, self.uintVars[keccak256("stakeAmount")]);

//Returns the dispute fee to the reportingParty
TellorTransfer.doTransfer(self, address(this), disp.reportingParty, disp.disputeUintVars[keccak256("fee")]);

//if reported miner stake was already slashed, return the fee to other reporting paties
} else{
TellorTransfer.doTransfer(self, address(this), disp.reportingParty, disp.disputeUintVars[keccak256("fee")]);
}

//Set the dispute state to passed/true
disp.disputeVotePassed = true;


//If the dispute was succeful(miner found guilty) then update the timestamp value to zero
//so that users don't use this datapoint
if (_request.inDispute[disp.disputeUintVars[keccak256("timestamp")]] == true) {
Expand Down
1,752 changes: 1,752 additions & 0 deletions flat_files/Tellor_flat_2019-11-13-DisputeUpdate.sol

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions migrations/2_library_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,45 +33,45 @@ module.exports = async function (deployer) {

// deploy transfer
await deployer.deploy(TellorTransfer);
//sleep_s(30);
sleep_s(30);

// deploy dispute
await deployer.link(TellorTransfer,TellorDispute);
await deployer.deploy(TellorDispute);
//sleep_s(30);
sleep_s(30);

// deploy stake
await deployer.link(TellorTransfer,TellorStake);
await deployer.link(TellorDispute,TellorStake);
await deployer.deploy(TellorStake);
//sleep_s(30);
sleep_s(30);

// deploy getters lib
await deployer.deploy(TellorGettersLibrary);
//sleep_s(30);
//await deployer.deploy(TellorGettersLibrary);
sleep_s(30);

// deploy lib
await deployer.link(TellorDispute, TellorLibrary);
await deployer.link(TellorTransfer, TellorLibrary);
await deployer.link(TellorStake, TellorLibrary);
await deployer.deploy(TellorLibrary);
//sleep_s(60);
sleep_s(60);

// deploy tellor
await deployer.link(TellorTransfer,Tellor);
await deployer.link(TellorDispute,Tellor);
await deployer.link(TellorStake,Tellor);
await deployer.link(TellorLibrary,Tellor);
await deployer.deploy(Tellor);
//sleep_s(60);
sleep_s(60);

// deploy tellor master
await deployer.link(TellorTransfer,TellorMaster);
await deployer.link(TellorGettersLibrary,TellorMaster);
await deployer.link(TellorStake,TellorMaster);
await deployer.deploy(Tellor).then(async function() {
await deployer.deploy(TellorMaster, Tellor.address)
});
// await deployer.link(TellorTransfer,TellorMaster);
// await deployer.link(TellorGettersLibrary,TellorMaster);
// await deployer.link(TellorStake,TellorMaster);
// await deployer.deploy(Tellor).then(async function() {
// await deployer.deploy(TellorMaster, Tellor.address)
// });



Expand Down
75 changes: 75 additions & 0 deletions migrations/3_library_migrations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/****Uncomment the body below to run this with Truffle migrate for truffle testing*/
var TellorTransfer = artifacts.require("./libraries/TellorTransfer.sol");
var TellorDispute = artifacts.require("./libraries/TellorDispute.sol");
var TellorStake = artifacts.require("./libraries/TellorStake.sol");
var TellorLibrary = artifacts.require("./libraries/TellorLibrary.sol");
var TellorGettersLibrary = artifacts.require("./libraries/TellorGettersLibrary.sol");
var OldTellor = artifacts.require("./oldContracts/OldTellor.sol");
var OldTellorTransfer = artifacts.require("./oldContracts/libraries/OldTellorTransfer.sol")
var OldTellorDispute = artifacts.require("./oldContracts/libraries/OldTellorDispute.sol")
var OldTellorLibrary = artifacts.require("./oldContracts/libraries/OldTellorLibrary.sol")
var Tellor = artifacts.require("./Tellor.sol");
var TellorMaster = artifacts.require("./TellorMaster.sol");
/****Uncomment the body to run this with Truffle migrate for truffle testing*/

/**
*@dev Use this for setting up contracts for testing
*this will link the Factory and Tellor Library
*These commands that need to be ran:
*truffle migrate --network rinkeby
*truffle exec scripts/Migrate_1.js --network rinkeby
*truffle exec scripts/Migrate_2.js --network rinkeby
*/
function sleep_s(secs) {
secs = (+new Date) + secs * 1000;
while ((+new Date) < secs);
}
/****Uncomment the body below to run this with Truffle migrate for truffle testing*/
// module.exports = function (deployer) {
// deployer.deploy(TellorLibrary).then(() => {
// deployer.deploy(Tellor);
// });
// deployer.link(TellorLibrary, Tellor);
// };

module.exports = async function (deployer) {

//OLD DEPS
await deployer.deploy(OldTellorTransfer);

// deploy dispute
await deployer.link(OldTellorTransfer,OldTellorDispute);
await deployer.deploy(OldTellorDispute);

// deploy stake
await deployer.link(OldTellorTransfer,TellorStake);
await deployer.link(OldTellorDispute,TellorStake);
await deployer.deploy(TellorStake);

// deploy getters lib
await deployer.deploy(TellorGettersLibrary);

// deploy lib
await deployer.link(OldTellorDispute, OldTellorLibrary);
await deployer.link(OldTellorTransfer, OldTellorLibrary);
await deployer.link(TellorStake, OldTellorLibrary);
await deployer.deploy(OldTellorLibrary);


// deploy tellor
await deployer.link(OldTellorTransfer,OldTellor);
await deployer.link(OldTellorDispute,OldTellor);
await deployer.link(TellorStake,OldTellor);
await deployer.link(OldTellorLibrary,OldTellor);
await deployer.deploy(OldTellor);

// deploy tellor master
await deployer.link(OldTellorTransfer,TellorMaster);
await deployer.link(TellorGettersLibrary,TellorMaster);
await deployer.link(TellorStake,TellorMaster);
await deployer.deploy(OldTellor).then(async function() {
await deployer.deploy(TellorMaster, OldTellor.address)
});


};
Loading

0 comments on commit 1382040

Please sign in to comment.