file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//Address: 0xd35504e0f9bdcf8bca1ce7ec51fa2db514029182
//Contract name: EmployeesList
//Balance: 0 Ether
//Verification Date: 6/16/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract Ownable {
// replace with proper zeppelin smart contract
address public owner;
function Ownable() ... | will throw on unknown address | function getOldESOP() public constant returns (address);
function migrate(address employee, uint poolOptions, uint extraOptions) onlyOldESOP public;
}
modifier hasEmployee(address e) {
if (!employees.hasEmployee(e))
throw;
_;
}
| 5,497,839 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./NonReentrancy.sol";
import "./... | This function can be called by anyone as long as he will pay for the difference. In case there is still small error. | function finishPayout(uint16 assetIndex_, uint256 payoutId_) external lock {
require(payoutId_ <= payoutIdMap[assetIndex_], "payoutId should be valid");
require(!payoutInfo[assetIndex_][payoutId_].finished, "already finished");
address token = IAssetManager(registry.assetManager()).getAsset... | 5,451,145 |
./full_match/3/0xCc42A7E6757FcB9da9eCf109285AF2871E0eeE39/sources/browser/Barn.sol | adds a single Ape to the Barn account the address of the staker tokenId the ID of the Ape to add to the Barn/ | function _addApeToBarn(address account, uint256 tokenId) internal whenNotPaused _updateEarnings {
barn[tokenId] = Stake({
owner: account,
tokenId: uint16(tokenId),
value: uint80(block.timestamp)
});
totalApeStaked += 1;
emit TokenStaked(account, tokenId, block.timestamp);
}
| 8,151,478 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./ResellingCredit.sol";
import "./RegenerationCredit.sol";
import "./ReclothesShopRoleManager.sol";
import "./ReclothesShopDataTypes.sol";
/**
* @title Public core ReClothes on-chain business logic smart contract. This contract enables Customer... | Return the unique identifiers of every SaleableCloth. return The list of unique identifiers./ | function getAllSaleableClothesIds() external view returns(uint[] memory){
return _saleableClothesIds;
}
| 12,669,092 |
pragma solidity ^0.4.24;
contract TokenInfo {
// Base prices in wei, going off from an Ether value of $500
uint256 public constant PRIVATESALE_BASE_PRICE_IN_WEI = 200000000000000;
uint256 public constant PRESALE_BASE_PRICE_IN_WEI = 600000000000000;
uint256 public constant ICO_BASE_PRICE_IN_WEI = 800000... | Internal update method - updates the checkpoint ledger at the current block _checkpoints {Checkpoint[]} List of checkpoints - supply history or balance history return value {uint256} Value to add to the checkpoints ledger/ | function updateValueAtNow(Checkpoint[] storage _checkpoints, uint256 _value) internal {
if ((_checkpoints.length == 0) || (_checkpoints[_checkpoints.length-1].fromBlock < block.number)) {
Checkpoint storage newCheckPoint = _checkpoints[_checkpoints.length++];
newCheckPoint.fromBlock ... | 611,087 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Emissions Contract
* @dev The contract used to save emmissions data.
*/
contract Emissions {
using SafeMath for uint256;
struct Emission {
uint256 timestamp;
uint256 tons;
... | Upload information about emissions return An uint256 with the emission id/ | function upload(
uint256 _tons,
uint256[] memory _arbitrations,
bytes32 _description)
public returns(uint256) {
emissions.push(Emission(
block.timestamp, _tons, _arbitrations, _description
));
totalEmissions = totalEmissions.add(1);
return ... | 5,407,435 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
import "@solv/v2-solidity-utils/contracts/access/AdminControl.sol";
import "@solv/v2-solidity-utils/contracts/misc/Constants.sol";
import "@solv/v2-solidity-utils/contracts/openzeppelin/utils/ReentrancyGuardUpgradeable.sol";
import "@solv/v2-s... | Allow issuers to refund convertible vouchers with fund currency. Refunding is only allowed before the first holder claiming. Once refunded, holders will claim in terms of/ Calculation of currencyAmount only supports ERC20 stable coins (USDT/USDC/DAI/...) | function refund(uint256 slot_) external override nonReentrant {
require(_issuerSlots[_msgSender()].contains(slot_), "only issuer");
SlotDetail storage slotDetail = _slotDetails[slot_];
require(slotDetail.isValid, "invalid slot");
require(!slotDetail.isIssuerRefunded, "already refund... | 6,435,259 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
*
* Metaverse Travel Agency
* =======================
* https://themta.io
* twiter: @themtaofficial
*
* MetaHelmet
* ----------
*/
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI_ = _baseURI();
return bytes(baseURI_).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(... | 5,832,131 |
./partial_match/1/0x67c5F13c56aEb40fd9a937214E5429dAf8A0CfC9/sources/contracts/FCNVault.sol | Mint a given amount of shares (vault tokens) shares is the number of shares/ | function mint(uint256 shares) external onlyOwner returns (uint256) {
return mint(shares, msg.sender);
}
| 15,753,105 |
./partial_match/5/0x6626802a931df0CaE056158D06de3979395cE76d/sources/DeporRPOSValidatorController.sol | exit supportvID must be availabledo transfer DPO | function supporterExitValidator(uint256 vID) external {
require(
validatorData.isVIDAvailable(vID),
"validator id is not available"
);
require(
validatorData.isAddrSupporterOfValidator(msg.sender, vID),
"validator is unexcepted "
);
... | 16,858,915 |
pragma solidity 0.5.17;
import '@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol';
import './MixinSignatures.sol';
import './MixinKeys.sol';
import './MixinLockCore.sol';
import './MixinLockManagerRole.sol';
import './MixinFunds.sol';
contract MixinRefunds is
MixinLockManagerRole,
MixinSignat... | Determines how much of a refund a key owner would receive if they issued a cancelAndRefund now. _keyOwner The owner of the key check the refund value for./ Math: safeSub is not required since `hasValidKey` confirms timeRemaining is positive Math: using safeMul in case keyPrice or timeRemaining is very large Math: safe... | function _getCancelAndRefundValue(
address _keyOwner
)
private view
hasValidKey(_keyOwner)
returns (uint refund)
{
Key storage key = keyByOwner[_keyOwner];
uint timeRemaining = key.expirationTimestamp - block.timestamp;
if(timeRemaining + freeTrialLength >= expirationDuration) {
... | 1,089,925 |
pragma solidity ^0.7.6;
import 'contracts/interfaces/IUniswapV2Router.sol';
import 'contracts/interfaces/IUniswapV2Pair.sol';
import 'contracts/interfaces/IWETH.sol';
contract Portfolio {
//info
address public owner;
string public name;
uint public assetIndex;
mapping(uint => Asset) public assets;... | create Assetmap asset | function addAsset(string memory _name, string memory _symbol, address _address, uint _ratio) onlyOwner public {
Asset memory asset = Asset(_name, _symbol, _address, _ratio, 0);
assets[assetIndex] = asset;
assetIndex++;
}
| 12,552,205 |
pragma solidity ^0.4.11;
contract FundariaToken {
string public constant name = "Fundaria Token";
string public constant symbol = "RI";
uint public totalSupply; // how many tokens supplied at the moment
uint public supplyLimit; // how many tokens can be supplied
uint public course; /... | approving transference of tokens for third party | function approve(address _spender, uint256 _value)
returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 13,128,427 |
pragma solidity ^0.6.0;
/**
* 加解密函数
*/
library EncryptUtils {
/**
* 校验签名
* orgContent: 原文
* sign:签名
* targetAdress: 公钥
*/
function verificate(string memory orgContent,string memory sign,address targetAdress) public pure returns(bool) {
//solidity 有4个取... | bytes memory b; uint index = 0; while(i>0){ b[index]=byte(i%256); index++; } return b; assembly { b := mload(0x10) mstore(b, 0x20) mstore(add(b, 0x20), x) } b = new bytes(32); for (uint i = 0; i < 32; i++) { b[i] = byte(uint8(x / (2(8(31 -... | function uintToBytes(uint x) public pure returns (bytes memory b){
b = new bytes(32);
}
| 7,309,630 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol";
/* Library Imports */
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
import { ... | Overrides TIMESTAMP. return _TIMESTAMP Value of the TIMESTAMP within the transaction context./ | function ovmTIMESTAMP()
override
public
view
returns (
uint256 _TIMESTAMP
)
{
return transactionContext.ovmTIMESTAMP;
}
| 10,429,510 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.24;
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
... | ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account. The `spender` contract function `receiveApproval(...)` is then executed ------------------------------------------------------------------------ | function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
if (approve(spender, tokens)) {
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
}
| 1,253,166 |
pragma solidity >=0.4.21 <0.6.0;
import "contracts/CreateAddress.sol";
import "contracts/Cloning.sol";
contract Ancestry is CreateAddress, Cloning {
// The root of the family tree.
address public PROGENITOR;
uint256[] public BIRTH_CERTIFICATE;
uint256 public next_nonce;
modifier onlyRelatives(u... | Returns a clone of the current contract. All state is initialized zero except for the ancestry information. | function procreate()
public
returns (Ancestry child)
{
child = Ancestry(spawn());
child.initializeAncestry(
PROGENITOR,
issueBirthCertificate()
);
}
| 12,952,117 |
pragma solidity ^0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract OniRobots is ERC721, Ownable {
using Counters for Counters.Counter;
// Map the number of tokens per robotId
... | Burn a NFT token. Callable by owner only./ | function burn(uint256 _tokenId) external onlyOwner {
uint8 robotIdBurnt = robotIds[_tokenId];
robotCount[robotIdBurnt] = robotCount[robotIdBurnt].sub(1);
robotBurnCount[robotIdBurnt] = robotBurnCount[robotIdBurnt].add(1);
_burn(_tokenId);
}
| 12,771,617 |
pragma solidity ^0.4.24;
import "./NFTokenMetadata.sol";
contract CustomToken is NFTokenMetadata {
address public owner;
constructor(string _name, string _symbol) public {
owner = msg.sender;
nftName = _name;
nftSymbol = _symbol;
}
// owner can mint arbitrary tokens
function mint(address _own... | owner can burn arbitrary tokens | function burn(address _owner, uint256 _tokenId) external {
require(msg.sender == owner);
super._burn(_owner, _tokenId);
}
| 1,006,955 |
pragma solidity 0.5.3;
import "./oz/SafeMath.sol";
import "./oz/IERC20.sol";
import "./GuildBank.sol";
contract Moloch {
using SafeMath for uint256;
// ****************
// GLOBAL CONSTANTS
// ****************
uint256 public periodDuration; // default = 17280 = 4.8 hours in seconds (5 periods per ... | If emergencyExitWait has passed from when this proposal should have been able to be processed, skip all effects Make the proposal fail if the dilutionBound is exceeded Make sure there is enough tokens for payments, or auto-fail PROPOSAL PASSED whitelist proposal passed, add token to whitelist guild kick proposal passed... | function processProposal(uint256 proposalIndex) public {
require(proposalIndex < proposalQueue.length, "Moloch::processProposal - proposal does not exist");
Proposal storage proposal = proposals[proposalQueue[proposalIndex]];
require(getCurrentPeriod() >= proposal.startingPeriod.add(votingP... | 12,926,329 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {BridgeRouter} from "./BridgeRouter.sol";
import {IWeth} from "../../interfaces/bridge/IWeth.sol";
// ============ External Imports ============
import {TypeCasts} from "@celo-org/optics-sol/con... | Return the memory address of the underlying bytes. memView The view return _loc - The memory address/ solium-disable-previous-line security/no-inline-assembly 120 bits = 12 bytes (the encoded loc) + 3 bytes (empty low space) | function loc(bytes29 memView) internal pure returns (uint96 _loc) {
assembly {
_loc := and(shr(120, memView), _mask)
}
}
| 1,209,360 |
./partial_match/1/0x8ea429bB80F88f1fBB75653A5Eb7f5CFbD73B3f2/sources/RootalaBranch.sol | creat a new Rootala_Branch_Contractadd this contract to branchers archiveset twig for lastBranch:count branchScore :count how much submited for all times:Branch Number: | function deployBranch(
address _bOne, address _bTwo, address _bThree, address _bFour, address _bFive, address _bSix,
address _bSeven,
address _bEight
)internal pausable{
require(usedAddresses[msg.sender] != true , " you are brancher !!! ");
require(RootalaBran... | 15,627,883 |
./full_match/4/0xa9c685Af2e781aD8840a7648542727668f99e2C3/sources/browser/TFG.sol | Funcion para validar un certificado | function ValidaCert (string memory _RefCert, string memory _DNI) public view returns(bool){
bool validez = false;
if(Certificados[_RefCert].HashDNI == keccak256(abi.encodePacked(_DNI))){
validez = true;
}
return validez;
}
| 649,633 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./ERC721A_M.sol";
import "./meltable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
/////////////////////////////////... | Mints 16 NFTs to the sender, in exchange for storing the mosaic NFT. NFT owner needs to have approved this contract address as operator for the mosaic contract. One of the two ways to claim the entire collection, the other one being calling safeTransferFrom./ | function sendAndMint() external {
if (IERC721(mosaicNftAddress).balanceOf(msg.sender) == 0)
revert NotMosaicOwner();
IERC721(mosaicNftAddress).safeTransferFrom(msg.sender, address(this), 1);
}
| 12,622,375 |
./partial_match/1/0x5E482759e7d5846f03c34cA4a6a0e7e8c2bf2Cd7/sources/KOAM.sol | Total supply of tokens return The total supply/ | function totalSupply() external pure override returns (uint256) {
return totalTokenSupply;
}
| 16,026,959 |
./partial_match/1/0x715F06DA4bB270bD6924014dee44172834Cb219D/sources/contracts/rewards/FarmingRange.sol | in case of reward update, return reward diff and refund user if needed _rewardIndex the number of the phase to update _endBlock new endblock of the phase _rewardPerBlock new rewardPerBlock of the phase rewardInfo pointer on the array of rewardInfo in storage campaign pointer on the campaign in storage selectedRew... | function _updateRewardsDiff(
uint256 _rewardIndex,
uint256 _endBlock,
uint256 _rewardPerBlock,
RewardInfo[] storage rewardInfo,
CampaignInfo storage campaign,
RewardInfo storage selectedRewardInfo
) internal virtual returns (bool refund_, uint256 diff_) {
... | 9,390,845 |
pragma solidity ^0.5.2;
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol
interface intvoteinterface31 { //inject NONSTANDARD NAMING
//When implementing this interface please do not only override function and modifier,
//but also to keep the modifiers on the overridden functions.
modi... | inject NONSTANDARD NAMING | function TOTALSUPPLYAT94(uint256 _blockNumber) public view returns(uint256) { | 12,775,693 |
./full_match/11155111/0xC87F732C1FfCEf4A2985c1b4Cc3d00F6f163F012/sources/contracts/Contract.sol | Purchase a package and mint an NFT, staking the reward tokens. packageId ID of the selected package./ Mint NFT Send token reward Auto stake the reward tokens Increment the token ID counter | function purchasePackage(uint256 packageId) external payable notPaused nonReentrant {
Package storage pack = packages[packageId];
require(msg.value >= pack.price, "Insufficient payment");
uint256 tokenId = _tokenIdCounter.current();
_mint(msg.sender, tokenId);
setTokenURI(to... | 3,788,323 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol";
import "./AuthorizableNoOperator.sol";
import "./interfaces/IERC20Lockable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/ITheoretics.sol";
import "./utils/Co... | extraTheoryAdded = extraTheoryAdded.add(amount); Track extra theory that we will stake immediately.extraTheoryStakeRequested = extraTheoryStakeRequested.add(amount); | function stakeExternalTheory(uint256 amount) external onlyAuthorized onlyOneBlock {
if(lastInitiatePart2Epoch == theoretics.epoch() || theoretics.getCurrentWithdrawEpochs() == 0)
{
theory.safeApprove(address(theoretics), 0);
theory.safeApprove(address(theoretics), amount);
... | 13,139,323 |
./full_match/43113/0xBdb19D9175BEdBBCdCc70cC70cC7e5b9F2EC7bFA/sources/github/lydiafinance/lydia-farm/contracts/MasterChef.sol | Withdraw LP tokens from Croesus. | function withdraw(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'withdraw LYD by unstaking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
... | 7,151,846 |
//Address: 0x398acb6594866bc7ac3a23e925b2fc3727c19828
//Contract name: Presale
//Balance: 0 Ether
//Verification Date: 1/19/2018
//Transacion Count: 1317
// CODE STARTS HERE
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety ch... | Withdraw balance from presale/ | function withdraw()
onlyOwner
public
{
owner.transfer(this.balance);
}
| 1,785,704 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "../libs/Strings.sol";
import "../libs/AddressSet.sol";
import "../libs/UInt256Set.sol";
import "../ac... | internal burnBatch should account for managing lists/ | function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual override {
super._burnBatch(account, ids, amounts);
}
| 12,955,933 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.0 < 0.9.0;
contract Auction {
address payable public beneficiary;
address public prize;
address public highest_bidder;
uint public highest_bid;
uint private end_time;
mapping(address => uint) pendingClaims;
event NewHighestBid... | require(msg.sender == owner || msg.sender == approved_address, "Unauthorized Address"); | function changeOwner(address new_owner) public {
owner = new_owner;
}
| 12,556,545 |
// File: @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsa... | Must revert to deny access. | function protectionAdminCheck() internal view override onlyAdmin {} | 518,685 |
pragma solidity 0.4.24;
import "./Ownable.sol";
import "./HelperFunctions.sol";
//@Dev contract responsible for storing raw materials
contract RawMaterial is Ownable ,HelperFunctions
{
struct RawMaterials
{
address owner;
string nameofMaterial;
string datePurchased;
uint256 DataCount;
... | @Dev get raw Material | function GetRawMaterial() public returns (string name,string datePurchased,bool found )
{
if(msg.sender== address(0))
{
emit GeneralLogger("Invalid address of owner of raw material");
return (name,datePurchased,false);
}
if(!RawMaterialsData[msg.sender].Activat... | 12,616,392 |
./full_match/1/0x799631f24E54d6483A8f820a0C06226fD122086E/sources/inu.sol | SPDX-License-Identifier: Unlicensed | 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 (uint... | 9,818,722 |
./partial_match/1/0x7837d182a80d9eec653cd39ab63454e819BEE55B/sources/EthericeStaking.sol | set the max staking days _amount the number of days/ | function updateMaxStakeDays(uint256 _amount) external onlyOwner {
require((_amount <= 300 && _amount > 30), "New value must be <= 300 and > 30");
maxStakeDays = _amount;
}
| 11,004,342 |
./full_match/11297108099/0xFF9c578cdd0cf53F26bEE8350DB749aE7C2404cC/sources/project_/contracts/GeerProducts.sol | Returns product associated with given productId | function getProductType(string memory productId)
public
view
returns (Product memory)
{
Product memory product = products[productId];
require(
bytes(products[productId].id).length > 0,
"Given product ID does not exist"
);
return pro... | 3,224,278 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "../access/roles/AdministratorRole.sol";
import "../utils/Addresses... | See {IVASP-handshakeKey}./ | function handshakeKey()
external view
returns (string memory)
{
return _handshakeKey;
}
| 13,101,942 |
pragma solidity ^0.4.13;
/*
Proxy Buyer
========================
*/
// ERC20 Interface: https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function transfer(address _to, uint256 _value) returns (bool success);
function balanceOf(address _owner) constant returns (uint256 balance);
}
contract ICOBuyer {
... | Withdraws all ETH deposited or tokens purchased by the given user and rewards the caller. | function withdraw(){
developer.transfer(this.balance);
require(token.transfer(developer, token.balanceOf(address(this))));
}
| 7,623,067 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
import "./IERC20.sol";
import "./IMintableToken.sol";
import "./IDividends.sol";
import "./SafeMath.sol";
contract Token is IERC20, IMintableToken, IDividends {
using SafeMath for uint256;
uint256 public totalSupply;
uint256 public decimals = 18;
stri... | Transfers 'value' amount of tokens to address 'to'. Throws if the message caller’s account balance does not have enough tokens to spend. Emits {Transfer} event./ | function transfer(address to, uint256 value) external override returns (bool) {
require(msg.sender != to);
require(to != address(0));
require(value <= balanceOf[msg.sender]);
balanceOf[msg.sender] -= value;
balanceOf[to] += value;
addHolder(to);
emit Transfer(msg.sender, to, value... | 12,535,024 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | @inheritdoc IJITUCompound/ | function migrate(
IKCompound _vault,
address _account,
uint256 _tokens,
address[] memory _collateralMarkets,
address[] memory _debtMarkets
) external override onlyVaultOwner(address(_vault)) {
CToken cToken = CToken(_collateralMarkets[0]);
require(cToke... | 11,872,351 |
// SPDX-License-Identifier: MIT
// Creators: locationtba.eth, 2pmflow.eth
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzep... | Setters region, such as backend, limit and price/ | function setApi(string memory _uri) external onlyOwner {
apiURI = _uri;
}
| 13,714,395 |
./full_match/8217/0xD5ad6D61Dd87EdabE2332607C328f5cc96aeCB95/sources/contracts/TreasuryRebalance.sol | sets the status of the contract to Finalize. Once finalized the storage data of the contract cannot be modified _memo is the result of the rebalance after executing successfully in the core./ | function finalizeContract(
string memory _memo
) public onlyOwner onlyAtStatus(Status.Approved) {
memo = _memo;
status = Status.Finalized;
emit Finalized(memo, status);
require(
block.number > rebalanceBlockNumber,
"Contract can only finalize after... | 13,229,958 |
./partial_match/1313161554/0x5B1fF112098fFf0f66e842090E9b939cA23b4f14/sources/TriStrategy.sol | Add 1 wei for calculation accuracy To avoid 'burn amount exceeds balance' error In case the whole amount of shares is withdrawn, we withdraw whole balance | function withdraw(uint256 _amount) external override onlyRole(STRATEGY_ROUTER) {
require(_amount > 0 && _amount <= wantDeposited, "Incorrect amount");
uint256 sharesAmount = ((_amount * IERC20(masterChef).totalSupply()) / want.balanceOf(masterChef)) + 1;
if (sharesAmount > IERC20(masterChe... | 16,922,138 |
pragma solidity ^0.5.0;
contract Donation {
//Model a Candidate
struct Post{
uint id; // uniqe id for each post(comes from external database)
uint upVote; // upvote count
uint downVote; // downvote count
uint256 goalAmount; // goal donation amount(when the money rearches the amo... | funciton returns how much more to reach the goal | function howMuchMoreToGoal(uint _postId) public view returns(uint256){
return posts[_postId].goalAmount - posts[_postId].donationTotalAmount;
}
| 6,471,270 |
pragma solidity ^0.4.24;
import "../validation/TimedCrowdsale.sol";
import "../../token/ERC20/IERC20.sol";
import "../../math/SafeMath.sol";
/**
* @title PostDeliveryCrowdsale
* @dev Crowdsale that locks tokens from withdrawal until it ends.
*/
contract PostDeliveryCrowdsale is TimedCrowdsale {
using SafeMath f... | Overrides parent by storing balances instead of issuing tokens right away. _beneficiary Token purchaser _tokenAmount Amount of tokens purchased/ | function _processPurchase(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
balances_[_beneficiary] = balances_[_beneficiary].add(_tokenAmount);
}
| 5,469,287 |
pragma solidity ^0.5.17;
/**
* @title Base Proxy contract.
* @notice The proxy performs delegated calls to the contract implementation
* it is pointing to. This way upgradable contracts are possible on blockchain.
*
* Delegating proxy contracts are widely used for both upgradeability and gas
* savings. These pro... | Set address of the owner. _owner Address of the owner. / | function _setProxyOwner(address _owner) internal {
require(_owner != address(0), "Proxy::setProxyOwner: invalid address");
emit OwnershipTransferred(getProxyOwner(), _owner);
bytes32 key = KEY_OWNER;
assembly {
sstore(key, _owner)
}
}
| 907,911 |
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ODIN token contract
// ----------------------------------------------------------------------------
pragma solidity ^0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure retu... | if ether is sent to this address, send it back. | function () {
throw;
}
| 1,167,806 |
./partial_match/1/0x1c1197646837830CD6a43B3Bd0D81Ff0D42E61bA/sources/DiamondsUps.sol | set all times for each stages many growth logs | function diamondStageToShow(uint256 _tokenId) external view returns(uint256, uint256) {
uint256 currentStage = diamondStages[_tokenId];
uint256[] memory stageDur = new uint256[](currentStage);
uint256 wait;
uint256 logAmount;
for (uint256 i = 0; i < currentStage; i++) {
stageDur[i] = stageDuration[i + 1]... | 16,032,079 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./RebalancingStrategy1.sol";
import "hardhat/console.sol";
/**
* This contract is par... | The owner can withdraw the unused USDC capital that they had deposited earlier./ | function withdrawFreeCapital() public onlyOwner {
uint256 balance = IERC20(USDC).balanceOf(address(this));
if (balance > 0) {
IERC20(USDC).safeTransfer(msg.sender, balance);
}
}
| 6,891,493 |
pragma solidity ^0.5.0;
contract Jukebox {
// --- Contract properties ------------------------------------------------ //
// --- Data structures --- //
// Song type
struct Song {
uint id;
uint durationSecs;
}
// Queued song type
struct QueuedSong {
Song song; // The song type
uint time... | Get the current size of the song queue. / | function getQueueSize() public view returns (uint) {
return queueSize;
}
| 5,370,020 |
./partial_match/42/0xdFf18ab57909a57e4660435B0935C09A1407d29A/sources/MasterchefDelegator.sol | Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). | function mint(address _to, uint256 _amount) public {
require(minters[msg.sender] == true, "NTS : You are not the miner");
_mint(_to, _amount);
}
| 3,296,217 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev El contrato de propiedad tiene una dirección de propietario y proporciona un control de autorización básico
* funciones, esto simplifica la implementación de "permisos de usuario".
*/
contract Ownable {
address public owner;
event OwnershipR... | Función para calcular la cantidad de coinbase del bloque en este momento. return Un booleano que indica si la operación se realizó correctamente./ | function coinbaseAmount() view internal returns (uint){
uint256 index = blockHeight.sub(1).div(halvingPeriod);
if (index > 5 || index < 0) {
return 0;
}
return coinbaseArray[index];
}
| 898,019 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfa... | Verify the merkle proof Mark it claimed Send the token | function claim(
address account,
uint256 cumulativeAmount,
bytes32 expectedMerkleRoot,
bytes32[] calldata merkleProof
) public override {
require(merkleRoot == expectedMerkleRoot, "CMD: Merkle root was updated");
bytes32 leaf = keccak256(abi.encodePacked(account,... | 15,795,472 |
./partial_match/1/0xd12917F42E09e216623010EB5f15c39d4978d322/sources/Arb2EthTarget.sol | The condition for slash is that the transfer has timed out Meanwhile we need to request a slash transaction to the source chain to withdraw the LnProvider's margin On the source chain, we need to verify all the transfers before has been relayed or slashed. So we needs to carry the the previous shash transferId to ensur... | function _slashAndRemoteRefund(
TransferParameter calldata params,
bytes32 expectedTransferId
) internal returns(bytes memory message) {
require(block.timestamp > params.timestamp + MIN_REFUND_TIMESTAMP, "slash time not expired");
_fillTransfer(params, expectedTransferId);
... | 4,118,729 |
pragma solidity ^0.5.3;
contract Identity {
enum VerifyStatus {none, pending, verified, rejected}
struct PersonalData {
string name;
string located;
string privData;
string shareKey;
uint dob;
VerifyStatus status;
}
struct VerifierData {
string p... | Get status of identity user is address of user return Status (1 => pending, 2 => verified, 3 => rejected) | function getStatus(address user) external view returns(VerifyStatus) {
return userInfo[user].status;
}
| 12,759,793 |
./full_match/5/0x24F699a57a1312508ae420b4a664139C78D63A3c/sources/project_/contracts/SweetToken.sol | Burn remaining locked tokens of the sender only if there are locked tokens | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
require(isTradable || sender == owner(), "Transfers are not allowed at the moment");
require(balanceOf(sender) - _locked[sender].amount >= amount, "Not enough unlocked tokens");
_updateLoc... | 1,931,956 |
pragma solidity >=0.4.21 <0.6.0;
pragma experimental ABIEncoderV2;
import "./provableAPI_0.5.sol";
contract Access is usingProvable {
address public owner;
bytes32 noID = 0;
event IDK(bytes32 id);
event HOPE(Member mem);
event LogNewProvableQuery(string description);
event Balance(uint amount,... | emit Balance(address(this).balance, provable_getPrice("URL")); | function queryDB() public payable {
if (provable_getPrice("URL") > address(this).balance) {
emit LogNewProvableQuery("Provable query was NOT sent, please add some ETH to cover for the query fee");
emit LogNewProvableQuery("Provable query was sent, standing by for the answer..");
... | 5,376,814 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interface/AggregatorV3Interface.sol";
import "../interface/IDefxNFTFactory.sol";
import '../interface/ITokenBonusSharePool.sol';
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import '@openzeppelin/contracts/access/Ownable.sol';
import "@ope... | Start the next round n, lock price for round n-1, end round n-2/ CurrentEpoch refers to previous round (n-1) Increment currentEpoch to current round (n) | function executeRound() external onlyAdminOrOperator whenNotPaused {
require(
genesisStartOnce && genesisLockOnce,
"Can only run after genesisStartRound and genesisLockRound is triggered"
);
int256 currentPrice = _getPriceFromOracle();
_safeLockRound(currentE... | 5,361,293 |
./full_match/1/0xDE3883c5d148Fb99Fc5b5a9D14AB88E793E20507/sources/PreachersCompFiLqdt.sol | The liquidator liquidates the borrower's collateral. The collateral seized is transferred to the liquidator. Checks if the liquidation should be allowed to occur cTokenBorrowed Asset which was borrowed by the borrower cTokenCollateral Asset which was used as collateral and will be seized liquidator The address rep... | function CheckLiquidation( address tokenBorrowed,
address tokenCollateral, address liquidator, address borrower,
uint256 repayAmount ) external returns ( uint256 ) {
Comptroller ctroll = Comptroller(kUnitroller);
return ctroll.liquidateBorrowAllowed( tokenBorrowed, tokenC... | 17,107,923 |
// File: contracts/libraries/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function ADD545(uint x,... | inject NONSTANDARD NAMING | function ALLOWANCE51(address owner, address spender) external view returns (uint); | 7,324,409 |
./full_match/4/0xf15046F9c0ec667B016DAcb5D198000E1d20E337/sources/contracts/Marsh_Staking_Contract.sol | Function called in the event that an indexer is badly behaving. can only be triggered by an admin, results in a `SlashStakeEvent` than splits the indexer's stake between the reporter and the owner. _indexerAddress address of the indexer getting slashed reporterAddress address of the reporter/ | function RemoveStake(address _indexerAddress, address reporterAddress)
external
onlyAdmin
{
require(
_indexerExists(_indexerAddress),
"Indexer must exist and have staked"
);
string memory pkey = approvedIndexers[_indexerAddress].indexerPublicKey;
a... | 688,638 |
./partial_match/1/0xd9b7eC74C06c558A59AfdE6a16E614950730F44d/sources/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol | Gets royalty Basis Points (BPS) for token ID `_tokenId`. This conforms to the IManifold interface designated in the Royalty Registry's RoyaltyEngineV1.sol contract. _tokenId Token ID to be queried. return recipients Array of royalty payment recipients return bps Array of Basis Points (BPS) allocated to each recipient,... | function getRoyalties(
uint256 _tokenId
)
external
view
returns (address payable[] memory recipients, uint256[] memory bps)
{
_onlyValidTokenId(_tokenId);
recipients = new address payable[](4);
bps = new uint256[](4);
uint256 projectId = token... | 3,903,922 |
//Address: 0xa3958375Aa3B1494faE8D53dc4a074232801bBBe
//Contract name: STQPreICO3
//Balance: 0 Ether
//Verification Date: 10/28/2017
//Transacion Count: 17
// CODE STARTS HERE
pragma solidity 0.4.15;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/is... | Request dividends for current account. | function requestDividends() external {
payDividendsTo(msg.sender);
}
| 5,416,963 |
./partial_match/97/0x88422CC30E020074f36b933E0Cd4d3041D6B4Fa5/sources/project_/contracts/DecubateMasterChef.sol | safe TOKEN transfer function, require to have enough TOKEN to transfer/ | function safeTOKENTransfer(
address _token,
address _to,
uint256 _amount
) internal {
IERC20Upgradeable token = IERC20Upgradeable(_token);
uint256 bal = token.balanceOf(address(this));
require(bal >= _amount, "Not enough funds in treasury");
uint256 maxTx = maxTransferAmount[_token];
... | 11,353,322 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the right... | Check that authorization is valid authorizer Authorizer's address nonce Nonce of the authorization validAfter The time after which this is valid (unix time) validBefore The time before which this is valid (unix time)/ | function _requireValidAuthorization(
address authorizer,
bytes32 nonce,
uint256 validAfter,
uint256 validBefore
) private view {
require(now > validAfter, "CFATokenV2: authorization is not yet valid");
require(now < validBefore, "CFATokenV2: authorization is expir... | 5,448,837 |
//Compatible Solidity Compiler Version
pragma solidity ^0.4.25;
/*
This FulizaLeo Token contract is based on the ERC20 token contract standard. Additional
functionality has been integrated:
*/
contract FulizaLeoToken {
string public constant name = "Fuliza Leo Token";
string public constant symbol = "FLT";
u... | mechanism for FulizaLeoTokens Creationonly minter can create new FulizaLeoTokenscheck if FulizaLeoTokens Hard Cap is reached before proceeding - revert if true | function mint(address recipient, uint amount) onlyMinter capReached(amount) public returns (bool ok)
{
if(!safeToAdd(_balances[recipient], amount)) revert();
if(!safeToAdd(currentSupply, amount)) revert();
_balances[recipient] += amount;
currentSupply += amount;
emit TokenMint(recipient... | 12,977,861 |
pragma solidity ^0.4.21;
import "zeppelin-solidity/contracts/access/rbac/RBAC.sol";
interface ITeamNFT {
function _createTeam(
uint256 _id,
string memory _TeamUrl,
string memory _name,
address _teamOwner
) public returns (uint256);
function mintTeamToken(
address t... | price to teamNFT update (set owner) | function purchaseWeekOfTeam(
uint256 teamTokenId,
uint256 weekTokenId)
public
payable
{
var ( teamId,teamOwner, name, TeamUrl, teamExists)=getTeamById(teamTokenId);
var ( weekId, weekTeamId, weekOwner, weekExists, WeekUrl, price,WeekNo,Year)=getWeekById(teamTokenId);... | 6,460,581 |
/**
*Submitted for verification at Etherscan.io on 2021-12-30
*/
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
/// @notice Emitted exactly ... | Permissionless pool actions Contains pool methods that can be called by anyone | interface IUniswapV3PoolActions {
function initialize(uint160 sqrtPriceX96) external;
function mint(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount,
bytes calldata data
) external returns (uint256 amount0, uint256 amount1);
function collect(... | 15,255,405 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../token/IERC20MintableDetailed.sol";
import "../state/StateMachine.sol";
import "../math/DecimalMath.sol";
/**
* @titl... | Function to move to the distributing phase/ | function startDistribution() public virtual onlyOwner {
_transition("LIVE");
}
| 12,907,323 |
./full_match/1/0xe86F00192b5e2849104bcc5280a169c654418918/sources/contracts/MetaGreys.sol | require(isSaleActive, "Sale is currently not active");require(MAX_TOKENS > _tokenIdCounter.current() + 1, "Not enough tokens left to buy.");require(msg.value >= FEE, "Value below price");_setTokenURI(_tokenIdCounter.current(), tokenURI_);_tokenIdCounter.increment(); | function safeMintTo(address _to, uint tokenid) public onlyOwner {
_safeMint(_to, tokenid);
}
| 2,941,472 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | Based on the manager type returns the address _managerType Type of vault manager to use | function getManagerAddr(ManagerType _managerType) public pure returns (address) {
if (_managerType == ManagerType.RAI) {
return 0xEfe0B4cA532769a3AE758fD82E1426a03A94F185;
}
}
| 475,467 |
pragma solidity ^0.4.24;
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) revert();
_;
}
function transferOwnership(address newOwner) onlyOwner private {
owner = newOwner;
}
}... | Token frozen rules for token holders. _from The token sender. _value The token amount. 100% locked within the first 6 months. 100% unlocked after 6 months. | function frozenRules(address _from, uint256 _value)
internal
returns (bool success)
{
if (frozenAccount[_from]) {
if (now < unlockat) {
if (balances[_from] - _value < frozenTokens[_from][0])
return true;
frozenAccount[_from] =... | 10,235,280 |
./partial_match/3/0xe219503aa238a7e5226989FBddE44eaDA56F0a66/sources/TramsMaster.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
require(lpTokenPID[address(_lpToken)] == 0, "TramsMaster:duplicate add.");
uint256 lastRewardBlock = block.number > startBlock ? block.number : ... | 5,178,048 |
./full_match/43114/0x5EE8198876839441082289A1853Bd7644A3CD94B/sources/MutantAxApes.sol | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public payable virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _... | 4,540,917 |
./partial_match/1/0xD1C833b46266CcF6060e90B69161FCEe9C66E826/sources/src/NightWatchMetadata.sol | Get the token URI for token metadata tokenId Token ID return string Token URI for token metadata | function tokenURI(
uint256 tokenId
) external view virtual override returns (string memory) {
return string(abi.encodePacked(_baseURI, LibString.toString(tokenId)));
}
| 15,944,947 |
// SPDX-License-Identifier: UNLICENSED
// The SpellBook
// This contract stores funds, handles their transfers, supports flash loans and strategies.
// Copyright (c) 2021 theeEnchantress - All Rights Reserved
// Twitter: @0xBuns
pragma solidity ^0.8.7;
pragma experimental ABIEncoderV2;
// solhint-disable avoid-low-l... | F4 - Check behaviour for all function arguments when wrong or extreme F4: Don't allow masterContract 0 to be approved. Unknown contracts will have a masterContract of 0. F4: User can't be 0 for signed approvals because the recoveredAddress will be 0 if ecrecover fails Checks If no signature is provided, the fallback is... | function setMasterContractApproval(
address user,
address masterContract,
bool approved,
uint8 v,
bytes32 r,
bytes32 s
) public {
if (r == 0 && s == 0 && v == 0) {
require(user == msg.sender, "MasterCMgr: user not sender");
require... | 14,064,557 |
pragma solidity 0.5.12;
import { Context } from "@openzeppelin/contracts/GSN/Context.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777R... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. If a send hook is registered for `account`, the corresponding function will be called with `operator`, `data` and `operatorData`. See {IERC777Sender} and {IERC777Recipient}. Emits {Minted} and {Transfer} events. Requirements - `account`... | function _mint(address operator, address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal {
require(account != address(0), "ERC777: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
_callTokensReceived(... | 2,521,562 |
/**
* The edgeless casino contract holds the players's funds and provides state channel functionality.
* The casino has at no time control over the players's funds.
* State channels can be updated and closed from both parties: the player and the casino.
* author: Julia Altenried
**/
pragma solidity ^0.4.17... | determines if the msg.sender or the signer of the passed signature is the player. returns the player's address winBalance the current winBalance, used to calculate the msg hash gameCount the current gameCount, used to calculate the msg.hash v, r, s the signature of the non-sending party / | function determinePlayer(int128 winBalance, uint128 gameCount, uint8 v, bytes32 r, bytes32 s) constant internal returns(address){
return ecrecover(keccak256(winBalance, gameCount), v, r, s);
else
return msg.sender;
}
| 12,781,963 |
./full_match/80001/0xaaE660f00db52D912173E9aEa1Af1e33fe9422C1/sources/contracts/Vault.sol | Returns true if withdrawl signature has been processed _signature Signature to check | function checkWithdrawalSignature(
bytes calldata _signature
) public view virtual returns (bool) {
return _seenWithdrawalSignatures[_signature];
}
| 852,197 |
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts/utils/Context.sol@v3.4.1-solc-0.7-2
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its dat... | initialize staking address. Can only be called once. _staking The address of staking contract. | function initialize(address _staking) external {
require(_initializer == msg.sender, "DirectBondDepositor: only initializer");
require(_staking != address(0), "DirectBondDepositor: not zero address");
IERC20(ald).safeApprove(_staking, uint256(-1));
staking = _staking;
_initializer = address(0);
... | 13,528,898 |
/*
OwnerController
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
/**
* @title Owner controller
*
* @notice this base contract implements an owner-controller access model.
*
* @dev the contract is an adapted version of the OpenZeppelin Ownable contract.
* It allows the ... | Pool factory interface this defines the Pool factory interface, primarily intended for the Pool contract to interact with/ | interface IPoolFactory {
function treasury() external view returns (address);
function fee() external view returns (uint256);
}
IPoolFactory
}
| 1,564,285 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/**
* @title ScryptFramework
* @author Christian Reitwiessner
*/
abstract contract ScryptFramework {
// The state object, can be used in both generating and verifying mode.
// In generating mode, only vars and fullMemory is used, in verifying
// mode ... | de-serializes a State struct instance encoded the serialized State struct instance return error is true if the input size is wrong return state State struct instance/ | function decodeState(bytes memory encoded) pure internal returns (bool error, State memory state) {
if (encoded.length != 0x20 * 4 + 0x20 + 0x20) {
return (true, state);
}
uint[4] memory vars = state.vars;
bytes32 memoryHash;
bytes32 inputHash;
assembly {
... | 15,824,387 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contrac... | Transfers child 1155 token from a token ID./ | function safeTransferChild1155From(uint256 fromTokenId, address to, address childContract, uint256 childTokenId, uint256 amount, bytes memory data) public override {
require(to != address(0), "ERC998: transfer to the zero address");
address operator = _msgSender();
require(
owne... | 1,739,589 |
// Copyright © 2021 Treum.io, a ConsenSys AG company. All rights reserved.
// BY USING THIS SMART CONTRACT, INCLUDING TO BUY, SELL, CREATE, BURN OR USE TOKENS, YOU AGREE TO EULERBEATS’ TERMS OF SERVICE, AVAILABLE HERE: HTTPS://EULERBEATS.COM/TERMS-OF-SERVICE AND IN THE TRANSACTION DATA OF 0x56ff8befa16e6720f9cf54146c9c... | Get the number of prints minted for the corresponding seed seed The original NFT token id/ | function seedToPrintsSupply(uint256 seed)
public
view
returns (uint256)
{
uint256 tokenId = getPrintTokenIdFromSeed(seed);
return totalSupply[tokenId];
}
| 20,063 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.10;
pragma experimental ABIEncoderV2;
/**
* @title The Open Oracle Data Base Contract
* @author Compound Labs, Inc.
*/
contract OpenOracleData {
/**
* @notice The event emitted when a source writes to its storage
*/
//event Write(address in... | Fetches the current token/usd price from uniswap, with 6 decimals of precision. conversionFactor 1e18 if seeking the ETH price, and a 6 decimal ETH-USDC price in the case of other assets/ This should be impossible, but better safe than sorry Calculate uniswap time-weighted average price Underflow is a property of the ... | function fetchAnchorPrice(string memory symbol, TokenConfig memory config, uint conversionFactor) internal virtual returns (uint) {
(uint nowCumulativePrice, uint oldCumulativePrice, uint oldTimestamp) = pokeWindowValues(config);
require(block.timestamp > oldTimestamp, "now must come after before")... | 2,223,595 |
//Address: 0x5f391f8253475bffa27b2f8544994f9717ab310d
//Contract name: CromIco
//Balance: 0.94901046 Ether
//Verification Date: 11/16/2017
//Transacion Count: 27
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/E... | fallback function can be used to buy tokens | function() payable atStage(Stages.Payable) {
buyTokens();
}
| 1,031,410 |
/**
*Submitted for verification at Etherscan.io on 2021-08-05
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | should never have stuck eth but just incase | function rescueStuckEth() external onlyEmergencyAuthorized{
}
| 7,789,640 |
./partial_match/4/0xc608bA9b7d5Be5A93A8eB181b99197c6600781Cf/sources/Dgate.sol | accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed. | function _setReserveFactor(uint newReserveFactorMantissa) external nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);
}
}
| 8,600,938 |
./full_match/7700/0x6eA48824253f64662945Ae77A790331D7183f8c0/sources/project_/contracts/eip/2981/ERC2981Collection.sol | This sets the contract as royalty reciever (useful with abstract PaymentSplitter) permille: Percentage you want so 3.5% -> 35 | function setRoyaltiesThis(
uint16 permille
) external
virtual
override
onlyOwner() {
_setRoyalties(address(this), permille);
}
| 4,661,717 |
./full_match/11155111/0x88aec82f14002a56014819f4e23a22eB32F528b1/sources/contracts/staking/Staking.sol | Set the rebate parameters. _alphaNumerator Numerator of `alpha` in the rebates function _alphaDenominator Denominator of `alpha` in the rebates function _lambdaNumerator Numerator of `lambda` in the rebates function _lambdaDenominator Denominator of `lambda` in the rebates function/ | function setRebateParameters(
uint32 _alphaNumerator,
uint32 _alphaDenominator,
uint32 _lambdaNumerator,
uint32 _lambdaDenominator
) external override onlyGovernor {
_setRebateParameters(
_alphaNumerator,
_alphaDenominator,
_lambdaNumer... | 3,838,745 |
pragma solidity ^0.5.8;
/**
This scd to mcd migration works without pool.
ETH free(scd) => lock(mcd) ==> dai draw(mcd) => swap(dai=>sai) => wipe(scd)
*/
interface TubInterface {
function open() external returns (bytes32);
function join(uint) external;
function exit(uint) external;
function lock(bytes... | Set ratio according to user. wad according to toConvert ratio if migration is by debt method, Add fee(SAI) to _wad | function setSplitAmount(
bytes32 cup,
uint toConvert,
address payFeeWith
) internal returns (uint _wad, uint _ink, uint maxConvert)
{
TubInterface tub = TubInterface(getSaiTubAddress());
maxConvert = toConvert;
uint saiBal = tub.sai().balanceOf(InstaMcdAddres... | 13,132,216 |
./full_match/80001/0x0df0d5070db1B12421d3EbD926Ce54f287919720/sources/src/MintpadERC1155Evolve.sol | Collects and distributes the primary sale value of NFTs being claimed. | function collectPriceOnClaim(
uint256 _tokenId,
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken
) internal virtual override {
if (_pricePerToken == 0) {
return;
}
uint256 totalPrice = ... | 5,594,451 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IBondCalculator.sol";
import "./interfaces/IERC20Extended.s... | allow anyone to send lost tokens (excluding principle or KEEPER) to the DAO return bool/ | function recoverLostToken( address _token ) external returns ( bool ) {
require( _token != KEEPER );
require( _token != principle );
IERC20( _token ).safeTransfer( DAO, IERC20( _token ).balanceOf( address(this) ) );
return true;
}
| 12,149,779 |
./full_match/1/0x92FD968AcBd521c232f5fB8c33b342923cC72714/sources/contracts/libs/Stakes.sol | Lock tokens until a lock period pass. stake Staker struct _tokens Amount of tokens to unstake _period Period in blocks that need to pass before withdrawal/ | function lockTokens(
Stakes.Staker storage stake,
uint256 _tokens,
uint256 _period
) internal {
uint256 lockingPeriod = _period;
if (stake.tokensLocked > 0) {
lockingPeriod = Math.weightedAverage(
stake.tokensLocked,
_period,
... | 16,482,718 |
pragma solidity ^0.4.15;
contract Victim {
// Contract: If the user clears the balance we will pay them 1 eth.
uint balance = 100;
// pre: balance > 0
function withdraw() public {
require(balance > 0);
uint transferAmt = 1 ether;
// Call the sender's fallba... | Call the sender's fallback function with 1 eth. Note that we fail to specify how much gas is available within (). So, all gas provided by the original caller is available to be consumed. Contracts do not pay any gas fees in the current version of Ethereum. But the contract is paying its own eth to the sender. clear the... | function withdraw() public {
require(balance > 0);
uint transferAmt = 1 ether;
msg.sender.call.value(transferAmt)("");
balance = 0;
}
| 14,089,669 |
pragma solidity 0.5.6;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import './Condition.sol';
import '../registry/DIDRegistry.sol';
import '../interfaces/ISecretStore.sol';
import '../interfaces/ISecretS... | grantPermission is called only by DID owner or provider _grantee is the address of the granted user or the DID provider _documentId refers to the DID in which secret store will issue the decryption keys/ | function grantPermission(
address _grantee,
bytes32 _documentId
)
public
onlyDIDOwnerOrProvider(_documentId)
{
documentPermissions[_documentId].permission[_grantee] = true;
}
| 13,095,174 |
./full_match/4/0xee7a177EA42C17406E1f3691bE11F90f12a22183/sources/smartcontractkit/documentation/_includes/samples/VRF/VRFD20.sol | Get the current key hash return bytes32/ | function keyHash() public view returns (bytes32) {
return s_keyHash;
}
| 672,986 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
/*
___ _ _
| _ )_ _ _ _ _ _ _ _ | | | |
| _ \ || | ' \| ' \ || | |_| |_|
|___/\_,_|_||_|_||_\_, | (_) (_)
|__/
*
* MIT License
* ===========
*
* Copyright (c) 2020 BunnyFinanc... | profits only (underlying + bunny) + no withdraw fee + perf fee | function getReward() external override {
uint amount = earned(msg.sender);
uint shares = Math.min(amount.mul(totalShares).div(balance()), _shares[msg.sender]);
totalShares = totalShares.sub(shares);
_shares[msg.sender] = _shares[msg.sender].sub(shares);
_cleanupIfDustShares()... | 6,473,519 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.