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
using Neo.SmartContract.Framework; | |
using Neo.SmartContract.Framework.Services.Neo; | |
// [assembly: ContractTitle("optional contract title")] | |
// [assembly: ContractDescription("optional contract description")] | |
// [assembly: ContractVersion("optional contract version")] | |
// [assembly: ContractAuthor("optional contract author")] | |
// [assembly: ContractEmail("optional contract email")] | |
[assembly: Features(ContractPropertyState.HasStorage)] |
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.8.0; | |
contract Student { | |
string firstName; | |
string lastName; | |
string dateOfBirth; | |
function setStudent(string memory fname, | |
string memory lname, | |
string memory dob) public { |
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
using Neo.SmartContract.Framework; | |
using Neo.SmartContract.Framework.Services.Neo; | |
[assembly: ContractTitle("Student Enrollment")] | |
[assembly: Features(ContractPropertyState.HasStorage)] | |
public class StudentEnrollment : SmartContract | |
{ | |
public static object Main(string operation, params string[] args) | |
{ |
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
import sys | |
from slither import Slither | |
slither = Slither('uninitialized.sol') | |
for contract in slither.contracts: | |
print(f'Contract: {contract.name}') | |
for function in contract.functions: | |
print(f'\t{function.full_name}') | |
print(f'\t\tVisibility{function.visibility}') |
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; | |
contract Token { | |
mapping (address => uint) public balances; | |
function sendToken(address receiver, uint amount) public payable { | |
require(balances[msg.sender] - amount > 0); | |
balances[msg.sender] -= amount; | |
balances[receiver] += amount; | |
} |
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; | |
contract IntegerTest { | |
function Sub(uint8 x, uint8 y) public pure returns(uint8) { | |
return x - y; | |
} | |
} |
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; | |
import "./TrustFund3.sol"; | |
contract BadPartner { | |
TrustFund public fund; | |
constructor(address fundAddress) public { | |
fund = TrustFund(fundAddress); | |
} |
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; | |
contract TrustFund { | |
address[3] partners; | |
uint totalFunding; | |
uint[3] withdrawn; | |
uint[3] distribution = [2, 4, 4]; | |
constructor(address[3] _partners) public { | |
partners = _partners; |
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; | |
contract TrustFund { | |
address[3] partners; | |
constructor(address[3] _partners) public { | |
partners = _partners; | |
} | |
function updateAddress(uint partner, address newAddress) public { |
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.0 <0.7.0; | |
contract SimpleLottery { | |
uint ticketingCloses; | |
address[] public tickets; | |
address public winner; | |
constructor(uint duration) public { | |
ticketingCloses = now + duration + 1 days; | |
} |
NewerOlder