Skip to content

Instantly share code, notes, and snippets.

@DonSHack
DonSHack / ECert.sol
Created January 3, 2019 11:46
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.5.2+commit.1df8f40c.js&optimize=false&gist=
pragma solidity ^0.4.24;
contract EC1{
address private owner;
struct Certificate{
string cource_name;
string performance;
string grade;
string issued_date;
}
@DonSHack
DonSHack / Certificate.json
Created January 2, 2019 12:04
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.24+commit.e67f0147.js&optimize=false&gist=
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
@DonSHack
DonSHack / Election.sol
Created December 20, 2018 11:27
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.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.24;
contract Election{
address private owner;
struct Candidate{
string name;
address acc_address;
uint256 num_of_votes;
}
@DonSHack
DonSHack / Election.sol
Created December 20, 2018 11:14
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.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.24;
contract Election{
address private owner;
struct Candidate{
string name;
address acc_address;
uint256 num_of_votes;
}
@DonSHack
DonSHack / Modifires.sol
Created December 20, 2018 05:49
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.5.2+commit.1df8f40c.js&optimize=false&gist=
pragma solidity ^0.5.1;
contract Bank{
address private owner;
constructor() public {
owner = msg.sender;
}
modifier isValid() {
require(owner == msg.sender);
_;
@DonSHack
DonSHack / Interfaces.sol
Created December 19, 2018 10:16
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.5.1+commit.c8a2cb62.js&optimize=true&gist=
pragma solidity ^0.5.1;
interface Interface {
function check() external returns (bool);
function loan() external returns (bool);
}
//inheritance
contract Parent is Interface{
//constructor
constructor(uint val) public {
@DonSHack
DonSHack / MyFirstSol.sol
Created December 19, 2018 10:04
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.5.1+commit.c8a2cb62.js&optimize=true&gist=
pragma solidity ^0.5.1;
//inheritance
contract Parent{
//constructor
constructor(uint val) public {
privateValue = val;
}
//protected modifire
uint internal internalValue;
//private modifire
@DonSHack
DonSHack / MyFirstSol.sol
Created December 19, 2018 09:01
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.5.1+commit.c8a2cb62.js&optimize=true&gist=
pragma solidity ^0.5.1;
contract MyFirstContract {
string public name;
uint public age;
function setName(string memory newName) public {
name = newName;
}
function getName() public returns (string memory){
return name;