Verified contractPartial
Bank
Address0xa34f75bd76b044b18c16dbf5481b05fdf75277af
- Balance
0.0001 ETH
- Transactions
51
- Compiler
solc 0.1.3
- Same code
Only this contract
Details
- Compiler
- solc 0.1.3+commit.028f561d
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: no, runtime code: yes
- Verified on Sourcify
- Created in block
- 218,799
- Creation transaction
- 0xeb4f472811…62abcf8041
Bank.sol
// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract Bank {
bool sent;
uint fee;
uint payout;
function Bank() {
manager = msg.sender;
numDeposits = 0;
roi = 120;
feeRate = 3;
minDiff = 30;
maxDecay = 90;
}
function withdraw() {
if (now - timestamps[msg.sender] >= minDiff) {
fee = profits[msg.sender] * feeRate / 100;
payout = profits[msg.sender] - fee;
if (this.balance > balances[msg.sender] + payout) {
sent = msg.sender.send(balances[msg.sender] + payout);
if (sent) {
profits[msg.sender] = 0;
balances[msg.sender] = 0;
}
}
}
}
function getBalance() constant returns (uint) {
return balances[msg.sender];
}
uint public roi;
uint public feeRate;
function deposit() {
++numDeposits;
lastTs = now;
timestamps[msg.sender] = lastTs;
depositors[numDeposits] = msg.sender;
balances[msg.sender] += msg.value;
reCalc();
}
function reCalc() {
if (now - timestamps[msg.sender] >= minDiff) {
profits[msg.sender] += balances[msg.sender] * roi / 100;
}
}
function withdrawProfit() {
if (now - timestamps[msg.sender] >= minDiff) {
fee = profits[msg.sender] * feeRate / 100;
payout = profits[msg.sender] - fee;
if (this.balance > payout) {
sent = msg.sender.send(payout);
if (sent) {
timestamps[msg.sender] = now;
profits[msg.sender] -= profits[msg.sender];
profits[msg.sender] += balances[msg.sender] * roi / 100;
cumulativeProfits[msg.sender] += balances[msg.sender] * roi / 100;
}
}
}
}
function decay() {
if (msg.sender != manager) return;
for (uint i = 0; i < numDeposits; ++i) {
if (balances[depositors[i]] > 0) {
if (this.balance > 0) {
sent = depositors[i].send(balances[depositors[i]]);
if (sent) {
balances[depositors[i]] = 0;
profits[depositors[i]] = 0;
}
}
}
}
}
function getProfit() constant returns (uint) {
return profits[msg.sender];
}
function getCumulativeProfit() constant returns (uint) {
return cumulativeProfits[msg.sender];
}
function getDepositDelta() constant returns (uint) {
return now - timestamps[msg.sender];
}
uint public lastTs;
uint public minDiff;
uint public numDeposits;
uint public maxDecay;
address public manager;
mapping (address => uint) balances;
mapping (address => uint) timestamps;
mapping (address => uint) cumulativeProfits;
mapping (address => uint) profits;
mapping (uint => address) depositors;
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.