Created
September 11, 2017 10:30
-
-
Save anonymous/77b240dcbac0a769a510ab091554e20e to your computer and use it in GitHub Desktop.
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.16+commit.d7661dd9.js&optimize=undefined&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract Sample { | |
mapping(address => address) arr; | |
uint8 limit; | |
function Sample(uint8 _limit) { | |
limit = _limit; | |
} | |
//i am the sender. if my balance > limit this receiver can take my 1 ether | |
function Accept(address _receiver){ | |
arr[msg.sender] = _receiver; | |
} | |
//i am the receiver and the sender gave me 1 ether. i wants to receive it. | |
function Take(address sender){ | |
if(msg.sender != arr[sender]) | |
return; | |
if(sender.balance < limit) | |
return; | |
//how can contract send 1 ether from sender to receiver(msg.sender) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment