Contract Overview
Balance:
0.000399344684979715 Ether
EtherValue:
$0.06 (@ $148.36/ETH)
Transactions:
892 txns
Latest 25 transactions from a total of 892 transactions
(+1 PendingTxn)
[ Download CSV Export ]
Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution
[ Download CSV Export ]
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.
Contract Source Code Verified (Exact Match)
Contract Source Code Verified (Exact Match)
Contract Name: | ETH_Silver |
Compiler Version: | v0.4.24+commit.e67f0147 |
Optimization Enabled: | Yes |
Runs (Optimizer): | 200 |
Contract Source Code
// The version of the compiler. pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } uint256 c = _a * _b; require(c / _a == _b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b <= _a); uint256 c = _a - _b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256) { uint256 c = _a + _b; require(c >= _a); return c; } /** * @dev Divides two numbers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } /** * @title ETH_Silver * @dev The main contract of the project. */ contract ETH_Silver { // Using SafeMath for safe calculations. using SafeMath for uint; // A variable for address of the owner. address owner; // A variable to store deposits of investors. mapping (address => uint) deposit; // A variable to store amount of withdrawn money of investors. mapping (address => uint) withdrawn; // A variable to store reference point to count available money to withdraw. mapping (address => uint) lastTimeWithdraw; // A function to transfer ownership of the contract (available only for the owner). function transferOwnership(address _newOwner) external { require(msg.sender == owner); require(_newOwner != address(0)); owner = _newOwner; } // A function to get key info for investors. function getInfo() public view returns(uint Deposit, uint Withdrawn, uint AmountToWithdraw) { // 1) Amount of invested money; Deposit = deposit[msg.sender]; // 2) Amount of withdrawn money; Withdrawn = withdrawn[msg.sender]; // 3) Amount of money which is available to withdraw; // Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 day)) * (Deposit * 3% / 100%) / 1 day AmountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].mul(3).div(100)).div(1 days); } // A constructor function for the contract. Being used once at the time as contract is deployed and simply set the owner of the contract. constructor() public { owner = msg.sender; } // A "fallback" function. It is automatically being called when anybody sends money to the contract. Function simply calls the "invest" function. function() external payable { invest(); } // A function which accepts money of investors. function invest() public payable { // Requires amount of money to be more than 0.01 ETH. If it is less, automatically reverts the whole function. require(msg.value > 10000000000000000); // Transfers a fee to the owner of the contract. The fee is 20% of the deposit (or Deposit / 5) owner.transfer(msg.value.div(5)); // The special algorithm for investors who increase their deposits: if (deposit[msg.sender] > 0) { // Amount of money which is available to withdraw; // Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 day)) * (Deposit * 3% / 100%) / 1 day uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].mul(3).div(100)).div(1 days); // The additional algorithm for investors who need to withdraw available dividends: if (amountToWithdraw != 0) { // Increasing amount withdrawn by an investor. withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw); // Transferring available dividends to an investor. msg.sender.transfer(amountToWithdraw); } // Setting the reference point to the current time. lastTimeWithdraw[msg.sender] = block.timestamp; // Increasing of the deposit of an investor. deposit[msg.sender] = deposit[msg.sender].add(msg.value); // End of the function for investors who increases their deposits. return; } // The algorithm for new investors: // Setting the reference point to the current time. lastTimeWithdraw[msg.sender] = block.timestamp; // Storing the amount of the deposit for new investors. deposit[msg.sender] = (msg.value); } // A function to get available dividends of an investor. function withdraw() public { // Amount of money which is available to withdraw. // Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 day)) * (Deposit * 3% / 100%) / 1 day uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].mul(3).div(100)).div(1 days); // Reverting the whole function for investors who got nothing to withdraw yet. if (amountToWithdraw == 0) { revert(); } // Increasing amount withdrawn by the investor. withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw); // Updating the reference point. // Formula without SafeMath: Current Time - ((Current Time - Previous Reference Point) % 1 day) lastTimeWithdraw[msg.sender] = block.timestamp.sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days)); // Transferring the available dividends to an investor. msg.sender.transfer(amountToWithdraw); } }
Contract ABI
[{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getInfo","outputs":[{"name":"Deposit","type":"uint256"},{"name":"Withdrawn","type":"uint256"},{"name":"AmountToWithdraw","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"invest","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"}]
Contract Creation Code
608060405234801561001057600080fd5b5060008054600160a060020a03191633179055610565806100326000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633ccfd60b811461006b5780635a9b0b8914610080578063e8b5e51f14610061578063f2fde38b146100b3575b6100696100e1565b005b34801561007757600080fd5b506100696102e1565b34801561008c57600080fd5b506100956103cb565b60408051938452602084019290925282820152519081900360600190f35b3480156100bf57600080fd5b5061006973ffffffffffffffffffffffffffffffffffffffff60043516610410565b6000662386f26fc1000034116100f657600080fd5b60005473ffffffffffffffffffffffffffffffffffffffff166108fc61012334600563ffffffff61049216565b6040518115909202916000818181858888f1935050505015801561014b573d6000803e3d6000fd5b503360009081526001602052604081205411156102be5733600090815260016020526040902054610214906201518090610195906101a1906064908390600363ffffffff6104ba16565b9063ffffffff61049216565b33600090815260036020526040902054610208906101db9062015180906101cf90429063ffffffff6104ef16565b9063ffffffff61050616565b336000908152600360205260409020546101fc90429063ffffffff6104ef16565b9063ffffffff6104ef16565b9063ffffffff6104ba16565b9050801561027c573360009081526002602052604090205461023c908263ffffffff61052716565b33600081815260026020526040808220939093559151909183156108fc02918491818181858888f1935050505015801561027a573d6000803e3d6000fd5b505b33600090815260036020908152604080832042905560019091529020546102a9903463ffffffff61052716565b336000908152600160205260409020556102de565b336000908152600360209081526040808320429055600190915290203490555b50565b33600090815260016020526040812054610314906201518090610195906101a1906064908390600363ffffffff6104ba16565b905080151561032257600080fd5b33600090815260026020526040902054610342908263ffffffff61052716565b336000908152600260209081526040808320939093556003905220546103899061037c9062015180906101cf90429063ffffffff6104ef16565b429063ffffffff6104ef16565b33600081815260036020526040808220939093559151909183156108fc02918491818181858888f193505050501580156103c7573d6000803e3d6000fd5b5050565b3360009081526001602081815260408084205460028352908420549290915291610409620151806101956101a160648288600363ffffffff6104ba16565b9050909192565b60005473ffffffffffffffffffffffffffffffffffffffff16331461043457600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116151561045657600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff191673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000808083116104a157600080fd5b82848115156104ac57fe5b0490508091505b5092915050565b6000808315156104cd57600091506104b3565b508282028284828115156104dd57fe5b04146104e857600080fd5b9392505050565b600080838311156104ff57600080fd5b5050900390565b600081151561051457600080fd5b818381151561051f57fe5b069392505050565b6000828201838110156104e857600080fd00a165627a7a7230582087431eed38d6a2279adfdd834ba14246f5514087ae74a697703b89bac07a7bca0029
Swarm Source:
bzzr://87431eed38d6a2279adfdd834ba14246f5514087ae74a697703b89bac07a7bca
Block | Age | transaction | Difficulty | GasUsed | Reward |
---|
Block | Age | Uncle Number | Difficulty | GasUsed | Reward |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.