Created
May 17, 2018 16:14
-
-
Save jigar23/b81611e55d2f874f0e18054209962f57 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
This file contains hidden or 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; | |
// Each contract has an ethereum address can be addressed by | |
// this | |
contract Transaction { | |
// Events can log what is passed to it | |
event SendLogger(address); | |
event ValueLogger(uint); | |
address private owner; | |
modifier checkOwner { | |
require(msg.sender == owner); | |
_; | |
} | |
modifier checkValue { | |
assert(msg.value >= 1 ether); | |
_; | |
} | |
function Transaction() { | |
owner = msg.sender; | |
} | |
// special function - fallback function | |
// If they know the address of the contract, they can send ether to it. | |
// So if you want your contract to receive Ether, you have to implement a fallback function. | |
function () payable checkOwner checkValue { | |
emit SendLogger(msg.sender); | |
emit ValueLogger(msg.value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment