Skip to content
Verified contractPartial

Bank

Address0xbaa43006db572fbe2d49439ee32f72723b3d0e88
Balance

0.0001 ETH

 

Transactions

50

 

Compiler

solc 0.1.3

 

Same code

1 more 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,255
Creation transaction
0x90c9cec2be…6d81aedd60

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 getBalance() constant returns (uint) {
        return balances[msg.sender];
    }

    uint public roi;
    uint public feeRate;
    uint public lastTs;
    uint public minDiff;

    function getProfit() constant returns (uint) {
        return profits[msg.sender];
    }

    function getCumulativeProfit() constant returns (uint) {
        return cumulativeProfits[msg.sender];
    }

    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;
                }
            }
        }
    }

    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;

    function deposit() {
        ++numDeposits;
        lastTs = now;
        timestamps[msg.sender] = lastTs;
        depositors[numDeposits] = msg.sender;
        balances[msg.sender] += msg.value;
        cumulativeProfits[msg.sender] += msg.value * roi / 100;
        profits[msg.sender] += msg.value * 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;
        if (now - lastTs >= maxDecay) {
            for (uint i = 0; i < numDeposits; ++i) {
                depositors[i].send(balances[depositors[i]]);
                balances[depositors[i]] = 0;
                profits[depositors[i]] = 0;
            }
        }
    }

    function getDepositDelta() constant returns (uint) {
        return now - timestamps[msg.sender];
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.