Skip to content

Instantly share code, notes, and snippets.

/sample.sol

Created Sep 11, 2017
Embed
What would you like to do?
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=
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