mirror of https://github.com/ConsenSys/mythril
commit
c49c35c8cf
@ -1,12 +1,15 @@ |
||||
pragma solidity 0.5.0; |
||||
|
||||
|
||||
contract HashForEther { |
||||
|
||||
function withdrawWinnings() { |
||||
// Winner if the last 8 hex characters of the address are 0. |
||||
function withdrawWinnings() public { |
||||
// Winner if the last 8 hex characters of the address are 0. |
||||
require(uint32(msg.sender) == 0); |
||||
_sendWinnings(); |
||||
} |
||||
|
||||
function _sendWinnings() { |
||||
msg.sender.transfer(this.balance); |
||||
function _sendWinnings() public { |
||||
msg.sender.transfer(address(this).balance); |
||||
} |
||||
} |
@ -1,13 +1,17 @@ |
||||
pragma solidity 0.5.0; |
||||
|
||||
|
||||
contract ReturnValue { |
||||
|
||||
address callee = 0xE0F7e56e62b4267062172495D7506087205A4229; |
||||
address public callee = 0xE0f7e56E62b4267062172495D7506087205A4229; |
||||
|
||||
function callnotchecked() { |
||||
callee.call(); |
||||
function callnotchecked() public { |
||||
callee.call(""); |
||||
} |
||||
|
||||
function callchecked() { |
||||
require(callee.call()); |
||||
function callchecked() public { |
||||
(bool success, bytes memory data) = callee.call(""); |
||||
require(success); |
||||
} |
||||
|
||||
} |
@ -1,152 +1,152 @@ |
||||
contract Rubixi { |
||||
|
||||
//Declare variables for storage critical to contract |
||||
uint private balance = 0; |
||||
uint private collectedFees = 0; |
||||
uint private feePercent = 10; |
||||
uint private pyramidMultiplier = 300; |
||||
uint private payoutOrder = 0; |
||||
|
||||
address private creator; |
||||
|
||||
//Sets creator |
||||
function DynamicPyramid() { |
||||
creator = msg.sender; |
||||
} |
||||
|
||||
modifier onlyowner { |
||||
if (msg.sender == creator) _; |
||||
} |
||||
|
||||
struct Participant { |
||||
address etherAddress; |
||||
uint payout; |
||||
} |
||||
|
||||
Participant[] private participants; |
||||
pragma solidity 0.5.0; |
||||
|
||||
//Fallback function |
||||
function() payable { |
||||
init(); |
||||
} |
||||
|
||||
//init function run on fallback |
||||
function init() private { |
||||
//Ensures only tx with value of 1 ether or greater are processed and added to pyramid |
||||
if (msg.value < 1 ether) { |
||||
collectedFees += msg.value; |
||||
return; |
||||
} |
||||
|
||||
uint _fee = feePercent; |
||||
//50% fee rebate on any ether value of 50 or greater |
||||
if (msg.value >= 50 ether) _fee /= 2; |
||||
|
||||
addPayout(_fee); |
||||
} |
||||
|
||||
//Function called for valid tx to the contract |
||||
function addPayout(uint _fee) private { |
||||
//Adds new address to participant array |
||||
participants.push(Participant(msg.sender, (msg.value * pyramidMultiplier) / 100)); |
||||
|
||||
//These statements ensure a quicker payout system to later pyramid entrants, so the pyramid has a longer lifespan |
||||
if (participants.length == 10) pyramidMultiplier = 200; |
||||
else if (participants.length == 25) pyramidMultiplier = 150; |
||||
|
||||
// collect fees and update contract balance |
||||
balance += (msg.value * (100 - _fee)) / 100; |
||||
collectedFees += (msg.value * _fee) / 100; |
||||
|
||||
//Pays earlier participiants if balance sufficient |
||||
while (balance > participants[payoutOrder].payout) { |
||||
uint payoutToSend = participants[payoutOrder].payout; |
||||
participants[payoutOrder].etherAddress.send(payoutToSend); |
||||
|
||||
balance -= participants[payoutOrder].payout; |
||||
payoutOrder += 1; |
||||
} |
||||
} |
||||
contract Rubixi { |
||||
//Declare variables for storage critical to contract |
||||
uint private balance = 0; |
||||
uint private collectedFees = 0; |
||||
uint private feePercent = 10; |
||||
uint private pyramidMultiplier = 300; |
||||
uint private payoutOrder = 0; |
||||
|
||||
address payable private creator; |
||||
|
||||
modifier onlyowner { |
||||
if (msg.sender == creator) _; |
||||
} |
||||
|
||||
struct Participant { |
||||
address payable etherAddress; |
||||
uint payout; |
||||
} |
||||
|
||||
//Fallback function |
||||
function() external payable { |
||||
init(); |
||||
} |
||||
|
||||
//Sets creator |
||||
function dynamicPyramid() public { |
||||
creator = msg.sender; |
||||
} |
||||
|
||||
Participant[] private participants; |
||||
|
||||
//Fee functions for creator |
||||
function collectAllFees() public onlyowner { |
||||
require(collectedFees == 0); |
||||
creator.transfer(collectedFees); |
||||
collectedFees = 0; |
||||
} |
||||
|
||||
function collectFeesInEther(uint _amt) public onlyowner { |
||||
_amt *= 1 ether; |
||||
if (_amt > collectedFees) collectAllFees(); |
||||
|
||||
require(collectedFees == 0); |
||||
|
||||
creator.transfer(_amt); |
||||
collectedFees -= _amt; |
||||
} |
||||
|
||||
function collectPercentOfFees(uint _pcent) public onlyowner { |
||||
require(collectedFees == 0 || _pcent > 100); |
||||
|
||||
uint feesToCollect = collectedFees / 100 * _pcent; |
||||
creator.transfer(feesToCollect); |
||||
collectedFees -= feesToCollect; |
||||
} |
||||
|
||||
//Functions for changing variables related to the contract |
||||
function changeOwner(address payable _owner) public onlyowner { |
||||
creator = _owner; |
||||
} |
||||
|
||||
function changeMultiplier(uint _mult) public onlyowner { |
||||
require(_mult > 300 || _mult < 120); |
||||
pyramidMultiplier = _mult; |
||||
} |
||||
|
||||
function changeFeePercentage(uint _fee) public onlyowner { |
||||
require(_fee > 10); |
||||
feePercent = _fee; |
||||
} |
||||
|
||||
//Functions to provide information to end-user using JSON interface or other interfaces |
||||
function currentMultiplier() public view returns (uint multiplier, string memory info) { |
||||
multiplier = pyramidMultiplier; |
||||
info = "This multiplier applies to you as soon as transaction is received, may be lowered to hasten payouts or increased if payouts are fast enough. Due to no float or decimals, multiplier is x100 for a fractional multiplier e.g. 250 is actually a 2.5x multiplier. Capped at 3x max and 1.2x min."; |
||||
} |
||||
|
||||
function currentFeePercentage() public view returns (uint fee, string memory info) { |
||||
fee = feePercent; |
||||
info = "Shown in % form. Fee is halved(50%) for amounts equal or greater than 50 ethers. (Fee may change, but is capped to a maximum of 10%)"; |
||||
} |
||||
|
||||
//Fee functions for creator |
||||
function collectAllFees() onlyowner { |
||||
if (collectedFees == 0) throw; |
||||
function currentPyramidBalanceApproximately() public view returns (uint pyramidBalance, string memory info) { |
||||
pyramidBalance = balance / 1 ether; |
||||
info = "All balance values are measured in Ethers, note that due to no decimal placing, these values show up as integers only, within the contract itself you will get the exact decimal value you are supposed to"; |
||||
} |
||||
|
||||
creator.send(collectedFees); |
||||
collectedFees = 0; |
||||
} |
||||
function nextPayoutWhenPyramidBalanceTotalsApproximately() public view returns (uint balancePayout) { |
||||
balancePayout = participants[payoutOrder].payout / 1 ether; |
||||
} |
||||
|
||||
function collectFeesInEther(uint _amt) onlyowner { |
||||
_amt *= 1 ether; |
||||
if (_amt > collectedFees) collectAllFees(); |
||||
function feesSeperateFromBalanceApproximately() public view returns (uint fees) { |
||||
fees = collectedFees / 1 ether; |
||||
} |
||||
|
||||
if (collectedFees == 0) throw; |
||||
|
||||
creator.send(_amt); |
||||
collectedFees -= _amt; |
||||
} |
||||
function totalParticipants() public view returns (uint count) { |
||||
count = participants.length; |
||||
} |
||||
|
||||
function collectPercentOfFees(uint _pcent) onlyowner { |
||||
if (collectedFees == 0 || _pcent > 100) throw; |
||||
function numberOfParticipantsWaitingForPayout() public view returns (uint count) { |
||||
count = participants.length - payoutOrder; |
||||
} |
||||
|
||||
uint feesToCollect = collectedFees / 100 * _pcent; |
||||
creator.send(feesToCollect); |
||||
collectedFees -= feesToCollect; |
||||
function participantDetails(uint orderInPyramid) public view returns (address addr, uint payout) { |
||||
if (orderInPyramid <= participants.length) { |
||||
addr = participants[orderInPyramid].etherAddress; |
||||
payout = participants[orderInPyramid].payout / 1 ether; |
||||
} |
||||
} |
||||
|
||||
//Functions for changing variables related to the contract |
||||
function changeOwner(address _owner) onlyowner { |
||||
creator = _owner; |
||||
//init function run on fallback |
||||
function init() private { |
||||
//Ensures only tx with value of 1 ether or greater are processed and added to pyramid |
||||
if (msg.value < 1 ether) { |
||||
collectedFees += msg.value; |
||||
return; |
||||
} |
||||
|
||||
function changeMultiplier(uint _mult) onlyowner { |
||||
if (_mult > 300 || _mult < 120) throw; |
||||
uint _fee = feePercent; |
||||
// 50% fee rebate on any ether value of 50 or greater |
||||
if (msg.value >= 50 ether) _fee /= 2; |
||||
|
||||
pyramidMultiplier = _mult; |
||||
} |
||||
addPayout(_fee); |
||||
} |
||||
|
||||
function changeFeePercentage(uint _fee) onlyowner { |
||||
if (_fee > 10) throw; |
||||
//Function called for valid tx to the contract |
||||
function addPayout(uint _fee) private { |
||||
//Adds new address to participant array |
||||
participants.push(Participant(msg.sender, (msg.value * pyramidMultiplier) / 100)); |
||||
|
||||
feePercent = _fee; |
||||
} |
||||
// These statements ensure a quicker payout system to |
||||
// later pyramid entrants, so the pyramid has a longer lifespan |
||||
if (participants.length == 10) pyramidMultiplier = 200; |
||||
else if (participants.length == 25) pyramidMultiplier = 150; |
||||
|
||||
//Functions to provide information to end-user using JSON interface or other interfaces |
||||
function currentMultiplier() constant returns(uint multiplier, string info) { |
||||
multiplier = pyramidMultiplier; |
||||
info = 'This multiplier applies to you as soon as transaction is received, may be lowered to hasten payouts or increased if payouts are fast enough. Due to no float or decimals, multiplier is x100 for a fractional multiplier e.g. 250 is actually a 2.5x multiplier. Capped at 3x max and 1.2x min.'; |
||||
} |
||||
|
||||
function currentFeePercentage() constant returns(uint fee, string info) { |
||||
fee = feePercent; |
||||
info = 'Shown in % form. Fee is halved(50%) for amounts equal or greater than 50 ethers. (Fee may change, but is capped to a maximum of 10%)'; |
||||
} |
||||
// collect fees and update contract balance |
||||
balance += (msg.value * (100 - _fee)) / 100; |
||||
collectedFees += (msg.value * _fee) / 100; |
||||
|
||||
function currentPyramidBalanceApproximately() constant returns(uint pyramidBalance, string info) { |
||||
pyramidBalance = balance / 1 ether; |
||||
info = 'All balance values are measured in Ethers, note that due to no decimal placing, these values show up as integers only, within the contract itself you will get the exact decimal value you are supposed to'; |
||||
} |
||||
|
||||
function nextPayoutWhenPyramidBalanceTotalsApproximately() constant returns(uint balancePayout) { |
||||
balancePayout = participants[payoutOrder].payout / 1 ether; |
||||
} |
||||
|
||||
function feesSeperateFromBalanceApproximately() constant returns(uint fees) { |
||||
fees = collectedFees / 1 ether; |
||||
} |
||||
|
||||
function totalParticipants() constant returns(uint count) { |
||||
count = participants.length; |
||||
} |
||||
|
||||
function numberOfParticipantsWaitingForPayout() constant returns(uint count) { |
||||
count = participants.length - payoutOrder; |
||||
} |
||||
//Pays earlier participiants if balance sufficient |
||||
while (balance > participants[payoutOrder].payout) { |
||||
uint payoutToSend = participants[payoutOrder].payout; |
||||
participants[payoutOrder].etherAddress.transfer(payoutToSend); |
||||
|
||||
function participantDetails(uint orderInPyramid) constant returns(address Address, uint Payout) { |
||||
if (orderInPyramid <= participants.length) { |
||||
Address = participants[orderInPyramid].etherAddress; |
||||
Payout = participants[orderInPyramid].payout / 1 ether; |
||||
} |
||||
balance -= participants[payoutOrder].payout; |
||||
payoutOrder += 1; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,6 +1,9 @@ |
||||
pragma solidity 0.5.0; |
||||
|
||||
|
||||
contract Suicide { |
||||
|
||||
function kill(address addr) { |
||||
function kill(address payable addr) public { |
||||
selfdestruct(addr); |
||||
} |
||||
|
||||
|
@ -1,8 +1,8 @@ |
||||
pragma solidity ^0.4.24; |
||||
pragma solidity 0.5.0; |
||||
|
||||
contract AssertFail { |
||||
|
||||
constructor(uint8 var1){ |
||||
assert(var1>0); |
||||
} |
||||
contract AssertFail { |
||||
constructor(uint8 var1) public { |
||||
assert(var1 > 0); |
||||
} |
||||
} |
||||
|
@ -1,16 +1,19 @@ |
||||
pragma solidity 0.5.0; |
||||
|
||||
|
||||
contract D { |
||||
uint public n; |
||||
address public sender; |
||||
|
||||
function callSetN(address _e, uint _n) { |
||||
_e.call(bytes4(sha3("setN(uint256)")), _n); |
||||
function callSetN(address _e, uint _n) public { |
||||
_e.call(abi.encode(bytes4(keccak256("setN(uint256)")), _n)); |
||||
} |
||||
|
||||
function callcodeSetN(address _e, uint _n) { |
||||
_e.callcode(bytes4(sha3("setN(uint256)")), _n); |
||||
function callcodeSetN(address _e, uint _n) public view { |
||||
_e.staticcall(abi.encode(bytes4(keccak256("setN(uint256)")), _n)); |
||||
} |
||||
|
||||
function delegatecallSetN(address _e, uint _n) { |
||||
_e.delegatecall(bytes4(sha3("setN(uint256)")), _n); |
||||
function delegatecallSetN(address _e, uint _n) public { |
||||
_e.delegatecall(abi.encode(bytes4(keccak256("setN(uint256)")), _n)); |
||||
} |
||||
} |
||||
|
@ -1,17 +1,16 @@ |
||||
pragma solidity ^0.4.17; |
||||
pragma solidity 0.5.0; |
||||
|
||||
contract Transfer1 { |
||||
|
||||
function transfer() { |
||||
msg.sender.transfer(1 ether); |
||||
} |
||||
contract Transfer1 { |
||||
function transfer() public { |
||||
msg.sender.transfer(1 ether); |
||||
} |
||||
|
||||
} |
||||
|
||||
contract Transfer2 { |
||||
|
||||
function transfer() { |
||||
msg.sender.transfer(2 ether); |
||||
} |
||||
|
||||
contract Transfer2 { |
||||
function transfer() public { |
||||
msg.sender.transfer(2 ether); |
||||
} |
||||
} |
||||
|
@ -1,6 +1,8 @@ |
||||
pragma solidity ^0.4.22; |
||||
pragma solidity 0.5.0; |
||||
|
||||
|
||||
contract nonAscii { |
||||
function renderNonAscii () public pure returns (string) { |
||||
function renderNonAscii () public pure returns (string memory) { |
||||
return "Хэллоу Ворлд"; |
||||
} |
||||
} |
@ -1,13 +1,17 @@ |
||||
pragma solidity 0.5.0; |
||||
|
||||
|
||||
contract ReturnValue { |
||||
|
||||
address callee = 0xE0F7e56e62b4267062172495D7506087205A4229; |
||||
address public callee = 0xE0f7e56E62b4267062172495D7506087205A4229; |
||||
|
||||
function callnotchecked() { |
||||
callee.call(); |
||||
function callnotchecked() public { |
||||
callee.call(""); |
||||
} |
||||
|
||||
function callchecked() { |
||||
require(callee.call()); |
||||
function callchecked() public { |
||||
(bool success, bytes memory data) = callee.call(""); |
||||
require(success); |
||||
} |
||||
|
||||
} |
@ -1,152 +1,152 @@ |
||||
contract Rubixi { |
||||
|
||||
//Declare variables for storage critical to contract |
||||
uint private balance = 0; |
||||
uint private collectedFees = 0; |
||||
uint private feePercent = 10; |
||||
uint private pyramidMultiplier = 300; |
||||
uint private payoutOrder = 0; |
||||
|
||||
address private creator; |
||||
|
||||
//Sets creator |
||||
function DynamicPyramid() { |
||||
creator = msg.sender; |
||||
} |
||||
|
||||
modifier onlyowner { |
||||
if (msg.sender == creator) _; |
||||
} |
||||
|
||||
struct Participant { |
||||
address etherAddress; |
||||
uint payout; |
||||
} |
||||
|
||||
Participant[] private participants; |
||||
pragma solidity 0.5.0; |
||||
|
||||
//Fallback function |
||||
function() { |
||||
init(); |
||||
} |
||||
|
||||
//init function run on fallback |
||||
function init() private { |
||||
//Ensures only tx with value of 1 ether or greater are processed and added to pyramid |
||||
if (msg.value < 1 ether) { |
||||
collectedFees += msg.value; |
||||
return; |
||||
} |
||||
|
||||
uint _fee = feePercent; |
||||
//50% fee rebate on any ether value of 50 or greater |
||||
if (msg.value >= 50 ether) _fee /= 2; |
||||
|
||||
addPayout(_fee); |
||||
} |
||||
|
||||
//Function called for valid tx to the contract |
||||
function addPayout(uint _fee) private { |
||||
//Adds new address to participant array |
||||
participants.push(Participant(msg.sender, (msg.value * pyramidMultiplier) / 100)); |
||||
|
||||
//These statements ensure a quicker payout system to later pyramid entrants, so the pyramid has a longer lifespan |
||||
if (participants.length == 10) pyramidMultiplier = 200; |
||||
else if (participants.length == 25) pyramidMultiplier = 150; |
||||
|
||||
// collect fees and update contract balance |
||||
balance += (msg.value * (100 - _fee)) / 100; |
||||
collectedFees += (msg.value * _fee) / 100; |
||||
|
||||
//Pays earlier participiants if balance sufficient |
||||
while (balance > participants[payoutOrder].payout) { |
||||
uint payoutToSend = participants[payoutOrder].payout; |
||||
participants[payoutOrder].etherAddress.send(payoutToSend); |
||||
|
||||
balance -= participants[payoutOrder].payout; |
||||
payoutOrder += 1; |
||||
} |
||||
} |
||||
contract Rubixi { |
||||
//Declare variables for storage critical to contract |
||||
uint private balance = 0; |
||||
uint private collectedFees = 0; |
||||
uint private feePercent = 10; |
||||
uint private pyramidMultiplier = 300; |
||||
uint private payoutOrder = 0; |
||||
|
||||
address payable private creator; |
||||
|
||||
modifier onlyowner { |
||||
if (msg.sender == creator) _; |
||||
} |
||||
|
||||
struct Participant { |
||||
address payable etherAddress; |
||||
uint payout; |
||||
} |
||||
|
||||
//Fallback function |
||||
function() external payable { |
||||
init(); |
||||
} |
||||
|
||||
//Sets creator |
||||
function dynamicPyramid() public { |
||||
creator = msg.sender; |
||||
} |
||||
|
||||
Participant[] private participants; |
||||
|
||||
//Fee functions for creator |
||||
function collectAllFees() public onlyowner { |
||||
require(collectedFees == 0); |
||||
creator.transfer(collectedFees); |
||||
collectedFees = 0; |
||||
} |
||||
|
||||
function collectFeesInEther(uint _amt) public onlyowner { |
||||
_amt *= 1 ether; |
||||
if (_amt > collectedFees) collectAllFees(); |
||||
|
||||
require(collectedFees == 0); |
||||
|
||||
creator.transfer(_amt); |
||||
collectedFees -= _amt; |
||||
} |
||||
|
||||
function collectPercentOfFees(uint _pcent) public onlyowner { |
||||
require(collectedFees == 0 || _pcent > 100); |
||||
|
||||
uint feesToCollect = collectedFees / 100 * _pcent; |
||||
creator.transfer(feesToCollect); |
||||
collectedFees -= feesToCollect; |
||||
} |
||||
|
||||
//Functions for changing variables related to the contract |
||||
function changeOwner(address payable _owner) public onlyowner { |
||||
creator = _owner; |
||||
} |
||||
|
||||
function changeMultiplier(uint _mult) public onlyowner { |
||||
require(_mult > 300 || _mult < 120); |
||||
pyramidMultiplier = _mult; |
||||
} |
||||
|
||||
function changeFeePercentage(uint _fee) public onlyowner { |
||||
require(_fee > 10); |
||||
feePercent = _fee; |
||||
} |
||||
|
||||
//Functions to provide information to end-user using JSON interface or other interfaces |
||||
function currentMultiplier() public view returns (uint multiplier, string memory info) { |
||||
multiplier = pyramidMultiplier; |
||||
info = "This multiplier applies to you as soon as transaction is received, may be lowered to hasten payouts or increased if payouts are fast enough. Due to no float or decimals, multiplier is x100 for a fractional multiplier e.g. 250 is actually a 2.5x multiplier. Capped at 3x max and 1.2x min."; |
||||
} |
||||
|
||||
function currentFeePercentage() public view returns (uint fee, string memory info) { |
||||
fee = feePercent; |
||||
info = "Shown in % form. Fee is halved(50%) for amounts equal or greater than 50 ethers. (Fee may change, but is capped to a maximum of 10%)"; |
||||
} |
||||
|
||||
//Fee functions for creator |
||||
function collectAllFees() onlyowner { |
||||
if (collectedFees == 0) throw; |
||||
function currentPyramidBalanceApproximately() public view returns (uint pyramidBalance, string memory info) { |
||||
pyramidBalance = balance / 1 ether; |
||||
info = "All balance values are measured in Ethers, note that due to no decimal placing, these values show up as integers only, within the contract itself you will get the exact decimal value you are supposed to"; |
||||
} |
||||
|
||||
creator.send(collectedFees); |
||||
collectedFees = 0; |
||||
} |
||||
function nextPayoutWhenPyramidBalanceTotalsApproximately() public view returns (uint balancePayout) { |
||||
balancePayout = participants[payoutOrder].payout / 1 ether; |
||||
} |
||||
|
||||
function collectFeesInEther(uint _amt) onlyowner { |
||||
_amt *= 1 ether; |
||||
if (_amt > collectedFees) collectAllFees(); |
||||
function feesSeperateFromBalanceApproximately() public view returns (uint fees) { |
||||
fees = collectedFees / 1 ether; |
||||
} |
||||
|
||||
if (collectedFees == 0) throw; |
||||
|
||||
creator.send(_amt); |
||||
collectedFees -= _amt; |
||||
} |
||||
function totalParticipants() public view returns (uint count) { |
||||
count = participants.length; |
||||
} |
||||
|
||||
function collectPercentOfFees(uint _pcent) onlyowner { |
||||
if (collectedFees == 0 || _pcent > 100) throw; |
||||
function numberOfParticipantsWaitingForPayout() public view returns (uint count) { |
||||
count = participants.length - payoutOrder; |
||||
} |
||||
|
||||
uint feesToCollect = collectedFees / 100 * _pcent; |
||||
creator.send(feesToCollect); |
||||
collectedFees -= feesToCollect; |
||||
function participantDetails(uint orderInPyramid) public view returns (address addr, uint payout) { |
||||
if (orderInPyramid <= participants.length) { |
||||
addr = participants[orderInPyramid].etherAddress; |
||||
payout = participants[orderInPyramid].payout / 1 ether; |
||||
} |
||||
} |
||||
|
||||
//Functions for changing variables related to the contract |
||||
function changeOwner(address _owner) onlyowner { |
||||
creator = _owner; |
||||
//init function run on fallback |
||||
function init() private { |
||||
//Ensures only tx with value of 1 ether or greater are processed and added to pyramid |
||||
if (msg.value < 1 ether) { |
||||
collectedFees += msg.value; |
||||
return; |
||||
} |
||||
|
||||
function changeMultiplier(uint _mult) onlyowner { |
||||
if (_mult > 300 || _mult < 120) throw; |
||||
uint _fee = feePercent; |
||||
// 50% fee rebate on any ether value of 50 or greater |
||||
if (msg.value >= 50 ether) _fee /= 2; |
||||
|
||||
pyramidMultiplier = _mult; |
||||
} |
||||
addPayout(_fee); |
||||
} |
||||
|
||||
function changeFeePercentage(uint _fee) onlyowner { |
||||
if (_fee > 10) throw; |
||||
//Function called for valid tx to the contract |
||||
function addPayout(uint _fee) private { |
||||
//Adds new address to participant array |
||||
participants.push(Participant(msg.sender, (msg.value * pyramidMultiplier) / 100)); |
||||
|
||||
feePercent = _fee; |
||||
} |
||||
// These statements ensure a quicker payout system to |
||||
// later pyramid entrants, so the pyramid has a longer lifespan |
||||
if (participants.length == 10) pyramidMultiplier = 200; |
||||
else if (participants.length == 25) pyramidMultiplier = 150; |
||||
|
||||
//Functions to provide information to end-user using JSON interface or other interfaces |
||||
function currentMultiplier() constant returns(uint multiplier, string info) { |
||||
multiplier = pyramidMultiplier; |
||||
info = 'This multiplier applies to you as soon as transaction is received, may be lowered to hasten payouts or increased if payouts are fast enough. Due to no float or decimals, multiplier is x100 for a fractional multiplier e.g. 250 is actually a 2.5x multiplier. Capped at 3x max and 1.2x min.'; |
||||
} |
||||
|
||||
function currentFeePercentage() constant returns(uint fee, string info) { |
||||
fee = feePercent; |
||||
info = 'Shown in % form. Fee is halved(50%) for amounts equal or greater than 50 ethers. (Fee may change, but is capped to a maximum of 10%)'; |
||||
} |
||||
// collect fees and update contract balance |
||||
balance += (msg.value * (100 - _fee)) / 100; |
||||
collectedFees += (msg.value * _fee) / 100; |
||||
|
||||
function currentPyramidBalanceApproximately() constant returns(uint pyramidBalance, string info) { |
||||
pyramidBalance = balance / 1 ether; |
||||
info = 'All balance values are measured in Ethers, note that due to no decimal placing, these values show up as integers only, within the contract itself you will get the exact decimal value you are supposed to'; |
||||
} |
||||
|
||||
function nextPayoutWhenPyramidBalanceTotalsApproximately() constant returns(uint balancePayout) { |
||||
balancePayout = participants[payoutOrder].payout / 1 ether; |
||||
} |
||||
|
||||
function feesSeperateFromBalanceApproximately() constant returns(uint fees) { |
||||
fees = collectedFees / 1 ether; |
||||
} |
||||
|
||||
function totalParticipants() constant returns(uint count) { |
||||
count = participants.length; |
||||
} |
||||
|
||||
function numberOfParticipantsWaitingForPayout() constant returns(uint count) { |
||||
count = participants.length - payoutOrder; |
||||
} |
||||
//Pays earlier participiants if balance sufficient |
||||
while (balance > participants[payoutOrder].payout) { |
||||
uint payoutToSend = participants[payoutOrder].payout; |
||||
participants[payoutOrder].etherAddress.transfer(payoutToSend); |
||||
|
||||
function participantDetails(uint orderInPyramid) constant returns(address Address, uint Payout) { |
||||
if (orderInPyramid <= participants.length) { |
||||
Address = participants[orderInPyramid].etherAddress; |
||||
Payout = participants[orderInPyramid].payout / 1 ether; |
||||
} |
||||
balance -= participants[payoutOrder].payout; |
||||
payoutOrder += 1; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,6 +1,9 @@ |
||||
pragma solidity 0.5.0; |
||||
|
||||
|
||||
contract Suicide { |
||||
|
||||
function kill(address addr) { |
||||
function kill(address payable addr) public { |
||||
selfdestruct(addr); |
||||
} |
||||
|
||||
|
Loading…
Reference in new issue