file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.5.0;
contract Storage {
/**** Storage Types *******/
mapping(bytes32 => uint256) private uIntStorage;
mapping(bytes32 => string) private stringStorage;
mapping(bytes32 => address) private addressStorage;
mapping(bytes32 => bytes) private bytesStorage;
mappin... | _key The key for the record | function deleteBytes(bytes32 _key) internal {
delete bytesStorage[_key];
}
| 5,502,267 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* @title CErc20 interface for Compound ERC20 assets
*/
interface ICERC20 {
function mint(uint256 mintAmount) external returns (uint256);
function redeem(uint256 redeemTokens) external returns (uint256);
function redeemUnderlying(uint256 r... | CErc20 interface for Compound ERC20 assets/ | interface ICERC20 {
function mint(uint256 mintAmount) external returns (uint256);
function redeem(uint256 redeemTokens) external returns (uint256);
function redeemUnderlying(uint256 redeemAmount) external returns (uint256);
function borrow(uint256 borrowAmount) external returns (uint256);
function r... | 13,130,444 |
./full_match/8453/0x369B3c81A36794625B3f49D60f85F3f6B06cB5d3/sources/contracts/BaseLotto.sol | Stuck Balances Functions | function rescueToken(address tokenAddress) external onlyOwner {
IERC20(tokenAddress).safeTransfer(
msg.sender,
IERC20(tokenAddress).balanceOf(address(this))
);
}
| 11,561,460 |
./partial_match/1/0xfF473Ee66f43C5dc749c6d0108D430480AD317A0/sources/CryptualProjectToken.sol | Adds single address to presale whitelist. _beneficiary Address to be added to the whitelist/ | function addToPresaleWhitelist(address _beneficiary) external onlyOwner {
presaleWhitelist[_beneficiary] = true;
}
| 3,666,985 |
./full_match/97/0x8BcA293D23eC9e67F53Dd6604A9B65e03DDA18E3/sources/project_/contracts/LPTokenStaker.sol | Deposit LP tokens to MasterChef for STRF allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
_massUpdatePools();
if (user.amount > 0) {
uint256 pending =
user.amount * pool.accSTRFPerShare / 1e12 - us... | 5,045,173 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {Math} from '../utils/math/Math.sol';
import {Pausable} from './Pausable.sol';
import {IARTH} from '../Arth/IARTH.sol';
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
impo... | Remove a migrator address Delete from the mapping 'Delete' from the array by setting the address to 0x0 | function removeMigrator(address migratorAddress)
public
onlyByOwnerOrGovernance
{
require(
validMigrators[migratorAddress] == true,
"address doesn't exist already"
);
delete validMigrators[migratorAddress];
for (uint256 i = 0; i < validMi... | 2,546,594 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Lib: Safe Math
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint256 a, uint256 b) public pure returns (uint256 c) {
c = a + b;
... | ------------------------------------------------------------------------ Don't accept ETH ------------------------------------------------------------------------ | function() public payable {
revert();
}
| 62,169 |
pragma solidity ^0.4.13;
/**
* @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(uint25... | Update the CNY/BTC rate to record purchases in CNY/ | function updateCnyBtcRate(uint256 rate)
external
onlyFundraiser
returns (bool)
{
cnyBtcRate = rate;
CnyBtcRateUpdated(cnyBtcRate);
return true;
}
| 12,901,700 |
pragma solidity ^0.4.24;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'AirlineRole' to manage this role - add, remove, check
contract AirlineRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other for Removing
event AirlineAdded(address indexed account);
e... | Define an internal function '_addAirline' to add this role, called by 'addAirline' | function _addAirline(address account) internal {
airlines.add(account);
emit AirlineAdded(account);
}
| 6,409,641 |
./full_match/5/0xbb1dCb854eE8e1ce1bcf27044E0B361215e7951A/sources/contracts/tenderfarm/TenderFarm.sol | @inheritdoc ITenderFarm | function harvest() external override {
_harvest(msg.sender);
}
| 1,887,785 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) ... | return true if crowdsale event has ended | function hasEnded() public view returns (bool) {
return block.timestamp > endTime;
}
| 10,666,600 |
./partial_match/1/0xd4bDCCa1CA76ceD6FC8BB1bA91C5D7c0Ca4fE567/sources/Comptroller.sol | Sets the collateralFactor for a market Admin function to set per-market collateralFactor cToken The market to set the factor on newCollateralFactorMantissa The new collateral factor, scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin | function _setCollateralFactor(CToken cToken, uint newCollateralFactorMantissa) public returns (uint256) {
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);
}
Market storage market = markets[address(cToken)];
if (!mar... | 3,684,657 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
// NOTE: this contract is not fully tested!
contract ERC734KeyManager {
event KeySet(bytes32 indexed key, uint256 indexed purposes, uint256 indexed keyType);
event KeyRemoved(bytes32 indexed key, uint256 indexed purposes, uint256 indexed keyType)... | Only purposes that are power of 2 are allowed e.g.: 1, 2, 4, 8, 16, 32, 64 ... Integers that represent multiple purposes are not allowed | function keyHasPurpose(bytes32 _key, uint256 _purpose) public view returns (bool) {
require(_purpose != 0 && (_purpose & (_purpose - uint256(1))) == 0, "purpose-must-be-power-of-2");
return (keys[_key].purposes & _purpose) != 0;
}
| 6,435,331 |
./full_match/1/0x94ac400fCB76547E7665BAdC28e1EAf9f7f43Ca7/sources/contracts/tokens/Root.sol | Renounce ownership of contract Not possible with this smart contract | function renounceOwnership() public virtual override onlyOwner {
revert("Ownable: Can't renounceOwnership here");
}
| 2,964,999 |
./full_match/1/0xDf5e9f529679c74Ba86449bA7258c7679E103206/sources/browser/Contract_Code_v2_Base.sol | get user level (time limit) level_v1 level (v1) level_v2 level (v2) levelStatus level Status (v1) limitTime level (v1) Valid time levelLockDemotion level (v2) Lock Demotion return level/ | function getLevelByValidTime(uint8 level_v1, uint8 level_v2, uint8 levelStatus, uint limitTime, uint8 levelLockDemotion)
internal
view
returns (uint8)
{
if(levelLockDemotion == 1) {
return level_v2;
}
if(levelStatus == 1 && limitTime >= now && level_v1 > level_... | 16,392,072 |
./full_match/421613/0xC7475E940ed80773703a783F0eF4858c850FD877/sources/project_/contracts/VestedERC20.sol | Mints wrapped tokens using underlying tokens. Can only be called before the vest is over. underlyingAmount The amount of underlying tokens to wrap recipient The address that will receive the minted wrapped tokens return wrappedTokenAmount The amount of wrapped tokens minted -------------------------------------------... | function wrap(uint256 underlyingAmount, address recipient)
external
returns (uint256 wrappedTokenAmount)
{
uint256 _startTimestamp = startTimestamp();
uint256 _endTimestamp = endTimestamp();
if (block.timestamp >= _endTimestamp) {
revert Error_Wrap_VestOver()... | 11,567,913 |
./partial_match/1/0x72eE4D7991Eeb9bc403e9A0019AAf7404F20599C/sources/INDICTED.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Trump Indicted", "TRUMPINDICTED") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
unisw... | 4,229,506 |
./partial_match/80001/0x38Eb53Bc0CB2E996230325e01FB147b47bd05d93/sources/contracts/UnergyBuyer.sol | Transfer funds to the installer based on the weight of each milestone and project financing income. project The project whose cost will be used to calculate the payment milestone The milestone whose weight will be used to calculate the payment/ | function _installerPayment(
Project memory project,
Milestone memory milestone
) internal {
IERC20 stableCoin = IERC20(project.stableAddr);
uint256 presentProjectFundingValue = unergyData
.getPresentProjectFundingValue(project.addr);
uint256 stableDecimals = ... | 8,796,026 |
./full_match/5/0x64511154b7d582aF28714d5d38861404617829A6/sources/node_modules/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Check that tokenId was not transferred by `_beforeTokenTransfer` hook Clear approvals... | function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId, 1);
... | 1,887,849 |
./full_match/137/0x0f18E158Ac5CD23E0097e1a94277DDFf82F5226d/sources/contract/Miracle-Tournament/Miracle-Escrow-R5.sol | The tournament CANCEL and the USERS withdrawn entry FEE. | function cancelRegFeeWithdraw(uint _tournamentId) external {
Tournament storage _tournament = tournamentMapping[_tournamentId];
require(_tournament.tournamentCanceled, "Tournament has not canceled");
require(_tournament.playersWithdrawableFee[msg.sender] > 0, "There is no prize token to be p... | 3,768,436 |
./full_match/80001/0x04629Ef344DD647FDC1199E154d207d9A465fe5e/sources/project_/contracts/Interfaces/IERC721Upgradeable.sol | Required interface of an ERC721 compliant contract./ | interface IERC721Upgradeable {
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 ba... | 5,661,246 |
pragma solidity ^0.5.0;
import "./Token.sol";
contract DrawToken is Token {
address owner; //owner만 가능하게 해주는 함수를 위한 주소 onlyOwner을 사용하기 위한
uint256 _initialAmount;
uint8 _decimalUnits;
string _tokenName;
string _tokenSymbol;
uint totalSupply;
uint houseEther;//하... | 하우스로부터 돈을 받는 스마트 컨트랙트이다. | function getDrawToken(address _to, uint amount) external returns(bool success){
if (houseEther >= amount && amount > 0) {
houseEther -= amount;
balances[_to] += amount;
return true;
return false;
}
}
mapping (address => uint256) balances... | 7,309,402 |
./full_match/1313161554/0xEF72330b252490648D01B242eCfFbb10b3C01B61/sources/contracts/JetStaking/JetStakingV2.sol | calculate the shares for a user per AURORA stream and other streams amount the staked amount WARNING: rewards are not claimed during stake. The UI must make sure to claim rewards before adding more stake. Unclaimed rewards will be lost. `_before()` must be called before `_stake` to update streams rps compounded AURORA... | function _stake(address account, uint256 amount) internal virtual {
User storage userAccount = users[account];
uint256 _amountOfShares = 0;
if (totalAuroraShares == 0) {
_amountOfShares = amount;
uint256 numerator = amount * totalAuroraShares;
_amountOfSha... | 13,233,230 |
./partial_match/1/0x3F6066BcbA8ECe43369650Dd564b36380C1cC211/sources/contracts/Valve.sol | create a new transfer token address of token, 0x0 for eth to address of to amount valid for erc20/ send eth eth erc20 | function createTransfer(
IERC20 token,
address to,
uint256 amount,
bool isDirect
) external payable nonReentrant whenNotPaused {
uint256 realAmount = msg.value;
TransferStatus status;
if (isDirect) {
if (address(token) == address(0)) {
... | 16,175,835 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
// Contracts
import "./Base.sol";
// Libraries
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol";
// Interfaces
import "../interfaces/loans/ILoanManager.sol";
import "../interfaces/IDappRegistry.sol";
// Commons
import "../util/Ad... | State Variables /// Modifiers / External Functions // | function addDapp(address dapp, bool unsecured) external onlyPauser {
require(dapp.isContract(), "DAPP_ISNT_A_CONTRACT");
require(!_isDapp(dapp), "DAPP_ALREADY_EXIST");
dappsList.add(dapp);
emit NewDappAdded(msg.sender, dapp, unsecured);
}
@param dapp address to add in ... | 12,659,393 |
pragma solidity 0.5.17;
import "../PriceOracle.sol";
import "../MErc20.sol";
import "../EIP20Interface.sol";
import "../SafeMath.sol";
import "./AggregatorV2V3Interface.sol";
contract ChainlinkOracle is PriceOracle {
using SafeMath for uint;
address public admin;
bytes32 public nativeToken;
mapping(a... | Chainlink USD-denominated feeds store answers at 8 decimals Ensure that we don't multiply the result by 0 | function getChainlinkPrice(AggregatorV2V3Interface feed) internal view returns (uint) {
(, int256 answer, , uint256 updatedAt, ) = AggregatorV2V3Interface(feed).latestRoundData();
require(answer > 0, "Chainlink price cannot be lower than 0");
require(updatedAt != 0, "Round is in incompleted ... | 12,902,000 |
./full_match/43113/0x48aC69a0F8bc90D5b3B81F6162Ec87C864eBD052/sources/_superfluid-finance/solidity-semantic-money/src/SemanticMoney.sol | Monetary unit rtb function for basic particle/universal index. | function rtb(BasicParticle memory a, Time t) internal pure returns (Value v) {
return a._flow_rate.mul(t - a._settled_at) + a._settled_value;
}
| 7,172,714 |
pragma solidity ^0.4.11;
import "./PrismLibData.sol";
import './SafeMath.sol';
import './IPrism.sol';
import './CerberusOracle.sol';
import './Registrar.sol';
import './PortfolioProposalLib.sol';
import './DecimalMath.sol';
library PortfolioLib {
using PortfolioProposalLib for PortfolioProposalLib.Data;
/******... | Copies the coin values of the portfolio. Also copies the registrar address. / get prism data | function copyPortfolio(Data storage self, IPrism prism) public {
uint[29] memory uints;
address[5] memory addresses;
(,addresses,uints,) = prism.data();
uint numOtherCoins = prism.numCoins();
self.coinsHeld.length = 0;
for (uint16 i=0; i<numOtherCoins; i++) {
bytes8 ticker = prism.getCo... | 12,723,134 |
./full_match/43114/0x2115f83922Ad1D732bbd3b3A255f861d6B95079F/sources/project_/contracts/HimalayaToken.sol | Update the marketing transfer tax rate. Can only be called by the current operator./ | function updateMarketingRate(uint16 newMarketingRate) public onlyOperator {
uint16 totalRate = liquidityRate.add(burnRate).add(newMarketingRate);
require(totalRate <= MAXIMUM_TRANSFER_TAX_RATE, "LAYA::Total rates exceeded");
marketingRate = newMarketingRate;
transferTaxRate = totalRa... | 4,600,308 |
pragma solidity ^0.4.15;
/**
* @title Log Various Error Types
* @author Adam Lemmon <adam@oraclize.it>
* @dev Inherit this contract and your may now log errors easily
* To support various error types, params, etc.
*/
contract LoggingErrors {
/**
* Events
*/
event LogErrorString(string errorStr... | Execute orders in batches. _token_and_EOA_Addresses Tokan and user addresses. _amountsExpirationAndSalt Offer and want token amount and expiration and salt values. _sig_v All order signature v values. _sig_r_and_s All order signature r and r values. return The success of this transaction./ | function batchExecuteOrder(
address[4][] _token_and_EOA_Addresses,
uint8[2][] _sig_v,
bytes32[4][] _sig_r_and_s
) external
returns(bool)
{
for (uint256 i = 0; i < _amountsExpirationAndSalt.length; i++) {
require(executeOrder(
_token_and_EOA_Addresses[i],
_amountsExpiratio... | 904,919 |
./partial_match/1/0x4F08eE02951C376A13406894AB678D249C9E68c1/sources/RAYBancorConverter.sol | sells the token by withdrawing from one of its reserve tokens _reserveToken reserve token contract address _sellAmount amount to sell (in the smart token) _minReturn if the conversion results in an amount smaller the minimum return - it is cancelled, must be nonzero return sell return amount/ ensure th... | function sell(IERC20Token _reserveToken, uint256 _sellAmount, uint256 _minReturn) internal returns (uint256) {
uint256 amount;
uint256 feeAmount;
(amount, feeAmount) = getSaleReturn(_reserveToken, _sellAmount);
require(amount != 0 && amount >= _minReturn);
uint256 tokenSuppl... | 9,259,146 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/**
* @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 returns (uint256);
/**
* @dev Returns the amount of tokens owned by `... | Returns the rebuilt hash obtained by traversing a Merklee tree up from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt hash matches the root of the tree. When processing the proof, the pairs of leafs & pre-images are assumed to be sorted. _Available since v4.4._/ Hash(current computed hash + current... | function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
computedHash = keccak256(abi.encodePacked(computedHash, proofElement... | 8,014,676 |
./full_match/5/0x7F0f99Aa51B88B3784D71712CBbf069dDE7abC46/sources/Staking.sol | A method to add a stakeholder. _stakeholder The stakeholder to add. MUST revet if stakeholder already exists/ | function addStakeholder(address _stakeholder) public {
(bool _isStakeholder, ) = isStakeholder(_stakeholder);
if (!_isStakeholder) stakeholders.push(_stakeholder);
}
| 1,856,629 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@chainlink/contracts/src/v0.8/dev/VRFConsumerBase.sol";
impor... | claim the first place reward if the token is eligible for it Requirements: - this `tokenId` must be the first place winner for the `lotteryId` - only the owner of the `tokenId` can claim the reward Emits a {AwardClaimed} event/ | function claimFirstPlacePrize(uint256 tokenId, uint256 lotteryId) public {
require(
lotteryIdToTokenIdToFirstPlace[lotteryId][tokenId],
"This tokenId has not won the first place for this lottery id or has already claimed the prize!"
);
require(
msg.sender ... | 12,770,233 |
./full_match/5/0x6110B8841fE5Af60B07e141bb1DBCD403494EBa4/sources/browser/contracts/CRAZY.sol | etherValueOfContract/total = rateOfConversion; | function forceEnd(uint256 rate) public makerOnly{
isTime = false;
rate = rateOfConversion;
}
| 11,625,578 |
./full_match/41/0xfc31253541a7A70AaBc7f8E693C13e116cf3F8D2/sources/contracts/FarmBoosterProxy.sol | It initializes the contract. It can only be called once. _admin: the admin address _farmBooster: the farm booster address _masterchefV2: the address of the Masterchef V2 _popsToken: the address of the pops token/ Make this contract initialized | function initialize(
address _admin,
address _farmBooster,
address _masterchefV2,
address _popsToken
) external {
require(!isInitialized, "Already initialized");
require(msg.sender == FARM_BOOSTER_PROXY_FACTORY, "Not factory");
isInitialized = true;
... | 16,370,604 |
./partial_match/1/0x9a129032F01EB4dDD764c1777c81b771C34a2fbE/sources/contracts/ERC998TopDown.sol | A token receives a child token param The address that caused the transfer _from The owner of the child token _childTokenId The token that is being transferred to the parent _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId return the selector of this method/ | function onERC721Received(
address,
address _from,
uint256 _childTokenId,
bytes calldata _data
) external virtual override whenNotPaused nonReentrant returns (bytes4) {
_validateAndReceiveChild(_from, msg.sender, _childTokenId, _data);
return this.onERC721Received... | 16,187,168 |
./full_match/4/0x90641Be52c0F2bD0B9c7F3C84CEE6Eee2bDB9000/sources/home/user/Documents/Projects/solidity/arbitrage-bot/third-party-contracts/USDC/USDC.sol | Transfer tokens from the caller to Payee's address value Transfer amount return True if successful/ | function transfer(address to, uint256 value)
external
override
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(to)
returns (bool)
{
_transfer(msg.sender, to, value);
return true;
}
| 13,310,595 |
./full_match/77/0xE693AeDa433ADF46b3C6464F95f2c505A52c4541/sources/contracts/official/CFC0/CFC0Token.sol | Returns the total amount of tokens the specified investor has in the offer/ | function getTotalInOffer(address _aInvestor)
public
view
returns (uint256)
{
if (offer == IOffer(0x0)){
return 0;
}
return nBalance;
}
| 5,047,896 |
./full_match/1/0xd2e7862bB34698d86884E4CE6c4F5f4511C6EC8e/sources/contracts/interfaces/IFeeCollector.sol | Events immutables non-view functions | interface IFeeCollector {
event FeeDistributed(
address asset,
uint256 defaultFundsDelta,
uint256 protocolFeesDelta
);
event FeeCollected(
address asset,
bool fromDefaultFund,
uint256 collectedAmount
);
event DefaultFundPaused(bool _defaultFundPaused);... | 3,078,650 |
// SPDX-License-Identifier: MIT
pragam solidity ^0.8.9;
contract Decentradit {
event PostCreated (bytes32 indexed postId, address indexed postOwner, bytes32 indexed parentId, bytes32 contentId, bytes32 categoryId);
event ContentAdded (bytes32 indexed contentId, string contentUri);
event CategoryCreated (by... | Validating the change in reputation | function validateReputationChange(address _sender, bytes32 _categoryId, uint8 _reputationAdded) internal view returns (bool _result) {
uint80 _reputation = reputationRegistry[_sender][_categoryId];
if (_reputation < 2 ) {
_reputationAdded == 1 ? _result = true: _result = false;
}... | 12,913,624 |
./partial_match/1/0x14F49AB05938b19B09463Be7926A01CF7309c182/sources/BallisticFreaksNFTs.sol | calls for random number and picks corresponding NFT deletes used ID from array and moves the last uint to it's place. Also shortens arrays length, so it would be impossible to pick same number. | function findUnminted() internal returns(uint) {
uint supply = totalSupply();
uint index = random(maxSupply - supply - 1);
uint chosenNft = mints[index];
uint swapNft = mints[maxSupply - supply - 1];
mints[index] = uint16(swapNft);
return (chosenNft);
}
| 2,805,607 |
./full_match/80001/0x127de82890D5298dE64bf7dbdde059e2a665e615/sources/base/ERC721Drop.sol | Checks whether owner can be set in the given execution context. | function _canSetOwner() internal view virtual override returns (bool) {
return msg.sender == owner() || hasRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
| 839,613 |
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the co... | buy ticket && start game | init game by conditions / | function buyTicket(address _player) onlyOwner
returns (uint256 playerNumber, uint256 gameNumber) {
if (currentGameStatus == GS_NOT_STARTED) {
currentGameStatus = GS_WAITING_USERS;
}
gamePlayers[game].push(_player);
playerNumber = gamePlayerN... | 12,882,687 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity >=0.6.0 <0.8.0;
import "./ERC20.sol";
import "./ERC20Burnable.sol";
/// @author Zarela Team
/// @title Decentralized marketplace platform for peer-to-peer transferring of Biosignals
contract ZarelaSmartContract is ERC20 , ERC20Burnable ... | Send the angel signal to mage and save then signal IPFS Hash in the block.Also, due to the difficulty of the Zarela network, each user pays the Reward to a number of people in the non-Reward queue | function contribute(
uint _orderId,
address payable _contributorAddress,
address payable _laboratoryAddress,
bool _isContributorGainReward,
address _orderOwner,
string memory _ipfsHash,
string memory _encryptionKey
)
public
checkOrderId (... | 1,391,624 |
./full_match/5/0x113459c544f4CaF69E5e758dC445f90B7Bb20B0d/sources/contracts/cryptopiggies.sol | always mint new token ids Verify and process payload. Collect price | function mintWithSignature(
MintRequest calldata _req,
bytes calldata _signature
) external payable returns (address signer) {
require(_req.quantity > 0, "Minting zero tokens.");
require(
block.timestamp < _req.unlockTime || _req.targetBalance > 0,
"Unlock... | 1,856,936 |
// File: contracts/IEpochUtils.sol
pragma solidity 0.6.6;
interface IEpochUtils {
function epochPeriodInSeconds() external view returns (uint256);
function firstEpochStartTimestamp() external view returns (uint256);
function getCurrentEpochNumber() external view returns (uint256);
function getEpoch... | full array size is expected to be of reasonable length for the next 1-2 years we thus start iterating from epoch 0 | function getUnclaimedEpochs(IFeeHandler feeHandler, address staker)
external
view
override
returns (uint256[] memory unclaimedEpochs)
{
uint256 currentEpoch = kyberDao.getCurrentEpochNumber();
uint256[] memory tempArray = new uint256[](currentEpoch);
uint2... | 1,542,550 |
/**
*Submitted for verification at Etherscan.io on 2022-02-15
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity =0.8.9;
////// src/ITimeLock.sol
/* pragma solidity 0.8.9; */
interface ITimeLock {
function delay() external view returns (uint);
function queuedTransactions(bytes32 hash) external... | Computes transaction hash. target Address to call value Amount of ETH to send signature Function signature data Data to send, function inputs eta Timestamp/ | function getTxHash(
address target,
uint value,
string calldata signature,
bytes calldata data,
uint eta
) external pure returns (bytes32) {
return _getTxHash(target, value, signature, data, eta);
}
| 7,870,876 |
./full_match/11155111/0x3253DafBFf93FE352611C975c5b5538772A0bAD1/sources/project_/contracts/TestPass.sol | super.transferFrom(from, to, id); | function transferFrom(
address from,
address to,
uint256 id
) public virtual override {
revert("Token is non-transferable");
}
| 3,794,773 |
pragma solidity ^0.4.24;
/**
* @title -FoMo-3D v0.7.1
* ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
* _____ _____
* ... | updates masks for round and player when keys are bought return dust left over/ calc profit per key & round mask based on this buy: (dust goes to pot) calculate player earning from their own buy (only based on the keys they just bought). & update player earnings mask calculate & return dust | function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys)
private
returns (uint256)
{
earnings masks are a tricky thing for people to wrap their minds around.
the basic thing to understand here. is were going to have a global
tracker based on prof... | 7,297,237 |
/**
*Submitted for verification at Etherscan.io on 2020-07-12
*/
// SPDX-License-Identifier: GPLv3
/**
Note that this is contract is not under the MIT license. While this is still open source code,
there are still limitations when using this contract.
*/
pragma solidity 0.6.11;
// This contract defines the st... | Unstake: Unstake x amount TRA from this contract Sends back to the user Empty the array Interest is deducted from the staking pool's balance | function UnstakeAll() public {
uint256 _totalStaked = _StakeAmounts[msg.sender];
_StakeAmounts[msg.sender] = 0;
uint256 interest = CalculateInterest(msg.sender);
delete _Hashes[msg.sender];
_TRAContract.transfer(msg.sender,_totalStaked.add(interest));
}
| 5,408,381 |
./full_match/5/0xF01d067E0782D27058442f0637e33dE9CD967F9F/sources/contracts/UniLikeDexTrader.sol | feeRate 按 10000 计算, 如果千分之三,则 feeRate 输入 9970 | function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut, uint256 feeRate) internal pure returns (uint256 amountIn) {
require(amountOut > 0, 'DexBotHelper: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'DexBotHelper: INSUFFICIENT_LIQUIDITY');
uin... | 1,882,850 |
./full_match/84531/0xbBE13Aba1F0E8D9c81FBC981D09C6Bed3F029B0F/sources/salary.sol | Set Release Interval / | function setReleaseInterval(uint256 newReleaseInterval) external onlyAdmin {
uint256 oldReleaseInterval = releaseInterval;
releaseInterval = newReleaseInterval;
emit NewReleaseInterval(oldReleaseInterval, newReleaseInterval);
}
| 11,515,635 |
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
// Part: IBetaBank
interface IBetaBank {
/// @dev Returns the address of BToken of the given underlying token, or 0 if not exists.
function bTokens(address _underlying) external view r... | Recovers lost tokens by the governor. This function is extremely powerful so be careful. _bToken The BToken to propagate this recover call. _token The ERC20 token to recover. _amount The amount of tokens to recover. | function recover(
address _bToken,
address _token,
uint _amount
) external onlyGov lock {
require(underlyings[_bToken] != address(0), 'recover/not-bToken');
BToken(_bToken).recover(_token, msg.sender, _amount);
}
| 10,721,903 |
pragma solidity ^0.7.0;
// SPDX-License-Identifier: MIT
import "./DaoConstants.sol";
import "../helpers/FlagHelper.sol";
import "../guards/AdapterGuard.sol";
import "../utils/IERC20.sol";
import "../utils/SafeMath.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted, free of charge, to any... | Get the revert message from a call This is needed in order to get the human-readable revert message from a call _res Response of the call return Revert message string/ If the _res length is less than 68, then the transaction failed silently (without a revert message) | function _getRevertMsg(bytes memory _res)
internal
pure
returns (string memory)
{
if (_res.length < 68) return "Transaction reverted silently";
}
| 5,421,688 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./libs/IUniRouter02.sol";
import "./libs/IWETH.sol";
interface IToken {
... | Withdraw reward token Only callable by owner. Needs to be for emergency./ | function emergencyRewardWithdraw(uint256 _amount) external onlyOwner {
require( block.number > bonusEndBlock, "Pool is running");
require(availableRewardTokens() >= _amount, "Insufficient reward tokens");
earnedToken.safeTransfer(address(msg.sender), _amount);
if (totalEarn... | 5,923,613 |
./full_match/4/0xAfA8d49AD126e9e9CcD6b27E47a6cA9Fc6F6cf52/sources/contracts/test.sol | I know this percent is off. But it leaves ETH in wallet for gas | function withdrawPublic() public onlyOwner {
require(publicBal > 0, "Insufficent balance");
uint256 devBal = ((publicBal * 80) / 100);
uint256 commBal = ((publicBal * 20) / 100);
_widthdraw(walletA, ((devBal * 1500) / 10000));
_widthdraw(walletB, ((devBal * 125) / 10000));
... | 646,694 |
pragma solidity 0.4.14;
/*
Copyright 2017 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 app... | Stores order and initializes sale parameters. orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. v ECDSA signature parameter v. r ECDSA signature parameters r... | function initializeSale(
address[5] orderAddresses,
uint[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s,
uint _startTimeInSec,
uint _baseEthCapPerAddress)
public
saleNotInitialized
onlyOwner
validStartTime(_startTimeInSec)
... | 2,500,805 |
./full_match/56/0x3260Ebd17d9038d2C2a3b24FFe5c8f1eA10603df/sources/project_/contracts/ClimbToken.sol | Sells CLIMB Tokens And Deposits Underlying Asset Tokens into Recipients's Address / | function sell(
address recipient,
uint256 tokenAmount
) external nonReentrant {
_sell(tokenAmount, recipient);
}
| 3,243,817 |
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to ... | Mints `quantity` tokens and transfers them to `to`. Requirements: - there must be `quantity` tokens remaining unminted in the total collection. - `to` cannot be the zero address. - `quantity` cannot be larger than the max batch size. Emits a {Transfer} event./ We know if the first token in the batch doesn't exist, the ... | function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
require(quantity != 0, "ERC721A: quantity must be greater than 0");
require(!_exists(startTokenId), "ERC7... | 15,039,520 |
pragma solidity ^0.4.21;
/**
* @title Safe maths library for big numbers.
*/
library SafeMath {
/**
* @notice Sums two numbers.
* @param a Number to add to.
* @param b Number to add.
* @return Returns the sum of two numbers.
*/
function add(uint a, uint b) internal pure returns (u... | Updates price step./ | function _updatePriceStep(uint _priceStep, uint _tierCounter) private pure returns (uint) {
uint ps = _priceStep;
if (ps > 5 szabo && _tierCounter % 1000 == 0) {
ps /= 4;
}
return ps;
}
| 14,105,594 |
./full_match/3/0x82d6f4a2aF03d396C33760e07668947c630a6044/sources/contracts/Cyclers.sol | function Purchase_Postion() external payable returns (bool) {require(msg.value == _cost, "Amount doesn't match position cost!"); | function Purchase_Postion() public {
uint256 amount = Position_Cost;
uint256 allowance = IERC20(Token).allowance(address(this), msg.sender);
require(allowance >= amount, "Check the token allowance");
IERC20(Token).transferFrom(address(this), msg.sender, amount);
uint... | 14,207,241 |
./full_match/80001/0xB769200Eb2109732eA9da606259A4d34986f5315/sources/contracts/player-id/ParagonsDAOPlayerID.sol | Mint a ParagonsDAO Player ID NFT for PDT (Whitelist). name On-chain username for the minter. signature Signature to verify whitelist./ | function whitelistMint(bytes32 name, bytes memory signature) external nonReentrant {
if (!_verifyAddressSigner(signature)) revert InvalidSignature();
_handleMint(msg.sender, name, true);
}
VIEW FUNCTIONS
| 9,505,801 |
./partial_match/1/0x8B74C9852140ea6494b69259D036d7FA33C62665/sources/VSPPFPTEST.sol | Sets the base URI for token metadata. Can only be called by the owner. baseURI_ The new base URI./ | function setBaseURI(string memory baseURI_) external onlyOwner {
baseURI = baseURI_;
}
| 2,591,183 |
pragma solidity ^0.4.13;
interface ERC721Enumerable /* is ERC721 */ {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() public v... | cutFor returns the affiliate cut for a sale cutFor returns the cut (amount in wei) to give in comission to the affiliate _affiliate - the address of the affiliate to check for _productId - the productId in the sale _purchaseId - the purchaseId in the sale _purchaseAmount - the purchaseAmount/ | function cutFor(
address _affiliate,
uint256 _productId,
uint256 _purchaseId,
uint256 _purchaseAmount)
public
view
returns (uint256)
{
uint256 rate = rateFor(
_affiliate,
_productId,
_purchaseId,
_purchaseAmount);
require(rate <= hardCodedMaximumRate);
... | 478,416 |
./full_match/3/0x8D7F693eAdAAd148F533B404B872EeB038a66E79/sources/alice/alice.sol | return 100_000_000_000_000; 100 million ALICE | function cap() public pure returns (uint256) {
}
| 14,261,465 |
/**
*Submitted for verification at polygonscan.com on 2022-02-12
*/
// Forge - Contract
//
// Distrubtion of Forge Token is as follows:
// 25% of Forge Token is Auctioned in the ForgeAuctions Contract which distributes tokens to users who use 0xBitcoin to buy tokens in fair price. Each auction lasts ~3 days. Using th... | runs every _BLOCKS_PER_READJUSTMENT / 4 | function ARewardSender() public {
uint256 runs = block.timestamp - lastrun;
uint256 runsperepoch = runs / epochsPast;
reward_amount = (100 * 10**uint(decimals)).div( 2**rewardEra );
uint256 x = (runsperepoch * 888).divRound(targetTime);
uint256 ratio = x * 100 / 888;
uint256 totalOwed;
if(ratio < ... | 13,066,694 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzepp... | Sets `_tokenURI` as the tokenURI of `tokenId`. Requirements: - `tokenId` must exist./ | function setTokenURI(uint256 tokenId, string memory _tokenURI) public virtual onlyOwner {
super._setTokenURI(tokenId, _tokenURI);
emit URIChanged(tokenId);
}
| 434,526 |
pragma solidity 0.4.26;
import "../Standards/IContractId.sol";
import "../AccessControl/AccessControlled.sol";
import "../AccessRoles.sol";
import "../KnownInterfaces.sol";
import "../Universe.sol";
import "../Identity/IIdentityRegistry.sol";
import "../Standards/ITokenController.sol";
/// @title token controller fo... | enables or disables address to be receipient of EUR-T | function setAllowedTransferTo(address to, bool allowed)
public
only(ROLE_EURT_LEGAL_MANAGER)
{
setAllowedTransferToPrivate(to, allowed);
}
| 12,608,427 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-core/pool/PoolV3.sol | Withdraws liquidity amount of asset to `to` address ensuring minimum amount required token The token to be withdrawn liquidity The liquidity to be withdrawn minimumAmount The minimum amount that will be accepted by user to The user receiving the withdrawal deadline The deadline to be respected return amount The to... | function withdraw(
address token,
uint256 liquidity,
uint256 minimumAmount,
address to,
uint256 deadline
) external override nonReentrant whenNotPaused returns (uint256 amount) {
_checkLiquidity(liquidity);
_checkAddress(to);
_ensure(deadline);
... | 2,762,447 |
./partial_match/42/0xdca624BA86505755e354C8C01CCa976063730441/sources/XTN.sol | Transfer recipient recives amount - fee | function transfer(address recipient, uint256 amount) public override returns (bool) {
if (activeFee && feeException[_msgSender()] == false) {
uint256 fee = transferFee.mul(amount).div(10000);
uint amountLessFee = amount.sub(fee);
_transfer(_msgSender(), recipient, amountLessFee);
... | 8,997,819 |
./partial_match/97/0x3601Fe48B06b0BEC400226Ea95543463566F78f7/sources/EchipsPresale.sol | Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/send tokens. beneficiary Address receiving the tokens tokenAmount Number of tokens to be purchased/ | function _processPurchase(address beneficiary, uint256 tokenAmount) internal {
_deliverTokens(beneficiary, tokenAmount);
}
| 11,349,617 |
// SPDX-License-Identifier: GPL-3.0-or-later
// 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 dis... | This uses the same technique used by the Vault in queryBatchSwap. Refer to that function for a detailed explanation. We perform an external call to ourselves, forwarding the same calldata. In this call, the else clause of the preceding if statement will be executed instead. solhint-disable-next-line avoid-low-level-cal... | function _queryAction(
bytes32 poolId,
address sender,
address recipient,
uint256[] memory balances,
uint256 lastChangeBlock,
uint256 protocolSwapFeePercentage,
bytes memory userData,
function(bytes32, address, address, uint256[] memory, uint256, uint2... | 67,408 |
// SPDX-License-Identifier: MIT
/*
$$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$\ $$\ $$\ $$$$$$$$\ $$\ $$\ $$\
$$ __$$\ $$ __$$\ $$$\ $$ |$$ __$$\ $$ | $$ |$$ _____|$$ | $$$\ $$$ |
$$ / \__|$$ / $$ |$$$$\ $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$$$\ $$$$ |
\$$$$$$\ $$$$$$$$ |$$ $$\$$ |$$... | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
| 1,220 |
// Copyright 2019 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | /< instruction page fault | function getMcauseFetchPageFault() public pure returns(uint64) {return 0xc;} | 15,821,264 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Checks if an airline is already registered Can only be called from FlightSuretyApp contract Airlines are assumed to be smart contracts, so they are represented here as addresses to contract accounts./requireAuthorizedCaller | function isRegistered
(
address airline
)
external
requireIsOperational
returns(bool)
{
return (airlines[airline].isRegistered);
... | 14,078,379 |
/**
*Submitted for verification at Etherscan.io on 2021-08-28
*/
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/lib/AddressUtil.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Utility Functions for addresses
/// @author Daniel Wang ... | Disable calls to certain contracts | function mintFromL2(
ExchangeData.State storage S,
address to,
address token,
uint256 nftID,
uint amount,
address minter,
bytes memory extraData,
... | 7,763,511 |
./partial_match/42/0x8fe80F7CA77dAA68b059f8B3e29e1c5d962f01E7/sources/Uni.sol | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint256 rawAmount)
external
returns (bool)
{
uint96 amount;
if (rawAmount == uint256(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "Uni::approve: amount exceeds 96 bits");
}
allowances[msg.sender]... | 8,844,716 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Counters {
struct Counter {
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) int... | price functions => public check price for each token, owner change unit price if needed. | function setunitPrice(uint256 _price) public onlyOwner {
unitPrice =_price;
}
| 13,820,054 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return... | Function to mint tokens _to The address that will receive 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 public returns (bool) {
totalSupply = SafeMath.add(totalSupply, _amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(0x0, _to, _amount);
return true;
}
| 8,008,191 |
./partial_match/4/0x2D7dC8f72f7Ff849E10679c0c7F296df3eF09718/sources/stake.sol | 50% of stakedDays (rounded up) with a minimum applied / | function _calcPayoutAndEarlyPenalty(
GlobalsCache memory g,
uint256 lockedDayParam,
uint256 stakedDaysParam,
uint256 servedDays,
uint256 stakeSharesParam
)
private
view
returns (uint256 payout, uint256 penalty)
{
uint256 servedEndDay = ... | 8,526,379 |
/**
*Submitted for verification at Etherscan.io on 2022-01-31
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-09
*/
// SPDX-License-Identifier: GPL-3.0-or-later
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
/**
* @dev Wrappers over Solidity... | Mint new tokens dst The address of the destination account rawAmount The number of tokens to be minted/ mint the amount transfer the amount to the recipient move delegates | function mint(address dst, uint rawAmount) external {
require(msg.sender == minter, "WSG::mint: only the minter can mint");
require(dst != address(0), "WSG::mint: cannot transfer to the zero address");
uint96 amount = safe96(rawAmount, "WSG::mint: amount exceeds 96 bits");
totalSupp... | 7,690,496 |
./full_match/1/0xbc11DDfBC71a1D91f34ffE4301aD772EAFF3119b/sources/artrix/bid.sol | Accept the bid on the token, transferring ownership to the current bidder and paying out the owner. _tokenid uint256 ID of the token with the standing bid/ Get the nft token of ownertransfer nft to the last biddercreatorPayment = value.mul(creatorPercentage).div(1000);ownerPayment = value.sub(creatorPayment).sub(maint... | function acceptbid(uint256 _tokenid) public payable ownerOrtokenof(_tokenid) whenNotPaused() {
address own = IERC721(aart).ownerOf(_tokenid);
address tk = cb[_tokenid].token;
address to = cb[_tokenid].curr;
uint256 value = cb[_tokenid].lastbid;
IERC721(aart).transferFrom(o... | 4,874,534 |
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs... | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.7;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721En... | 15,345,249 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
import "../../../token/ERC1155721/ERC1155721InventoryBurnable.sol";
import "../../../token/ERC1155721/IERC1155721InventoryMintable.sol";
import "../../../token/ERC1155/IERC1155InventoryCreator.sol";
import "../../../metadata/BaseMetadataURI.sol";
import "@animoca... | See {IERC721Metadata-name()}. | function name() external view virtual override returns (string memory) {
return "ERC1155721InventoryBurnableMock";
}
| 12,609,178 |
contract PacBall{
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public initialSupply;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (address => ui... | Public variables of the token / This creates an array with all balances / Initializes contract with initial supply tokens to the creator of the contract / | function Token() {
initialSupply =10000;
name ="PacBall";
decimals =5;
symbol = "PBC";
}
| 13,846,900 |
// File: node_modules\@openzeppelin\contracts\utils\Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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.d... | Add liquidity approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(coinageFinanceRouter), tokenAmount);
address(this),
tokenAmount,
BURN_ADDRESS,
block.timestamp
);
}
| 13,753,091 |
./partial_match/1/0xCFc2d34b63d0e2fC623eEb4c0d7943e341140810/sources/MorpheusGameController.sol | superclaim is the function who can only call the owner of 3 rabbits (3 different colors) Those 3 rabbits will be burn and 50% of the reward pool wll be transfer to claimer Rabbits must be approvedForAll by the owner for contract of gameAddress Can't be called before 30 days Re entry secure Update number of periods of c... | function superClaim(
uint256 _id1,
uint256 _id2,
uint256 _id3
) public {
require(gameInstanceNumber == 0, "There is a game instance pending please wait");
require(_rewardPool > 0, "There is no reward on pool");
require(now.sub(beginningTime) >= 40 days);
r... | 16,054,989 |
./partial_match/1/0xE9605B179259c73EB7f09d74C166d34B5934D66f/sources/contracts/VeToken.sol | """ Deposit `_value` tokens for `msg.sender` and lock until `_unlock_time` _value Amount to deposit _unlock_time Epoch time when tokens unlock, rounded down to whole weeks """ | function createLock(uint256 _value, uint256 _unlockTime)
public
virtual
nonReentrant
{
_createLockFor(msg.sender, _value, _unlockTime);
}
| 2,658,111 |
pragma solidity ^0.5.0;
import "./SafeERC20.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
/**
* @title PartnersVesting
* @dev A token holder contract that can release its token balance gradually at different vesting points
*/
contract TokenVesting is Ownable {
// The vesting schedule is time-based (i.... | return the vesting token address./ | function tokenAddress() public view returns (IERC20) {
return _token;
}
| 6,986,762 |
./full_match/4/0x0Cd4aB3C76E1F452d951118c8a3861Ca533cef09/sources/Cryptogotchi.sol | find growth stage for feeding, dead or alive | function growthStage(uint256 tokenId) public view returns (DeviceState) {
Device memory device = unit[tokenId];
if (device.createdAt == 0) return DeviceState.Unsold;
if (device.createdAt == MAX_TIMESTAMP) return DeviceState.Egg;
uint256 elapsed = block.timestamp.sub... | 816,955 |
// File: localhost/utils/Address.sol
pragma solidity ^0.6.0;
interface ERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
f... | Deprecated. This function has issues similar to the ones found in {IERC20-approve}, and its usage is discouraged./ | function safeApprove(ERC20 token, address spender, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
| 558,948 |
// v7
/**
* Token.sol
*/
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
* @param a First number
* @param b Second number
*/
function mul(uint256 a, uint256 ... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address _spender, uint256 _value) public returns (bool) {
return super.approve(_spender, _value);
}
| 1,981,318 |
//Address: 0x0348b55abd6e1a99c6ebc972a6a4582ec0bceb5c
//Contract name: PromissoryToken
//Balance: 23.298072903130000015 Ether
//Verification Date: 1/24/2017
//Transacion Count: 342
// CODE STARTS HERE
pragma solidity ^0.4.8;
//This contract is backed by the constitution of superDAO deployed at : .
//The constitutio... | Requestng withdrawal of `_totalAmount` to `_destination.address()` Create a new withdrawal request _totalAmount The total amount of tokens to be withdrawan, should be equal to the total number of owned tokens _reason Reason/Description for the withdrawal _destination The receiving address/ | function withdraw(uint _totalAmount, bytes _reason, address[] _destination)
external
founderCall
{
if (this.balance < _totalAmount) throw;
uint withdrawalID = withdrawals.length++;
withdrawals[withdrawalID].Amount = _totalAmount;
withdrawals[withdrawalID].reason... | 6,464,544 |
./full_match/1/0xa7edC2905Ae0bBdBE24F24B0962DF77DC64348F1/sources/browser/PickleJar_StrategyUniEthUsdtLpV1.sol | Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned? if so, a new strategy will be deployed. Collects UNI tokens 10% is locked up for future gov Burn some pickles first Donates DUST ... | function harvest() public {
IStakingRewards(rewards).getReward();
uint256 _uni = IERC20(uni).balanceOf(address(this));
if (_uni > 0) {
uint256 _keepUNI = _uni.mul(keepUNI).div(keepUNIMax);
IERC20(uni).safeTransfer(IController(controller).rewards(), _keepUNI);
... | 9,620,707 |
pragma solidity ^ 0.4.24;
contract ERC20Interface {
function totalSupply() public constant returns(uint);
function balanceOf(address tokenOwner) public constant returns(uint balance);
function allowance(address tokenOwner, address spender) public constant returns(uint remaining);
function transfer(address to... | uint sendmoney = amountpubper/100; | function setpubprize(uint sendmoney) private returns(bool) {
uint len = moneydata.length;
if(len > 0) {
uint all = 0;
uint start = 0;
uint m = 0;
if(len > 10) {
start = len - 10;
}
for(uint i = start; i < len; i++) {
all += money... | 894,211 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0 <0.8.0;
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol';
import '../libraries/EnumerableSet.sol';
import '../interfaces/ITimeWeightedOracle.sol';
import '../utils/Governa... | An implementation of ITimeWeightedOracle that uses Uniswap V3 pool oracles This oracle will attempt to use all fee tiers of the same pair when calculating quotes solhint-disable-next-line func-name-mixedcase solhint-disable-next-line func-name-mixedcase solhint-disable-next-line func-name-mixedcase | interface IUniswapV3OracleAggregator is ITimeWeightedOracle {
event AddedFeeTier(uint24 _feeTier);
event PeriodChanged(uint32 _period);
function factory() external view returns (IUniswapV3Factory _factory);
function supportedFeeTiers() external view returns (uint24[] memory _feeTiers);
function poolsUsedF... | 1,435,058 |
./full_match/1/0x63Dc098220C912ec4312dcdD61BCf963Bd80e0f8/sources/erc1155delta/contracts/ERC1155Delta.sol | Creates `amount` tokens, and assigns them to `to`. Emits a {TransferBatch} event. Requirements: - `to` cannot be the zero address. - `amount` cannot be zero. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value./ | function _mint(
address to,
uint256 amount,
bytes memory data
) internal virtual {
if(to == address(0)) {
revert MintToZeroAddress();
}
if(amount == 0) {
revert MintZeroQuantity();
}
address operator = _msgSender();
... | 16,433,898 |
pragma solidity ^0.4.20;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOw... | Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator. _to address to be approved for the given token ID _tokenId uint256 ID of ... | function approve(address _to, uint256 _tokenId) public {
address owner = ownerOf(_tokenId);
require(_to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
if (getApproved(_tokenId) != address(0) || _to != address(0)) {
tokenApprovals[_tokenId... | 10,092,980 |
pragma solidity ^0.4.15;
contract ERC20Interface {
// Get the total token supply
function totalSupply() constant returns (uint256 tS);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant returns (uint256 balance);
// Send _value... | Transfer the balance from owner's account to another account | function transfer(address _to, uint256 _amount) returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sende... | 1,823,004 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.