mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-26 15:13:56 +00:00
Make event name consistent, remove trailing spaces
This commit is contained in:
parent
71389bd423
commit
588b699b25
@ -134,7 +134,7 @@ uint constant VERSION_ID = 0x123A1; // A hex constant
|
|||||||
// All state variables (those outside a function)
|
// All state variables (those outside a function)
|
||||||
// are by default 'internal' and accessible inside contract
|
// are by default 'internal' and accessible inside contract
|
||||||
// and in all contracts that inherit ONLY
|
// and in all contracts that inherit ONLY
|
||||||
// Need to explicitly set to 'public' to allow external contracts to access
|
// Need to explicitly set to 'public' to allow external contracts to access
|
||||||
int256 public a = 8;
|
int256 public a = 8;
|
||||||
|
|
||||||
// For int and uint, can explicitly set space in steps of 8 up to 256
|
// For int and uint, can explicitly set space in steps of 8 up to 256
|
||||||
@ -352,7 +352,7 @@ function increment(uint x) constant returns (uint x) {
|
|||||||
// y is a state variable, and can't be changed in a constant function
|
// y is a state variable, and can't be changed in a constant function
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'pure' is more strict than 'constant', and does not
|
// 'pure' is more strict than 'constant', and does not
|
||||||
// even allow reading of state vars
|
// even allow reading of state vars
|
||||||
// The exact rules are more complicated, so see more about
|
// The exact rules are more complicated, so see more about
|
||||||
// constant/pure:
|
// constant/pure:
|
||||||
@ -384,7 +384,7 @@ function depositEther() public payable {
|
|||||||
|
|
||||||
|
|
||||||
// Prefer loops to recursion (max call stack depth is 1024)
|
// Prefer loops to recursion (max call stack depth is 1024)
|
||||||
// Also, don't setup loops that you haven't bounded,
|
// Also, don't setup loops that you haven't bounded,
|
||||||
// as this can hit the gas limit
|
// as this can hit the gas limit
|
||||||
|
|
||||||
// B. Events
|
// B. Events
|
||||||
@ -399,11 +399,11 @@ function depositEther() public payable {
|
|||||||
event LogSent(address indexed from, address indexed to, uint amount); // note capital first letter
|
event LogSent(address indexed from, address indexed to, uint amount); // note capital first letter
|
||||||
|
|
||||||
// Call
|
// Call
|
||||||
Sent(from, to, amount);
|
LogSent(from, to, amount);
|
||||||
|
|
||||||
// For an external party (a contract or external entity), to watch using
|
// For an external party (a contract or external entity), to watch using
|
||||||
// the Web3 Javascript library:
|
// the Web3 Javascript library:
|
||||||
Coin.Sent().watch({}, '', function(error, result) {
|
Coin.LogSent().watch({}, '', function(error, result) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
console.log("Coin transfer: " + result.args.amount +
|
console.log("Coin transfer: " + result.args.amount +
|
||||||
" coins were sent from " + result.args.from +
|
" coins were sent from " + result.args.from +
|
||||||
@ -709,7 +709,7 @@ contract CrowdFunder {
|
|||||||
return contributions.length - 1; // return id
|
return contributions.length - 1; // return id
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIfFundingCompleteOrExpired()
|
function checkIfFundingCompleteOrExpired()
|
||||||
public
|
public
|
||||||
{
|
{
|
||||||
if (totalRaised > minimumToRaise) {
|
if (totalRaised > minimumToRaise) {
|
||||||
|
Loading…
Reference in New Issue
Block a user