- pragma solidity ^0.4.0;
- contract SimpleBank {
- address public owner;
- // even that gets logged on block chain...
- event MyWorthIs(uint balance);
- /*
- */
- function SimpleBank() {
- // the 'owner' is the person who creates this contract
- owner = msg.sender;
- }
- /*
- */
- function() payable {
- }
- /*
- */
- function Worth() {
- MyWorthIs(this.balance);
- }
- function send(address _to, uint256 _amount) {
- _to.send(_amount);
- }
- /*
- * Suicide function will kill the contract.
- */
- function kill() {
- suicide(msg.sender);
- }
- }
- contract IsAlive {
- address public thing;
- function IsAlive(address _thing) {
- thing = _thing;
- }
- function() payable {
- if (SimpleBank(thing).owner() == 0) {
- // the contract is dead, send amount back
- msg.sender.send(msg.value);
- } else {
- // don't need gas?
- thing.call.gas(300000000).value(msg.value)();
- // you can call a specific funtion by..
- // thing.call.gas(x).value(y)(bytes4(sha3("pay()")));
- }
- }
- /*
- * Suicide function will kill the contract.
- */
- function kill() {
- suicide(msg.sender);
- }
- }