file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/4/0xe33C8a6cD48423cCe8DF949dC0265E50AaA358ed/sources/FRTTreasury.sol | scaled by nowTotalSupply / origTotalSupply when claiming rewardLimit to 200frt max!!. | function sendReward(uint256 rate, address account) public checkhalve
{
require(msg.sender == gov || msg.sender == monetaryPolicy, "Not Allowed to Send");
uint256 limiter = 200;
if (reward > 0) {
uint256 nowTotalSupply = REWARD_TOKEN.totalSupply();
reward = rewar... | 8,610,956 |
pragma solidity ^0.4.21;
//-----------------------------------------
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
... | override for get eth only after finalization | function _forwardFunds() internal {
}
| 10,910,803 |
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// File contracts/Functional.sol
pragma solidity ^0.8.0;
abstract contract Functional {
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
... | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_burn}. Requirements: - `ids` and `amounts` must have the same length./ | function _burnBatch(
address from,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(7 == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_befor... | 14,617,197 |
./full_match/80001/0x6bEDBE8Ab8ef09F510EE968E8d5079c3e81Fe535/sources/contracts/Contract.sol | Lets an account claim a given quantity of NFTs. _receiver The receiver of the NFTs to claim. _quantity The quantity of NFTs to claim. _proofs The proof of the claimer's inclusion in the merkle root allowlist ... | function claim(
address _receiver,
uint256 _quantity,
bytes32[] calldata _proofs,
uint256 _proofMaxQuantityForWallet
) external nonReentrant {
address claimer = _msgSender();
verifyClaim(claimer, _quantity, _proofs, _proofMaxQuantityForWallet);
_transfer... | 846,808 |
// File: contracts/interfaces/IMarketHandler.sol
pragma solidity 0.6.12;
/**
* @title BiFi's market handler interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface IMarketHandler {
function setCircuitBreaker(bool _emergency) external returns (bool);
function setCircuitBreakWithOwn... | Change the owner of the handler newOwner the address of the owner to be replaced return true (TODO: validate results)/ | function ownershipTransfer(address payable newOwner) onlyOwner external override returns (bool)
{
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
return true;
}
| 1,420,226 |
./full_match/1/0x8e3B64b3737097F283E965869e3503AA20F31E4D/sources/@balancer-labs/v2-interfaces/contracts/liquidity-mining/IL1StandardBridge.sol | Standard token bridging interface, common to Optimism and Base networks./ | interface IL1StandardBridge {
function depositERC20To(
address _l1Token,
address _l2Token,
address _to,
uint256 _amount,
uint32 _l2Gas,
bytes calldata _data
) external;
}
| 16,468,675 |
pragma solidity ^0.4.11;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
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 w... | Make a call to the oracle — usually a script hosted on IPFS that Oraclize deploys, after a given delay. We leave nested query as default to maximize optionality for queries. To readers of the code (aka prospective betters) if this is a computation query, you can view the script we use to compute the winner, as it is ho... | function callOracle(uint timeOrDelay, uint gas) private {
oraclizeQueryId = makeOraclizeQuery(timeOrDelay, "nested", "[computation] ['QmTVF5CKjkZvduN2QUQoxZdCUVPTY2nZMdMcbjyezKAp2t']", gas);
}
| 2,231,876 |
pragma solidity ^0.4.24;
import "zeppelin/token/ERC20/SafeERC20.sol";
import "zeppelin/math/SafeMath.sol";
import "zeppelin/math/Math.sol";
import "./lib/AdditionalMath.sol";
import "contracts/MinersEscrow.sol";
import "contracts/NuCypherToken.sol";
import "contracts/proxy/Upgradeable.sol";
/**
* @notice Contract h... | Revoke policy by client _policyId Policy id/ | function revokePolicy(bytes16 _policyId) public {
refundInternal(_policyId, RESERVED_NODE, true);
}
| 889,797 |
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./ValSafeMath.sol";
import "./ILiquidator.sol";
import "@trusttoken/registry/contracts/Registry.sol";
import "wjm-airswap-swap/contracts/Swap.sol";
/**
* @dev Program that executes a t... | return True if an order is prunable If the order cannot be executed at this moment, it is prunable No need to check things immutably true that were checked during registration/ check allowance, nonce status, and minimum nonce correspond to cancellation check signatory has not been revoked | function prunableOrder(FlatOrder memory _order) internal view returns (bool) {
if (_order.expiry < now) {
return true;
}
if (rewardToken.balanceOf(_order.signerWallet) < _order.signerAmount) {
return true;
}
if (rewardToken.allowance(_order.signerWalle... | 5,408,679 |
pragma solidity >=0.4.24;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'ConsumerRole' to manage this role - add, remove, check
contract ConsumerRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other for Removing
event ConsumerAdded(address indexed account);... | Define a function 'renounceConsumer' to renounce this role | function renounceConsumer() public {
_removeConsumer(msg.sender);
}
| 922,622 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(string memory p0, bool p1, address p2, string memory p3) internal view { | 14,087,836 |
/**
* Crowdfunding.sol v1.0.0
*
* Bilal Arif - https://twitter.com/furusiyya_
* Notary Platform
*/
pragma solidity ^0.4.16;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
ret... | Allow investor to just send in money/ | function() nonZero payable{
buy(msg.sender);
}
| 933,799 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract Staking {
using SafeMath for uint256;
// map address to user stake
mapping (address => uint256) stakes;
//staking details
... | Requirements: - nameOption/ | function stake (uint256 amount)
public
_positive(amount)
_realAddress(msg.sender)
payable
returns (bool) {
address sender = msg.sender;
return _stakeToken(sender,amount);
}
| 2,498,182 |
./full_match/43113/0x09b49ccC09a930216fE280E192E64FC145842ECC/sources/contracts/MasterChef.sol | Safe gondola transfer function, just in case if rounding error causes pool to not have enough GONDOLAs. | function safeGondolaTransfer(address _to, uint256 _amount) internal {
uint256 gondolaBal = gondola.balanceOf(address(this));
if (_amount > gondolaBal) {
gondola.transfer(_to, gondolaBal);
gondola.transfer(_to, _amount);
}
}
| 7,150,193 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity ... | Peterson&39;s Law Protection Claim tokens/ | function claimTokens(address _token) public onlyOwner {
if (_token == 0x0) {
owner.transfer(address(this).balance);
return;
}
MintableToken token = MintableToken(_token);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
... | 15,289,312 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
pragma solidity ^0.4.6;
import "./PricingStrategy.sol";
import "./Crowdsale.sol";
... | Calculate the current price for buy in amount. This investor is coming through pre-ico | function calculatePrice(uint value, uint weiRaised, uint tokensSold, address msgSender, uint decimals) public constant returns (uint) {
uint multiplier = 10 ** decimals;
if(preicoAddresses[msgSender] > 0) {
return value.times(multiplier) / preicoAddresses[msgSender];
}
uint price = getCurrent... | 5,378,046 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | Retrieves the allowance for a token, owner, and spender. Returns `0` if the call reverts. token The address of the token contract. owner The owner of the tokens. spender The address the spender. return allowance_ The allowance for a token, owner, and spender. | function compatAllowance(IERC20TokenV06 token, address owner, address spender)
internal
view
returns (uint256 allowance_)
{
(bool didSucceed, bytes memory resultData) = address(token).staticcall(
abi.encodeWithSelector(
token.allowance.selector,
... | 13,013,545 |
./partial_match/1313161554/0x35CC71888DBb9FfB777337324a4A60fdBAA19DDE/sources/BRLMasterChef.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, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 400, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBloc... | 16,928,277 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts/t... | change the proser_role of the climbertimelock contract change delay time upgrade logic contract from proxy schedule all the sequential calls execute all the sequential calls | function attack(address payable _timelock, address _proxy, address tokenAddr, address recipient) external {
upgradedClimber = new ClimberVaultUpgraded();
timeLock = ClimberTimelock(_timelock);
_push(
address(timeLock),
abi.encodeWithSelector(
AccessC... | 12,859,849 |
./partial_match/42/0xeA4Fb06930eB34DcfB6385a42A0bfF2c7a3c5178/sources/zzznapMigrationPool.sol | Called by admin after the pool has ended to migrate ZZZ/NAP LP to ZZZv2/NAPv2 LP, so that users can withdraw their tokens Gets a snapshot of the reserves in the Uniswap pair MIGHT BE UNECESSARY, PENDING TESTING. IF THE LP IS ADDED BACK AT SAME RATIO THEN DON'T NEED TO GRAB THIS INFO (uint zzzreserve, uint napreserve, u... | function migrateLPtokens() public onlyOwner {
require(migrationComplete == 0, "Migration has already been completed");
require(now > periodFinish, "Migration must be completed after the Pool has finished");
IUniswapV2Router02(uniswapV2Router).removeLiquidity(
zzzV1,
... | 8,909,573 |
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/HomoraBank.sol | Borrow tokens from that bank. Must only be called while under execution. token The token to borrow from the bank. amount The amount of tokens to borrow. | function borrow(address token, uint amount) external override inExec poke(token) {
Bank storage bank = banks[token];
require(bank.isListed, 'bank not exists');
Position storage pos = positions[POSITION_ID];
uint totalShare = bank.totalShare;
uint totalDebt = bank.totalDebt;
uint share = totalS... | 4,169,108 |
./full_match/4/0x0D5de5B9229d3619B54CE8aE56878f1d75055b27/sources/contracts/21208_25_Olea_v1_amb_message.sol | This function returns the balance of the Owner | function getBalance() public view returns(uint256){
return balanceOf[Owner];
}
| 13,324,218 |
./partial_match/56/0x08c0AbFf159C61E0a1bFe54b3522E0191732482b/sources/HDCORE.sol | Sends all available balances and mints LP tokens Possible ways this could break addressed 1) Multiple calls and resetting amounts - addressed with boolean 2) Failed WBNB wrapping/unwrapping addressed with checks 3) Failure to create LP tokens, addressed with checks 4) Unacceptable division errors. Addressed with multip... | function addLiquidityToBakerySwapHDxWBNBPair() public {
require(liquidityGenerationOngoing() == false, "HDCORE LGE ongoing");
require(LPGenerationCompleted == false, "HDCORE LGE already finished");
totalBNBContributed = address(this).balance;
IBakerySwapPair pair = IBakerySwapPair(to... | 11,096,834 |
pragma solidity 0.5.4;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
//... | [NOT MANDATORY FOR ERC1410 STANDARD] Transfer tokens from default partitions. operator The address performing the transfer. from Token holder. to Token recipient. value Number of tokens to transfer. data Information attached to the transfer, and intended for the token holder ('from') [CAN CONTAIN THE DESTINATION ... | {
bytes32[] memory _partitions = _getDefaultPartitions(from);
require(_partitions.length != 0, "A8: Transfer Blocked - Token restriction");
uint256 _remainingValue = value;
uint256 _localBalance;
}
}
function _transferByDefaultPartitions(
address operator,
address from,
address to,... | 2,563,776 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* @title L1BuildParam
* @dev L1BuildParam has parameters and contract code for Verse-Layer builds.
*/
contract L1BuildParam {
/**********************
* Contract Variables *
**********************/
uint256 public maxTransactionGasLimit;
... | Returns the code hash of the L1StandardBridge code./ | function l1StandardBridgeCodeHash() external view returns (bytes32) {
return keccak256(l1StandardBridgeCode);
}
| 2,529,342 |
// SPDX-License-Identifier: Apache-2.0
/**
*Submitted for verification at Etherscan.io on 2021-05-13
*/
// SPDX-License-Identifier: MIT
// Special Thanks to @BoringCrypto for his ideas and patience
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;
// https://github.com/OpenZeppelin/openzeppelin-contract... | Update the given pool's SUSHI allocation point and `IRewarder` contract. Can only be called by the owner. _pid The index of the pool. See `poolInfo`. _pool New pool to set | function setPoolAddr(
uint256 _pid,
IERC20 _pool
) public onlyOwner {
lpToken[_pid] = _pool;
emit LogSetPoolAddress(
_pid,
_pool
);
}
| 600,505 |
// SPDX-License-Identifier: MIT
// Cowri Labs Inc.
pragma solidity =0.8.4;
import {InteractionType} from "./Interactions.sol";
/**
* A BalanceDelta structure tracks a user's intra-transaction balance change
* for a particular token
* @param tokenId ID of the tracked token
* @param delta a signed integer that re... | Now that we have allocated a pair of mint arrays and a pair of burn arrays, we iterate over the balance deltas again, this time moving the positive deltas, along with their assosciated tokenIds into the mints arrays, and moving the negative deltas and their assosciated tokenIds into the burns arrays./ | function _copyDeltasToMintAndBurnArrays(
BalanceDelta[] memory self,
uint256[] memory mintIds,
uint256[] memory mintAmounts,
uint256[] memory burnIds,
uint256[] memory burnAmounts
) private pure {
uint256 mintsSoFar = 0;
uint256 burnsSoFar = 0;
for... | 15,807,318 |
./full_match/8453/0x0d18a1876A1Df3271f441C3693F906dee9272125/sources/contracts/marketplace/offers/OffersLogic.sol | Returns all existing offers within the specified range. | function getAllOffers(uint256 _startId, uint256 _endId) external view returns (Offer[] memory _allOffers) {
OffersStorage.Data storage data = OffersStorage.offersStorage();
require(_startId <= _endId && _endId < data.totalOffers, "invalid range");
_allOffers = new Offer[](_endId - _startId ... | 11,558,835 |
./full_match/80001/0xF524Cc28CB890F5f0514ABA478E23F0B7BCf8f88/sources/contracts/BnBeanLotteryGame.sol | View lottery information _lotteryId: lottery id/ | function viewLottery(
uint256 _lotteryId
) external view returns (Lottery memory) {
return _lotteries[_lotteryId];
}
| 5,584,690 |
./full_match/1/0xa22620b5bfC0A1bC34B0Aa41C8C09dcDAcE0aFDc/sources/TsstToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 8,384,527 |
// File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC20\IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of... | All withdrawn tokens are marked as claimable, so anyway we need to withdraw from the protocol | function withdraw(address beneficiary, uint256[] memory amounts) public onlyDefiOperator {
address[] memory registeredVaultTokens = IVaultProtocol(vault).supportedTokens();
require(amounts.length == registeredVaultTokens.length, "Wrong amounts array length");
uint256 nWithdraw;
uint... | 630,474 |
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function... | Registers new user bookOwner Is new user a book owner?/ | function addUser(bool bookOwner) bookshopIsOpen external {
require(users[msg.sender].exists == 0, "user already registered");
bool isSellerApproved = false;
uint8 exists = 1;
users[msg.sender] = User(msg.sender, bookOwner, isSellerApproved, exists);
... | 12,985,269 |
//Address: 0xdac4f0d74592012eb4baeb608b1992ffe5cc537a
//Contract name: WorldCupBroker
//Balance: 1.88335987807420416 Ether
//Verification Date: 6/9/2018
//Transacion Count: 33
// CODE STARTS HERE
pragma solidity ^0.4.18;
// File: contracts/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner... | Returns some of the properties of a match. Functionality had to be seperated into 2 function calls to prevent stack too deep errors _matchId the index of that match in the matches array return `string` the match name return `string` the fixutre Id of the match for the football-data endpoint return `string` t... | function getMatch(uint8 _matchId) public view validMatch(_matchId) returns (string, string, string, bool, uint8, uint8, uint8, uint, bool, bool) {
Match memory mtch = matches[_matchId];
return (
mtch.name,
mtch.fixtureId,
mtch.secondaryFixtureId,
mtch... | 1,790,197 |
./partial_match/56/0x7B9D43599AA3C5590CF068bE7BD67Ebf30462b47/sources/FeeProvider.sol | transfers to the user a specific amount from the reserve. _reserve the address of the reserve where the transfer is happening _user the address of the user receiving the transfer _amount the amount being transferred/solium-disable-next-line | function transferToUser(
address _reserve,
address payable _user,
uint256 _amount
) external onlyLendingPool {
if (_reserve != BscAddressLib.bnbAddress()) {
ERC20(_reserve).safeTransfer(_user, _amount);
(bool result, ) = _user.call.value(_amount).gas(50000... | 11,035,080 |
./full_match/4/0x083D83D12f81F6EE2aD17858658cb1aeaa8c97C7/sources/browser/gists/8a173a65099261582a652ba18b7d96c1/APIConsumer.sol | Create a Chainlink request to retrieve API response, find the target data, then multiply by 1000000000000000000 (to remove decimal places from data)./ const queryString = 'symbol=GME®ion=US' const res = await fetch( `https:apidojo-yahoo-finance-v1.p.rapidapi.com/stock/v2/get-summary?${queryString}`, { params: {... | function requestVolumeData() public returns (bytes32 requestId)
{
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
request.add("path", "price.regularMarketPrice.raw");
i... | 12,501,625 |
./partial_match/1/0xc75d41E691A24F8f7161791cd375174069455BDc/sources/Shrimp.sol | Move tokens in approve token transfer to cover all possible scenarios add the liquidity Zero out any approval that didn't get set back to zero | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) public {
transferFrom(msg.sender, address(this), tokenAmount);
allowance[address(this)][address(uniswapV2Router)] = tokenAmount;
address(this),
tokenAmount,
address(this),
block.timestamp
... | 9,122,010 |
./full_match/1/0x55084eE0fEf03f14a305cd24286359A35D735151/sources/contracts/HashflowRouter.sol | @inheritdoc IHashflowRouter | function updatePoolAuthorization(address pool, bool authorized)
external
override
{
require(
_msgSender() == factory,
'HashflowRouter: msg.sender should be the Factory.'
);
authorizedPools[pool] = authorized;
emit UpdatePoolAuthorizaton(p... | 16,534,630 |
pragma solidity 0.4.24;
contract Governable {
event Pause();
event Unpause();
address public governor;
bool public paused = false;
constructor() public {
governor = msg.sender;
}
function setGovernor(address _gov) public onlyGovernor {
governor = _gov;
}
modifie... | id : the index of the token to burn/ require(isTradable(cards[id].proto)); use the internal transfer function as the external has a guard to prevent transfers to 0x0 | function burn(uint id) public {
require(owns(msg.sender, id));
burnCount++;
_transfer(msg.sender, address(0), id);
}
| 2,056,483 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/unsigned/uint256Constraints.sol";
//import "Safemath.sol";
///
/// @title block.number Logic Library for use with the chronological generation of blocks on the bl... | return {uint} total number of blocks, in the future, from the current blocklhs.requireGreatThan(block.number); | function blockNumberFutureDelta(
uint lhs
)internal pure returns(
bool
){
return lhs.sub(block.number);
}
| 5,536,979 |
./partial_match/4/0x98527aeE992Fa368fB59b4eEa094F7D78603506F/sources/MasterChef.sol | Deposit LP tokens to MasterChef for swapdex allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accSwapdexPerShare).div(1e12).sub(user.rewa... | 8,624,262 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Max leverage we can go up to, w.r.t safe buffer Infinite geometric series | function getMaxLeverage() public view returns (uint256) {
uint256 safeLeverageColFactor = getSafeLeverageColFactor();
uint256 leverage = uint256(1e36).div(1e18 - safeLeverageColFactor);
return leverage;
}
are technically snapshots and don't represent the real value.
As su... | 397,449 |
pragma solidity 0.6.10;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among o... | function safeTransferFrom(address from, address to, uint256 tokenId) external; function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
... | 7,435,050 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_265(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,978 |
./partial_match/1/0x520e06Bce908ECCdaf5bC0Ea0Fe3B8487841C309/sources/factoty.sol | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
| 15,728,417 |
./partial_match/4/0xd6c67EF9f8dcF01a8c4ecc6e4Ea42a6Ea2f5C4e1/sources/FestakedWithReward.sol | check the remaining amount to be staked For pay per transfer tokens we limit the cap on incoming tokens for simplicity. This might mean that cap may not necessary fill completely which is ok. uint256 stakedTotal = state.stakedTotal; | function stake(address payer, address staker, uint256 amount,
uint256 stakingStarts,
uint256 stakingEnds,
uint256 stakingCap,
address tokenAddress,
FestakeState storage state
)
external
_after(stakingStarts)
_before(stakingEnds)
_positive(amount)
r... | 8,619,662 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/// @title Token Distributor Contra... | Grants DISTRIBUTOR_ROLE to a new user have to be admin/owner to call this function user the user to assign the new role to | function addNewDistributor(address user)
public
isAdminOrOwner
{
grantRole(DISTRIBUTOR_ROLE, user);
}
| 6,474,718 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.6;
import { IEmissionsController } from "../interfaces/IEmissionsController.sol";
import { IMasset } from "../interfaces/IMasset.sol";
import { IRevenueRecipient } from "../interfaces/IRevenueRecipient.sol";
import { DialData } from "../emissions/Emissi... | donates purchased rewards, eg MTA, to staking contracts via the Emissions Controller./ STEP 1 - Get the voting power of the staking contracts Get the voting power of each staking contract | function donateRewards() external onlyKeeperOrGovernor {
uint256 numberStakingContracts = stakingDialIds.length;
uint256[] memory votingPower = new uint256[](numberStakingContracts);
uint256 totalVotingPower;
for (uint256 i = 0; i < numberStakingContracts; i++) {
address ... | 89,279 |
./full_match/1/0x6E2B82eb7c349a4A2a690C0FC1C3A3cb643b8fA2/sources/browser/hasbeen.sol | Update reward variables of the given pool to be up-to-date. | {
function update() internal
if (block.number <= lastRewardBlock) {
return;
}
if (totalProductivity == 0) {
lastRewardBlock = block.number;
return;
}
uint256 multiplier = block.number.sub(lastRewardBlock);
uint256 reward = mul... | 3,032,233 |
pragma solidity ^0.4.19;
import "./crowdsale/PreSaleCrowdsale.sol";
import "./math/SafeMath.sol";
import "./OneSmartToken.sol";
/**
* In 2018 and in real world a huge amount of conditions required to success processing
* private round investments.
*
* We do not want to
* 1. Do any kind of non blockchain related inves... | _beneficiary the address of the investor wallet to get current bonus rate./ | function getBonusRate(address _beneficiary) internal view returns (uint256) {
uint256 bonusRateTime = investorsMap[_beneficiary].bonusRateTime;
uint256 bonusRate = investorsMap[_beneficiary].bonusRate;
if (bonusRateTime >= now && bonusRate > 0) {
return bonusRate;
}
return 0;
}... | 12,616,568 |
pragma solidity ^0.5.1;
import "./MPOStorage.sol";
import "./lib/Destructible.sol";
import "./lib/ZapInterface.sol";
// import "./ECRecovery.sol";
// @title - A MultiPartyOracle contract that implements the client1 callback
// @authors - Max Inciong, Jonathan Pang, Jon Morales
// @notice the contract receives queries ... | middleware function for handling queries recieves query, called from dispatch uint256 id Dispatch created query ID string userQuery User provided query String bytes32 endpoint Determines whether to use Onchain Providers, Offchain Providers, Non-Providers bytes32[] endpointParams Parameters passed to providers boo... | function receive(uint256 id, string calldata userQuery, bytes32 endpoint, bytes32[] calldata endpointParams, bool onchainSubscriber) external {
emit RecievedQuery(userQuery, endpoint, endpointParams, msg.sender);
require(msg.sender == dispatchAddress && stor.getQueryStatus(id) == 0, "Dispatch only")... | 15,795,763 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/util... | SPDX-License-Identifier: MIT | interface IRaid {
function act(
Action[] calldata heroActions,
Action[] calldata fighterActions
) external;
function equip(
Property item,
uint256 id,
uint8 slot
) external;
function unequip(Property item, uint8 slot) external;
function enhance(
... | 10,332,580 |
./full_match/11155111/0x196d4119944CD005AD917466B8e2e2Ec018FA547/sources/contracts/CrowdFunding.sol | campaign.donation[msg.sender] = amount; | function donateCampaign(uint256 _id) public payable{
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
require(sent,"Donation Failed");
campaign.donators.push(msg.sender);
campaign.donations.push(msg.value);
campaign.amountCollected += amount;
... | 3,807,746 |
contract Foo {
/// #if_succeeds abi.encode(v).length > 0;
function foo(uint v) public {
}
/// #if_succeeds abi.encodePacked(v).length > 0;
function foo1(uint v) public {
}
/// #if_succeeds abi.encodeWithSelector(bytes4(hex"01020304"), v).length > 0;
function foo2(uint v) public {
}
/// #if_succeeds abi.enc... | if_succeeds abi.encodeWithSignature("dummy", v).length > 0; | function foo3(uint v) public {
}
| 1,842,514 |
/**
*Submitted for verification at Etherscan.io on 2021-11-26
*/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemente... | See {IERC165-supportsInterface}. / | function supportsInterface(bytes4 interfaceId) public view virtual
override(ERC721, ERC721Enumerable, AccessControlEnumerable) returns (bool)
{
return super.supportsInterface(interfaceId);
}
| 1,700,116 |
// File: contracts/compound/ComptrollerInterface.sol
pragma solidity ^0.5.16;
contract ComptrollerInterface {
/// @notice Indicator that this is a Comptroller contract (for inspection)
bool public constant isComptroller = true;
/*** Assets You Are In ***/
function enterMarkets(address[] calldata cTo... | Claim all comp accrued by the holders holders The addresses to claim COMP for cTokens The list of markets to claim COMP in borrowers Whether or not to claim COMP earned by borrowing suppliers Whether or not to claim COMP earned by supplying/ | function claimComp(address[] memory holders, CToken[] memory cTokens, bool borrowers, bool suppliers) public {
for (uint i = 0; i < cTokens.length; i++) {
CToken cToken = cTokens[i];
require(markets[address(cToken)].isListed, "!listed");
if (borrowers == true) {
... | 6,421,979 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.0;
import "../interfaces/IERC20.sol";
import "../Dependencies/SafeMath.sol";
contract YuzuLP{
using SafeMath for uint256;
uint256 private _totalSupply;
string constant internal _NAME = "Yuzu LP";
string constant internal _SYMBOL = "YLP";
... | emit Transfer(address(0), account, amount); | function _mint(address account, uint256 amount) internal {
assert(account != address(0));
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
}
| 7,285,904 |
./full_match/1/0x622a1C6a0f49594f6BA11F0B8cE8706F1f14cc8d/sources/contracts/TicketStorage.sol | Assigns `count` amount of tickets to `owner` address. Requirements: - there must be enough tickets left Emits a {TicketsAssigned} event./ | function _assignTickets(address owner, uint16 count) internal {
require(_ticketsLeft > 0, "All tickets are assigned");
require(_ticketsLeft >= count, "Assigning too many tickets at once");
uint16 from = _tickets - _ticketsLeft;
_ticketsLeft -= count;
TicketNumberRange memory... | 8,321,553 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
contract Turtis is ERC721, ChainlinkClient {
address public contractOwner; // Owner of this contract
// Bytes32 data related to IPFS Hash r... | Function 'setApiSecondUrl' sets a new second URL link for the API | function setApiSecondUrl(string memory _url) public onlyContractOwner {
apiSecondUrl = _url;
}
| 12,617,631 |
pragma solidity ^0.5.0;
contract CogScience_project {
int public max_score;
int public min_score;
uint public totalNum_transactions; // it's used as transaction's ID too.
uint public totalNum_proposals;
uint public lecture_tokens; // it keeps a fixed number of tokens.
uint public current_l... | in the UI, each student should be able to see a list of active offers he/she has made. This allows the student to fetch specific offer ID used in send_token. This function allows a student to post an offer on the UI. It can offer to engage in an actitivy and specify how many tokens it is willing to send or recieve. | function makeProposal(uint numOf_tokens_, string calldata reason_, string calldata email_address_) external{
require(valid_student_addr[msg.sender] == true, "Not a valid sender");
require(student_token_balance[msg.sender] >= numOf_tokens_,"Not enough token");
Proposal memory proposa... | 12,760,856 |
/*
* Abstract Token Smart Contract. Copyright © 2017 by ABDK Consulting.
* Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com>
*/
pragma solidity ^0.4.20;
contract SafeMath {
uint256 constant private MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
/**
* Add ... | Get name of the token. return name of the token/ | function name () public delegatable view returns (string) {
return "GHI Token";
}
| 10,882,424 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import './IERC20.sol';
import './IERC721.sol';
import "./IERC721Receiver.sol";
import "./ERC165.sol";
import './Ownable.sol';
import './SafeMath.sol';
import './Address.sol';
import './Context.sol';
interface ILink is IERC20 {
... | Callback function used by VRF Coordinator/ | function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
requestId = 0;
progress = false;
winner = randomness;
}
| 5,741,059 |
pragma solidity 0.8.9;
import { Pinball } from "./Pinball.sol";
contract Play {
bytes4 constant SELECT_MISSION_SELECTOR = 0x00e100ff;
bytes4 constant COMPLETE_MISSION_SELECTOR = 0xF00FC7C8;
bytes4 constant POWER_UP_SELECTOR = 0x01020304;
bytes4 constant BUMPERS_SELECTOR = 0x50407060;
bytes32[] MI... | need 4 bytes for the selector and 256 for the bumpers | function flipLeftBumpers() internal {
bytes memory empty;
commands.push(Command(
FLIPLEFTBUMPERS,
bytes2(uint16(0x00ff - 4)),
bytes2(uint16(256 + 4)),
empty
));
}
| 13,068,134 |
pragma solidity ^0.4.24;
// File: zeppelin-solidity/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as ... | Submit a name 6 characters long or less. If it has been registered, the submitter will earn 50% of the deed value. We are purposefully handicapping the simplified registrar as a way to force it into being restructured in a few years. unhashedName An invalid name to search for in the registry./ Reward the discover... | function invalidateName(string unhashedName) public inState(keccak256(unhashedName), Mode.Owned) {
require(strlen(unhashedName) <= 6);
bytes32 hash = keccak256(unhashedName);
Entry storage h = _entries[hash];
_tryEraseSingleNode(hash);
if (address(h.deed) != 0) {
... | 448,861 |
./full_match/80001/0xC4C7722125148Aba8cBC4599AC71BC361c1e8F71/sources/project_/contracts/NissanApp.sol | Returns the Uniform Resource Identifier (URI) for `tokenId` token. Requirements: - `tokenId` must exist./ | function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
_requireMinted(tokenId);
return _tokenURIs[tokenId];
}
| 5,661,906 |
./partial_match/56/0xbe3E4CFD929156F612DF36042D79201Ecf5344D7/sources/Weather.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sende... | 11,038,165 |
./partial_match/56/0x5Bb91Cf750458F8B5E6Df27C6e5BA285079E9267/sources/GenToken.sol | Burn `_amount` token to address(0). Must only be called by the owner (MasterChef). | function burn(uint256 amount) public onlyOwner {
_burn(0x000000000000000000000000000000000000dEaD, amount);
}
| 11,050,534 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division o... | get records about approval _ind uint the index of record/ | function getApproveRecord(uint _ind) onlyOwner public view returns (bytes) {
require(_ind < approveRecords.length);
return approveRecords[_ind];
}
| 1,786,599 |
./full_match/1/0xCCFF562017bdAAa064184b3Eb9bd892d8Acce7d6/sources/contracts/minter-suite/Minters/MinterHolder/MinterHolderV4.sol | Unregisters holders of NFTs at address `_NFTAddress` to be considered for adding to future allowlists. _NFTAddress NFT core address to be unregistered./ | function unregisterNFTAddress(
address _NFTAddress
) external onlyCoreAdminACL(this.unregisterNFTAddress.selector) {
_registeredNFTAddresses.remove(_NFTAddress);
emit UnregisteredNFTAddress(_NFTAddress);
}
| 17,119,883 |
// full contract sources : https://github.com/DigixGlobal/dao-contracts
pragma solidity 0.4.25;
// File: @digix/solidity-collections/contracts/abstract/AddressIteratorInteractive.sol
/**
@title Address Iterator Interactive
@author DigixGlobal Pte Ltd
*/
contract AddressIteratorInteractive {
/**
... | get all information and details of proposal next to _proposalId _proposalId Proposal ID, i.e. hash of IPFS doc return { "_id": "" } | function getNextProposal(bytes32 _proposalId)
public
view
returns (bytes32 _id)
{
_id = read_next_from_bytesarray(
allProposals,
_proposalId
);
}
| 6,489,482 |
// https://opensea.io/collection/loot-familiars
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
// File: @openzeppelin/contracts/access/Ownable.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
* spe... | Transfer floot to familiar owner | function _claim(uint256 _id) private {
require(isClaimable(_id), "Familiar cannot claim FLOOT");
address familiarOwner = familiarContract.ownerOf(_id);
(bool success, bytes memory data) = address(flootContract).call(abi.encodeWithSelector(0xa9059cbb, familiarOwner, FLOOT_PER_FAMILIAR));
req... | 1,808,390 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @title Manager Interface.
* @author @NoahMarconi
*/
interface IManager {
/*---------- Public Helpers ----------*/
function isManager(address toCheck)
external
view
returns(bool);
function requireManager()
... | Manager Interface. @NoahMarconi/ | interface IManager {
function isManager(address toCheck)
external
view
returns(bool);
function requireManager()
external
view;
pragma solidity ^0.7.0;
}
| 12,591,058 |
./full_match/4/0x20651ff8423170E7FAe80FFc01070426d9139d80/sources/src/Shapeshifter.sol | require(walletMints[msg.sender] + quantity_ <= maxPerWallet, "Max per wallet reached"); | function publicMint(uint256 tokenId_, uint256 quantity_) external payable isUser isMintEnabled {
require(tokenId_ > 0 && tokenId_ <= MAX_TOKEN_TYPE, "Token Id not exists");
require(quantity_ <= maxPerTxn, "Max per txn exceeded");
require(msg.value == mintPrice * quantity_, "Wrong value!");
... | 13,317,874 |
pragma solidity ^0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
... | Decompose to datetime. Calculate the next start time of budget period. (1/1, 4/1, 7/1, 10/1) | function _nextBudgetStartAndEndAndOfficalVotingTime()
view
internal
returns (uint256, uint256, uint256)
{
uint32 year;
uint8 month;
uint8 mday;
uint8 hour;
uint8 minute;
uint8 second;
(year, month, mday, hour, minute, second) = n... | 6,216,685 |
./full_match/1/0x70588Eb4626600e6b9cD49b140E39e5a814D9535/sources/erc721bo/contracts/ERC721BO.sol | Approve `to` to operate on `tokenId` of `owner` Emits an `Approval` event of ERC721./ | function _approve(address owner, address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
| 3,053,416 |
/*
Copyright 2019 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Validations for placeBid: - Module is sender - getBidPrice validations _quantity The amount of currentSet to be rebalanced/ | function validatePlaceBid(
uint256 _quantity
)
internal
view
{
validateCallerIsModule();
validateGetBidPrice(_quantity);
}
| 6,343,006 |
./full_match/3/0x0E5EB56bA2b461083F2EB321Ce211Bc64DFE1CAf/sources/contracts/_EBT.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 8,126,351 |
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
pragma solidity 0.6.0;
/**
* @title Offering contract
* @dev Offering logic and mining logic
*/
contract Nest_NToken_OfferMain {
using SafeMath for uint256;
using address_make_payable for address;
using SafeERC20 for ERC20;
... | Retrieve mining token Token address/ Block mining amountoffer fee/block offer fee Transfer NToken | function mining(uint256 blockNum, address token, uint256 serviceCharge, address owner) private returns(uint256) {
uint256 miningAmount = _blockMining[blockNum][token].mul(serviceCharge).div(_blockOfferAmount[blockNum][token]);
Nest_NToken nToken = Nest_NToken(address(_tokenMapping.checkToken... | 7,993,977 |
./full_match/1/0xC6c4F0B3C73A524006B01f8Cae7810bb39C81B2a/sources/contracts/lending/IVaultController.sol | VaultController Interface extends VaultControllerEvents initializer view functions | interface IVaultController is VaultControllerEvents {
function initialize() external;
function tokensRegistered() external view returns (uint256);
function vaultsMinted() external view returns (uint96);
function lastInterestTime() external view returns (uint64);
function totalBaseLiability() external vie... | 9,797,635 |
// Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which c... | Setup max tokens purchase per transaction. Permission: only owner | function setMaxPurchase(uint256 _value) external onlyOwner {
require(_value != 0, "Very low value");
maxTokenPurchase = _value;
emit MaxPurchaseChanged(_value);
}
| 9,843,370 |
// contracts/Maze.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// BlockMazing
// The genesis maze https://blockmazing.com/m/0/maze.txt
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | | | | | | | | | | | | ... | Given a row and column, at the index in the flat array. | function rowColToBitIndex(uint row, uint col) private pure returns(uint) {
return row * MAZE_SIZE + col;
}
| 232,836 |
// File: contracts/Owned.sol
pragma solidity 0.6.7;
contract Owned {
address public owner = msg.sender;
event LogOwnershipTransferred(address indexed owner, address indexed newOwner);
modifier onlyOwner {
require(msg.sender == owner, "Sender must be owner");
_;
}
function setOwner(address _owner... | From ERC777: The token contract MUST call the tokensToSend hook before updating the state. From ERC777: The token contract MUST call the tokensReceived hook after updating the state. | function doSend(TokenState storage _tokenState, address _operator, address _from, address _to, uint256 _amount,
bytes memory _data, bytes memory _operatorData, bool _enforceERC777)
public
{
assert(_from != address(0));
require(_to != address(0), "Cannot send funds to 0 address");
sendHook(_op... | 1,986,089 |
./partial_match/1/0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8/sources/lib/core-physical/src/core/engines/BaseEngine.sol | mint option token to user, increase short position (debt) in storage _data bytes data to decode/ decode parameters update the account in state mint option token | function _mintOption(address _subAccount, bytes calldata _data) internal virtual {
(uint256 tokenId, address recipient, uint64 amount) = abi.decode(_data, (uint256, address, uint64));
_increaseShortInAccount(_subAccount, tokenId, amount);
emit PhysicalOptionTokenMinted(_subAccount, tokenId... | 4,199,089 |
pragma solidity ^0.4.18;
// File: contracts/flavours/Ownable.sol
/**
* @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 Owners... | Terminate the ICO. ICO goals are not reached, ICO terminated and cannot be resumed./ | function terminate() public onlyOwner {
require(state != State.Terminated &&
state != State.NotCompleted &&
state != State.Completed);
state = State.Terminated;
ICOTerminated();
}
| 1,641,970 |
./full_match/44787/0x449Ab7283A2f98cc6C71a53Cf2f97aAaC2FEA597/sources/contracts/community/CommunityAdminImplementation.sol | Transfers an amount of an ERC20 from community to an address _community address of the community _token address of the ERC20 token _to address of the receiver _amount amount of the transaction/ | function transferFromCommunity(
ICommunity _community,
IERC20 _token,
address _to,
uint256 _amount
) external override onlyOwner nonReentrant {
_community.transfer(_token, _to, _amount);
}
| 13,248,510 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./interfaces/IStakedToken.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract AaveRestaker is ERC20 {
using SafeERC20 fo... | Returns the user's stkAAVE balance in the pool | function stkAaveBalanceOf(address query) external view returns (uint256) {
require(balanceOf(query) > 0, "Queried address has no shares.");
uint256 userStkAaveBalance = balanceOf(query).mul(totalStkAave).div(totalShares);
return userStkAaveBalance;
}
| 12,725,226 |
pragma solidity ^0.6.12;
// 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 allowanc... | if any account belongs to _isExcludedFromFee account then remove the fee | function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater th... | 1,202,995 |
pragma solidity >=0.6.0 <0.7.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
/**
* @dev Extension of {ERC20} that adds a set of accounts with the {MinterRole},
* which have permission to mint (create) new tokens as they see fit.
*
* At construction, the deployer of the contract i... | Returns the ERC20 asset token used for deposits. return The ERC20 asset token | function depositToken() public view override returns (address) {
return (sushiAddr);
}
| 358,657 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
// Part: Chips
interface Chips {
function mintChip(uint256 amount) external payable;
function mintTokens(uint256 count) external payable;
function mintChip() external payable;
}
// Part: Context
/**
* @dev Provides information about the current ... | Withdraw ether from the contract/ | function withdraw() onlyOwner public {
uint balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
| 6,135,253 |
./partial_match/97/0x3F846b2c5857fECf0b4a7F0e6a87465c9EAf8b54/sources/baseNFT.sol | throws if illegal callers comes in Push Order data primary sale to metadata contract addNftMetaPrimary(eventAddress, nftIndex, orderTime, ticketPrice); Fetch blocktime as to assist ticket explorer for ordering moveFuelToken(mintGETfee, FUELTOKEN, GETcollector); | function primaryMint(address destinationAddress, address ticketIssuerAddress, address eventAddress, string memory ticketMetadata) public returns (uint256) {
require(gAC.hasRole(MINTER_ROLE, _msgSender()), "primaryMint: sender must have minter role to mint");
_mint(destinationAddress, nftIn... | 11,427,739 |
pragma solidity ^0.4.24;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until ... | check every have mounted children with the will mount child relationship | function _checkChildRule(address _owner, uint256 _avatarId, address _childContract, uint256 _child) internal {
uint256[] memory tokens = childTokens[_avatarId][_childContract];
if (tokens.length == 0) {
if (!AvatarChildService(_childContract).isAvatarChild(_child)) {
revert("it can't be avatar c... | 946,059 |
./full_match/100/0x264F4D5556E7bC67e7F0a95E7f8Bb99184Cf7d73/sources/contracts/citrus-vaults/src/external/aave-v2/ILendingPoolAddressesProvider.sol | LendingPoolAddressesProvider contract Main registry of addresses part of or connected to the protocol, including permissioned roles - Acting also as factory of proxies and admin of those, so with right to change its implementations - Owned by the Aave Governance Aave/ | interface ILendingPoolAddressesProvider {
event MarketIdSet(string newMarketId);
event LendingPoolUpdated(address indexed newAddress);
event ConfigurationAdminUpdated(address indexed newAddress);
event EmergencyAdminUpdated(address indexed newAddress);
event LendingPoolConfiguratorUpdated(address indexed newA... | 14,271,969 |
./partial_match/42/0x9aaA2535Ab0e38a0272786d94d8905C32D47c9B7/sources/VotesCalc.sol | dep profile name == data_label | function calcVotesForERC20(string calldata data_label, uint256 amount) public view returns(uint256){
uint256 rate_dec = uint256(dpContract.getDecimals(data_label));
uint256 rate = uint256(dpContract.getData(data_label));
uint256 votes = amount.mul(rate);
uint256 dec = pow(10,rate_de... | 3,303,299 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import "@nomiclabs/buidler/console.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
... | Mints obligation tokens Can only be called by option contract before expiry account Address to credit amount Total credit btcHash Bitcoin hash format Bitcoin script format/ insert into the accounts balance check treasury has enough unlocked | function mint(address account, uint256 amount, bytes20 btcHash, Bitcoin.Script format) external override notExpired onlyOwner {
_balances[account] = _balances[account].add(amount);
_obligations[account] = _obligations[account].add(amount);
totalSupply = totalSupply.add(amount);
_set... | 12,938,173 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {ERC721Full} from "../../.openzeppelin/0.8/token/ERC721/ERC721Full.sol";
import {Counters} from "../../.openzeppelin/0.8/drafts/Counters.sol";
import {IERC721} from "../../.openzeppelin/0.8/token/ERC721/IERC721.sol";
import {Address} from "../../.openzepp... | Converts the given address to string. Used when minting new passports./ | function _toAsciiString(
address _address
)
private
pure
returns (string memory)
{
bytes memory s = new bytes(40);
for (uint i = 0; i < 20; i++) {
bytes1 b = bytes1(uint8(uint(uint160(_address)) / (2**(8*(19 - i)))));
bytes1 hi = bytes1... | 11,896,565 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;
import "../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contra... | Mint cTokens by providing/lending underlying as collateral underlying The underlying to lend to Compound cToken The Compound cToken amount The amount of underlying to lend | function mint(
address underlying,
address cToken,
uint256 amount
) internal {
if (amount == 0) {
return;
}
IERC20(underlying).safeIncreaseAllowance(cToken, amount);
uint256 result = ICToken(cToken).mint(amount);
require(result... | 14,595,695 |
./full_match/1287/0xb4136B5b279c73649234305a979012e5cb9255e7/sources/src/BettingDex.sol | getListingResult. reuturns result for the listing. listId uint256. return Result ./ | function getListingResult(uint256 listId) public view returns (Result) {
return listings[listId].result;
}
| 7,097,776 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IMintableERC20.sol";
import "./NftStakeVaultV2.sol";
/** @title SamuraiSagaStakeVaultV2
*/
contract SamuraiSagaStakeVaultV2 is NftStakeVaultV2 {
event BatchStake(address indexed account, uint256 poolId, uint256[] tokenIds);
event B... | Stake a token from the collection/ | function stake(uint256 poolId, uint256 tokenId) external whenPoolOpened(poolId) nonReentrant {
address account = _msgSender();
_stake(account, poolId, tokenId);
emit Stake(account, poolId, tokenId);
}
| 12,209,486 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
// OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol)
import "../../@openzeppelin/contracts/access/Ownable.sol";
import "../../@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../Cloneable/Cloneable.sol";
import "../interfaces/IPayment... | Transfers the ownership of the instance to the specified address/ | function transferOwnership(address newOwner) public override(IPaymentSplitter, Ownable) onlyOwner {
super._transferOwnership(newOwner);
}
| 13,014,112 |
./full_match/1/0x7225244B17051c76c8C758EAf3F7bb4d0Fc953bA/sources/contracts/YeyeBase.sol | set Uri of Metadata/ | function setVaultAddress(address _newAddress) public onlyRole(DEFAULT_ADMIN_ROLE) {
vaultAddress = _newAddress;
}
| 5,005,404 |
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "hardhat/console.sol";
contract Oltac is ERC20, ERC20Burnable, Ownable {
uint tokenPrice ;
constructor( uint _tokenprice, uint _numberOfTo... | EOA can buy oltac token for a price | function buyOlt( uint _amount) public payable {
uint topay = getTotalPrice(_amount);
console.log("amount to pay:",topay);
require(msg.value >= topay, " you don't have enough money" );
transferFrom(owner(), msg.sender, _amount);
approve(msg.sender, _amount);
}
| 6,376,913 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.