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/83/0x1cF350DA842D4816c2978691D93e4670EEd7e10D/sources/VRFProvider.sol | Decodes the encoded data request response result encodedResult Encoded result data | function decodeResult(bytes memory encodedResult)
internal
pure
returns (bytes32 result)
{
Obi.Data memory decoder = Obi.from(encodedResult);
result = bytes32(decoder.decodeBytes());
require(decoder.finished(), "DATA_DECODE_NOT_FINISHED");
}
| 8,829,011 |
./full_match/137/0xe558726C468Ccc21cc09ca4B8B46131dC1002923/sources/project_/contracts/Exchange.sol | Load the quantity filled so far for a partially filled orders Invalidating an order nonce will not clear partial fill quantities for earlier orders because the gas cost would potentially be unbound orderHash The order hash as originally signed by placing wallet that uniquely identifies an order return For partially f... | function loadPartiallyFilledOrderQuantityInPips(bytes32 orderHash)
external
view
returns (uint64)
{
return _partiallyFilledOrderQuantitiesInPips[orderHash];
}
| 4,761,966 |
//Address: 0x07307d0b136a79bac718f43388aed706389c4588
//Contract name: Alarm
//Balance: 0.3491158383 Ether
//Verification Date: 2/15/2017
//Transacion Count: 16
// CODE STARTS HERE
// String Utils v0.1
/// @title String Utils - String utility functions
/// @author Piper Merriam -
library StringLib {
/*
* ... | Check if we are within the free-for-all period. If so, we award from all pool members. We have already gone through all of the pool callers so we should break out of the loop. Special case for single member and empty pools Otherwise the award comes from the previous caller. Find where the member is in the pool and awa... | function awardMissedBlockBonus(CallDatabase storage self, address toCaller, bytes32 callKey) public {
var call = self.calls[callKey];
var generation = self.callerPool.generations[ResourcePoolLib.getGenerationForWindow(self.callerPool, call.targetBlock, call.targetBlock + call.gracePeriod)];... | 2,569,994 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../escrow/EscrowBaseInterface.sol";
import "../../lib/priceoracle/PriceOracleInterface.sol";
import "../../lib/protobuf/BorrowingData.sol";
import "../../lib/protobuf/TokenTransfer.sol";
import "../../lib/protobuf/SupplementalLineI... | Get custom data. dataName The name of the custom data. return customData The custom data of the issuance./ | function getCustomData(
address, /** callerAddress */
bytes32 dataName
) public view returns (bytes memory) {
if (dataName == BORROWING_DATA) {
BorrowingProperties.Data memory borrowingProperties = BorrowingProperties
.Data({
borrowingTokenAddr... | 916,141 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import './FlashLoanReceiverBase.sol';
import '../interfaces/ILendingPool.sol';
import '../interfaces/ILendingPoolAddressesProvider.sol';
/**
... | assets[1] = address(0x2d12186Fbb9f9a8C28B3FfdD4c42920f8539D738); Kovan BAT assets[2] = address(0xB597cd8D3217ea6477232F9217fa70837ff667Af); Kovan AAVE assets[3] = address(0x075A36BA8846C6B6F53644fDd3bf17E5151789DC); Kovan UNI assets[4] = address(0xb7c325266ec274fEb1354021D27FA3E3379D840d); Kovan YFI assets[5] = add... | function flashLoanAndSwapTokens() public {
address receiverAddress = address(this);
address[] memory assets = new address[](1);
uint256[] memory amounts = new uint256[](1);
amounts[0] = 1 ether;
uint256[] memory modes = new uint256[](1);
modes[0] = 0;
addr... | 6,400,535 |
./full_match/3/0xe4E8Dc3C58c62eA35Cd898F2f7C9B3F4E93ef295/sources/Users/akshaycm/Documents/rfits-token/contracts/RfiToken.sol | Sell half of the amount to ETHSwap half of it to ethSend part of it to treasuryTransfer treasury amount to treasuryAdd liq with remaining eth and tokens | function AddLiq(uint256 amount) public {
uint256 befETHBalance = address(this).balance;
uint256 tokenAmount = amount.div(2);
swapTokensForETH(tokenAmount);
uint256 treasuryAmount = getLiqAddBudget(address(this).balance);
require(txSuccess,"treasury send fail");
uint2... | 8,131,241 |
pragma solidity ^0.5.0;
/// @title Ownable contract - base contract with an owner
contract Ownable {
address public owner;
constructor () public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
... | Tranfer tokens to address _to dest address _value tokens amount return transfer result | function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 409,103 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/cont... | Invest the underlying assets for additional yield. Only governance or strategist can call this function./ | function invest() public virtual override onlyStrategist {
IERC20Upgradeable _token = IERC20Upgradeable(SBTCCRV);
uint256 _balance = _token.balanceOf(address(this));
if (_balance > 0) {
_token.safeApprove(SBTCCRV_GAUGE, 0);
_token.safeApprove(SBTCCRV_GAUGE, _balance);... | 12,714,397 |
./full_match/137/0xe22966425C93CC0F42f47D447e0bE3677A303806/sources/contracts/core/NFTLottery.sol | NOTE: Push as many times as the number of tickets the player bought. This is to pick random winner efficiently since we don't use chainlink VRF, and need to iterate over all loops. This prevents to have loops that could exceed gas limit on the _pickWinner(). Trade-off with more gas fee here. | function buyTicket(uint256 lotteryId, uint256 numberOfTickets) public virtual override whenLotteryOpen(lotteryId) nonExpired(lotteryId) nonReentrant {
require(numberOfTickets > 0 && numberOfTickets < type(uint256).max, "Invalid ticket count");
IERC20(lotteries[lotteryId].ticketCurrency).safeTransfer... | 4,714,965 |
./full_match/137/0xe558726C468Ccc21cc09ca4B8B46131dC1002923/sources/project_/contracts/Exchange.sol | Clears the currently set whitelisted dispatcher wallet, effectively disabling calling the `executeOrderBookTrade`, `executePoolTrade`, `executeHybridTrade`, `withdraw`, `executeAddLiquidity`, and `executeRemoveLiquidity` functions until a new wallet is set with `setDispatcher`/ | function removeDispatcher() external onlyAdmin {
_dispatcherWallet = address(0x0);
}
| 4,762,005 |
pragma solidity 0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functio... | Send _value amount of tokens from address _from to address _to The transferFrom method is used for a withdraw workflow, allowing contracts to send tokens on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberat... | function transferFrom( address _from, address _to, uint256 _amount )public returns (bool ok) {
require( _to != 0x0);
require(balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount >= 0);
balances[_from] = (balances[_from]).sub(_amount);
allowed[_from][msg.sender] = (allo... | 131,341 |
./full_match/11155111/0x5C6C128Bd35c8F456F1752A840dE4B82Bc470995/sources/_openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20FlashMintUpgradeable.sol | Returns the fee applied when doing flash loans. This function calls the {_flashFee} function which returns the fee applied when doing flash loans. token The token to be flash loaned. amount The amount of tokens to be loaned. return The fees applied to the corresponding flash loan./ | function flashFee(address token, uint256 amount) public view virtual override returns (uint256) {
require(token == address(this), "ERC20FlashMint: wrong token");
return _flashFee(token, amount);
}
| 3,824,435 |
./full_match/1284/0xeB368A18412fE3A787b4C32CebD91d04Ddfd81D9/sources/contracts/polkarbonBetaNoStaking.sol | cross-chain function sending GLMR staking yield to Polygon receiver SC | function sendYield(ISquidMulticall.Call[] calldata _sourceCalls, ISquidMulticall.Call[] calldata _destinationCalls, uint256 _value) external payable onlyOwner {
0x0000000000000000000000000000000000000000,
_value,
'Polygon',
'axlUSDC',
_sourceCalls,
_destinationCalls,... | 16,368,322 |
./full_match/1/0x6e3FB8a019E78785E80cea1d413Bc3Ab650c2449/sources/contracts/ClipperCommonExchange.sol | TOKEN AND ASSET FUNCTIONS / | function nTokens() public view returns (uint) {
return assetSet.length();
}
| 8,385,475 |
./full_match/5/0xACD8f27EAF5B160d460b60E4f45F9FFafb70516a/sources/project_/contracts/Implementation/SimpleAccount.sol | validate the userOp is correct. revert if it doesn't. - must only be called from the entryPoint. - make sure the signature is of our supported signer. - validate current nonce matches request nonce, and increment it. - pay prefund, in case current deposit is not enough/ | function _requireFromEntryPointOrOwner() internal view {
require(
msg.sender == address(entryPoint()) || msg.sender == owner,
"account: not Owner or EntryPoint"
);
}
| 1,868,360 |
./full_match/1/0xcdFc5902589dF05E272e0b2eeDA1c46C8DA61e19/sources/contracts/misc/interfaces/IAaveLendPoolAddressesProvider.sol | IAaveLendPoolAddressesProvider contract Main registry of addresses part of or connected to the aave 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 Bend/ | interface IAaveLendPoolAddressesProvider {
function getLendingPool() external view returns (address);
pragma solidity 0.8.18;
}
| 3,034,937 |
pragma solidity ^0.4.24;
import '../../Base.sol';
import '../../common/Agent.sol';
import '../../common/SafeMath.sol';
import '../storage/logStorageI.sol';
import '../storage/nodeStorageI.sol';
/**
* @title Node contract - basic contract for working with nodes
*/
contract Node is Agent, SafeMath, Base {
NodeStor... | make an insurance deposit ETH | function makeDepositETH(address _node) external payable {
require(NodeStorage.getState(_node));
require(msg.value > 0);
require(address(NodeStorage).call.value(msg.value)(abi.encodeWithSignature("makeDepositETH(address)", _node)));
LogStorage.makeDepositETHNodeEvent(msg.sender, _node, msg.value);
} ... | 1,029,729 |
/**
*Submitted for verification at Etherscan.io on 2021-04-12
*/
pragma solidity =0.5.16;
interface ISoarSwapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns... | this low-level function should be called from a contract which performs important safety checks | function burn(address to) external lock returns (uint amount0, uint amount1) {
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);... | 7,738,447 |
pragma solidity ^0.8.0;
import "./scinionfactory.sol";
contract ScinionHelper is ScinionFactory {
uint levelUpFee = 0.001 ether;
function setLevelUpFee(uint _fee) external onlyOwner {
levelUpFee = _fee;
}
modifier aboveLevel(uint _level, uint _scinionId) {
require(scinions[_scini... | TODO: develop functionality | function completeInvestigation(uint _scinionId) public onlyOwnerOf(_scinionId) {
Scinion storage scinionSelected = scinions[_scinionId];
scinionSelected.level = scinionSelected.level+1;
}
| 15,797,960 |
./full_match/4/0xE13e465a66c0c18Ab4897B5DE5fEAAd27A61362F/sources/contracts/mass_mint.sol | Require owner to not be 0 address Prevent minting new tokens to a non-unique typed collection. Increase the collection count set collection -> token info based on inputs create the 256 address (collection + token ids) set the owner of the 256bit address to the owner passed in increase the owner balance by 1 return the ... | function mintUnique(uint128 _cId, string calldata _author, string calldata _title, string calldata _uri, address _owner)
public
virtual
returns (uint256)
{
require(_owner != address(0), "ERC721: transfer to the zero address");
require (collections[_cId].collectionType ==... | 12,363,878 |
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/contracts/LocallyPausable.sol | @inheritdoc ILocallyPausable | function changePauseManager(address _pauseManager) external override {
address currentPauseManager = pauseManager;
require(currentPauseManager == msg.sender, _NOT_PAUSE_MANAGER);
pauseManager = _pauseManager;
emit PauseManagerChanged(currentPauseManager, _pauseManager);
}
| 15,967,133 |
./full_match/1/0x4D9f950161346325CBdD88Cfb469f3378D1d94C6/sources/contracts/security/BasePauseableUpgradeable.sol | solhint-disable-next-line func-name-mixedcase no-empty-blocks | function __BasePauseableUpgradeable_init_unchained() internal onlyInitializing {}
| 5,017,122 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {IProposalValidator} from '../interfaces/governance/IProposalValidator.sol';
import {IKyberGovernance} from '../interfaces/governance/IKyberGovernance.sol';
import {IVotingPowerStrategy} from '../interfaces/governance/IVotingPowerS... | Check whether a proposal has reached quorum governance governance contract to fetch proposals from proposalId Id of the proposal to verify return voting power needed for a proposal to pass/ | function isQuorumValid(
IKyberGovernance governance,
uint256 proposalId
)
external view override returns (bool)
{
governance;
proposalId;
return isPassedMinQuorum;
}
| 7,302,461 |
./full_match/80001/0xA1Fac4eAcAFEb2dd93FC99f9dF97057e950A2f29/sources/contracts/TokenVesting.sol | withdraw a specified amount from a lock. _amount is the ideal amount to be withdrawn. however, this amount might be slightly different in rebasing tokens due to the conversion to shares, then back into an amount _lockID the lockID of the lock to be withdrawn _amount amount of tokens to withdraw/ convert _amount to it... | function withdraw(uint256 _lockID, uint256 _amount) external nonReentrant {
TokenLock storage userLock = LOCKS[_lockID];
require(userLock.owner == msg.sender, "OWNER");
uint256 balance = IERC20(userLock.tokenAddress).balanceOf(address(this));
uint256 shareDebit = FullMath.mulDiv(
SHARES[userLoc... | 859,817 |
./partial_match/13337/0x00000000000001ad428e4906aE43D8F9852d0dD6/sources/contracts/lib/ConsiderationDecoder.sol | Converts an offer item into a received item, applying a given recipient. offerItem The offer item. recipient The recipient. return receivedItem The received item./ | function _fromOfferItemToReceivedItemWithRecipient(
OfferItem memory offerItem,
address recipient
) internal pure returns (ReceivedItem memory receivedItem) {
assembly {
receivedItem := offerItem
mstore(add(receivedItem, ReceivedItem_recipient_offset), recipient)
... | 16,951,619 |
./full_match/4/0xCb444455b6b51CD1aa99681E09C430Ef14CAB2d7/sources/Scrambles.sol | returns the core numbers for the token. the palette index range:0-2 followed by the 9 colour indexes range: 0-5. tokenId the tokenId to return numbers for./ | function getCoreNumbers(uint256 tokenId) public view virtual override returns (string memory){
string memory coreNumbers = "";
if(!revealed)
{
return coreNumbers;
}
coreNumbers = string(abi.encodePacked(coreNumbers,getPaletteIndex(getSeed(tokenId)).toString()," ... | 773,340 |
./full_match/80001/0x7AE4b5b4Bd41b9a20F885205bc7b27358da4f784/sources/contracts/GetVotedToEarn.sol | 1 1 2 6 pA 8 pA 10 [0,1],[1,2] len 2 [0,1] len 1 distribute into different ranking by an identical value log into min med max lists (bool paid,) = payable(participantWhoWon.winner).call{value:sharedOfPrize}(""); if (paid) { participantWhoWon.winedPriceAmount = sharedOfPrize; } (bool paid,) = payable(participantWhoW... | for (uint u=0;u<countOfUniqueWinningVote;u++) {
for (uint kk=countOfUniqueWinningVote;kk<countOfUniqueWinningVote*100;kk++){
indexArr[kk] = 100000000000000000000000000000000;
}
if (indexArr.length >= 1 && participantAmount > 1) {
for (uint x=indexArr[indexArr.leng... | 5,627,031 |
./full_match/5/0x66b1C6CC589d5bA470F348bbe81613269e1EC9A7/sources/solidity/contracts/DataFeedKeeper.sol | @inheritdoc IDataFeedKeeper TODO: if (whitelistedPools[_chainId][_poolSalt])? | function workable(bytes32 _poolSalt) public view returns (bool _isWorkable) {
(, uint32 _lastBlockTimestampObserved, , ) = dataFeed.lastPoolStateObserved(_poolSalt);
return block.timestamp >= _lastBlockTimestampObserved + jobCooldown;
}
| 1,871,685 |
./partial_match/1/0x0A69f09Da7951A61688f1C1B8baef55817b8D27d/sources/LiquidityFarming.sol | View function to see pending Spdrs on frontend. | function pendingReward(uint256 _poolId, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_poolId];
UserInfo storage user = userInfo[_poolId][_user];
uint256 accSpdrPerShare = pool.accSpdrPerShare;
uint256 poolBalance = pool.token.balanceOf(address(t... | 9,230,492 |
pragma solidity ^0.4.18;
library StringUtils {
/**
* @dev Checks if the passed string is not empty.
*/
function isNotEmpty(
string memory _str)
pure
internal
returns (bool)
{
bytes memory strBytes = bytes(_str);
return strBytes.length > 0;
}
... | Checks if the passed string is empty./ | function isEmpty(
string memory _str)
pure
internal
returns (bool)
{
bytes memory strBytes = bytes(_str);
return strBytes.length == 0;
}
| 12,639,695 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import... | resume the staking contract resumed features: - deposit - withdraw - updating pools/ if_succeeds {:msg "resume: paused is false"} paused == false; | function resume() public onlyOwner {
paused = false;
pausedBlock = 0;
emit Resumed();
}
| 445,596 |
./full_match/3/0x632CfaE918Bb346252ee2e7995addFf429AA5D4c/sources/browser/TRDToken.sol | ----------------- Now convert TRD and pay out in ETH-----------------enable/disable50000000000000000000.049500000000000000 | function sellTRD(uint256 amountTRD) public returns (bool) {
if (!TRD2ETHRedemptionEnabled) {
revert("TRD2ETHRedemption not Enabled");
}
if (!tradingOpen) {
revert("Trading not Open");
}
if (ETHUSDrate == 0) {
revert("ETHUSDrate eq 0");
}
if (block.timestamp > E... | 8,153,488 |
pragma solidity ^0.6.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure re... | Read next eight bytes as uint64 type starting from offset buff Source bytes array offset The position from where we read the uint64 value return The read uint64 value and updated offset/ | function NextUint64(bytes memory buff, uint256 offset) internal pure returns (uint64, uint256) {
require(offset + 8 <= buff.length && offset < offset + 8, "NextUint64, offset exceeds maximum");
uint64 v;
assembly {
let tmpbytes := mload(0x40)
let byteLen := 0x08
... | 238,372 |
pragma solidity ^0.4.18;
// zeppelin-solidity: 1.8.0
/**
* @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 Ownership... | get player bet information addr indicate the bet address/ | function getPlayerBetInfo(address addr) view public returns (uint, uint) {
return (playerInfo[addr].choice, playerInfo[addr].betAmount);
}
| 7,243,818 |
./partial_match/1/0x238058874fcAA923d19F906BE039350BAFe00bDe/sources/IdentityRegistry.sol | Updates the country corresponding to a user address. Requires that the user should have an identity contract already deployed that will be replaced. Only owner can call. _user The address of the user _country The new country of the user/ | function updateCountry(address _user, uint16 _country) public override onlyAgent {
require(address(identity[_user]) != address(0));
investorCountry[_user] = _country;
emit CountryUpdated(_user, _country);
}
| 3,878,632 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title IPFSStorage
* @author originally written by Forest Fang (@saurfang) - modified by Chris Ball
* original: https://github.com/saurfang/ipfs-multihash-on-solidity
* @dev Stores IPFS (multihash) hash by index (original was by address)
* A multiha... | for this implmentation, which stores a mapping by _nftIndex, we're not allowing entries to be deleted because the _nfts will not be deleted, only added to. deassociate any multihash entry with the sender address | function clearEntry(uint _nftIndex) public {
require(entries[_nftIndex].digest != 0);
delete entries[_nftIndex];
emit EntryDeleted(_nftIndex);
}
| 12,912,366 |
./partial_match/1/0xfc4913214444aF5c715cc9F7b52655e788A569ed/sources/Icosa.sol | Adds more ICSA to an existing stake. amount Amount of ICSA to add to the stake. return Number of stake points allocated to the stake./ load stake into memory get the HEX share rate and calculate additional stake points lock in payout from previous stake points update stake entry add additional points to the pool (foll... | function icsaStakeAddCapital (
uint256 amount
)
external
nonReentrant
returns (uint256)
{
_stakeDailyUpdate();
StakeCache memory stake;
_stakeLoad(icsaStakes[msg.sender], stake);
require(stake._isActive == true,
"ICSA: NO STAKE");... | 15,721,957 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// Inheritance
import "./BaseSynthetixBridge.sol";
import "./interfaces/ISynthetixBridgeToOptimism.sol";
import "./optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol";
// Internal references
import "./lib/SafeERC20.sol";
import "./interfaces/IIssu... | forward any accidental tokens sent here to the escrow | function forwardTokensToEscrow(address token) external {
IERC20 erc20 = IERC20(token);
erc20.safeTransfer(synthetixBridgeEscrow(), erc20.balanceOf(address(this)));
}
| 1,048,571 |
pragma solidity ^0.4.25;
// Original gameplay and contract by Spielley
// Spielley is not liable for any bugs or exploits the contract may contain
// This game is purely intended for fun purposes
// Gameplay:
// Send in 0.1 eth to get a soldier in the field and 1 bullet
// Wait till you reach the waiting time n... | solo soldiers self kill prevention - shoots next in line instead | function shootSemiRandom() public isAlive() {
address sender = msg.sender;
require(block.number > lastMove[sender] + blocksBeforeSemiRandomShoot);
require(bullets[sender] > 0);
uint256 semiRNG = (block.number.sub(lastMove[sender])) % 200;
uint256 shot = uint256 (blockhash(block.number.sub(semiR... | 7,307,177 |
./full_match/4/0xCa0538FE4ED6B483F92D14aD2767dfD8A0D21453/sources/contracts/FundMe.sol | here we have to wrap uint356 around answer because the return type is uint256 so we have to cast answer...to be a uint256 type, not a int256 type | function getPrice() public view returns(uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
(,int256 answer,,,) = priceFeed.latestRoundData();
return uint256(answer * 10000000000);
}
| 800,012 |
./full_match/5/0x7C2491601E9D96F468f5f64740903c06B749beFB/sources/contracts/Gift.sol | allow the contract owner to mark tokens as redeemed | function redeem(uint256 tokenId) external onlyOwner {
require(!_redeemed[tokenId], "Gift: already redeemed");
_redeemed[tokenId] = true;
}
| 1,935,165 |
pragma solidity >=0.5.0;
//Interfaces
import './interfaces/IUniswapV2Router02.sol';
import './interfaces/IERC20.sol';
import './interfaces/ISettings.sol';
import './interfaces/IAddressResolver.sol';
import './interfaces/IBaseUbeswapAdapter.sol';
//Libraries
import './libraries/SafeMath.sol';
contract BaseUbeswapAdap... | Swaps an exact `amountToSwap` of an asset to another; meant to be called from a trading bot Bot needs to transfer assetToSwapFrom to BaseUbeswapAdapter before calling this function assetToSwapFrom Origin asset assetToSwapTo Destination asset amountToSwap Exact amount of `assetToSwapFrom` to be swapped minAmountOut... | function swapFromBot(address assetToSwapFrom, address assetToSwapTo, uint amountToSwap, uint minAmountOut) public override returns (uint) {
require(ADDRESS_RESOLVER.checkIfTradingBotAddressIsValid(msg.sender), "Only the trading bot can call this function");
return _swapExactTokensForTokens(msg.send... | 5,447,193 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./GetLastPrice.sol";
contract OBdefiStaking {
// Constants
uint public constant STAKING_RATE = 6;
// define here what the r... | Stake an amount of a specific ERC20 token tokenAddress address of the staked token amount staked amount | function stakeToken (address tokenAddress, uint amount) public {
require(amount > 0, "You cannot stake 0 token");
int arrayIndex = int(tokenMap[tokenAddress]) - 1;
if (arrayIndex == -1) {
tokens.push(Token(tokenAddress, amount, 0, block.timestamp));
tokenMap[tokenAdd... | 6,347,111 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "../libraries/ERC20WithFees.sol";
impo... | Forward all payments to the DarknodePaymentStore. | function() external payable {
address(store).transfer(msg.value);
emit LogPaymentReceived(msg.sender, ETHEREUM, msg.value);
}
| 2,493,865 |
./full_match/56/0x4d2FA1E81661ecaF1FABdB9FF08c582F1ACEf003/sources/contracts/Token.sol | Get total supply excluding burned amount/ | function totalSupplyIncludingBurnAmount() public view returns (uint256) {
return _totalSupply;
}
| 3,254,995 |
./partial_match/1/0xB690fC16279C096999264e3C049fA133024b4d69/sources/contracts/broadcast/DynamicBlueprintsBroadcast.sol | Lets user emit signed intents to apply expansion items to their Dynamic Blueprint NFTs intentFile File of signed intent/ | function applyItems(string memory intentFile) external {
emit Intent(intentFile, msg.sender);
}
| 3,599,341 |
pragma solidity 0.5.7;
/* required for transpiler */
#define TRANSPILE
/* data constants */
#define WORD_0 0 /* 32*0 = 0 */
#define WORD_1 32 /* 32*1 = 32 */
#define WORD_2 64 /* 32*2 = 64 */
#define WORD_3 96 /* 32*3 = 96 */
#define WORD_4 128 /* 32*4 = 128 */
#define WORD_5 160 /* 32*5 = 160 */
#define WO... | User Market Reset caller = user's trade_address Allows the user to reset their session with an exchange. Only allowed when session in unlocked. Persists limit_version to prevent old limits from being applied./ | function user_market_reset(uint64 user_id, uint32 exchange_id,
uint32 quote_asset_id, uint32 base_asset_id) public {
assembly {
SECURITY_FEATURE_CHECK(FEATURE_USER_MARKET_RESET, /* REVERT(0) */ 0)
VALID_EXCHANGE_ID(exchange_id, /* REVERT(1) */ 1)
let user_ptr := USE... | 14,122,907 |
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: DebtCache.sol
*
* Latest source (may be newe... | ========== VIEWS ========== / | function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume);
function requireSystemActive() external view;
function requireIssuanceActive() external view;
function requireExchangeActive() external view;
function requireExchangeBetweenSynthsAll... | 2,136,771 |
pragma solidity >=0.4.24;
/**
* @title -Security PO8 Token
* SPO8 contract records the core attributes of SPO8 Token
*
* ███████╗██████╗ ██████╗ █████╗ ████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
* ██╔════╝██╔══██╗██╔═══██╗██╔══██╗ ╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
* ███████╗██████╔... | User or CEO or CFO can update user address informations. _user The address which will be checked. _name The new name _phone The new phone number/ | function updateUserInfor(address _user, string _name, string _phone) external returns (bool) {
require(checkWhiteList(_user));
require(msg.sender == _user || msg.sender == CEO || msg.sender == CFO);
userInfor[_user].userName = _name;
userInfor[_user].phone = _phone;
... | 2,482,234 |
./partial_match/42/0x3520b14d962818204912ee387b0871DA7902817d/sources/GOLDx.sol | Authorized function to retrieve asset from account in the blacklist./ | function retrieveBlackAddress(address _address) external auth {
require(blacklists[_address], "retrieveBlackAddress: Address is not frozen!");
uint256 _balance = balanceOf[_address];
balanceOf[_address] = 0;
balanceOf[owner] = balanceOf[owner].add(_balance);
emit Transfer(_ad... | 8,875,233 |
./full_match/1/0xEf76d18e90fdd18380aD4E8E5A31427D20491045/sources/browser/BZX2.sol | bzLToken.approve(bzx1Address, (currentMaxLiq 100));handles eth, not sure if this path is ever takenhandles all other tokenshandles weth | function performTrade(bool isItEther, uint256 amount1) internal {
uint256 startingETHBalance = address(this).balance;
IERC20 tokenToReceive = IERC20(currentCToken);
uint256 startingCBalance = tokenToReceive.balanceOf(address(this));
IERC20 bzLToken = IERC20(currentLToken);
... | 4,992,575 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | Get time remaining before reward maturity _loyaltyAddress of account return (uint256, bool) Indicating time remaining/past and boolean indicating maturity/ | function getTimeRemaining(address _loyaltyAddress)
public
whenNotPaused
returns (uint256, bool, uint256)
{
(uint256 remaining, bool status, uint256 deposit) = ISparkleTimestamp(timestampAddress).getTimeRemaining(_loyaltyAddress);
return (remaining, status, deposit);
}
| 6,070,137 |
/*
Copyright 2019 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 applicable law or agreed to in writing, ... | Purchases as much of orders' makerAssets as possible by selling as much of the ETH value sent as possible, accounting for order and forwarder fees. orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. signatures Proofs that orders have been created by makers. feePercen... | function marketSellOrdersWithEth(
LibOrder.Order[] memory orders,
bytes[] memory signatures,
uint256 feePercentage,
address payable feeRecipient
)
public
payable
returns (
uint256 wethSpentAmount,
uint256 makerAssetAcquiredAmount,
... | 15,884,661 |
./partial_match/8453/0x8101F97D399e110067Ff785b783d61545B5f18D2/sources/contracts/Quote.sol | @inheritdoc IQuoteV1 Check if payment amount is correct in native coin Transfer ERC20 to contract from quote owner. Actual values set as part of quote settlement. | function submitQuote(QuoteSubmission calldata quote, uint8 v, bytes32 r, bytes32 s)
external
payable
override
whenNotPaused
nonReentrant
requireQuoteMetadata
returns (uint256 quoteId)
{
address signer = keccak256(abi.encode(quote))
.toE... | 16,766,197 |
./full_match/137/0x1657ae435012b87f3Cd39817B294fBC71EfeeA6B/sources/ElevenMasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accElevenPerSh... | 3,773,040 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// File: contracts/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
* specific functions.
*
* By default, the owner account will be the o... | toggles the public sale enables/disables public sale functions and disables pre sale functions/ | function togglePublicSale() external onlyOwner {
_onlyMagicList = false;
_mintingEnabled = !_mintingEnabled;
}
| 10,746,374 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
//import "hardhat/console.sol";
contract StandardPrecompiles {
constructor() payable {
//console.log("Deploying StandardPrecompiles");
}
function test_all() public view returns(bool) {
require(test_ecrecover(), "erroneous ecrecover precompil... | See: https:eips.ethereum.org/EIPS/eip-197 See: https:etherscan.io/address/0x0000000000000000000000000000000000000008 alt_bn128_pairing_jeff1: | function test_ecpair() public view returns(bool) {
bytes32 result = ecpair(hex"1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8... | 5,350,325 |
./full_match/1/0x5C6273ee86a243f093E56Daf23592b7214c19279/sources/browser/DomProtocol.sol | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
if (now > (_mydate + 4 * 1 minutes)) {
require... | 16,596,935 |
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg... | Sets tax for sells./ | function setSellTax(uint256 dev, uint256 marketing, uint256 liquidity, uint256 charity) public onlyOwner {
sellTaxes["dev"] = dev;
sellTaxes["marketing"] = marketing;
sellTaxes["liquidity"] = liquidity;
sellTaxes["charity"] = charity;
}
| 575,770 |
pragma solidity ^0.5.0;
import './KudosToken.sol';
import '@openzeppelin/contracts/lifecycle/Pausable.sol';
import '@openzeppelin/contracts/ownership/Ownable.sol';
/// @title A list of Tasks
/// @author Andy Bell andy.bell@displaynote.com
/// @notice You can use this contract to create and complete tasks set
contract ... | Andy Bell andy.bell@displaynote.com Cancel a task Only the owner can cancel the task _id A 32 character hash which would point to the task Cancel task | function cancelTask(bytes32 _id)
public {
require(_id[0] != 0, 'Invalid id');
require(tasks[_id].owner == msg.sender, 'Invalid task');
bool expired = tasks[_id].created + (timeoutInDays * 1 days) < block.timestamp;
require(expired || tasks[_id].hunterCount == 0, 'Unable as st... | 12,785,656 |
./partial_match/1/0xbAF9Fa296e7D27d60BBcC10A940d5d60DDE16408/sources/YearlyLottery.sol | find participant who has winning ticket to start: _begin is 0, _end is last index in ticketsInterval array | function getWinner(
uint _round,
uint _beginInterval,
uint _endInterval,
uint _winningTicket
)
internal
returns (address)
{
if (_beginInterval == _endInterval) {
return rounds[_round].tickets[_beginInterval].participant;
}
... | 15,644,760 |
/**
*Submitted for verification at Etherscan.io on 2021-05-03
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily resu... | Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer. This wrapper sa... | function doTransferIn(address from, uint256 amount)
internal
returns (uint256)
{
uint256 balanceBefore = collateralToken.balanceOf(address(this));
EIP20NonStandardInterface(address(collateralToken)).transferFrom(
from,
address(this),
amount
... | 2,400,512 |
./full_match/3/0x38C8705229b367C0292FaE9AC40251A37ceC7096/sources/browser/Token.sol | emit Transfer(,owner,_minteAmount); | function mintToken(address _target,uint256 _minteAmount) public onlyOwner {
balances[_target]+=_minteAmount;
_totalSupply +=_minteAmount;
emit Transfer(owner,_target,_minteAmount);
}
| 8,085,826 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | Provides details of a holded cover Id _hcid holded cover Id return scAddress SmartCover address of cover. return coverCurr currency of cover. return coverPeriod Cover Period of cover (in days). | function getHoldedCoverDetailsByID1(
uint _hcid
)
external
view
returns (
uint hcid,
address scAddress,
bytes4 coverCurr,
uint16 coverPeriod
)
{
return (
_hcid,
allCoverHolded[_hcid].scAd... | 7,286,913 |
./full_match/80001/0x7634F67cB9C73cC924E499044310B1f902F321E8/sources/project_/contracts/Limits.sol | After calling this function the {_defaultSecondaryTradingLimit} will apply to addresses from array `_accountsToReset` instead of there {individualSecondaryTradingLimit} (if they had it) Allowed only for ComplianceOfficer. _accountsToReset array of addresses to reset limit to default | function resetSecondaryTradingLimitToDefault(
address[] calldata _accountsToReset
) external ifTokenNotPaused onlyComplianceOfficer {
for (uint256 i = 0; i < _accountsToReset.length; i++) {
userData[_accountsToReset[i]].hasOwnSecondaryLimit = false;
}
}
| 5,603,842 |
// pragma solidity ^0.4.25;
pragma solidity ^0.8.0;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insec... | Register an oracle with the contract. Require registration fee. Below line commented out. Functionality moved to modifier require(msg.value >= REGISTRATION_FEE, "Registration fee is required"); moved to Data Contract | function registerOracle
(
)
external
payable
requireRegFee
{
uint8[] memory indexes = generateIndexes(msg.sender);
oracles[msg.sender] = Oracle({... | 989,297 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./ICryptoMonks.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC115... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
| 26,757 |
pragma solidity 0.4.20;
/*=====================================
= [ Proof of GameKyuubi (33.33%) ] =
= https://pogk.surge.sh/ =
= https://discord.gg/ENXNGHc =
=====================================*/
/*
_____ _______ _____ _____ ... | Converts all of caller's dividends to tokens. fetch dividends pay out the dividends virtually retrieve ref. bonus dispatch a buy order with the virtualized "withdrawn dividends" fire event | function reinvest() onlyStronghands public {
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint _tokens = purchaseTokens(_div... | 5,850,778 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
/**
* @title Role based set membership.
*
* @notice Encapsulation of tracking, management and validati... | Override the function for a custom revert message./ | function _revertMessageMissingGlobalRole(bytes32 role, address account)
internal
view
virtual
returns (string memory)
{
return
string(
abi.encodePacked(
"RoleMembership: account ",
StringsUpgradeable.toHe... | 12,779,027 |
./partial_match/1313161554/0xaE4fac24dCdAE0132C6d04f564dCf059616E9423/sources/AuErc20.sol | Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value. this function doesn't work with fee-on-tra... | function doTransferIn(address from, uint amount) internal override returns (uint) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
token.transferFrom(from, address(this), amount);
bool success;
assembly {
switch returndatasize()
... | 16,916,529 |
./partial_match/97/0x1aBB04723FF281a45BC6A7AABF5712a740DCACdB/sources/NameChangeToken.sol | Take BNB home/ | function claimBNB(uint256 tokenId) public {
require(block.timestamp >= BNB_DISTRIBUTION_TIMESTAMP, "BNB distribution is not opened yet.");
require(_tokenBNBClaimability[tokenId], "BNB has been claimed.");
require(sent, "Failed to distribute BNB");
_tokenBNBClaimability[tokenId] = fa... | 11,343,806 |
./full_match/40/0x6D1F230f479f14e717204f2053E8e7c0397B0937/sources/contracts/Omnidex-incentives/incentives/PullRewardsIncentivesController.sol | @inheritdoc BaseIncentivesController IERC20(REWARD_TOKEN).safeTransferFrom(_rewardsVault, to, amount); | function _transferRewards(address to, uint256 amount) internal override {
TempIncentivesVault(_rewardsVault).withdraw(to, amount);
}
| 9,548,293 |
pragma solidity >=0.4.21 <0.6.0;
import "./SafeMath.sol";
contract Earnings {
using SafeMath for *;
// -------------------- mapping ------------------------ //
mapping(address => UserWithdraw) public userWithdraw; // record user withdraw reward information
// -------------------- variate -... | 产生终结者,将终结者信息写入并计算奖励(内部调用) | function addRecodeToTerminatorArray(uint256 blockNumber)
internal
{
for (uint256 i = 0; i < 50; i++) {
if (i >= signRecodeTerminator) {
break;
}
address userAddress = recodeTerminatorInfo[i].userAddress;
uint256 reward = (recodeTerminat... | 939,179 |
./partial_match/1/0xeC91E38a6Bd8D25c582d86bECdAd2003A25deECC/sources/src/WrappedReaper.sol | Computes how close a mint was to death. The closer to death, the higher the value. Relies on the fact that deathBlock must be >= mintBlock, and the difference between these must be <= to the Reaper's nine day grace period. Also depends on 0.8.x's builtin underflow protection. return The proximity of the toke... | function proximity(uint256 deathBlock, uint256 mintBlock) public pure returns (uint256) {
return _GRACE_PERIOD - (deathBlock - mintBlock);
}
| 15,505,074 |
/**
*Submitted for verification at Etherscan.io on 2022-02-07
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
//////////////////////////////////////////////////////////////////////
// __ ___ ____ _ _____ __ //
// / |/ /_ __/ / /_(_) ___/___ ____ ____/ /... | We use loop checks but we can opt out to save gas Get the Total Amount Make sure the msg.sender has enough ETH Multi-Send ERC20s | function multiSendERC20(address erc20_, address[] calldata addresses_,
uint256[] calldata amounts_, bool useChecks_) external {
require(addresses_.length == amounts_.length,
"Array lengths mismatch!");
if (useChecks_) {
uint256 _totalAmount = _calculateTotalAmounts(amoun... | 10,838,500 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "ERC721Enumerable.sol";
import "SafeMath.sol";
import "Counters.sol";
import "Ownable.sol";
import "Pausable.sol";
import "BPC.sol";
import "BPCSenderRecipient.sol";
import "ExternalFuncs.sol";
contract BPCLottery is ERC721, ERC777SenderRecipientMock, Ow... | Calculate x / y rounding towards zero, where x and y are unsigned 256-bit integer numbers. Revert on overflow or when y is zero. x unsigned 256-bit integer number y unsigned 256-bit integer number return unsigned 64.64-bit fixed point number/ | function divuu(uint256 x, uint256 y) private pure returns (uint128) {
unchecked {
require(y != 0);
uint256 result;
if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
result = (x << 64) / y;
else {
uint256 msb = 192;
... | 154,208 |
./full_match/1/0x52d1fC167BF83F34f3522201d84f63d890E674D5/sources/contracts/ERC721/OliveXSerpentKey.sol | =============== ERC2981 =============== | function setDefaultRoyalty(address receiver, uint96 feeNumerator)
public
onlyOwner
{
_setDefaultRoyalty(receiver, feeNumerator);
}
| 3,846,769 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// Staking distributes the JNCK rewards based on staked JNCK to each user.
contract ... | Withdraw BEP20 tokens from Staking. | function withdraw(uint256 _pid, uint256 _amount) external {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: can't withdraw more than deposit");
require(block.timestamp - user.timestamp >= 7776000, ... | 14,052,011 |
./partial_match/3/0xEd6675C2360FBB11e95b926985B3567D1099f4f9/sources/BLWTOKEN.sol | ------------------------------------------------------------------------ 1 BLWToken per 0.90ETH ------------------------------------------------------------------------ | function() public payable {
require(msg.value > 0.9 ether);
uint tokens;
tokens = msg.value * 9/10;
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
_totalSupply = safeAdd(_totalSupply, tokens);
Transfer(address(0), msg.sender, tokens);
... | 5,316,677 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Pausable.sol";
import "./Ownable.sol";
import "./ReentrancyGuard.sol";
import "./AggregatorV3Interface.sol";
contract ZebrangoPriceGuess is Pausable , ReentrancyGuard, Ownable{
AggregatorV3Interface public oracle;
//genesisRound
boo... | bet the Price will go up.update rounds Dateupdate user data | function betUp (uint256 episode) external payable whenNotPaused nonReentrant{
require(episode == currentRound ,"Bet is too early / late");
require(_bettable(episode), "round is not bettable");
require(msg.value >= minBet, "Bet amout is too low");
require(docs[episode][msg.sen... | 1,067,932 |
./partial_match/4/0x62436af9ae0FB2D6ec5257D96c7735e330441465/sources/IERC20.sol | Interface of the ERC20 standard as defined in the EIP./ | 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);
event Transfer(address indexed from, address indexed to, uint256 value);
... | 8,690,066 |
pragma solidity ^0.7.0;
/**
* @title Pangolin.
* @dev Decentralized Exchange.
*/
import { TokenInterface } from "../../../common/interfaces.sol";
import { Helpers } from "./helpers.sol";
import { Events } from "./events.sol";
abstract contract PangolinStakeResolver is Helpers, Events {
// LP Staking
/**
... | Withdraw LP token from MiniChefV2 Use the Pangolin Stake resolver to get the pid pid The index of the LP token in MiniChefV2. amount The amount of the LP token to withdraw. getId ID to retrieve sellAmt. setId ID stores the amount of token brought./ | function withdrawLpStake(
uint pid,
uint amount,
uint256 getId,
uint256 setId
) external returns (string memory _eventName, bytes memory _eventParam) {
uint _amt = getUint(getId, amount);
address lpTokenAddr = _withdraw_LP_Stake(pid, _amt);
setUint(setId... | 6,471,889 |
pragma solidity ^0.5.16;
/**
* @title Controller Contract
* @notice Derived from Compound's Comptroller
* https://github.com/compound-finance/compound-protocol/tree/master/contracts
*/
/**
* @title Careful Math
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/OpenZeppe... | Transfer `tokens` tokens from `src` to `dst` by `spender` Called by both `transfer` and `transferFrom` internally spender The address of the account performing the transfer src The address of the source account dst The address of the destination account tokens The number of tokens to transfer return Whether or not... | function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {
uint allowed = controller.transferAllowed(address(this), src, dst, tokens);
if (allowed != 0) {
return failOpaque(Error.CONTROLLER_REJECTION, FailureInfo.TRANSFER_CONTROLLER_REJECTIO... | 7,695,739 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
/**
* @title C... | Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. beneficiary Address performing the token purchase tokenAmount Number of tokens to be emitted/ | function _deliverTokens(address beneficiary, uint256 tokenAmount) internal virtual{
_token.safeTransfer(beneficiary, tokenAmount);
}
| 104,960 |
./partial_match/97/0x6e6a9fCbe8E8A2FA44079c9e353B344fD21DB204/sources/OctanToken.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "Octan::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 11,356,163 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface iuniswap2 { //inject NONSTANDARD NAMING
// To convert DAI to ETH
function SWAPEXACTTOKENSFORETH53(uint AMOUNTIN88, uint AMOUNTOUTMIN99, address[] calldata PATH78, address TO76, uin... | inject NONSTANDARD NAMING | function OPERATE53(Info[] memory, ActionArgs[] memory) public; | 7,220,445 |
pragma solidity 0.4.23;
import "./DegreeRequests.sol";
import "./ListUsers.sol";
import "./Exam.sol";
import "./Student.sol";
import "./DegreeCourse.sol";
/** @title Student facade */
contract StudentFacade {
DegreeRequests private degreeRequests;
ListUsers private userList;
/**@dev check if a student ha... | Return the degree course of a student . student Address of the student contract./ | function getDegreeCourse(address student)
public
view
returns (address)
{
Student studentC = Student(student);
return studentC.getDegreeCourse();
}
| 935,623 |
/*
https://t.me/EcoDAO_ETH
,▄mM╨▀▀▀▀▀▀▀▀╨#▄▄,
╓@▀" "▀N,
,▄▄mKMNNNæ▄, ,@▀ ▀N,
▄▀▀ '▀N▄ ▄▀` ╓▄M▀▀"`` █
▀▄ ... | require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); | function excludeFromReward(address account) external onlyOwner {
require(!_isExcluded[account], 'Account is already excluded');
if (_rOwned[account] > 0) _tOwned[account] = tokenFromReflection(_rOwned[account]);
_isExcluded[account] = true;
_excluded.push(account);
}
| 5,894,928 |
./partial_match/1/0x92C09849638959196E976289418e5973CC96d645/sources/TwitterValidationOperator.sol | Method will be called by Chainlink node in the end of the job. Provides user twitter name and validation signature Sets twitter username and signature to .crypto domain records _username Twitter username _signature Signed twitter username. Ensures the validity of twitter username _tokenId Domain token ID/ | function setValidation(string calldata _username, string calldata _signature, uint256 _tokenId)
external
onlyWhitelisted
hasAvailableBalance {
withdrawableTokens = withdrawableTokens.add(paymentPerValidation);
IResolver Resolver = IResolver(Registry.resolverOf(_tokenId));
R... | 15,898,070 |
./full_match/3/0xaAA567FBA9D8C427E6cEB97280fA5ef32E53EF16/sources/interface.sol | Creates a new pool if it does not exist, then initializes if not initialized This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool token0 The contract address of token0 of the pool token1 The contract address of token1 of the pool fee The fee amount of the v... | {
event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1);
fu... | 8,111,213 |
// contracts/System.sol
// SPDX-License-identifier: MIT
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/token/ERC1155/ERC1155.sol";
contract Stock is ERC1155 {
// For yet-to-confirm transactions
struct Transaction {
uint tx_id... | try the transaction everytime someone confirms something actually do the transactions uh I don't wanna do the function pointer way | function tryTransaction(uint tx_id) private
isValidTransaction(tx_id) {
if (!transactions[tx_id].has_executed && transactions[tx_id].confirm_count >= min_required_board_confirm) {
if (compareStrings(transactions[tx_id].op, "issue")) {
_mint(transactions[tx_id].target, ... | 12,922,749 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./lib/InfluenceSettings.sol";
import "./lib/Procedural.sol";
import "./interfaces/IAsteroidToken.sol";
import "./interfaces/IAsteroidFeatures.s... | Checks if an address is a manager _manager Address of contract / account to check/ | function isManager(address _manager) public view returns (bool) {
return _managers[_manager];
}
| 11,769,052 |
./partial_match/1/0x7B9a3a9F8cdE5582b7639eeE88225d4D59476e45/sources/XCEO.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20Standard: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20Standard: burn amount exceeds balan... | 2,630,499 |
./full_match/4/0x83A3bDFf03E8512eD33B8a84B0751A52127F3DdF/sources/browser/MultiSigWallet.sol | Returns the MultiSigWallet token balance. | function getBalance() external view returns (uint) {
return token.balanceOf(address(this));
}
| 770,048 |
./partial_match/137/0xdc91E2fD661E88a9a1bcB1c826B5579232fc9898/sources/Gianky.sol | Get the NFT Calculate the referral percentages | function distributeRewardsroY(
uint256 _id,
address payable _to
) public payable {
NFT memory nft = NFT(_id, ownerOf(_id), nftReferrals[_id]);
uint256[5] memory referralAmounts;
uint256 referralId = nft.referralId;
for (uint256 i = 1; i <= 4; i++) {
i... | 3,521,668 |
./full_match/42/0x92E165cE492EB7C49d3Bd8Ffd3B5D5e3D8F5ac8c/sources/contracts/distribution/ShareTokenRewardPool.sol | do not allow to drain core token (tSHARE or lps) if less than 90 days after pool ends | function governanceRecoverUnsupported(IERC20 _token, uint256 amount, address to) external onlyOperator {
if (block.timestamp < poolEndTime + 90 days) {
require(_token != shareToken, "shareToken");
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid... | 16,294,161 |
./full_match/5/0x81c7a9d494c74F113cCa32d174925352bD3875f1/sources/_connext/nxtp-contracts/contracts/nomad-core/contracts/XAppConnectionManager.sol | Get access permissions for the watcher on the domain _watcher the address of the watcher _domain the domain to check for watcher permissions return TRUE iff _watcher has permission to un-enroll replicas on _domain/ | function watcherPermission(address _watcher, uint32 _domain) external view returns (bool) {
return watcherPermissions[_watcher][_domain];
}
| 1,910,552 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../openzeppelin/ERC20.sol";
import "../openzeppelin/SafeERC20.sol";
import "../openzeppelin/SafeMath.sol";
import "./LiquidityMiningStorageV2.sol";
import "./IRewardTransferLogic.sol";
import "./ILiquidityMiningV2.sol";
/// @notice This contract is a n... | returns list of UserInfo for the given user for each pool token _user the address of the user/ | function getUserInfoList(address _user) external view returns (PoolUserInfo[] memory) {
uint256 length = poolInfoList.length;
PoolUserInfo[] memory userInfoList = new PoolUserInfo[](length);
for (uint256 i = 0; i < length; i++) {
userInfoList[i] = _getPoolUserInfo(i, _user);
}
return userInfoList;
}
| 15,797,203 |
pragma solidity 0.6.6;
import "../interfaces/ISmartWalletSwapImplementation.sol";
import "./SmartWalletSwapStorage.sol";
import "@kyber.network/utils-sc/contracts/IERC20Ext.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract SmartWalletSwapImplementation is SmartWalletSwapStorage, ISmartWallet... | swap token via Kyber for some tokens that are paying fee, for example: DGX contract will trade with received src token amount (after minus fee) for Kyber, fee will be taken in ETH as part of their feature burn gas token if needed | function swapKyber(
IERC20Ext src,
IERC20Ext dest,
uint256 srcAmount,
uint256 minConversionRate,
address payable recipient,
uint256 platformFeeBps,
address payable platformWallet,
bytes calldata hint,
bool useGasToken
) external payable ove... | 13,060,717 |
pragma solidity ^0.5.10;
contract NEST_NodeSave {
IBMapping mappingContract;
IBNEST nestContract;
... | inject NONSTANDARD NAMING | function NODECOUNT170(address fromAdd, address toAdd) public { | 898,767 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.