file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.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 re... | Set the new operator for minting sdToken _operator operator address | function setSdTokenOperator(address _operator) external {
require(msg.sender == governance, "!auth");
ISdToken(minter).setOperator(_operator);
emit SdTokenOperatorChanged(_operator);
}
| 1,563,676 |
// 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... | Update reward variables of the given pool to be up-to-date. | function updatePool() public {
if (block.number <= lastRewardBlock || isMigrateComplete == 1) {
return;
}
if (totalSupply() == 0) {
lastRewardBlock = block.number;
return;
}
uint256 sakeBalance = sake.balanceOf(address(this));
uint... | 7,777,372 |
./partial_match/3/0x7c1051042268Ac634aEE7429180fe08CE253D4E0/sources/Creature.sol | function mintTo(address _to, uint256 _numOfTokens) public onlyOwner { | function mintTo(address _to, uint256 _numOfTokens) public {
for (uint256 i = 0; i < _numOfTokens; i++) {
uint256 newTokenId = _getNextTokenId();
_mint(_to, newTokenId);
_incrementTokenId();
}
}
| 5,310,692 |
./full_match/5/0x1f85B789655fB4c3CEB448C2733B6b1e387867E0/sources/project_/contracts/extensions/TokenExtension.sol | The ERC1820 interface label the extension will be registered as in the ERC1820 registry/ | function interfaceLabel() external view override returns (string memory) {
return _interfaceLabel;
}
| 11,602,557 |
pragma solidity 0.5.17;
import "./ERC721Token.sol";
import "./ERC20Interface.sol";
import "./Freezable.sol";
/**
* @title Base ERC721 token
* @author Prashant Prabhakar Singh [[email protected]]
* This contract implements basic ERC721 token functionality with bulk functionalities
*/
contract BaseERC721 is ERC721T... | Burn an existing NFT _id Id of NFT to be burned/ | function burn(uint _id)
public
noEmergencyFreeze
returns (bool)
{
super._burn(msg.sender, _id);
return true;
}
| 1,529,739 |
pragma solidity ^0.5.7;
/// @title DaiDaddy 2.0: Pay back your debt by unwinding your CDP
/// @author Chris Maree
import "./SaiTubInterface.sol";
import "./MedianizerInterface.sol";
import "./KyberNetworkProxyInterface.sol";
import "./ERC20Interface.sol";
contract Unwinder {
// constants
uint256 SAFE_NO_LIQU... | the per value stores the weth to peth ratio in the maker contracts.this is scaled by 10^27 so by devided by 10^9 get ouput wp ratio 10^18 | function getWpRatio() public view returns (uint256) {
return saiTubContract.per() / (10**9);
}
| 6,455,179 |
./full_match/42161/0x9C3557204b93Ef8f050Ac748bba953249E801d10/sources/src/Airdrop.sol | _token ERC20 token to airdrop _recipients list of recipients _amounts list of amounts to send each recipient _total total amount to transfer from caller/ bytes selector for transferFrom(address,address,uint256) bytes selector for transfer(address,uint256) store transferFrom selector store caller address store addres... | function airdropERC20(
IERC20 _token,
address[] calldata _recipients,
uint256[] calldata _amounts,
uint256 _total
) external {
bytes4 transferFrom = 0x23b872dd;
bytes4 transfer = 0xa9059cbb;
assembly {
let transferFromData := add(0x20, mload(0... | 16,309,019 |
/*
Copyright 2018 CoinAlpha, 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 writing, ... | BasketEscrow constructor _basketRegistryAddress Address of basket registry _transactionFeeRecipient Address to send transactionFee _transactionFee Transaction fee in ETH percentage | function BasketEscrow(
address _basketRegistryAddress,
address _transactionFeeRecipient,
uint _transactionFee
) public {
basketRegistryAddress = _basketRegistryAddress;
basketRegistry = IBasketRegistry(_basketRegistryAddress);
transactionFeeRecipient = _transactionFeeRecipient;
... | 5,491,141 |
./full_match/42220/0xe18033a1e93b3B516A2671c29631136E1fC68A78/sources/D/wannaswap/wannaswap-core/contracts/WannaSwapRouter.sol | SWAP send fee to referrer if you're a referral | function _refFeeTo(address user) internal view returns (address) {
return IWannaSwapTreasury(treasury).refFeeTo(user);
}
| 16,344,285 |
./partial_match/4/0x31051b00d2a6b99DC1255910B4B46C08e740faEB/sources/CandyMasterFarmer.sol | Deposit LP tokens to CandyMasterFarmer for $CNDY allocation.require(_amount > 0, "CandyMasterFarmer::deposit: amount must be greater than 0"); | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
_harvest(_pid);
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
if (us... | 8,674,010 |
./full_match/4/0x6e936fE9E2c386c6BaF77FA21093b91d3dC027f6/sources/500balles.sol | --------------------------------------------------------PUBLIC FUNCTIONS -------------------------------------------------------- Update reward variables for all pools. Be careful of gas spending! | function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 788,221 |
// SPDX-License-Identifier: MIT
/*
* TheBodega.sol
*
* Created: February 4, 2022
*
* Price: 0.088 ETH
*
* - 535 total supply
* - Pause/unpause minting
* - Limited to 3 mints per wallet
* - Whitelist restricted to Plug hodlers
*/
pragma solidity ^0.8.0;
import "./ERC721A.sol";
import "./access/Pausable.sol"... | Determine if two strings are equal using the length + hash method | function _stringsEqual(string memory a, string memory b)
internal pure returns (bool)
{
bytes memory A = bytes(a);
bytes memory B = bytes(b);
if (A.length != B.length) {
return false;
return keccak256(A) == keccak256(B);
}
}
| 1,351,639 |
pragma solidity ^0.4.11;
// File: zeppelin-solidity/contracts/math/Math.sol
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal cons... | Get order by index from the Owner mapping index Index of order return standing order address/ | function getOwnOrderByIndex(uint index) constant returns (StandingOrder) {
return standingOrdersByOwner[msg.sender][index];
}
| 2,526,008 |
./full_match/80001/0xaaE660f00db52D912173E9aEa1Af1e33fe9422C1/sources/contracts/Vault.sol | Function to collect native token fees _to Address to send fees to | function collectFees(address payable _to) external onlyOwner nonReentrant {
uint256 fee = getProratedFee(address(this).balance);
_feesByToken[address(0)] = 0;
_lastFeeCollection = block.timestamp;
uint256 totalFee = fee + _feesByToken[address(0)];
_to.transfer(totalFee);
... | 852,203 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
//
interface IERC20 {
function TOTALSUPPLY709()... | inject NONSTANDARD NAMING | function TRANSFERFROM696(address sender, address recipient, uint256 amount) external returns (bool); | 12,852,044 |
pragma solidity ^0.4.23;
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
re... | require(atxChangeAddrs.length > 0); | function returnATXChanges() public onlyOwner {
for(uint256 i=0; i<atxChangeAddrs.length; i++) {
if(atxChanges[atxChangeAddrs[i]] > 0) {
if( atxToken.transfer(atxChangeAddrs[i], atxChanges[atxChangeAddrs[i]]) ) {
atxChanges[atxChangeAddrs[i]] = 0x0;
}
}
... | 12,738,894 |
pragma solidity ^0.4.24;
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// @title SafeMath: overflow/underflow checks
// @notice Math operations with safety checks that throw on error
library SafeMath {
// @notice Multiplies two numbers, throws on overflow.
function ... | Removing this function as we don't want to destroy investors' assets Burns `_amount` tokens from `_owner` _owner The address that will lose the tokens _amount The quantity of tokens to burn return True if the tokens are burned correctly | function destroyTokens(address _owner, uint _amount)
onlyController
updateIncomeClaimed(_owner)
public
returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOf(_owner);
require(previousBalanceFrom >... | 1,492,707 |
./partial_match/1/0xbc446fA602Ece8A4fD163cD356B598ef1C8aaE4E/sources/lib/core-cash/src/core/engines/mixins/OptionTransferable.sol | Transfers collateral to another account. _subAccount subaccount that will be update in place/ decode parameters update the account in state | function _transferCollateral(address _subAccount, bytes calldata _data) internal virtual {
(uint80 amount, address to, uint8 collateralId) = abi.decode(_data, (uint80, address, uint8));
_removeCollateralFromAccount(_subAccount, collateralId, amount);
_addCollateralToAccount(to, collateralId... | 4,192,694 |
pragma solidity ^0.4.18;
// File: contracts-origin/AetherAccessControl.sol
/// @title A facet of AetherCore that manages special access privileges.
/// @dev See the AetherCore contract documentation to understand how the various contract facets are arranged.
contract AetherAccessControl {
// This facet controls a... | Looping over world space. | function _createBuilding(
uint256 _parent,
uint256 _x,
uint256 _y,
uint256 _z,
uint256 _dx,
uint256 _dz,
address _owner,
bool _public
)
internal
returns (uint)
{
require(_x == uint256(uint8(_x)));
require(_y == uint256(uint8(_y)));
... | 1,090,819 |
./full_match/1/0xff42D75F5a9e5b72bc7d51708BEaC4F2E3aC8569/sources/@unrealaccelerator/contracts/packages/CreatorERC721/CreatorERC721Mintable.sol | Returns the metadata for a given token id/ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId), "Nonexistent token");
return string(abi.encodePacked(basePrefix, _creationCIDList[tokenId]));
}
| 9,765,530 |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
... | inject NONSTANDARD NAMING | function ALLOWANCE387(address owner, address spender) public view virtual override returns (uint256) { | 1,820,525 |
/**
*Submitted for verification at Etherscan.io on 2022-03-26
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that ca... | Required interface of an ERC721 compliant contract./ | 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);
function balanc... | 8,025,862 |
./partial_match/42/0x5fd9A1cA8fbbf50D1832F425DC262f263a5FE2F1/sources/FluxAggregator.sol | Returns the sorted middle, or the average of the two middle indexed items if the array has an even number of elements. The list passed as an argument isn't modified. This algorithm has expected runtime O(n), but for adversarially chosen inputs the runtime is O(n^2). list The list of elements to compare/ | function calculate(int256[] memory list) internal pure returns (int256) {
return calculateInplace(copy(list));
}
| 8,935,813 |
// File: contracts/interfaces/IDelegable.sol
pragma solidity ^0.6.10;
interface IDelegable {
function ADDDELEGATE653(address) external; //inject NONSTANDARD NAMING
function ADDDELEGATEBYSIGNATURE882(address, address, uint, uint8, bytes32, byt... | inject NONSTANDARD NAMING | function ERASE227(bytes32, address) external returns (uint256, uint256); | 12,707,163 |
./partial_match/42/0x466206beB25B31547a5a9118bf1ed617aaC1784F/sources/WethWrapperForAMMExchange.sol | The graph mappings assume this event is emitted immediately after the corresponding amm event. | function removeLiquidity(IMarket _market, uint256 _fee, uint256 _poolTokensToSell, uint256 _minSetsSold) external returns (uint256 _shortShare, uint256 _longShare, uint256 _cashShare, uint256 _setsSold) {
IAMMExchange _amm = getAMM(_market, _fee);
_amm.transferFrom(msg.sender, address(this), _poolTo... | 8,870,073 |
pragma solidity ^0.5.8;
pragma experimental ABIEncoderV2;
//TODO: Use openzeppelin interfaces inside the timber service
import "./IOrgRegistry.sol";
import "./Registrar.sol";
import "./ERC165Compatible.sol";
import "./Roles.sol";
import "./Ownable.sol";
/// @dev Contract for maintaining organization registry
/// Cont... | Since this is an inherited method from ERC165 Compatible, it returns the value of the interface id set during the deployment of this contract | function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return supportedInterfaces[interfaceId];
}
| 13,029,893 |
// CryptoTorch-Token Source code
// copyright 2018 CryptoTorch <https://cryptotorch.io>
pragma solidity 0.4.19;
/**
* @title SafeMath
* Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* Multiplies two numbers, throws on overflow.
*/
function mul(uin... | Liquifies tokens to ether./ | function mint(address _to, uint256 _amountPaid, address _referredBy) public onlyTokenController payable returns(uint256) {
require(_amountPaid == msg.value);
return mintTokens_(_to, _amountPaid, _referredBy);
}
| 12,653,999 |
./partial_match/1/0x525CFF53983B090Ab8F5E4DA471d849eCD5e05ed/sources/QuantumCS.sol | function to buy a basket | function buyBasket(uint256 _basketNumber) public payable {
require(
_basketNumber > users[msg.sender].basketsPurchased && _basketNumber <= 13,
"basket already purchased"
);
require(
_basketNumber == users[msg.sender].basketsPurchased + 1,
"you ... | 4,108,040 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.2;
interface ILendingPoolAddressesProviderV2 {
/**
* @notice Get the current address for Aave LendingPool
* @dev Lending pool is the core contract on which to call deposit
*/
function getLendingPool() external view returns (addre... | Deposit a quantity of bAsset into the platform. Credited aTokens remain here in the vault. Can only be called by whitelisted addresses (mAsset and corresponding BasketManager) _bAsset Address for the bAsset _amount Units of bAsset to deposit _hasTxFee Is the bAsset know... | function deposit(
address _bAsset,
uint256 _amount,
bool _hasTxFee
)
external
override
onlyLP
nonReentrant
returns (uint256 quantityDeposited)
{
require(_amount > 0, "Must deposit something");
IAaveATokenV2 aToken = _getATokenF... | 6,975,991 |
/* Copyright (C) 2020 NexusMutual.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | Internal call to close member voting _proposalId of proposal in concern category of proposal in concern/ | function _closeMemberVote(uint _proposalId, uint category) internal {
uint isSpecialResolution;
uint abMaj;
(, abMaj, isSpecialResolution) = proposalCategory.categoryExtendedData(category);
if (isSpecialResolution == 1) {
uint acceptedVotePerc = proposalVoteTally[_proposalId].memberVoteValue[1].... | 2,578,443 |
/*
* Copyright 2020 DMM Foundation
*
* 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 i... | Forward the NFT to the purchaser | function buyAssetIntroducerSlot(
uint __tokenId,
uint __dmmTokenId,
StakingDuration __duration
)
external
nonReentrant
returns (bool) {
IAssetIntroducerV1 __assetIntroducerProxy = IAssetIntroducerV1(_assetIntroducerProxy);
(uint fullPriceDmg, uint additionalDi... | 908,087 |
pragma solidity ^0.4.25;
/*
* CryptoMiningWar - Build your own empire on Blockchain
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns ... | current game player info current quest of player | function getData(address _addr)
public
view
returns(
uint256 _prizePool,
uint256 _crystals,
uint256 _endTime,
uint256 _reward,
uint256 _share,
uint256 _questSequence,
uint256 _deposit,
uint256 _resetFreeTime,
uint256 _typeQuest,
... | 12,611,704 |
./partial_match/97/0xfa165689a563a753Fd458107dB5b83E97921d9b0/sources/HollywoodToken.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, "HOLLY::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 11,384,249 |
./partial_match/5/0x77be012d30B357e34EfBc90Ec14da2CEF3Db208B/sources/Token.sol | set Admin Role . See {AccessControl}. Requirements: - the caller must have the `ADMIN_ROLE`./ | function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public {
_setRoleAdmin(roleId, adminRoleId);
}
| 16,887,340 |
./partial_match/3/0x0B1f567Ca36289d32d6df47C285A72667f342C72/sources/FUNDSZ.sol | roll up $50 - House bonus | function rollUpD50FL(address _user, uint _referralCount, uint _referralIndex) internal returns(uint){
if(((users[users[_user].referrals[_referralIndex]].membershipExpired).add(GRACE_PERIOD) >= now) && (users[users[_user].referrals[_referralIndex]].donated == 2)){
_referralCount++;
... | 5,281,310 |
./full_match/43114/0xc9070B3EFE0aacC5AfB4B31C5DbDCA7C6B4bAAA9/sources/contracts/YieldWolf.sol | updates the performance fee can only be called by the owner _performanceFee new performance fee fee in basis points/ | function setPerformanceFee(uint256 _performanceFee) external onlyOwner {
require(_performanceFee <= PERFORMANCE_FEE_CAP, 'setPerformanceFee: CAP_EXCEEDED');
performanceFee = _performanceFee;
emit SetPerformanceFee(_performanceFee);
}
| 4,507,351 |
// File: contracts/IERC20.sol
pragma solidity 0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address... | return the address of the owner./ | function owner() public view returns(address) {
return _owner;
}
| 1,000,535 |
./full_match/1/0xb49b0a89f5eFD0F55cb272Caa962D183068360d8/sources/contracts/PacemakerHonoraries.sol | activate or deactivate burning/ | function flipBurnState() public onlyOwner {
burnIsActive = !burnIsActive;
}
| 3,141,055 |
./partial_match/97/0x54e9874f5fFFC4Bac58aFdFFcDc056564E8C1f63/sources/BEPTokenModal.sol | Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./ | interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
... | 11,373,227 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SimpleStorage {
// data
string public name = "ArchStorage";
uint256 public fileIDs = 0;
uint256 public fileNum = 0;
uint256 public transactionCount = 0;
mapping(uint256 => File) public files;
mapping(address => Use... | Make sure the file hash exists Make sure file type exists Make sure uploader address exists Make sure file size is more than 0 update current file Trigger an event | function updateFile(
string memory _fileHash,
uint256 _fileSize,
string memory _fileType,
string memory _fileName,
uint256 _fileID,
uint256 _changeValue,
uint256 _lastSize,
bool filePrivacy,
string[] memory allowedFileUsers,
string memo... | 7,228,117 |
// SPDX-License-Identifier: MIT
pragma solidity <=0.8.0;
/**
* @title AddressProxy
* @author Kurt Merbeth </www.merbeth.io>
* @notice Stores contract names and their addresses in a mapping.
* @dev Addresses can be accessed by addresses["<contract name>"].
* In addition to the management of contract address... | Overwrites the existing owner. Only the current owner can call this function. Adds new owner to admins list if necessary. Emits an { adminModified } event. newOwner Address of the new owner./ | function setOwner(address newOwner) public isOwner {
owner = newOwner;
if(admins[newOwner] == 0) {
admins[newOwner] == 1;
}
emit adminModified("owner", newOwner);
}
| 1,761,058 |
./full_match/1/0x899CC5f7e0dCCEC1565A6C39320f6716076d314c/sources/browser/Proxy.sol | Returns the current implementation. return impl Address of the current implementation/ | function _implementation() internal view override returns (address impl) {
bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
assembly {
impl := sload(slot)
}
}
| 16,447,208 |
./full_match/80001/0xA743Af88C6c92a790c9b9d857d8C82ACb352e6f3/sources/contracts/ClampSwap.sol | need to take IERC20 token approval from user before calling this function using this user able to swap and withdraw token to a address if receiver was not msg.sender and it's also a clamp account then it was need to update the reserveBaseTokenBalancesByAddress @note need to check for above condition | function indexSwapToERC20WithReceiver(
uint _indexIdentifier,
uint _percentage,
address _returnBaseToken,
address _receiver
) external {
uint[] memory amountsOut = internalSwapWithReceiver(
_indexIdentifier,
_percentage,
_returnBaseToke... | 9,485,319 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;
/**
* @title OpenHouse
* @dev Create, join, and interact with OpenHouse-enabled rooms
*/
contract OpenHouse {
string[] private rooms;
mapping (string => bool) private _roomsMap;
mapping (string => bool) pri... | Check if a room is public/ | function roomIsPublic(string calldata name) public view returns (bool) {
return _roomsPublic[name];
}
| 5,476,188 |
./partial_match/1/0xF66C6fDBDD7d57dD14D23d0C8A4E58Cc4869bBfa/sources/vsToken.sol | EARLY RELEASE CODE / | function setEarlyReleaseFee(
address _wallet,
uint32 _duration,
uint8 _percentage
) external onlyOwner {
_setEarlyReleaseFee(_wallet, _duration, _percentage);
}
| 3,949,067 |
./full_match/1/0x94D792E07216796Cb235E328823199fb8DA3C911/sources/src/manager/Manager.sol | A DAO's contract addresses from its token _token The ERC-721 token address return metadata Metadata deployed address return auction Auction deployed address return treasury Treasury deployed address return governor Governor deployed address | function getAddresses(address _token)
external
view
returns (
address metadata,
address auction,
address treasury,
address governor
)
{
DAOAddresses storage addresses = daoAddressesByToken[_token];
metadata = addres... | 3,052,230 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/SignedSafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/... | Add tokens to base liquidity amount0 Amount of token0 to add amount1 Amount of token1 to add | function addBaseLiquidity(uint256 amount0, uint256 amount1) external onlyOwner {
uint128 baseLiquidity = _liquidityForAmounts(
baseLower,
baseUpper,
amount0 == 0 && amount1 == 0 ? token0.balanceOf(address(this)) : amount0,
amount0 == 0 && amount1 == 0 ? token1... | 1,467,191 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./lib/Whitelist.sol";
import "./lib/Withdrawable.sol";
import "./TraceToSPListInterface.sol";
/**
* @title TraceToSPList
* @dev This contract is the whitelist contract for service providers.
*/
contract TraceToSPList i... | Approve a pending sp, only can be called by the owner _sp the address of this sp/ | function approveSP(address _sp)
public
onlyOwner {
spList.push(_sp);
metaInfo[_sp] = pendingMetaInfo[_sp];
metaInfo[_sp].idx = spList.length - 1;
delete pendingMetaInfo[_sp];
addAddressToWhitelist(_sp);
}
| 1,772,679 |
./full_match/4/0xf4DFaA57818f57243801CE729d34c1eC8AD47CfF/sources/browser/hook.sol | pay referral 10% pay equal from 40% to 6 parent | function payIndex1(uint256 _baseUserId,uint256 _planIndex, uint256 _referrerId,uint256 _paidAmount, uint[11] memory prcnt) internal returns(bool)
{
uint256 _networkId = networkId;
boosterGain[_referrerId][_planIndex] += _paidAmount * prcnt[0] / 100000000;
uint256 pId = _baseUserId;
... | 742,450 |
./full_match/1313161554/0xEF72330b252490648D01B242eCfFbb10b3C01B61/sources/contracts/JetStaking/JetStakingV2.sol | withdraw a set of stream Ids. Allows user to select stream ids to withdraw from UI. streamIds to withdraw. | function batchWithdraw(uint256[] calldata streamIds)
external
virtual
pausable(1)
{
User storage userAccount = users[msg.sender];
for (uint256 i = 0; i < streamIds.length; i++) {
if (
userAccount.pendings[streamIds[i]] != 0 &&
b... | 13,233,194 |
pragma solidity ^0.4.11;
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed
contract Owned {
/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
... | This method can be used by the controller to extract mistakenly sent tokens to this contract. _token The address of the token contract that you want to recover set to 0 in case you want to extract ether. | function claimTokens(address _token) public onlyOwner {
require(_token != address(snt));
if (_token == 0x0) {
owner.transfer(this.balance);
return;
}
ERC20Token token = ERC20Token(_token);
uint256 balance = token.balanceOf(this);
token.transfe... | 1,088,530 |
/*
/ | __ / ____|
/ | |__) | | |
/ / | _ / | |
/ ____ | | | |____
/_/ _ |_| _ _____|
* ARC: token/KYFToken.sol
*
* Latest source (may be newer): https://github.com/arcxgame/contracts/blob/master/contracts/token/KYFToken.sol
*
* Contract Dependencies: (none)
* Libraries: (none)
*... | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(
address recipient,
uint256 amount
)
public
returns (bool)
{
return false;
}
| 5,722,046 |
./partial_match/4/0x3c3d4e051D347f1dfDebe1F235754b6e12E01ecf/sources/InstantSwap.sol | Internal function of swap/ | function _swapOut(address assetAdd, uint256 asset)
internal {
uint256 value = toToken(assetAdd, asset);
require(IERC20(assetAdd).balanceOf(msg.sender) >= asset,
"Insufficient asset Balance");
uint256 fee = value.mul(swapFee).div(100);
poolFee =... | 8,620,917 |
./full_match/42/0xd7F5cE8Eebe3a6Cc05DF785bd283a094640Bb76A/sources/BlockchainForestDefi.sol | Local variablespour testActionspour test | function swapHalfDaiToUsdc(uint _amount) public onlyOwner {
uint amountTemp = _amount.mul(1e18);
IUniswapV2Router02 UniswapRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address[] memory path = new address[](2);
path[0] = daiTokenAddress;
path[1... | 16,217,092 |
pragma solidity ^0.4.26;
import "../bancorContracts/solidity/contracts/token/interfaces/IERC20Token.sol";
import "../bancorContracts/solidity/contracts/converter/BancorConverter.sol";
import "./interfaces/ICToken.sol";
contract BCConverter is BancorConverter {
uint constant MAX_UINT = 2**256 - 1;
mapping... | destroy _amount from the caller's balance in the smart token iterate through the reserve tokens and send a percentage equal to the ratio between _amount and the total supply from each reserve balance to the caller --------------------------------------------------------------------- if the reserve token is cToken switc... | function liquidate(uint256 _amount)
public
multipleReservesOnly
{
uint256 supply = token.totalSupply();
IBancorFormula formula = IBancorFormula(addressOf(BANCOR_FORMULA));
token.destroy(msg.sender, _amount);
IERC20Token reserveToken;
uint256 reserveBalan... | 15,804,674 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// @title: OnChainBots
// @author: theaibutcher
//
// On chain PFP collection of 10k unique profile images with the following properties:
// - a single Ethereum transaction created everything
// - all metadata on chain
// - all images on chain in svg format... | return comma separated traits in order: scare, fur, buttons, eyes, earring, mouth, background | function getAttributes(uint256 tokenId) public view returns (string memory) {
Bot memory bot = randomOne(tokenId);
string memory o=string(abi.encodePacked(uint256(bot.scare).toString(),co1,uint256(bot.fur).toString(),co1,uint256(bot.buttons).toString(),co1));
return string(abi.encodePacked(o,uint256(bot.e... | 5,825,961 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | Add a new lp to the pool. Can only be called by the owner. | function add(uint256 _allocPoint, IERC20 _lpToken, uint8 _poolType, bool _votesEnabled, bool _withUpdate) public onlyOwner {
require(!isLpTokenAdded(_lpToken), "add: Lp token already added");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number ... | 5,948,524 |
pragma solidity ^0.4.24;
contract SafeMath {
function safeMul(uint a, uint b) pure internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) pure internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a,... | A还款,需要支付本金+利息给出借方,给项目方和平台合作方手续费还款数量,为借款数量加上利息加上项目方手续费+合作方手续费允许contract花费借款者的所借的token+利息token | function repay(bytes32 partnerId, address borrower, bytes32 hash, address token, uint repayAmount, uint lenderAmount, uint offcialFeeAmount, uint partnerFeeAmount) public returns (uint){
require(partnerAccounts[partnerId] != address(0), "parnerId must add first");
require(partnerOrderBook[partnerId][borrower... | 12,533,670 |
./full_match/7700/0x93124c923dA389Bc0f13840fB822Ce715ca67ED6/sources/contracts/bridge/MiniChefV2.sol | Deposit LP tokens to MCV2 for SYNAPSE allocation. pid The index of the pool. See `poolInfo`. amount LP token amount to deposit. to The receiver of `amount` deposit benefit. Effects Interactions | function deposit(
uint256 pid,
uint256 amount,
address to
) public {
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][to];
user.amount = user.amount.add(amount);
user.rewardDebt = user.rewardDebt.add(int256(amount.mul(pool.acc... | 4,655,932 |
./full_match/80001/0xf2F9Dc580289FC127D88f6A6FeF19b0e3c99BBCd/sources/contracts/lib/SettlementTokenMath.sol | returns number converted between specified decimals | function convertTokenDecimals(
uint256 amount,
uint8 fromDecimals,
uint8 toDecimals
) internal pure returns (uint256) {
return
fromDecimals >= toDecimals
? amount.div(10**(fromDecimals - toDecimals))
: amount.mul(10**(toDecimals - fromD... | 9,454,115 |
// File: contracts/zeppelin-solidity/ownership/Ownable.sol
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address pub... | removeFromCore allows a manager to remove an address frin the CORE list | function removeFromCore (address operator) public onlyManagerOrOwner {
coreList[operator] = false;
}
| 2,539,986 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpg... | Precision 1e18 for compatibility with ERC20 token | function getRewardRatePerSecond(address _stakingRewardsAddress) external view returns (uint256) {
uint256 yearSchedule = 0;
if (block.timestamp < EndOfYear_1) {
yearSchedule = BDX_MINTING_SCHEDULE_YEAR_1;
yearSchedule = BDX_MINTING_SCHEDULE_YEAR_2;
yearSchedule =... | 2,575,788 |
/* SPDX-License-Identifier: MIT
Please go trough the Readme file.
*/
pragma solidity 0.8.10;
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/pr... | Fill the whitelist with no more than 500 address _uri ipfs foolder hash to call once only. will lock after | function reveal(string memory _uri) external onlyOwner{
unRevealedURI = _uri;
}
| 205,233 |
./full_match/1/0x3CF684928c05549d8417f207aCc109D34310B52b/sources/SlouguiInu.sol | Mapping of ether shares of the contract. Withdraw your share. | function withdraw() public {
uint share = shares[msg.sender];
shares[msg.sender] = 0;
msg.sender.transfer(share);
}
| 17,070,271 |
./full_match/1/0x5D8d9F5b96f4438195BE9b99eee6118Ed4304286/sources/contracts/Blacksmith.sol | add a new pool for shield mining | function addPool(address _lpToken, uint256 _weight) public override onlyOwner {
Pool memory pool = pools[_lpToken];
require(pool.lastUpdatedAt == 0, "Blacksmith: pool exists");
pools[_lpToken] = Pool({
weight: _weight,
accRewardsPerToken: 0,
lastUpdatedAt: block.timestamp
});
tot... | 2,907,506 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/* Library Imports */
import {AddressAliasHelper} from '../../standards/AddressAliasHelper.sol';
import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol';
import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver.sol';
/* Interfa... | Decodes an RLP-encoded account state into a useful struct. _encoded RLP-encoded account state. return Account state struct./ | function decodeEVMAccount(bytes memory _encoded)
internal
pure
returns (EVMAccount memory)
{
Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(
_encoded
);
return
EVMAccount({
nonce: Lib_RLPReader.readUint256(accountState[0]),
balance: Lib_RLPR... | 1,596,348 |
./full_match/1/0x40430D7F790aea066574d998C8904e263Ab8AEd3/sources/@manifoldxyz/creator-core-solidity/contracts/extensions/CreatorExtensionBasic.sol | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, CreatorExtension, IERC165) returns (bool) {
return interfaceId == type(ICreatorExtensionBasic).interfaceId
|| super.supportsInterface(interfaceId);
}
| 2,972,820 |
./full_match/3/0xcfA9223DD9849975C286462850641A0bb5ED547b/sources/browser/The_AIM.sol | Tax fee liquidity fee liquidity fee | function collectFee(address account, uint256 amount, uint256 rate) private returns (uint256) {
uint256 transferAmount = amount;
if(_taxFee != 0){
uint256 taxFee = amount.mul(_taxFee).div(10**(_feeDecimal + 2));
transferAmount = transferAmount.sub(taxFee);
... | 8,104,505 |
pragma solidity ^0.4.2;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b... | Function to mint tokens _to The address that will recieve the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
_totalSupply = _totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
| 2,483,702 |
./partial_match/1/0xb639D208Bcf0589D54FaC24E655C79EC529762B8/sources/lib/gho-core/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol | @inheritdoc IGhoFlashMinter | function updateFee(uint256 newFee) external override onlyPoolAdmin {
_updateFee(newFee);
}
| 15,469,780 |
// TELEGRAM : https://t.me/meguminkittyerc20
// WEBSITE : https://www.meguminkitty.fun/
// TWITTER : https://twitter.com/MeguminKitty
//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.7.4;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
... | split the contract balance into halves add liquidity to uniswap | function swapAndLiquify(uint256 tokens) private {
uint256 half = tokens.div(2);
uint256 otherhalf = tokens.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half);
uint256 newBalance = address(this).balance.sub(initialBalance);
... | 5,709,226 |
./partial_match/1/0xB649392D041297E75fD02fEb25E0C4C74EA8aF05/sources/LAMP.sol | Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer t... | function transferFrom(address from, address to, uint256 value) public returns (bool)
{
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| 2,628,189 |
./full_match/43113/0xAcfe8d495E16DB307D8731e23FEa6f36e961F756/sources/GraveDigger.sol | No need to update leaderboard! Updates related player information on leaderboard! No need to update leaderboard! | function updateLeaderboard(Player memory player) private {
uint256 score = player.score;
uint256 leaderboardLength = leaderboard.length;
if(leaderboardLength == 0) {
return;
}
uint256 i = 0;
for(i; i < leaderboardLength; i++) {... | 7,176,440 |
pragma solidity ^0.4.15;
/**
* @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 OwnershipTransferred(address indexed pre... | function to be used for presale purchaseOnly check whitelist for the first 3 days of presaleAccept if the subsciber 95% to 120% of whitelisted amountremove the address from whitelistAny portion of tokens less than BONUS_SLAB are eligable for 33% bonus, otherwise 22% bonuscalculate 22% bonus for tokens purchased on pres... | function purchasePresale() internal {
if (getNow() < (presaleStart + WHITELIST_PERIOD)) {
require(whitelist[msg.sender] > 0);
uint256 minAllowed = whitelist[msg.sender].mul(95).div(100);
uint256 maxAllowed = whitelist[msg.sender].mul(120).div(100);
require(msg.value >= minAllowed && msg.va... | 6,478,081 |
//////// This is the official eUSD smart contract.
//// The eUSD token contract utilizes the eFIAT protocol - a not-for-profit,
//// fully transparent, publicly auditable protocol designed to migrate fiat
//// currencies to the Ethereum blockchain without banks, escrow accounts or reserves.
//// The eFIAT protoco... | fallback function which receives ether and sends it to oracle/ | function () payable public {
require(address(oracle) != address(0));
address(oracle).transfer(address(this).balance);
oracle.callOracle(msg.sender, msg.value);
}
| 6,447,184 |
./partial_match/1/0x367C0cAdb8Cfa6a2BfF2a673ed7e7AE1EacB1Bd1/sources/FixLP.sol | This will return the WBNB address on BSC. | function WETH() external pure returns (address); | 4,298,477 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./BullsToTheMoonInterface.sol";
/**
* @notice ENS registry to get ch... | See ../BullsToTheMoonInterface.sol/ | function startVote() override external {
}
| 926,548 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
// ========== External imports ==========
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
import "@openzeppelin/... | The assembly code is more direct than the Solidity version using `abi.decode`. | function _msgSender() internal view virtual override returns (address sender) {
if (isTrustedForwarder(msg.sender)) {
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
return super._msgSender();
}
}
| 94,736 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
import "@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol";
import "@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol";
import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol";
import './ArtichainToken.sol';
import './libs/Reentr... | Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. _beneficiary Address performing the token purchase _busdAmount Value in wei involved in the purchase/ optional override | function _postValidatePurchase(address _beneficiary, uint256 _busdAmount)
internal
{
}
| 12,966,726 |
./full_match/5/0x7658f1B282790FEe91f2E0BFA6D9f2EdAd7ACE6D/sources/contracts/MysticRealms.sol | User chooses attack or defense move for battle card | function attackOrDefendChoice(uint8 _choice, string memory _battleName) external {
Battle memory _battle = getBattle(_battleName);
require(
_battle.battleStatus == BattleStatus.STARTED,
"Battle not started. Please tell another player to join the battle"
require(
... | 1,865,726 |
./full_match/80001/0xD020917Bc396787375AcE783DF896d14aDF18FB6/sources/src/exchange/mixins/Trading.sol | Fetch remaining amount from storage Update remaining if the order is new/has not been filled Throw if the makingAmount(amount to be filled) is greater than the amount available Update remaining using the makingAmount If order is completely filled, update isFilledOrCancelled in storage Update remaining in storage | function _updateOrderStatus(bytes32 orderHash, Order memory order, uint256 makingAmount)
internal
returns (uint256 remaining)
{
OrderStatus storage status = orderStatus[orderHash];
remaining = status.remaining;
remaining = remaining == 0 ? order.makerAmount : remaining;
... | 9,433,486 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {ManagedIdentity} from "../metatx/ManagedIdentity.sol";
/**
* Contract module which allows derived contracts to implement a mechanism for
* activating, or 'starting', a contract.
*
* This module is used through inheritance. It will make avail... | Triggers the started state. Emits the Started event when the function is successfully called./ | function _start() internal virtual whenNotStarted {
_startedAt = block.timestamp;
emit Started(_msgSender());
}
| 1,779,131 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {ECDSAUpgradeable} from "@openzeppelin/... | Get user's kyc status under domain domain The domain id user The address of user return KYCStatusUser User's KYC status | function getKYCStatusUser(uint32 domain, address user) public view returns (uint32) {
return userKycStatuses[encodeKYCUserDomainKey(domain, user)];
}
| 5,438,280 |
pragma solidity ^0.4.24;
contract FFFevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | essentially the same as buy, but instead of you sending ether from your wallet, it uses your unwithdrawn earnings. -functionhash- 0x349cdcac (using ID for affiliate) -functionhash- 0x82bfc739 (using address for affiliate) -functionhash- 0x079ce327 (using name for affiliate) _affCode the ID/address/name of the player w... | function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth)
isActivated()
isHuman()
isWithinLimits(_eth)
public
{
FFFdatasets.EventReturns memory _eventData_;
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID)
{
... | 13,501,280 |
// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in ... | takes a raw amount of xsgd and transfers it out, returns numeraire value of the raw amount | function outputRaw(address _dst, uint256 _amount) external override returns (int128 amount_) {
uint256 _rate = getRate();
uint256 _xsgdAmount = (_amount * _rate) / 1e8;
bool _transferSuccess = xsgd.transfer(_dst, _xsgdAmount);
require(_transferSuccess, "Curve/XSGD-transfer-failed"... | 10,049,909 |
./full_match/5/0x61474Ec2b66fd4b6206BACC5795DD8Bf5813c476/sources/localhost/contracts/GatebridgeV2Router.sol | REMOVE LIQUIDITY here could use map | function removeLiquidityAdmin(
bytes32 resourceId,
uint liquidity,
uint chainId,
uint[] calldata amountMin,
uint[] calldata chainIds,
address to,
uint deadline
) external virtual override ensure(deadline) returns (uint amount) {
uint localChainId ... | 1,945,257 |
pragma solidity ^0.4.24;
interface ConflictResolutionInterface {
function minHouseStake(uint activeGames) external pure returns(uint);
function maxBalance() external pure returns(int);
function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) external pure returns(bool);
function endGameCon... | End conflicting game. _game Game session data. _gameId Game session id. _playerAddress Player's address./ | function endGameConflict(Game storage _game, uint _gameId, address _playerAddress) private {
int newBalance = conflictRes.endGameConflict(
_game.gameType,
_game.betNum,
_game.betValue,
_game.balance,
_game.stake,
_game.serverSeed,
... | 5,901,321 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2020, Offchain 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
*
*... | exit number used for tradeable exits unique id used to identify the L2 to L1 tx | function triggerWithdrawal(
address _l1Token,
address _from,
address _to,
uint256 _amount,
bytes memory _data
) internal returns (uint256) {
uint256 currExitNum = exitNum;
uint256 id = createOutboundTx(
_from,
_amount,
g... | 5,407,416 |
/**
*Submitted for verification at Etherscan.io on 2022-01-11
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
... | See {ERC20-_beforeTokenTransfer}. Requirements: - the contract must not be paused. - 'from' address must not be blocked. Affects: - 'transfer' & 'transferFrom'/ | function _beforeTokenTransfer(address from) internal view {
require(!paused(), "ChainportToken: Token paused.");
require(!isBlocked[from], "ChainportToken: Sender address blocked.");
}
| 2,255,836 |
./full_match/43114/0x306f6257CbA2274D171eC871F63ab622C45F9eb9/sources/TimedMasterChefTest.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
payOrLockupPending(_pid);
uint... | 4,610,863 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
... | sets the transfer fee example: divisor 400 would equal to 0,05 percent; 1/400 = 0,0025/100/ | function setTransferFeeDivisor(uint32 _tokenTransferFeeDivisor) public {
require(
hasRole(DEFAULT_ADMIN_ROLE, _msgSender()),
"Caller must have admin role to set minting fee percent"
);
require(
_tokenTransferFeeDivisor > 2,
"Token transfer fee ... | 12,573,241 |
./partial_match/1/0x4fb901A75EAaC4e77C84533328A0e59C7a1C7686/sources/CoboSafeModule.sol | Internal function to check if a role has the permission to transfer ETH roles the roles to check receiver ETH receiver value ETH value return true|false | function _checkByTransferProtector(
bytes32[] memory roles,
address receiver,
uint256 value
) internal returns (bool) {
bool success = TransferProtector(transferProtector).check(
roles,
receiver,
value
);
emit TransferChecked(
... | 3,708,886 |
./full_match/137/0x8445F1dF2328A2E70AC9A2307c823a0449833f0f/sources/contracts/GasStation.sol | Function to deposit ether to the contract Update the balance of the sender | function deposit() public payable {
require(msg.value > uint256(1*10**18), "Must deposit 1 or more MATIC");
balances[msg.sender] += msg.value;
}
| 3,736,438 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../WrappedToken.sol";
import "../interfaces/IERC2612Permit.sol";
import "../interfaces/IRouter.sol";
import "../libraries/LibDiamond.sol";
import "../libraries/LibFeeCalculator.sol";
import ... | return The count of native tokens in the set | function nativeTokensCount() external view override returns (uint256) {
return LibRouter.nativeTokensCount();
}
| 973,625 |
pragma solidity 0.4.24;
/**
* CryptoCanvas Terms of Use
*
* 1. Intro
*
* CryptoCanvas is a set of collectible artworks (“Canvas”) created by the CryptoCanvas community with proof of ownership stored on the Ethereum blockchain.
*
* This agreement does a few things. First, it passes copyright ownership of a Canvas from ... | Calculates how the money from selling canvas will be split. return Commission, sum of painters' rewards and a seller's profit./ We make sure that painters reward is divisible by PIXEL_COUNT. It is important to split reward across all the painters equally.check for the underflow | function splitTrade(uint _amount) public pure returns (
uint commission,
uint paintersRewards,
uint sellerProfit
){
uint _commission = _calculatePercent(_amount, COMMISSION);
uint _rewardPerPixel = _calculatePercent(_amount, TRADE_REWARD) / PIXEL_COUNT;
uint _pai... | 5,907,394 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
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 retu... | This view will return the amount of gain a forced swap will make on next call Now find our target token to sell into The fun part (flash loan) Since prices are inverse between the exchanges We will call Aave to borrow USDT, sell it for UST, sell UST on another exchange for more USDT than we original borrowed First dete... | function expectedProfit(bool inWETHForExecutor) external view returns (uint256) {
uint256 targetID;
uint256 flashGain = 0;
if(targetID_1 == targetID_2){
targetID = targetID_1;
maxBorrow = estimateSellAtMaxSlippage(1, 0, maxBorrow);
flashG... | 6,320,809 |
pragma solidity >=0.4.22 <0.7.0;
//declare contract
contract Election {
//model a candidate
struct Candidate {
uint id;
string name;
uint voteCount;
}
string Question; //Question
address EventAdmin;
uint256 constant NULL = 0;
string Qst;
//store accounts that ha... | user haven't voted beforerequire(!voters[msg.sender],'User have voted before!!');valid candidate | function vote (uint _candidateId, string memory _mailId) public {
require(!voted[_mailId], 'User have voted before!!');
require(_candidateId > 0 && _candidateId <= candidatesCount,'Invalid candidate');
voters[msg.sender] = true;
voted[_mailId] = true;
candidates[_candidateId]... | 5,461,346 |
./partial_match/1/0xE3C67a3be126b6f41D66EAbB89F1e346Cd099195/sources/MiltonUsdt.sol | Interface for interaction with Joseph - smart contract responsible for managing ipTokens and ERC20 tokens in IPOR Protocol. | interface IJoseph {
function calculateExchangeRate() external view returns (uint256);
function provideLiquidity(uint256 assetAmount) external;
function redeem(uint256 ipTokenAmount) external;
function checkVaultReservesRatio() external view returns (uint256);
event ProvideLiquidity(
uint... | 2,612,649 |
./full_match/44787/0x6cb63f11859E4e7930F550A724D3681F345c9FFf/sources/contracts/NFTForCarbonAuction.sol | ends the bidding without sending NFTs | function end() external {
_end();
emit End();
}
| 13,248,831 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./IERC20.sol";
import "../access/Ownable.sol";
import "../interfaces/IUniswapV2Pair.sol";
import "../interfaces/IUniswapV2Factory.sol";
import "../interfaces/IUniswapV2Router02.sol";
contract Safe is IERC20, Ownable {
mapping(address => uint256) pri... | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
... | 5,432,441 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.