Discover more of Etherscan's tools and services in one place.
Sponsored
Contract Source Code:
File 1 of 1 : shared_bank
contract shared_bank { function Deposit(uint _unlockTime) public payable { Holder storage acc = Accounts[msg.sender]; acc.balance += msg.value; acc.unlockTime = _unlockTime > block.timestamp ? _unlockTime : block.timestamp; LogFile.AddMessage(msg.sender, msg.value, "Put"); } function Collect(uint _am) public payable { Holder storage acc = Accounts[msg.sender]; if (acc.balance > MinSum && acc.balance >= _am && block.timestamp > acc.unlockTime) { (bool success, ) = msg.sender.call{value: _am}(""); if (success) { acc.balance -= _am; LogFile.AddMessage(msg.sender, _am, "Collect"); } } } struct Holder { uint unlockTime; uint balance; } mapping(address => Holder) public Accounts; Log LogFile; uint public MinSum = 1 ether; constructor(address log) { LogFile = Log(log); } fallback() external payable { Deposit(0); } receive() external payable { Deposit(0); } } contract Log { event Message(address indexed Sender, string Data, uint Val, uint Time); function AddMessage(address _adr, uint _val, string memory _data) external { emit Message(_adr, _data, _val, block.timestamp); } }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
My Name Tag:
Private Note:
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.