Skip to content

Instantly share code, notes, and snippets.

@KardanovIR
Created September 22, 2020 15:39
Show Gist options
  • Save KardanovIR/693139fdfd268ad68a0d0135b696ba79 to your computer and use it in GitHub Desktop.
Save KardanovIR/693139fdfd268ad68a0d0135b696ba79 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.11;
contract HelloWorld {
uint public myFavoriteNumber = 1610;
//define a new variable "yourFavoriteNumber" here
function myFavoriteNumberPlusYourFavoriteNumber() public view returns (uint) {
return myFavoriteNumber + yourFavoriteNumber;
}
function addTwoNumbers(uint a, uint b) public pure returns (uint) {
return a + b;
}
function coolFunction() public payable {
// function body here
}
function payBill() public {
address billsAddress = 0xEdadA4E79332899e6fAD41F726a346B8BB8ecb4f;
if(billsAddress.balance > 50 ether) {
//Bill is rich already! He won't even notice if I don't pay him
return;
}
else {
//I'll give bill the two ether I owe him
billsAddress.transfer(2 ether);
}
}
/*
// Not needed!
function getMyFavoriteNumber() public view returns (uint) {
return myFavoriteNumber;
}*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment