More Info
Private Name Tags
ContractCreator
TokenTracker
Loading...
Loading
Contract Name:
Resilience
Compiler Version
v0.4.6+commit.2dabbdf0
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2017-01-03 */ pragma solidity ^ 0.4 .6; contract CloseIfBug { address public JohanNygren; bool public bugDiscovered; // closes everything but sell() function CloseIfBug() { bugDiscovered = false; } modifier onlyJohan { if (msg.sender != JohanNygren) throw; _; } modifier isOpen { if (bugDiscovered != false) throw; _; } function closeCampaign() onlyJohan { bugDiscovered = true; } } contract RES is CloseIfBug { /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint public totalSupply; /* This creates an array with all balances */ mapping(address => uint256) public balanceOf; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* Bought or sold */ event Bought(address from, uint amount); event Sold(address from, uint amount); /* Initializes contract with name, symbol and decimals */ function RES() { name = "RES"; symbol = "RES"; decimals = 18; } function buy() isOpen public payable { balanceOf[msg.sender] += msg.value; totalSupply += msg.value; Bought(msg.sender, msg.value); } function sell(uint256 _value) public { if (balanceOf[msg.sender] < _value) throw; balanceOf[msg.sender] -= _value; if (!msg.sender.send(_value)) throw; totalSupply -= _value; Sold(msg.sender, _value); } } contract SwarmRedistribution is CloseIfBug, RES { struct dividendPathway { address from; uint amount; uint timeStamp; } mapping(address => dividendPathway[]) public dividendPathways; mapping(address => bool) public isHuman; mapping(address => uint256) public totalBasicIncome; uint taxRate; uint exchangeRate; address[] humans; mapping(address => bool) inHumans; event Swarm(address indexed leaf, address indexed node, uint256 share); function SwarmRedistribution() { /* Tax-rate in parts per thousand */ taxRate = 20; /* Exchange-rate in parts per thousand */ exchangeRate = 0; } /* Send coins */ function transfer(address _to, uint256 _value) isOpen { /* reject transaction to self to prevent dividend pathway loops*/ if (_to == msg.sender) throw; /* if the sender doenst have enough balance then stop */ if (balanceOf[msg.sender] < _value) throw; if (balanceOf[_to] + _value < balanceOf[_to]) throw; /* Calculate tax */ uint256 taxCollected = _value * taxRate / 1000; uint256 sentAmount; /* Create the dividend pathway */ dividendPathways[_to].push(dividendPathway({ from: msg.sender, amount: _value, timeStamp: now })); iterateThroughSwarm(_to, now, taxCollected); if (humans.length > 0) { doSwarm(_to, taxCollected); sentAmount = _value; } else sentAmount = _value - taxCollected; /* Return tax */ /* Add and subtract new balances */ balanceOf[msg.sender] -= sentAmount; balanceOf[_to] += _value - taxCollected; /* Notifiy anyone listening that this transfer took place */ Transfer(msg.sender, _to, sentAmount); } function iterateThroughSwarm(address _node, uint _timeStamp, uint _taxCollected) internal { for (uint i = 0; i < dividendPathways[_node].length; i++) { uint timeStamp = dividendPathways[_node][i].timeStamp; if (timeStamp <= _timeStamp) { address node = dividendPathways[_node][i].from; if ( isHuman[node] == true && inHumans[node] == false ) { humans.push(node); inHumans[node] = true; } if (dividendPathways[_node][i].amount - _taxCollected > 0) { dividendPathways[_node][i].amount -= _taxCollected; } else removeDividendPathway(_node, i); iterateThroughSwarm(node, timeStamp, _taxCollected); } } } function doSwarm(address _leaf, uint256 _taxCollected) internal { uint256 share = _taxCollected / humans.length; for (uint i = 0; i < humans.length; i++) { balanceOf[humans[i]] += share; totalBasicIncome[humans[i]] += share; inHumans[humans[i]] = false; /* Notifiy anyone listening that this swarm took place */ Swarm(_leaf, humans[i], share); } delete humans; } function removeDividendPathway(address node, uint index) internal { delete dividendPathways[node][index]; for (uint i = index; i < dividendPathways[node].length - 1; i++) { dividendPathways[node][i] = dividendPathways[node][i + 1]; } dividendPathways[node].length--; } } contract Resilience is CloseIfBug, RES, SwarmRedistribution { function Resilience() { } function setBeneficiary() { if(JohanNygren != 0) throw; JohanNygren = msg.sender; isHuman[JohanNygren] = true; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"bugDiscovered","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"dividendPathways","outputs":[{"name":"from","type":"address"},{"name":"amount","type":"uint256"},{"name":"timeStamp","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"setBeneficiary","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"totalBasicIncome","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"closeCampaign","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"sell","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"JohanNygren","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isHuman","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"leaf","type":"address"},{"indexed":true,"name":"node","type":"address"},{"indexed":false,"name":"share","type":"uint256"}],"name":"Swarm","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Bought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Sold","type":"event"}]
Contract Creation Code
606060405234610000575b5b5b5b6000805460a060020a60ff02191690555b6040805180820190915260038082527f524553000000000000000000000000000000000000000000000000000000000060209283019081526001805460008290528251600660ff1990911617825590937fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6600283871615610100026000190190931692909204601f0104810192916100de565b828001600101855582156100de579182015b828111156100de5782518255916020019190600101906100c3565b5b506100ff9291505b808211156100fb57600081556001016100e7565b5090565b50506040805180820190915260038082527f524553000000000000000000000000000000000000000000000000000000000060209283019081526002805460008290528251600660ff1990911617825590937f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace60018316156101000260001901909216859004601f0104810192916101bf565b828001600101855582156101bf579182015b828111156101bf5782518255916020019190600101906101a4565b5b506101e09291505b808211156100fb57600081556001016100e7565b5090565b50506003805460ff191660121790555b60146009556000600a555b5b5b610ec78061020b6000396000f3606060405236156100b95760e060020a6000350463031f74d481146100be57806306fdde03146100df57806318160ddd1461015a5780632b1857a514610179578063313ce567146101b457806345239b90146101d757806370a08231146101e657806395d89b4114610208578063a6f2ae3a14610283578063a9059cbb1461028d578063b06ee044146102a2578063d7557f18146102c4578063e4849b32146102d3578063e5815b33146102e5578063f72c436f1461030e575b610000565b34610000576100cb610332565b604080519115158252519081900360200190f35b34610000576100ec610342565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34610000576101676103cf565b60408051918252519081900360200190f35b346100005761018c6004356024356103d5565b60408051600160a060020a039094168452602084019290925282820152519081900360600190f35b34610000576101c161041f565b6040805160ff9092168252519081900360200190f35b34610000576101e4610428565b005b346100005761016760043561047b565b60408051918252519081900360200190f35b34610000576100ec61048d565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101e4610518565b005b34610000576101e4600435602435610595565b005b34610000576101676004356107a3565b60408051918252519081900360200190f35b34610000576101e46107b5565b005b34610000576101e46004356107f8565b005b34610000576102f26108b1565b60408051600160a060020a039092168252519081900360200190f35b34610000576100cb6004356108c0565b604080519115158252519081900360200190f35b60005460a060020a900460ff1681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b505050505081565b60045481565b600660205281600052604060002081815481101561000057906000526020600020906003020160005b5080546001820154600290920154600160a060020a03909116935090915083565b60035460ff1681565b600054600160a060020a03161561043e57610000565b60008054600160a060020a031916606060020a3381020417808255600160a060020a03168152600760205260409020805460ff191660011790555b565b60056020526000908152604090205481565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b505050505081565b60005460a060020a900460ff161561052f57610000565b600160a060020a033316600081815260056020908152604091829020805434908101909155600480548201905582519384529083015280517fc55650ccda1011e1cdc769b1fbf546ebb8c97800b6072b49e06cd560305b1d679281900390910190a15b5b565b60008054819060a060020a900460ff16156105af57610000565b33600160a060020a031684600160a060020a031614156105ce57610000565b600160a060020a033316600090815260056020526040902054839010156105f457610000565b600160a060020a038416600090815260056020526040902054838101101561061b57610000565b6009546103e89084020491506006600085600160a060020a0316815260200190815260200160002080548060010182818154818355818115116106a3576003028160030283600052602060002091820191016106a391905b8082111561069f578054600160a060020a03191681556000600182018190556002820155600301610673565b5090565b5b505050916000526020600020906003020160005b5060408051606081018252338082526020820188905242919092018190528254600160a060020a031916606060020a9283029290920491909117825560018201869055600290910181905561071091508590846108d5565b600b54600090111561072d576107268483610b10565b5081610732565b508082035b600160a060020a033381166000818152600560209081526040808320805487900390559388168083529184902080548789030190558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35b5b50505050565b60086020526000908152604090205481565b60005433600160a060020a039081169116146107d057610000565b6000805474ff0000000000000000000000000000000000000000191660a060020a1790555b5b565b600160a060020a0333166000908152600560205260409020548190101561081e57610000565b600160a060020a033316600081815260056020526040808220805485900390555183156108fc0291849190818181858888f19350505050151561086057610000565b60048054829003905560408051600160a060020a03331681526020810183905281517fae92ab4b6f8f401ead768d3273e6bb937a13e39827d19c6376e8fd4512a05d9a929181900390910190a15b50565b600054600160a060020a031681565b60076020526000908152604090205460ff1681565b600080805b600160a060020a038616600090815260066020526040902054831015610b0757600160a060020a03861660009081526006602052604090208054849081101561000057906000526020600020906003020160005b50600201549150848211610afa57600160a060020a03861660009081526006602052604090208054849081101561000057906000526020600020906003020160005b5054600160a060020a031660008181526007602052604090205490915060ff16151560011480156109ba5750600160a060020a0381166000908152600c602052604090205460ff16155b15610a5857600b8054806001018281815481835581811511610a0157600083815260209020610a019181019083015b8082111561069f57600081556001016109e9565b5090565b5b505050916000526020600020900160005b8154606060020a808602046101009290920a918202600160a060020a03928302199091161790915582166000908152600c60205260409020805460ff19166001179055505b600160a060020a03861660009081526006602052604081208054869190869081101561000057906000526020600020906003020160005b5060010154031115610ae457836006600088600160a060020a0316815260200190815260200160002084815481101561000057906000526020600020906003020160005b506001018054919091039055610aee565b610aee8684610d19565b5b610afa8183866108d5565b5b5b6001909201916108da565b5b505050505050565b600b54600090819083811561000057049150600090505b600b54811015610cc1578160056000600b84815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055508160086000600b84815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055506000600c6000600b84815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316815260200190815260200160002060006101000a81548160ff021916908360f860020a908102040217905550600b81815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031684600160a060020a03167fe16c93e57d246dbbfc845af9aaa7ea8498152b75979609efa09eff175f33ead3846040518082815260200191505060405180910390a35b600101610b27565b600b8054600080835591909152610d10907f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9908101905b8082111561069f57600081556001016109e9565b5090565b5b505b50505050565b600160a060020a03821660009081526006602052604081208054839081101561000057906000526020600020906003020160005b508054600160a060020a031916815560006001820181905560029091015550805b600160a060020a03831660009081526006602052604090205460001901811015610e4257600160a060020a03831660009081526006602052604090208054600183019081101561000057906000526020600020906003020160005b50600160a060020a03841660009081526006602052604090208054839081101561000057906000526020600020906003020160005b5081548154600160a060020a031916606060020a600160a060020a03909216820291909104178155600180830154908201556002918201549101555b600101610d6e565b600160a060020a038316600090815260066020526040902080546000198101808355909190828015829011610ebc57600302816003028360005260206000209182019101610ebc91905b8082111561069f578054600160a060020a03191681556000600182018190556002820155600301610673565b5090565b5b505050505b50505056
Deployed Bytecode
0x606060405236156100b95760e060020a6000350463031f74d481146100be57806306fdde03146100df57806318160ddd1461015a5780632b1857a514610179578063313ce567146101b457806345239b90146101d757806370a08231146101e657806395d89b4114610208578063a6f2ae3a14610283578063a9059cbb1461028d578063b06ee044146102a2578063d7557f18146102c4578063e4849b32146102d3578063e5815b33146102e5578063f72c436f1461030e575b610000565b34610000576100cb610332565b604080519115158252519081900360200190f35b34610000576100ec610342565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34610000576101676103cf565b60408051918252519081900360200190f35b346100005761018c6004356024356103d5565b60408051600160a060020a039094168452602084019290925282820152519081900360600190f35b34610000576101c161041f565b6040805160ff9092168252519081900360200190f35b34610000576101e4610428565b005b346100005761016760043561047b565b60408051918252519081900360200190f35b34610000576100ec61048d565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101e4610518565b005b34610000576101e4600435602435610595565b005b34610000576101676004356107a3565b60408051918252519081900360200190f35b34610000576101e46107b5565b005b34610000576101e46004356107f8565b005b34610000576102f26108b1565b60408051600160a060020a039092168252519081900360200190f35b34610000576100cb6004356108c0565b604080519115158252519081900360200190f35b60005460a060020a900460ff1681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b505050505081565b60045481565b600660205281600052604060002081815481101561000057906000526020600020906003020160005b5080546001820154600290920154600160a060020a03909116935090915083565b60035460ff1681565b600054600160a060020a03161561043e57610000565b60008054600160a060020a031916606060020a3381020417808255600160a060020a03168152600760205260409020805460ff191660011790555b565b60056020526000908152604090205481565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b505050505081565b60005460a060020a900460ff161561052f57610000565b600160a060020a033316600081815260056020908152604091829020805434908101909155600480548201905582519384529083015280517fc55650ccda1011e1cdc769b1fbf546ebb8c97800b6072b49e06cd560305b1d679281900390910190a15b5b565b60008054819060a060020a900460ff16156105af57610000565b33600160a060020a031684600160a060020a031614156105ce57610000565b600160a060020a033316600090815260056020526040902054839010156105f457610000565b600160a060020a038416600090815260056020526040902054838101101561061b57610000565b6009546103e89084020491506006600085600160a060020a0316815260200190815260200160002080548060010182818154818355818115116106a3576003028160030283600052602060002091820191016106a391905b8082111561069f578054600160a060020a03191681556000600182018190556002820155600301610673565b5090565b5b505050916000526020600020906003020160005b5060408051606081018252338082526020820188905242919092018190528254600160a060020a031916606060020a9283029290920491909117825560018201869055600290910181905561071091508590846108d5565b600b54600090111561072d576107268483610b10565b5081610732565b508082035b600160a060020a033381166000818152600560209081526040808320805487900390559388168083529184902080548789030190558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35b5b50505050565b60086020526000908152604090205481565b60005433600160a060020a039081169116146107d057610000565b6000805474ff0000000000000000000000000000000000000000191660a060020a1790555b5b565b600160a060020a0333166000908152600560205260409020548190101561081e57610000565b600160a060020a033316600081815260056020526040808220805485900390555183156108fc0291849190818181858888f19350505050151561086057610000565b60048054829003905560408051600160a060020a03331681526020810183905281517fae92ab4b6f8f401ead768d3273e6bb937a13e39827d19c6376e8fd4512a05d9a929181900390910190a15b50565b600054600160a060020a031681565b60076020526000908152604090205460ff1681565b600080805b600160a060020a038616600090815260066020526040902054831015610b0757600160a060020a03861660009081526006602052604090208054849081101561000057906000526020600020906003020160005b50600201549150848211610afa57600160a060020a03861660009081526006602052604090208054849081101561000057906000526020600020906003020160005b5054600160a060020a031660008181526007602052604090205490915060ff16151560011480156109ba5750600160a060020a0381166000908152600c602052604090205460ff16155b15610a5857600b8054806001018281815481835581811511610a0157600083815260209020610a019181019083015b8082111561069f57600081556001016109e9565b5090565b5b505050916000526020600020900160005b8154606060020a808602046101009290920a918202600160a060020a03928302199091161790915582166000908152600c60205260409020805460ff19166001179055505b600160a060020a03861660009081526006602052604081208054869190869081101561000057906000526020600020906003020160005b5060010154031115610ae457836006600088600160a060020a0316815260200190815260200160002084815481101561000057906000526020600020906003020160005b506001018054919091039055610aee565b610aee8684610d19565b5b610afa8183866108d5565b5b5b6001909201916108da565b5b505050505050565b600b54600090819083811561000057049150600090505b600b54811015610cc1578160056000600b84815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055508160086000600b84815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055506000600c6000600b84815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316815260200190815260200160002060006101000a81548160ff021916908360f860020a908102040217905550600b81815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031684600160a060020a03167fe16c93e57d246dbbfc845af9aaa7ea8498152b75979609efa09eff175f33ead3846040518082815260200191505060405180910390a35b600101610b27565b600b8054600080835591909152610d10907f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9908101905b8082111561069f57600081556001016109e9565b5090565b5b505b50505050565b600160a060020a03821660009081526006602052604081208054839081101561000057906000526020600020906003020160005b508054600160a060020a031916815560006001820181905560029091015550805b600160a060020a03831660009081526006602052604090205460001901811015610e4257600160a060020a03831660009081526006602052604090208054600183019081101561000057906000526020600020906003020160005b50600160a060020a03841660009081526006602052604090208054839081101561000057906000526020600020906003020160005b5081548154600160a060020a031916606060020a600160a060020a03909216820291909104178155600180830154908201556002918201549101555b600101610d6e565b600160a060020a038316600090815260066020526040902080546000198101808355909190828015829011610ebc57600302816003028360005260206000209182019101610ebc91905b8082111561069f578054600160a060020a03191681556000600182018190556002820155600301610673565b5090565b5b505050505b50505056
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | Ether (ETH) | 100.00% | $3,673.13 | 0.1 | $367.31 |
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.