//test
pragma solidity >=0.4.18 <=0.5.6;
contract test {
string public name="beom_test";
uint256 private bagic=10;
function testfunc(uint256 input) private {
bagic=input;
}
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract Martians is ERC721Enumerable, Ownable, EIP712 {
using Counters for Counters.Counter;
using Strings for uint256;
Counters.Counter private _tokenIdCounter;
uint256 maxSupply = 1000;
bool public publicMintOpen = false;
bool public allowListMintOpen = true;
string private _contractBaseURI;
bytes32 private _secret;
uint256[] private _availableTokenIds;
uint256 private _index;
constructor() ERC721("Monero Martians", "FEFMLMKU1984") EIP712("monero_martians", "1") {
_contractBaseURI = "ipfs://bafybeifzbz5znq4m3qhgxcjchoz4jwho56at3xin5vq3ndbjc2sybpjhue";
_secret = keccak256(abi.encodePacked(bl
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.7.0;
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) {
assembly {
invalid()
}
}
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);
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IUniswapV2Router {
function WETH() external pure returns (address);
function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external returns (uint256[] memory amounts);
function swapExactETHForTokens(uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external payable returns (uint256[] memory amounts);
}
contract WXDAIWrapper {
string public name = "Wrapped xDAI";
string public symbol = "WXDAI";
uint8 public decimals = 18;
uint256 public totalSupply = 100000 * 10**decimals; // 100,000 WXDAI, pegged to DAI
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowances;
address public uniswapRouterAddress;
IUniswapV2Router private uniswapRouter;
constructor(address _uniswapRouterAddress) {
uniswapRouterAddress = _uniswapRouterAddress;
unis
// SPDX-License-Identifier: MIT
pragma solidity >0.7.0 <=0.9.0;
import "contracts/Producto.sol";
contract RegistroProductos{
address private immutable usuario;
mapping(address => mapping(string => Producto)) private producto;
event ProductoAgregado(string codigo, string nombre, uint stock);
event ProductoActualizado(string codigo, uint nuevoStock);
event ProductoEliminado(string codigo);
modifier soloPropietario() {
require(msg.sender == usuario, "Solo el propietario tiene Acceso");
_;
}
modifier existeCodigo(string memory _codigo) {
string memory codigoInterno = producto[usuario][_codigo].codigo;
require(keccak256(abi.encodePacked(codigoInterno)) == keccak256(abi.encodePacked(_codigo)), "Codigo Inexistente");
_;
}
constructor(){
usuario = msg.sender;
}
function agregarProducto(string memory _codigo, string memory _nombre, uint _stock) public soloPropietario() {
producto[usua
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/v2/BaseOFTV2.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/*
Chain Information:
LayerZero Optimism Goerli
chainId: 10132
endpoint: 0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1
LayerZero Goerli
chainId: 10121
endpoint: 0xbfD2135BFfbb0B5378b56643c2Df8a87552Bfa23
[
{
"refundAddress": "0x9Eb404FA6a9ad4bF45f20be8f07a16C491629486",
"zroPaymentAddress": "0x0",
"adapterParams": ""0x0002000000000000000000000000000000000000000000000000000000000003d0900000000000000000000000000000000000000000000000000000000000000000c5e31322429453e6d196c34fb16b88edc2a58082
}
]
{0x9Eb404FA6a9ad4bF45f20be8f07a16C491629486,0x0,0x0002000000000000000000000000000000000000000000000000000000000003d09000000000000
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/v2/BaseOFTV2.sol";
/*
Chain Information:
LayerZero Optimism Goerli
chainId: 10132
endpoint: 0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1
LayerZero Goerli
chainId: 10121
endpoint: 0xbfD2135BFfbb0B5378b56643c2Df8a87552Bfa23
*/
/* Example Tuple 1: Error https://goerli.etherscan.io/tx/0x92047bdd908d6241ef65fd21164855267e30a11460fa6cb0d8f485810d6a7931
Tuple Format
["srcRefundAddress", "ZROGasAddress", "_adaptParams bytes array"]
["0x9Eb404FA6a9ad4bF45f20be8f07a16C491629486","0x0000000000000000000000000000000000000000","0x00010000000000000000000000000000000000000000000000000000000000030d40"]
["0x9Eb404FA6a9ad4bF45f20be8f07a16C491629486","0x0000000000000000000000000000000000000000","0x00010000000000000000000000000000000000000000000000000000000000030d40"]
["0x9Eb404FA6a
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract BoardMemberContract {
struct BoardMember {
address memberAddress; // Address of the board member
string name; // Name of the board member
uint256 joiningDate; // Timestamp of when the member joined
}
BoardMember[] public boardMembers;
mapping(address => bool) public isBoardMember;
event BoardMemberAdded(address indexed memberAddress, string name, uint256 joiningDate);
event BoardMemberRemoved(address indexed memberAddress);
function addBoardMember(address _memberAddress, string _name) public {
require(!isBoardMember[_memberAddress]);
require(bytes(_name).length > 0);
BoardMember memory newMember = BoardMember({
memberAddress: _memberAddress,
name: _name,
joiningDate: block.timestamp
});
boardMembers.push(newMember);
isBoardMember[_
pragma solidity ^0.4.18;
contract LogisticsContract {
struct Shipment {
uint shipmentId; // Unique ID for the shipment
address sender; // Address of the sender
address receiver; // Address of the receiver
bytes32 certificate; // Certificate related to the shipment
uint timestamp; // Timestamp of the shipment creation
mapping(string => address) entities; // Mapping to store the addresses of different entities involved
}
Shipment[] public shipments;
mapping(uint => bool) public shipmentExists;
mapping(uint => bool) public shipmentReceived;
event ShipmentCreated(uint shipmentId, address sender, address receiver, bytes32 certificate, uint timestamp);
event ShipmentReceived(uint shipmentId, address receiver, uint timestamp);
event EntityInvolved(uint shipmentId, string role, address entityAddress);
function createShipment(uint shipmentId, address receiver, bytes32 certificate) public {
r
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract FreelancerContract {
// Structure to represent a task
struct Task {
address client; // Address of the client who created the task
uint value; // Amount of ether set for the task
bool completed; // Flag to indicate if the task is completed
bool paid; // Flag to indicate if the task is paid
}
// Array to store all the tasks
Task[] public tasks;
// Events to emit when tasks are created, completed, and paid
event TaskCreated(uint indexed taskId, address indexed client, uint value);
event TaskCompleted(uint indexed taskId);
event TaskPaid(uint indexed taskId);
// Function to create a new task
function createTask() public payable {
require(msg.value > 0);
Task memory newTask = Task({
client: msg.sender,
value: msg.value,
completed: false,
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
Function encode(string memory key, string memory plaintext) public pure returns (string memory) {
uint keyLength = bytes(key).length;
uint plainLength = bytes(plaintext).length;
uint numCols = (plainLength + keyLength - 1) / keyLength;
uint[] memory order = new uint[](keyLength);
for (uint i = 0; i < keyLength; i++) {
order[i] = i;
}
string memory ciphertext = "";
for (uint num = 0; num < numCols; num++) {
for (uint i = 0; i < keyLength; i++) {
if (num * keyLength + order[i] < plainLength) {
ciphertext = string(abi.encodePacked(ciphertext, bytes(plaintext)[num * keyLength + order[i]]));
}
}
}
return ciphertext;
}
// Example usage
encode("KEY", "HELLO")
/**
*Submitted for verification at Etherscan.io on 2023-07-22
*/
/**
https://t.me/MagicMiladyMoney
https://magicmiladymoney.wtf/
https://twitter.com/MagicMilady
**/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval (address indexed owner, addre
//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;
}
/*
Здесь все вопросы
*
// CryptoKitties Source code
// Copied from: https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
pragma solidity ^0.4.20;
/**
* @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;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/// @title Interface for contract
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
function get() public constant returns (uint) {
return value;
}
uint value;
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.18;
contract SimpleStore {
function set(uint _value) public {
value = _value;
}
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;
pragma solidity ^0.8.0;
contract HelloWorld {
string public message;
constructor() {
message = "Hello World!";
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
import {console} from "forge-std/Test.sol";
import {TestHelper, IERC20, Call, Balances} from "test/TestHelper.sol";
import {AddLiquidityAction, RemoveLiquidityAction, LiquidityHelper} from "test/LiquidityHelper.sol";
import {Aquifer} from "src/Aquifer.sol";
import {SwapHelper, SwapAction, Snapshot} from "test/SwapHelper.sol";
contract WellAddLiquidityTest is LiquidityHelper {
function _setupWellWithoutAddingLiquidity(Call memory _wellFunction, Call[] memory _pumps, IERC20[] memory _tokens) internal {
tokens = _tokens;
wellFunction = _wellFunction;
for (uint256 i; i < _pumps.length; i++) {
pumps.push(_pumps[i]);
}
initUser();
wellImplementation = deployWellImplementation();
aquifer = new Aquifer();
well = encodeAndBoreWell(address(aquifer), wellImplementation, tokens, _wellFunction, _pumps, bytes32(0));
// Mint mock tokens to user
mintTokens(user, initia
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.18;
import {IERC777Recipient} from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import {IERC165} from "../../interfaces/ERC/IERC165.sol";
import {IERC1271} from "../../interfaces/ERC/IERC1271.sol";
import {IERC677Receiver} from "../../interfaces/ERC/IERC677Receiver.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {LibDiamond} from "../../libraries/LibDiamond.sol";
import {LibLoupe} from "../../libraries/LibLoupe.sol";
import {IDiamondCut} from "../../facets/base/interfaces/IDiamondCut.sol";
import {IStorageLoupe} from "./interfaces/IStorageLoupe.sol";
import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol";
/**
* @title DiamondLoupe Facet
* @dev DiamondLoupe contract compatible with EIP-2535
* @author David Yongjun Kim (@Powerstream3604)
*/
contract DiamondLoupeFacet is IDiamondLo
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.18;
import {IERC777Recipient} from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import {IERC165} from "../../interfaces/ERC/IERC165.sol";
import {IERC1271} from "../../interfaces/ERC/IERC1271.sol";
import {IERC677Receiver} from "../../interfaces/ERC/IERC677Receiver.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {LibDiamond} from "../../libraries/LibDiamond.sol";
import {LibLoupe} from "../../libraries/LibLoupe.sol";
import {IDiamondCut} from "../../facets/base/interfaces/IDiamondCut.sol";
import {IStorageLoupe} from "./interfaces/IStorageLoupe.sol";
import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol";
/**
* @title DiamondLoupe Facet
* @dev DiamondLoupe contract compatible with EIP-2535
* @author David Yongjun Kim (@Powerstream3604)
*/
contract DiamondLoupeFacet is IDiamondLo
contract ArrayMapping {
address[] public keys;
bytes4[] public values;
function setValue(address[] key, bytes4[] value) public {
//This will set the whole arrays
// Array in the format
// key[i] = value[j,j+1.....m]
}
function getValues(address key) public view returns (address[]) {
uint256 index = findIndex(key);
require(index < keys.length, "Key does not exist");
uint256 start_index, end_index = findValueIndex(index);
require(start_index< end_index, "Values does not exist");
return values[start_index:end_index];
}
function findValueIndex(uint256 vi) internal view returns (uint256, uint256) {
for (uint256 i=0; i <values.length; i++) {
uint256 start_index = 0;
uint256 end_index = 0
if (values[i].length == 0) {
index++;
if (start_index !=0) {
end_index = i-1;
return start_index, end_index;
contract ArrayMapping {
bytes4[] public keys;
address[] public values;
function setValue(bytes4 key, address value) public {
uint256 index = findIndex(key);
if (index < keys.length) {
values[index] = value;
} else {
keys.push(key);
values.push(value);
}
}
function getValue(bytes4 key) public view returns (address) {
uint256 index = findIndex(key);
require(index < keys.length, "Key does not exist");
return values[index];
}
function findIndex(bytes4 key) internal view returns (uint256) {
for (uint256 i = 0; i < keys.length; i++) {
if (keys[i] == key) {
return i;
}
}
return keys.length;
}
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.18;
import {IERC777Recipient} from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import {IERC165} from "../../interfaces/ERC/IERC165.sol";
import {IERC1271} from "../../interfaces/ERC/IERC1271.sol";
import {IERC677Receiver} from "../../interfaces/ERC/IERC677Receiver.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {LibDiamond} from "../../libraries/LibDiamond.sol";
import {LibLoupe} from "../../libraries/LibLoupe.sol";
import {IDiamondCut} from "../../facets/base/interfaces/IDiamondCut.sol";
import {IStorageLoupe} from "./interfaces/IStorageLoupe.sol";
import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol";
/**
* @title DiamondLoupe Facet
* @dev DiamondLoupe contract compatible with EIP-2535
* @author David Yongjun Kim (@Powerstream3604)
*/
contract DiamondLoupeFacet is IDiamondLo
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.18;
import {IERC777Recipient} from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import {IERC165} from "../../interfaces/ERC/IERC165.sol";
import {IERC1271} from "../../interfaces/ERC/IERC1271.sol";
import {IERC677Receiver} from "../../interfaces/ERC/IERC677Receiver.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {LibDiamond} from "../../libraries/LibDiamond.sol";
import {LibLoupe} from "../../libraries/LibLoupe.sol";
import {IDiamondCut} from "../../facets/base/interfaces/IDiamondCut.sol";
import {IStorageLoupe} from "./interfaces/IStorageLoupe.sol";
import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol";
/**
* @title DiamondLoupe Facet
* @dev DiamondLoupe contract compatible with EIP-2535
* @author David Yongjun Kim (@Powerstream3604)
*/
contract DiamondLoupeFacet is IDiamondLo
pragma solidity ^0.7.1;
contract A {
uint8 a;
}
contract B {
uint256[50] a;
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.17;
// import "./TCStoken.sol";
contract TransparentCharity {
// TCStoken public token;
// address public tokenContractAddress;
struct Donor {
string name;
uint256 balance;
address payable Address;
mapping(uint256 => uint256) donations; // project ID => donation amount
uint256[] transactionHistory;
}
struct CharityProject {
address payable beneficiary;
string name;
string title;
string desc;
string image;
uint256 goalAmount;
uint256 currentAmount;
//uint256 deadline;
bool isActive;
address[] donators;
uint256[] donations;
}
struct Beneficiary {
string name;
string rescueInformation;
// string[] documents;
address payable Address;
uint256 balance;
// mapping(uint256 => uint256) etherUsage; // project ID => token usage
uint256[] transactionH
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/token/ERC20/utils/SafeERC20.sol";
interface ITaxDistributor {
function distributeTax() external;
}
contract SongbirdToken is ERC20 {
using SafeERC20 for IERC20;
event Trade(
address user,
address pair,
uint256 amount,
uint256 side,
uint256 circulatingSupply,
uint256 timestamp
);
address public constant DEAD = 0x000000000000000000000000000000000000dEaD;
uint256 public cooldown = 3600;
ITaxDistributor public taxDistributor;
bool public inSwap;
uint256 public launchedAt;
address public swapVault;
address private deployer;
mapping(address => bool) public isFeeExempt;
mapping(address => uint256) public lastSellAt;
constructor(
string memory _n
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "bls12377.sol"; // Hypothetical library for BLS12-377
import "kzg.sol"; // Hypothetical library for KZG Commitments
import "plonk.sol"; // Hypothetical library for PLONK
contract ShieldContract {
// Trusted setup parameters for KZG Commitments
KZG.SetupParameters kzgSetup;
// Trusted setup parameters for PLONK
PLONK.SetupParameters plonkSetup;
constructor(KZG.SetupParameters memory _kzgSetup, PLONK.SetupParameters memory _plonkSetup) {
kzgSetup = _kzgSetup;
plonkSetup = _plonkSetup;
}
// This function allows a user to submit a proof without revealing their transaction details.
function submitProof(
KZG.Commitment memory commitment,
PLONK.Proof memory proof,
uint256 publicInput
)
public
{
// Verify the commitment using KZG
require(KZG.verify(kzgSetup, commitment), "KZG Commitment verification failed");
// Verify the zero kn
//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f.
pragma solidity ^0.4.24;
contract wasif {
//uint256 public age;
//string public name;
function savee_person(string memory _name, uint256 _age )
{
classx.push(Student({age: _age, name:_name}));
}
struct Student {
uint256 age;
string name;
}
Student[] public classx;
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/token/ERC20/utils/SafeERC20.sol";
interface ITaxDistributor {
function distributeTax() external;
}
contract SongbirdToken is ERC20 {
using SafeERC20 for IERC20;
event Trade(
address user,
address pair,
uint256 amount,
uint256 side,
uint256 circulatingSupply,
uint256 timestamp
);
address public constant DEAD = 0x000000000000000000000000000000000000dEaD;
uint256 public cooldown = 3600;
ITaxDistributor public taxDistributor;
bool public inSwap;
uint256 public launchedAt;
address public swapVault;
address private deployer;
mapping(address => bool) public isFeeExempt;
mapping(address => uint256) public lastSellAt;
constructor(
string memory _n
/**
*Submitted for verification at Etherscan.io on 2023-05-29
*/
/**
* SourceUnit: g:\valleySound\Hechooo\jeton_transfer\contracts\BulkTransfer\jetonTransferTool.sol
*/
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: 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 vi
//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 dada;
uint dodo;
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();
}
0xa51a4410798b53039f2c2dB4356851608c04dE12
/*
* Frees `free' tokens from the Gastoken at address `
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title Dagmar Contract
* @dev Accepts ethereum and simulates a humorous relationship dynamic with Dagmar.
*/
contract Dagmar {
using SafeMath for uint256;
string[5] public reasons = [
"You forgot to put the toilet seat down!",
"You finished the last slice of pizza without asking!",
"You left your socks on the floor again!",
"You used all the hot water in the shower!",
"You forgot our anniversary!"
];
uint256 public argumentThreshold;
uint256 public hystericalArgumentCount;
event HystericalArgument(address indexed partner1, address indexed partner2, string reason);
/**
* @dev Constructor that initializes randomness.
*/
constructor() {
argumentThreshold = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty))) % 10 + 1;
}
/**
* @dev Simulates Dagmar's irresistible ch
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title Marriage Contract
* @dev Accepts ethereum and simulates a humorous marriage dynamic with randomness.
*/
contract Marriage {
using SafeMath for uint256;
bool public isWoman;
mapping(address => bool) public notHappy;
address public divorceAddress;
uint256 public argumentThreshold;
uint256 public hystericalArgumentCount;
event Divorce(address indexed partner1, address indexed partner2, uint256 value);
event HystericalArgument(address indexed partner1, address indexed partner2, string reason);
/**
* @dev Constructor that sets the gender of the contract initiator and initializes randomness.
* @param _isWoman Indicates if the contract initiator is a woman.
*/
constructor(bool _isWoman) {
isWoman = _isWoman;
argumentThreshold = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty))) % 10 + 1;
}
pragma solidity >=0.4.22 <0.6.0;
contract SimpleAuction {
address payable public beneficiary;
uint public auctionEndTime;
address public highestBidder;
uint public highestBid;
mapping(address => uint) pendingReturns;
bool ended;
event HighestBidIncreased(address bidder, uint amount);
event AuctionEnded(address winner, uint amount);
constructor(uint _biddingTime, address payable _beneficiary) public {
beneficiary = _beneficiary;
auctionEndTime = now + _biddingTime;
}
function bid() public payable {
require(now <= auctionEndTime, "Auction already ended.");
require(msg.value > highestBid, "There already is a higher bid.");
if (highestBid != 0) {
pendingReturns[highestBidder] += highestBid;
}
highestBidder = msg.sender;
highestBid = msg.value;
emit HighestBidIncreased(msg.sender, msg.value);
}
function withdraw() public returns (bool) {
uint amount = pendingReturns[
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
contract DTRASH is ERC20Votes {
uint256 public constant VESTING_DURATION = 730 days;
uint256 public constant UNLOCK_START = 365 days;
uint256 public unlockTime;
mapping(address => uint256) private _lockedBalances;
constructor(
address[] memory lockedRecipients,
uint256[] memory lockedAmounts,
address[] memory unlockedRecipients,
uint256[] memory unlockedAmounts
) ERC20Votes("DecentTrash", "DTRASH") {
require(lockedRecipients.length == lockedAmounts.length, "Mismatched locked");
require(unlockedRecipients.length == unlockedAmounts.length, "Mismatched unlocked");
unlockTime = block.timestamp + UNLOCK_START;
for(uint i = 0; i < lockedRecipients.length; i++) {
_mintAndLock(lockedRecipients[i], lockedAmounts[i]);
}
for(uint i = 0; i < unlockedRecipients.length; i++)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface Vesting {
function getTotalTokens(IERC20 _token, address _beneficiary) external view returns(uint256);
}
// Moves voting power with the normally private `_moveVotingPower` function by calling the `_afterTokenTransfer` function.
// see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/dfef6a68ee18dbd2e1f5a099061a3b8a0e404485/contracts/token/ERC20/extensions/ERC20Votes.sol#LL217C6-L217C6
// see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/dfef6a68ee18dbd2e1f5a099061a3b8a0e404485/contracts/token/ERC20/ERC20.sol#L364
abstract contract ERC20VotesVestable is ERC20Votes, Ownable {
Vesting vest;
// to be called after tokens have been transferred to the vesting contract
function setUpVestedVotingPower(address _vestingAddress, address[] memory _vestees) external onlyOwner {
if (
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface Vesting {
function getHolders(address _token) external view returns(address[] memory);
function getTotalTokens(address _token, address _beneficiary) external view returns(uint256);
}
// Moves voting power with the normally private `_moveVotingPower` function by calling the `_afterTokenTransfer` function.
//
// see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/dfef6a68ee18dbd2e1f5a099061a3b8a0e404485/contracts/token/ERC20/extensions/ERC20Votes.sol#LL217C6-L217C6
// see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/dfef6a68ee18dbd2e1f5a099061a3b8a0e404485/contracts/token/ERC20/ERC20.sol#L364
abstract contract ERC20VotesVestable is ERC20Votes, Ownable {
Vesting vest;
// to be called after tokens have been transferred to the vesting contract
function setUpVestedVotingPower
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
abstract contract ERC20VotesEscrowed is ERC20Votes {
function getAddresses() internal view virtual returns(address[] memory);
function escrowBalance(address holder) internal view virtual returns(uint256);
// to be called after tokens have been transferred to this escrow contract
function setUpVotingPower() internal {
address[] memory addresses = getAddresses();
for (uint i = 0; i < addresses.length; i++) {
address a = addresses[i];
_jankyMoveVotingPower(address(this), a, escrowBalance(a));
}
}
function _afterTokenTransfer(address _from, address _to, uint256 _amount) internal override {
// if it's the escrow contract, don't transfer any voting power when it leaves escrow, the
// power will remain with whoever it's been delegated to already
if (address(this) != _from) {
s
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface Escrow {
function getAddresses() external view returns(address[] memory);
function balanceOf(address holder) external view returns(uint256);
}
abstract contract ERC20VotesEscrowed is ERC20Votes, Ownable {
Escrow escrow;
bool initialized = false;
error AlreadyInitialized();
// to be called after tokens have been transferred to the escrow contract
function setUpVotingPower(address _escrowAddress) external onlyOwner {
if (initialized) revert AlreadyInitialized();
escrow = Escrow(_escrowAddress);
address[] memory addresses = escrow.getAddresses();
for (uint i = 0; i < addresses.length; i++) {
address a = addresses[i];
_jankyMoveVotingPower(_escrowAddress, a, escrow.balanceOf(a));
}
initialized = true;
}
f
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
contract DTRASH is ERC20Votes {
uint256 public constant VESTING_DURATION = 730 days;
uint256 public constant UNLOCK_START = 365 days;
uint256 public unlockTime;
mapping(address => uint256) private _lockedBalances;
constructor(address[] memory lockedRecipients, uint256[] memory lockedAmounts, address[] memory unlockedRecipients, uint256[] memory unlockedAmounts) ERC20Votes("DecentTrash", "DTRASH") {
require(lockedRecipients.length == lockedAmounts.length, "Mismatched locked");
require(unlockedRecipients.length == unlockedAmounts.length, "Mismatched unlocked");
unlockTime = block.timestamp + UNLOCK_START;
for(uint i = 0; i < lockedRecipients.length; i++) {
_mintAndLock(lockedRecipients[i], lockedAmounts[i]);
}
for(uint i = 0; i < unlockedRecipients.length; i++) {
_mint(unlockedRecipients[i]
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
contract DTRASH is ERC20Votes {
uint256 public constant VESTING_DURATION = 730 days;
uint256 public constant UNLOCK_START = 365 days;
uint256 public unlockTime;
mapping(address => uint256) private _lockedBalances;
constructor(address[] memory lockedRecipients, uint256[] memory lockedAmounts, address[] memory unlockedRecipients, uint256[] memory unlockedAmounts) ERC20Votes("DecentTrash", "DTRASH") {
require(lockedRecipients.length == lockedAmounts.length, "Mismatched locked");
require(unlockedRecipients.length == unlockedAmounts.length, "Mismatched unlocked");
unlockTime = block.timestamp + UNLOCK_START;
for(uint i = 0; i < lockedRecipients.length; i++) {
_mintAndLock(lockedRecipients[i], lockedAmounts[i]);
}
for(uint i = 0; i < unlockedRecipients.length; i++) {
_mint(unlockedRecipients[i]
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!';
}