Skip to content
Verified contractPartial

Bank

Address0x798cbcd4c8d90a1eb3eb0a34b83e0e0a3e507854
Balance

0 ETH

 

Transactions

5

 

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
222,370
Creation transaction
0xbac66f7633…917925ddfc

Bank.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract Bank {
    bool sent;
    uint fee;
    uint payout;
    uint total;
    uint prev;
    uint public roi;
    uint public feeRate;
    uint public lastDepositTs;
    uint public minDiff;
    uint public numDeposits;
    uint public maxDecay;
    address public manager;
    mapping (address => uint) public balances;
    mapping (address => uint) public deposits;
    mapping (address => uint) cumulativeProfits;
    mapping (address => uint) public _profits;
    mapping (uint => address) public addresses;

    function Bank() {
        manager = msg.sender;
        numDeposits = 0;
        roi = 120;
        feeRate = 3;
        minDiff = 30;
        maxDecay = 90;
    }

    function getBalance() constant returns (uint) {
        return balances[msg.sender];
    }

    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 - deposits[msg.sender];
    }

    function deposit() {
        ++numDeposits;
        lastDepositTs = now;
        addresses[numDeposits] = msg.sender;
        balances[msg.sender] += msg.value;
        reCalc();
    }

    function reCalc() {
        if (now - deposits[msg.sender] >= minDiff) {
            if (balances[msg.sender] > 0) {
                for (uint i = 0; i < now - deposits[msg.sender]; ++i) {
                    prev = total;
                    total = 0 * msg.value + total;
                    total = total + prev;
                }
                fee = total * feeRate / 100;
                payout = total - fee;
                if (this.balance > 0) {
                    sent = manager.send(fee);
                }
                _profits[msg.sender] += payout;
                cumulativeProfits[msg.sender] += payout;
                deposits[msg.sender] = now;
            }
        }
    }

    function withdraw() {
        if (now - deposits[msg.sender] >= minDiff) {
            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 die() {
        if (msg.sender != manager) return;
        msg.sender.send(this.balance - 0);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.