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.23; | |
contract D { | |
uint public n; | |
address public sender; | |
function callSetN(address _e, uint _n) { | |
_e.call(bytes4(sha3("setN(uint256)")), _n); // E's storage is set, D is not modified | |
} |
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.5.0; | |
import "./IndirectEventEmitter.sol"; | |
contract EventEmitter { | |
event Argumentless(); | |
event ShortUint(uint8 value); | |
event ShortInt(int8 value); | |
event LongUint(uint256 value); | |
event LongInt(int256 value); |
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.22 <0.6.0; | |
/// @title Voting with delegation. | |
contract Ballot { | |
// This declares a new complex type which will | |
// be used for variables later. | |
// It will represent a single voter. | |
struct Voter { | |
uint weight; // weight is accumulated by delegation | |
bool voted; // if true, that person already voted |
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.22 <0.6.0; | |
/// @title Voting with delegation. | |
contract Ballot { | |
// This declares a new complex type which will | |
// be used for variables later. | |
// It will represent a single voter. | |
struct Voter { | |
uint weight; // weight is accumulated by delegation | |
bool voted; // if true, that person already voted |
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.22 <0.6.0; | |
/// @title Voting with delegation. | |
contract Ballot { | |
// This declares a new complex type which will | |
// be used for variables later. | |
// It will represent a single voter. | |
struct Voter { | |
uint weight; // weight is accumulated by delegation | |
bool voted; // if true, that person already voted |
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.5.0; | |
contract ArrayTesting { | |
uint[] public num; | |
function pushInt(uint value) public { | |
num.push(value); | |
} | |
function getLength() public view returns(uint) { |
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.24; | |
/* | |
Understanding Method overiding by mulitle child contracts | |
Parent contract is Crowdsale, | |
Child contracts are CappedCrowdSale and TimeCrowdsale. Both overides the Parent Contract method _preValidatePurchase. | |
Grand Child contract, SampleCrowdsale first chooses to inhert from it's parent TimeCrowdsale and later contract CappedCrowdSale. | |
Since the inherted method overiding happens in FIFO style, TimeCrowdsale method is called first and CappedCrowdSale later. Super must | |
be called by both child contract inorder the complete the method overiding chain. |
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.23; | |
contract D { | |
uint public n; | |
address public sender; | |
function callSetN(address _e, uint _n) { | |
_e.call(bytes4(sha3("setN(uint256)")), _n); // E's storage is set, D is not modified | |
} | |
} |
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.11; | |
contract CrowdFunding { | |
// Defines a new type with two fields. | |
struct Funder { | |
address addr; | |
uint amount; | |
} | |
struct Campaign { |
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.11; | |
contract CrowdFunding { | |
// Defines a new type with two fields. | |
struct Funder { | |
address addr; | |
uint amount; | |
} | |
struct Campaign { |
NewerOlder