file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// Dependency 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() ext...
Update reward variables of the given pool to be up-to-date./
function updatePool() public { if (block.number <= poolInfo.lastRewardBlock) { return; } uint256 lpSupply = poolInfo.lpToken.balanceOf(address(this)); if (lpSupply == 0) { poolInfo.lastRewardBlock = block.number; return; } uint256...
7,713,031
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; pragma abicoder v2; import {ERC20Detailed} from "../libs/ERC20Detailed.sol"; import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import {DistributionTypes} from "./DistributionTypes.sol"; import {SafeMath}...
Internal ERC20 _transfer of the tokenized staked tokens from Address to transfer from to Address to transfer to amount Amount to transfer/ Sender Recipient
function _transfer( address from, address to, uint256 amount ) internal override { uint256 balanceOfFrom = balanceOf(from); _updateCurrentUnclaimedRewards(from, balanceOfFrom, true); if (from != to) { uint256 balanceOfTo = balanceOf(to); _...
1,562,170
./full_match/97/0xAFF60E6d6119D7807247809B4D39995dA2E0eF92/sources/project:/contracts/tokens/CELLIT.sol
This method is used to add new vesters can be called only from the owner account vester new vester isActive boolean condition/
function updateVesters(address vester, bool isActive) external onlyOwner { vesters[vester] = isActive; }
3,274,512
pragma solidity ^0.4.24; import "./IEscrowStorage.sol"; import "../common/Manageable.sol"; import "../common/UsePermille.sol"; contract EscrowStorage is IEscrowStorage, UsePermille, Manageable { // //Inner types //Escrow information: current fee, flag if it's active, flag if it's set struct Escro...
returns information about escrow specified by zero-based index in escrows array /
function getEscrowInfo(uint256 index) public view returns(address, bool, bool, uint16) { address escrow = escrowAgent[index]; return (escrow, escrowInfo[escrow].isActive, escrowInfo[escrow].isBanned, escrowInfo[escrow].currentFee); }
15,806,315
// File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.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.data, they should not be accessed in such a direct * man...
lockable supply is the token balance of this contract needed in case contract already owns eth
function rebalanceLiquidity() public { require(balanceOf(msg.sender) >= minRebalanceAmount, "You are not part of the syndicate."); require(block.timestamp > lastRebalance + rebalanceInterval, 'Too Soon.'); lastRebalance = block.timestamp; uint256 _lockableSupply = balanceOf(address(t...
6,145,039
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.0; // --- INTERFACES --- // Interfaces for Uniswap and MakerDao // // CDP Interface contract DssCdpManagerLike { mapping (address => uint) public first; // Owner => First CDPId mapping (uint => address) public urns; // CDPId => UrnHandler }...
Pay back contract's ether to owner
function payBack() public onlyMyself { owner.transfer(address(this).balance); }
12,664,168
pragma solidity ^0.7.0; import "./IERC165.sol"; import "./ERC165.sol"; import "./Address.sol"; import "./EnumerableMap.sol"; import "./EnumerableSet.sol"; import "./SafeMath.sol"; import "./Strings.sol"; import "./Context.sol"; import "./Ownable.sol"; import "./ISFT.sol"; import "./IFaces.sol"; import "./IERC721Enumer...
Returns if the name has been reserved./
function isNameReserved(string memory nameString) public view override returns (bool) { return _nameReserved[toLower(nameString)]; }
10,371,336
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.10; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @title Basic listing management for ERC721 NFTs /// @author Sam King (samking.eth) /// @notice Allows the contract owner or token owner to l...
Updates the address that minted the original tokens The address is used in the purchase flow to transfer tokens _tokenOwnerAddress The original minter of the tokens
function setTokenOwnerAddress(address _tokenOwnerAddress) external onlyOwnerOrMinter { tokenOwnerAddress = _tokenOwnerAddress; }
12,188,384
//Address: 0x647f24fc14b75335adf97eb9792ce004471bf35a //Contract name: MitToken //Balance: 0 Ether //Verification Date: 5/24/2018 //Transacion Count: 31 // CODE STARTS HERE pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure return...
balances[_to] = balances[_to].add(_value);
function previligedLock(address _to, uint _value) onlyOwner public returns (bool) { address _from = msg.sender; balances[_from] = balances[_from].sub(_value); previligedBalances[_to] = previligedBalances[_to].add(_value); PreviligedLock(_from, _to, _value); return true; }...
934,848
./partial_match/80001/0x0AA4AA95DF0eC39340b8bAdf5778D21412375064/sources/ErneMaster.sol
Safe Erne transfer function, just in case if rounding error causes pool to not have enough Erne's.
function safeErneTransfer(address _to, uint256 _amount) internal { uint256 ErneBal = IERC20(Erne).balanceOf(address(this)); if (_amount > ErneBal) { IERC20(Erne).transfer(_to, ErneBal); IERC20(Erne).transfer(_to, _amount); } }
8,797,780
pragma solidity ^0.4.24; // submitted by @dev-xu // 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 o...
Convert the payment token into the listing fee token
function processListingFee(address _paymentTokenAddress, uint _fromAmount) private uint listingFee = database.uintStorage(keccak256(abi.encodePacked("platform.listingFee"))); address listingFeeTokenAddress = database.addressStorage(keccak256(abi.encodePacked("platform.listingFeeToken"))); address platfo...
5,794,721
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "./ShackledStructs.sol"; import "./ShackledMath.sol"; import "./Trigonometry.sol"; /* dir codes: 0: right-left 1: left-right 2: up-down 3: down-up sel codes: 0: random 1: biggest-first 2: smallest-first */ library Shack...
Return the sine of a value, specified in radians scaled by 1e18 This algorithm for converting sine only uses integer values, and it works by dividing the circle into 30 bit angles, i.e. there are 1,073,741,824 (2^30) angle units, instead of the standard 360 degrees (2pi radians). From there, we get an output in range ...
function sin(uint256 _angle) internal pure returns (int256) { unchecked { _angle = (ANGLES_IN_CYCLE * (_angle % TWO_PI)) / TWO_PI; uint256 interp = (_angle >> INTERP_OFFSET) & ((1 << INTERP_WIDTH) - 1); uint256 index = (_angle >> INDEX_OFFSET) & ((1 << IN...
1,257,401
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library EnumerableCardNFT { struct CardEntry { bytes32 _tokenId; uint256 _star; // 剩余粉尘 uint256 _tokenVal; uint256[] _cardType; // 词条 uint256[] _cardEntrys; string _uri; add...
Returns the element stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./ 剩余粉尘 词条
function at(UintToAddressMap storage map, uint256 index) internal view returns ( uint256, uint256, uint256, uint256[] memory, uint256[] memory, string memory, address ) { ( byt...
907,744
pragma solidity ^0.4.24; import "../openzeppelin-solidity-2.0.0/contracts/utils/Address.sol"; import "../openzeppelin-solidity-2.0.0/contracts/math/SafeMath.sol"; import "../openzeppelin-solidity-2.0.0/contracts/ownership/Ownable.sol"; import "../openzeppelin-solidity-2.0.0/contracts/introspection/ERC165Checker.sol"; ...
只允许 owner 使用的销毁服务合约并取回捐赠的函数/
function destoryOracle() public onlyOwner { selfdestruct(owner()); }
6,357,801
./partial_match/1/0x2F9d44C0A80B9E673b20c469846e46A870A73CA2/sources/Masterchef.sol
See {BEP20-approve}. Requirements: - `spender` cannot be the zero address./
function approve( address spender, uint256 amount ) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
2,816,261
// SPDX-License-Identifier: AGPL-3.0 // File contracts/dependencies/open-zeppelin/Context.sol pragma solidity 0.7.5; /* * @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.data, they s...
Removes addresses from the token transfer allowlist. Reverts if any of the addresses don't exist in the allowlist. Only callable by owner. addressesToRemove Addresses to remove from the token transfer allowlist./
function removeFromTokenTransferAllowlist( address[] calldata addressesToRemove ) external onlyOwner { for (uint256 i = 0; i < addressesToRemove.length; i++) { require( _tokenTransferAllowlist[addressesToRemove[i]], 'ADDRESS_DOES_NOT_EXIST_IN_TRANSFER_ALLOWLIST' ); ...
12,691,755
pragma solidity ^0.4.24; import "./CroupierRole.sol"; import "./SafeMath.sol"; contract BlackJack is CroupierRole { using SafeMath for *; uint constant THIS_DIVISOR = 1000; uint constant LOCK_RATIO = 2500; uint8 constant MAX_CUT_CARD = 15; mapping (address => uint256) private _balanc...
Deal action core./ verify commit is "Clean". verify cut card position.verify bet amount range. Store bet parameters on blockchain.
function _dealCore(address gambler, uint256 commit, uint128 amount, uint8 cutCard) internal { Bet storage bet = bets[commit]; require(bet.gambler == address(0), "Bet should be in 'clean' state."); require(cutCard <= MAX_CUT_CARD, "Cut card position is not valid."); uint256 valu...
15,868,285
pragma solidity 0.4.26; import "../../ConverterBase.sol"; import "../../../token/interfaces/ISmartToken.sol"; /** * @dev Liquid Token Converter * * The liquid token converter is a specialized version of a converter that manages a liquid token. * * The converters govern a token with a single reserve ...
defines the reserve token for the converter can only be called by the owner while the converter is inactive and the reserve wasn't defined yet _token address of the reserve token _weight reserve weight, represented in ppm, 1-1000000/ verify that the converter doesn't have a reserve yet
function addReserve(IERC20Token _token, uint32 _weight) public { require(reserveTokenCount() == 0, "ERR_INVALID_RESERVE_COUNT"); super.addReserve(_token, _weight); }
12,951,862
./full_match/1/0xF66B8c3d9933a8f9362B4D30f2b918CC97E5a31E/sources/home/bugman/Projects/idle-governance/contracts/IdleController.sol
Add markets to idleMarkets, allowing them to earn IDLE in the flywheel idleTokens The addresses of the markets to add/
function _addIdleMarkets(address[] memory idleTokens) public { require(adminOrInitializing(), "only admin can change idle rate"); for (uint256 i = 0; i < idleTokens.length; i++) { _addIdleMarketInternal(idleTokens[i]); } refreshIdleSpeedsInternal(); }
4,845,731
./full_match/5/0xD579767E232A56AFbc1EB0863A1511a175d94D65/sources/contracts/strategies/Default.sol
Unstake tokens from the contract
function unstakeTokens(uint256 amount, uint256 proposalId) external { require(amount > 0, "ChaiLabsStrategy: Amount must be greater than zero"); require(votingStake[msg.sender][proposalId] >= amount, "ChaiLabsStrategy: Not enough staked tokens"); token.safeTransfer(msg.sender, amount); ...
1,856,544
pragma solidity ^0.4.23; import "openzeppelin-solidity/contracts/ownership/HasNoEther.sol"; import "openzeppelin-solidity/contracts/ownership/HasNoTokens.sol"; import "openzeppelin-solidity/contracts/ownership/Claimable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./TrueUSD.sol"; // This ...
Transfer ownership of _child to _newOwner Can be used e.g. to upgrade this TimeLockedController contract.
function transferChild(Ownable _child, address _newOwner) public onlyOwner { emit TransferChild(_child, _newOwner); _child.transferOwnership(_newOwner); }
5,345,378
./partial_match/5/0xF8244d1177A6f93AAf3770Af9256aC4BF56c869f/sources/MurAllNFTL2.sol
If you're attempting to bring metadata associated with token from L2 to L1, you must implement this method, to be invoked when minting token back on L1, during exit/ This function should decode metadata obtained from L2 and attempt to set it for this `tokenId` Following is just a default implementation, feel free to de...
function setTokenMetadata(uint256 tokenId, bytes memory data) internal virtual { (bytes32 dataHash, address artist, uint256 name, uint256 metadata) = abi.decode( data, (bytes32, address, uint256, uint256) ); ArtWork memory _artwork = ArtWork(dataHash, artist, name, me...
16,873,862
./full_match/420/0xbb19276AcBC448dC4DD7161d69D33fF2e854a7a0/sources/contracts/coordinape-protocol/contracts/cosoul/CoSoul.sol
Get Base URI used for computing {tokenURI}./
function getBaseURI() external returns (string memory) { return baseUri; }
13,228,456
./full_match/5/0x559385E8728b7d8C98B3910e5531D8C49F861c31/sources/project:/contracts/main/MentaportRegistry.sol
Adds new project to registry _projectRequest Project request/
function addProject( ProjectRequest memory _projectRequest ) external onlySigner registryNotPaused { if(!hasRole(PROJECT_OWNER_ROLE, _projectRequest.owner)){ _grantProjectOwnerRole(_projectRequest.owner); } uint256 projectId = totalProjects...
1,916,303
pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a ...
Get claimable tokens/
function claimableTokens() public constant returns (uint256) { address _to = msg.sender; uint256 numberOfGrants = grants[_to].length; if (numberOfGrants == 0) { return 0; } uint256 claimable = 0; uint256 claimableFor = 0; for (uint256 i = 0; i < numberOfGrants; i++) { claimab...
1,147,005
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2020-2021 SCEME SAS * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights ...
force a transfer from any account to any account Validates that caller is the admin from address the account from which to send to address the account that will receive the tokens amount uint256 the amount of token to send/
function forceTransfer(address from, address to, uint256 amount) public virtual onlyRole(ADMIN) { _transfer(from, to, amount); }
6,064,676
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.7/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This ca...
return the beneficiary of the tokens./
function beneficiary() public view virtual returns (address) { return _beneficiary; }
19,885
pragma solidity ^0.4.24; interface PlayerBookReceiverInterface { function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external; function receivePlayerNameList(uint256 _pID, bytes32 _name) external; } interface TeamAnonymousInterface { function requiredSignatures() external...
deletes proposal signature data after successfully executing a multiSig functiondone for readability sakedelete the admins votes & log. i know for loops are terrible. but we have to do thisfor our data stored in mappings. simply deleting the proposal itself wouldn't accomplish this.
function deleteProposal(Data storage self, bytes32 _whatFunction) internal { bytes32 _whatProposal = whatProposal(_whatFunction); address _whichAdmin; for (uint256 i=0; i < self.proposal_[_whatProposal].count; i++) { _whichAdmin = self.proposal_[_whatProposal...
271,055
./partial_match/42/0x96567CA7b90a28CF16Bb24EB68f582A5660CBd9c/sources/Vault.sol
Indicates that the strategy update will happen in the future/
function announceStrategyUpdate(address _strategy, address _bridgeStrategy, uint256 when) external { onlyControllerOrGovernance(); require(_strategy != address(0), "V:8"); require(IBridgeStrategy(bridgeStrategy).underlying(strategy) == address(underlying), "V:9"); require(IBridgeStra...
3,479,703
pragma solidity ^0.4.24; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import 'openzeppelin-solidity/contracts/math/Math.sol'; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; import 'openzeppelin-solidity/contracts/lifecycle/Pausable.sol'; import 'openzeppelin-solidity/contracts/lifecycle...
Get content creator tier content, by index. contentCreatorAddress The content creator address. index The index of the array. return title The title of the tier. return description The description of the tier. return price The price of the tier./
function getTier(address contentCreatorAddress, uint index) public view returns ( string title, string description, uint price ) { PriceTierSuggestion memory tier = suggestPriceTiers[contentCreatorAddress][index]; title = tier.title; description = tier.description; price = tier.price; ...
7,284,489
pragma solidity ^0.4.24; contract Utils { function stringToBytes32(string memory source) internal pure returns (bytes32 result) { assembly { result := mload(add(source, 32)) } } function bytes32ToString(bytes32 x) internal pure returns (string) { bytes memory bytes...
目的账户不存在客户转移目的地址是客户商户转移目的地址是客户
function transferScoreToAnother(uint _senderType, address _sender, address _receiver, uint _amount) public { if (!isCustomerAlreadyRegister(_receiver) && !isMerchantAlreadyRegister(_receiver)) { emit TransferScoreToAnother(msg.sender, "目的账户不存在,请确认后再转移!"); ret...
12,970,607
./partial_match/4/0xfEA88eF98dd313B5c52c814BE5CA1aeFCCDbc796/sources/REVVInventory.sol
See {IERC721-approve(address,uint256)}.
function approve(address to, uint256 nftId) external virtual override { address tokenOwner = ownerOf(nftId); require(to != tokenOwner, "Inventory: self-approval"); address sender = _msgSender(); require((sender == tokenOwner) || _operators[tokenOwner][sender], "Inventory: non-approv...
8,622,817
pragma solidity ^0.4.10; import "Ownable.sol"; import "Administrator.sol"; import "Identified.sol"; contract IDChain is Ownable { address public partiesContract; address public storageContract; //Data store Administrator public admin; Identified public identified; mapping (bytes32 =...
bool result = false;
function addCustomerHash(bytes32 _token, bytes32 _hash) returns (bool result){ uint8 crole = GetPartyRole(msg.sender); eAddCustomerHash(_token, _hash, msg.sender, crole); if ( crole == 0 || crole == 1 || crole == 3){ return false; } if (_token.length == 0 || _hash...
7,303,011
./full_match/80001/0x784665Fb071C433CA4d2c9Fe413c93FA07Ca036B/sources/src/GameAccessControl.sol
Function to check goal id claim _goalId Unique identifier of the goal/
function _checkVerifierClaims(uint256 _goalId) internal view onlyVerifier(_msgSender()) { _checkClaim(_msgSender(), GOAL_ID_CLAIM, keccak256(abi.encodePacked(_goalId))); }
9,465,609
pragma solidity ^0.4.21; /// @title ERC-165 Standard Interface Detection /// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md interface ERC165 { function supportsInterface(bytes4 interfaceID) external view returns (bool); } /** * @title Ownable * @dev The Ownable contract has an owner addr...
Enable or disable approval for a third party ("operator") to manage all your asset. Emits the ApprovalForAll event _operator Address to add to the set of authorized operators. _approved True if the operators is approved, false to revoke approval
function setApprovalForAll(address _operator, bool _approved) external { operatorApprovals[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved); }
7,691,916
pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @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 (uint...
Burn token, only owner is allowed to do this value Amount of tokens to burn/
function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); }
396,603
./full_match/100/0x2327dB49Af92d468F00127AA9037334CFed3CB38/sources/contracts/TokenSale.sol
View-only function to return this contract's Ether balance in WEI. As Buys are made, this contract receives Ether and sends out our custom token based on the math conversion rate. return This contract's default Ether balance in ETH format
function getContractEtherBalanceWholeTokens() external view returns(uint256){ uint256 fullBalance = getContractEtherBalance(); if(fullBalance > 0) { return convertWeiToWholeTokens(fullBalance); } else { return 0; } }
14,291,244
./full_match/43114/0x3428aa6424E65a174bB78EDe122f39301c626a44/sources/Divident/WAVAX.sol
Initialize the contract _stakedToken: staked token address _rewardToken: reward token address _rewardPerBlock: reward per block (in rewardToken) _startBlock: start block _bonusEndBlock: end block _poolLimitPerUser: pool limit per user in stakedToken (if any, else 0) _withdrawalInterval: the withdrawal interval f...
function initialize( IBEP20 _stakedToken, IBEP20 _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, uint256 _withdrawalInterval, address _admin ) external { require(!isInitialized,...
4,513,526
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contract...
the auction end is always set to now + the bid period
function _updateAuctionEnd(address _nftContractAddress, uint256 _tokenId) internal { nftContractAuctions[_nftContractAddress][_tokenId].auctionEnd = _getAuctionBidPeriod(_nftContractAddress, _tokenId) + block.timestamp; emit AuctionPeriodUpdated( _nftC...
5,506,309
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import './bases/staking/StakingRewards.sol'; import './bases/BaseTokenUpgradeable.sol'; import './bases/staking/interfaces/IOriginatorStaking.sol'; import '../reserve/IReserve.sol'; import '../utils/SafeMathUint128.sol'; im...
Function to declare as DEFAULT _defaultedAmount uint256/
function declareDefault(uint256 _defaultedAmount) external override onlyGovernance onlyOnStakingState { require(block.timestamp >= DEFAULT_DATE, 'DEFAULT_DATE_NOT_REACHED'); defaultedAmount = _defaultedAmount; _endDistributionIfNeeded(); _changeState(OriginatorStakingState.DEFAULT); ...
142,847
//Address: 0xd0df293593912a594b790137ff3b7a296ec33f42 //Contract name: MoyTokenOpenDistribution //Balance: 0 Ether //Verification Date: 12/30/2017 //Transacion Count: 2 // CODE STARTS HERE pragma solidity ^0.4.18; // **----------------------------------------------- // MoyToken Open Distribution Smart Contract. // 3...
0. conditions (length, OpenDistribution setup, zero check, exceed funding contrib check, contract valid check, within funding block range check, balance overflow check etc.) 1. vars 2. effects 3. interaction 4. events
function BuyMOYTokens() public payable { require(!(msg.value == 0) && (isOpenDistributionSetup) && (block.number >= fundingStartBlock) && (block.number <= fundingEndBlock) && (tokensRemaining > 0)); uint256 rewardTransferAmount = 0; setPrice(); amountRaised = safeAd...
12,886,841
//Address: 0x20f7a3ddf244dc9299975b4da1c39f8d5d75f05a //Contract name: SapienToken //Balance: 0 Ether //Verification Date: 4/3/2018 //Transacion Count: 4104 // CODE STARTS HERE pragma solidity ^0.4.18; // File: contracts/zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable co...
The maximum supply that can be minted, in microSPN. 500M with 6 decimals./ All initial tokens to owner
function SapienToken() public { balances[msg.sender] = MAX_SUPPLY_USPN; totalSupply_ = MAX_SUPPLY_USPN; }
13,030,219
//"SPDX-License-Identifier: MIT" pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract LiquidityMining is Ownabl...
Get rewards for a specific amount of tokenPerBlocks Calculate number of blocks covered. Get the amount of token for this pool Retrieve allowance and balance If the actual balance is less than the allowance, use the balance.no more token to pay as reward If we reached the total amount allowed already, return the allowed...
function getPoolReward( uint256 _from, uint256 _to, uint256 _tokenPerBlock, uint256 _waitForWithdraw ) public view returns (uint256 rewards) { uint256 blockCount = _to - _from; uint256 amount = blockCount*(_tokenPerBlock); uint256 allowedToken = tokenTok...
13,489,945
//Twitter: https://twitter.com/web3_io //TG: https://t.me/web3eth pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence ...
get balance of liquidity pair calculate amount to burn pull tokens from pancakePair liquidity and move to dead address permanently
function autoBurnLiquidityPairTokens() internal returns (bool){ lastLpBurnTime = block.timestamp; uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair); uint256 amountToBurn = liquidityPairBalance.mul(percentForLPBurn).div(10000); if (amountToBurn > 0){ super._...
5,776,301
// File: contracts/interfaces/SIInterface.sol interface SIInterface { function setCircuitBreakWithOwner(bool emergency) external returns (bool); function setCircuitBreaker(bool emergency) external returns (bool); function updateRewardPerBlockLogic(uint256 _rewardPerBlock) external returns (bool); function update...
Set circuitBreak to freeze/unfreeze all handlers by marketManager _emergency The status of the circuit breaker return true (TODO: validate results)/
function setCircuitBreaker(bool _emergency) onlyMarketManager external override returns (bool) { SIHandlerDataStorage.setCircuitBreaker(_emergency); emit CircuitBreaked(_emergency, block.number, handlerID); return true; }
5,937,291
./full_match/80001/0x3A907E57Dca4a585b5cFE13Cbb438De03231a814/sources/contracts/ClampGovernance.sol
queue the proposal in the timelock contract for community validators to check if proposal is valid queue function can be called by anyone
function queue(uint _proposalId) external { require(_proposalId == proposalCount, "CLAMP: INVALID PROPOSAL ID"); require(block.number >= proposals[_proposalId].endBlock, "CLAMP: VOTING NOT ENDED YET!"); ProposalState proposersLatestProposalState = state(_proposalId); require(propos...
9,491,925
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-ethereum-package/contracts/math/Math.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/Safe...
Transfer rewards from msg.sender, to be used for reward distribution
function loadRewards(uint256 rewards) public onlyAdmin updateReward(0) { rewardsToken().safeTransferFrom(msg.sender, address(this), rewards); rewardsAvailable = rewardsAvailable.add(rewards); emit RewardAdded(rewards); }
1,799,979
pragma solidity ^0.6.0; import "../common/Initializable.sol"; // Ownable implements basic access control mechanism with a single account, // the owner, that has been granted an elevated access privilege to specific // functions of the inherited contract. contract Ownable is Initializable { // keep the owner addre...
isOwner checks if the given address is the current owner
function isOwner(address adr) public view returns (bool) { return adr == _owner; }
2,562,200
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT OR Apache-2.0 import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; import "./SafeMathUInt128.sol"; import "./SafeCast.sol"; import "./Utils.sol"; import "./Storage.sol"; import "./Config.sol"; import "./Events.sol"; im...
Register creator corresponding to the factory _creatorAccountId Creator's zkSync account ID _creatorAddress NFT creator address _signature Creator's signature
function registerNFTFactoryCreator( uint32 _creatorAccountId, address _creatorAddress, bytes memory _signature ) external { require(address(nftFactories[_creatorAccountId][_creatorAddress]) == address(0), "Q"); bytes32 messageHash = keccak256(packRegisterNFTFactoryMsg(_cr...
10,423,188
/** *Submitted for verification at Etherscan.io on 2022-04-20 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ...
Generates a pseudo random index of our tokens that has not been used so far number of tokens left to create generate a random index if we havent stored a replacement token...... we just return the current index else we take the replace we stored with logic below we need to store a replacement token for the next time w...
function _mintRandomIndex(address buyer, uint256 amount) internal { uint256 supplyLeft = maxSupply - _totalMinted; for (uint256 i = 0; i < amount; i++) { uint256 index = _random(supplyLeft); uint256 tokenAtPlace = indices[index]; uint256 tokenId; if ...
6,735,497
pragma solidity ^0.4.24; import "../common/Owned.sol"; import "../common/SafeMath.sol"; import "./IFund.sol"; /**@dev This contract is used to split incoming ether in proportions between 2 or more receivers The share of each one is stored in sharePermille mapping.*/ contract EtherFund is Owned, SafeMath, IFund { ...
check the input parameters, sum should be unchanged
function changeShares3(address receiver1, uint16 share1, address receiver2, uint16 share2, address receiver3, uint16 share3) public ownerOnly { require(share1 <= MAXPERMILLE && share2 <= MAXPERMILLE && share3 <= MAXPERMILLE); require(share1 + share2 + share3 == sharePermille[rec...
14,057,642
./full_match/1/0xa3a592a37803f48da9cA6c0558Ef1Fe96181c175/sources/lib/rain.interface.interpreter/src/LibEncodedDispatch.sol
Decodes an `EncodedDispatch` to its constituent parts. dispatch_ The `EncodedDispatch` to decode. return The expression, source index, and max outputs as per `encode`.
function decode(EncodedDispatch dispatch_) internal pure returns (address, SourceIndex, uint16) { return ( address(uint160(EncodedDispatch.unwrap(dispatch_) >> 32)), SourceIndex.wrap(uint16(EncodedDispatch.unwrap(dispatch_) >> 16)), uint16(EncodedDispatch.unwrap(dispatch_...
17,080,392
./partial_match/4/0xdc629dC4a89eC8d533b3D7Da0D9FF3a7a0d2c105/sources/UpgradeableToken.sol
Somebody has upgraded some of his tokens./ New upgrade agent available./ Do not allow construction without upgrade master set./
function UpgradeableToken(address master) internal { setUpgradeMaster(master); }
8,690,772
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @title Un contrat de passeport animaliers /// @author Théo, ...
Permet de récuperer les infos
function getMember() public view returns (Member memory) { return member[msg.sender]; }
14,086,642
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; import "@evolutionland/common/contracts/interfaces/ERC223.sol"; import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; import "./interfaces/IAp...
Returns auction info for an NFT on auction. _tokenId - ID of NFT on auction.
function getAuction(uint256 _tokenId) public view returns ( address seller, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt, address token ) { Auction storage auction = tokenIdToAuction[_tokenId]; req...
2,571,181
./full_match/1/0xA2A7c7DC114765B21E7D167d9665D3992152E6d9/sources/src/abstracts/BaseVault.sol
@inheritdoc IERC4626
function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) { return _convertToAssets(shares, Math.Rounding.Down); }
16,499,476
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./interfaces/IOwnable.sol"; import "./interfaces/ISTFactory.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/ISecurityTokenRegistry.sol"; import "./storage/EternalStorage.sol"; import "./libraries/Util.sol"; import...
Called by the owner to pause, triggers stopped state/
function pause() external whenNotPaused onlyOwner { set(PAUSED, true); emit Pause(now);
12,831,577
./partial_match/1/0x5bCDC405Cb237996d29fe3Ec779209e65fF2d39C/sources/OperatorFilterRegistry.sol
Returns true if operator is filtered by a given address or its subscription./
function isOperatorFiltered(address registrant, address operator) external view returns (bool) { address registration = _registrations[registrant]; if (registration != registrant) { return _filteredOperators[registration].contains(operator); } return _filteredOperators[re...
2,831,676
./full_match/1/0x4f272815fb641082b0291025016aebEBBC6Cf0D7/sources/contracts/NarfexFiat.sol
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 {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have a...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve( msg.sender, spender, _allowances[msg.sender][spender] - subtractedValue ); return true; }
4,846,417
// SPDX-License-Identifier: MIT // 2nd part of the transition applier due to contract size restrictions pragma solidity 0.8.6; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; /* Internal Imports */ import {DataTypes as dt} from "./libraries/DataTypes.sol"; import {Transitions as tn} from "./libraries...
Apply a TransferOperatorFeeTransition. _transition The disputed transition. _accountInfo The involved account from the previous transition. _globalInfo The involved global info from the previous transition. return new account info and global info after applying the disputed transition/
function applyTransferOperatorFeeTransition( dt.TransferOperatorFeeTransition memory _transition, dt.AccountInfo memory _accountInfo, dt.GlobalInfo memory _globalInfo ) external pure returns (dt.AccountInfo memory, dt.GlobalInfo memory) { require(_accountInfo.accountId == _transi...
12,924,559
./full_match/1/0xa9F60bF2676D5069A279496076cabF8aE713Af44/sources/contracts/client.sol
Purchase multiple NFTs at once
function purchaseTokens(uint256 _howMany) external payable tokensAvailable(_howMany) { require(isSaleActive, "Sale is not active"); require(_howMany > 0, "Mint min 1"); require(msg.value >= _howMany * itemPrice, "Try to send more ETH"); uint256 ownerMinte...
16,429,701
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./open-zeppelin/interfaces/IERC20.sol"; import "./open-zeppelin/libraries/SafeERC20.sol"; import "./open-zeppelin/utils/Ownable.sol"; import "./open-zeppelin/utils/Pausable.sol"; import "./open-zeppelin/utils/ReentrancyGuard.sol"; import "./interfaces/IVo...
Block user fee claims/
function blockClaim() external onlyOwner { if(_claimBlocked) revert Errors.ClaimBlocked(); _claimBlocked = true; }
15,836,163
// File: contracts/tokens/ERC20.sol pragma solidity 0.5.14; contract ERC20 { ...
inject NONSTANDARD NAMING
function BALANCEOF603(address _owner) public view returns (uint256 balance);
12,906,817
./partial_match/1/0x21b346622e607fcC936a320D3ab8224fb36B3C0c/sources/contracts/vault/VaultFactory.sol
Hook that is called before any token transfer. This notifies the vault contract about the ownership transfer. Does not let tokens with withdraw enabled be transferred, which ensures that items cannot be withdrawn in a frontrunning attack before loan origination. from The previous owner of the t...
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721Upgradeable, ERC721EnumerableUpgradeable) { IAssetVault vault = IAssetVault(address(uint160(tokenId))); if (vault.withdrawEnabled()) revert VF_NoTransferWithdrawEnab...
9,283,484
// 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.data, they should not be accessed in such a direct * manner, sinc...
If a pre-redeem hook has been configured, call the external-protocol contract./
function _callPreRedeemHooks(ISetToken _setToken, uint256 _setQuantity, address _caller, address _to) internal { INAVIssuanceHook preRedeemHook = navIssuanceSettings[_setToken].managerRedemptionHook; if (address(preRedeemHook) != address(0)) { preRedeemHook.invokePreRedeemHook(_setToken,...
101,370
pragma solidity ^0.4.8; //EnergyTradingContract // @authors: // Jorge <alvaradojl@live.com> // usage: // accepts bids from the Grid operator /** @title Energy Trading Contract */ contract EnergyTradingContract { event HasBeenPayed(uint timestamp, address from, uint amount); //event raised contract received money. ...
Allows the trader to query to current capacity before an actual trade./
function getCapacityAvailability() constant public returns(uint) { return capacity; }
12,923,522
./partial_match/1/0x12A73E14ef40DbD995baE85377961A1D2F1596be/sources/contracts/interfaces/ICreate3.sol
ICreate3 Interface for a Create3 contract. Normally, this functionality would exist as internal functions in a library, which can be inherited by other contracts. Instead, we put this functionality in a contract so that other contracts can use non-standard Create3 formulas in a modular way. The...
interface ICreate3 { function deploy( bytes32 _salt, bytes memory _creationCode, uint256 _value ) external returns (address deployed); function getAddress(bytes32 _salt) external view returns (address); function getAddressFromDeployer( bytes32 _salt, address _de...
9,336,604
./partial_match/42/0x8E845b08319e3203701bCBC1e457F5377403b765/sources/MigratedReserve.sol
hard deposit guarantees that the currency stays in the reserve
function hardDeposit(uint currencyAmount) public auth { _depositAction(msg.sender, currencyAmount); }
8,840,390
./full_match/71402/0x62AEdB532DBa29a45C36396A84b4D57FAF5766Ec/sources/contracts/LinearPool.sol
The wrapped token's scaling factor is not constant, but increases over time as the wrapped token increases in value.
function _scalingFactors() internal view virtual override returns (uint256[] memory) { uint256[] memory scalingFactors = new uint256[](_TOTAL_TOKENS); scalingFactors[_mainIndex] = _scalingFactorMainToken; scalingFactors[_wrappedIndex] = _scalingFactorWrappedToken.mulDown(_getWrappedTokenRat...
7,092,476
./full_match/1/0xCEB1aAaf0E97b7a9b6d7313e999a3a27b04d75Cb/sources/src/tokens/ERC5095.sol
Determine how many principal tokens are needed to purchase the underlying Pre maturity Receive the shares from the caller If owner is the sender, sell PT without allowance check Transfer the underlying to the desired receiver Else, sell PT with allowance check Get the allowance of the user spending the tokens Check for...
function _withdraw( uint256 a, address r, address o, uint256 m ) internal returns (uint256) { uint256 needed = previewWithdraw(a); if (block.timestamp < maturity) { _transfer(o, address(this), needed); if (o == msg.sender) { ...
17,135,319
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.so...
Keep track of each color in this block so we can add a trait for each color Check if color has already been detected
function getAttributes(uint256 tokenId) public view returns (string memory) { string[9] memory colorStrings; bool[9] memory alreadyAdded; uint pointer; for (uint i=0; i<stackData[tokenId].length; i++) { uint color = stackData[tokenId][i].color; ...
14,559,588
./full_match/1/0xCf3b485bd11BCa74103D7D3534503bAD3fbdaC6d/sources/contracts/JBFundingCycleStore.sol
/ If there's not yet a funding cycle for the project, initialize one. Use an empty funding cycle as the base. Get the active funding cycle's configuration. If an eligible funding cycle does not exist, get a reference to the latest funding cycle configuration for the project. Get the latest funding cycle's configuration...
function _configureIntrinsicPropertiesFor( uint256 _projectId, uint256 _configuration, uint256 _weight, uint256 _mustStartAtOrAfter ) private { if (latestConfigurationOf[_projectId] == 0) return _initFor(_projectId, _getStructFor(0, 0), _configuration, _mustStartAtOrAfter, _weight)...
17,049,544
/** * SPDX-License-Identifier: LicenseRef-Aktionariat * * MIT License with Automated License Fee Payments * * Copyright (c) 2020 Aktionariat AG (aktionariat.com) * * Permission is hereby granted to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Softwar...
Declares the number of total shares, including those that have not been tokenized and those that are held by the company itself. This number can be substiantially higher than totalSupply() in case not all shares have been tokenized. Also, it can be lower than totalSupply() in case some tokens have become invalid./
function setTotalShares(uint256 _newTotalShares) external onlyOwner() { require(_newTotalShares >= totalValidSupply(), "below supply"); totalShares = _newTotalShares; }
12,639,255
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../interfaces/IUniswapV2Router.sol"; import "../interfaces/IBPool.sol"; import "../i...
tokenA is always MEE
function _removeLiquidity(address _lpAdd, address _tokenB, uint256 _liquidity) internal { _removeLiquidity2(_lpAdd, mee, _tokenB, _liquidity); }
12,793,423
./full_match/80001/0x88fa272fE8685B4E73D4590bdcA70A5B901F7Ebc/sources/contracts/BraleToken.sol
For `ControlledAccessType.Allow`, returns `true` if `account` has been granted {CONTROLLED_ACCESS_ROLE}. For `ControlledAccessType.Deny`, returns `true` if `account` has not been granted {CONTROLLED_ACCESS_ROLE}./
function isAllowed(address account) external view returns (bool) { if (controlledAccessType == ControlledAccessType.Allow) { return hasRole(CONTROLLED_ACCESS_ROLE, account); return !hasRole(CONTROLLED_ACCESS_ROLE, account); } }
5,576,372
./full_match/5/0x0ABfb5e7b5f6B96A2d1717226740E145aeBC95eD/sources/contracts/CrowdFunding.sol
gets all the campaigns available
function getCampaigns() public view returns (Campaign[] memory) { Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns); for (uint i = 0; i < numberOfCampaigns; i++){ Campaign storage item = campaigns[i]; allCampaigns[i] = item; } return allCam...
1,935,100
pragma solidity ^0.6.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a,...
function to set the total tokens to sell only owner can call this function
function setTotalAmount(uint256 _totalAmount) external onlyOwner { require(_totalAmount >= soldAmount, "More amount already sold"); require(totalAmount != _totalAmount, "Same value already set"); emit SetTotalAmount(totalAmount, _totalAmount); totalAmount = _totalAmount; }
13,120,543
pragma solidity >=0.5.0; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath#mul: OVERFLOW"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256)...
See {IERC721-setApprovalForAll}./
function setApprovalForAll(address operator, bool approved) public { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); }
7,222,158
pragma solidity ^0.4.17; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { a...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(balances[_from] >= _value); require(allowed[_from][msg.sender] <= _value); require(_value >= 0); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[...
7,688,691
/* * Copyright ©️ 2018 Galt•Space Society Construction and Terraforming Company * (Founded by [Nikolai Popeka](https://github.com/npopeka), * [Dima Starodubcev](https://github.com/xhipster), * [Valery Litvin](https://github.com/litvintech) by * [Basic Agreement](http://cyb.ai/QmSAWEG5u5aSsUyMNYuX2A2Eaz4kEuoYWUkVBR...
Mints reputation for given token to the owner account
function mint( ISpaceLocker _spaceLocker ) public { spaceLockerRegistry().requireValidLocker(address(_spaceLocker)); address owner = _spaceLocker.owner(); require(msg.sender == owner, "Not owner of the locker"); uint256 spaceTokenId = _spaceLocker.spaceTokenId(); require(reputationMi...
896,807
pragma solidity ^0.4.18; // zeppelin-solidity: 1.5.0 /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b)...
SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); ...
1,721,867
pragma solidity ^0.4.22; /** * @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; } func...
Check cap for pool address in tier 1 and 2 _address Participant address _value Participant contribution _tier Current tier/
function checkAllowedContribution(address _address, uint256 _value, uint8 _tier) internal view returns (bool _success) { bool status = false; if(contributors[_address].canContribute) { if(_tier == 0) { if(participantCapTier1 >= contributors[_address].contributionInWeiTie...
5,504,685
pragma solidity ^0.4.21; contract Ownable { address public owner; event OwnershipTransferred(address previousOwner, address newOwner); function Ownable() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwn...
the matron is a valid monster the matron is pregnant if and only if this field is set no need to check cooldown of matron or sire since giveBirth can only be called by COO determine higher generation of the parents clear pregnant related info decrease pregnant counter. send the blockchain storage fee to the coo
function giveBirth(uint256 _matronId, uint256 _monsterId, uint256 _birthTime, bytes _properties) external whenNotPaused onlyCOO returns (uint256) { require(cryptoStorage.getBirthTime(_matronId) != 0); uint256 sireId = cryptoStorage.getSiringWithId(_matronId); ...
34,088
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'ADE' 'AdeCoin' token contract // // Symbol : ADE // Name : AdeCoin // Total supply: Generated from contributions // Decimals : 8 // // ------------------------------------------------------------...
------------------------------------------------------------------------ Sall a token from a contract ------------------------------------------------------------------------
function sellCoin(address seller, uint amount) public onlyOwner is_not_locked(seller) validate_position(seller,amount){ require(balances[seller] >= amount * 10**uint(decimals)); require(sellRate > 0); require(seller != msg.sender); uint tmpAmount = amount * (1 ether * 1 wei / sellRat...
1,561,415
pragma solidity ^0.5.0; /** * @title Tellor Transfer * @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol * reference this library for function's logic. */ library TellorTransfer { using SafeMath for uint256; event Approval(address indexed _owner, address indexed _spende...
This function allows users to withdraw their stake after a 7 day waiting period from request/
function withdrawStake() external { tellor.withdrawStake(); }
12,861,528
./full_match/80001/0xc560D0eF74127Ba81B188A2e0aB5f2fBd99a6260/sources/src/LS1155.sol
scale a percentage to find the balance of a given account account The account to find the balance of return balance The balance of the account can't overflow; invariant: sum(balanceOf) == TOTAL_SUPPLY = 1e3 SUPPLY_TO_PERCENTAGE = 1e6 / 1e3 = 1e3 => sum(balanceOf[i] SUPPLY_TO_PERCENTAGE) == PERCENTAGE_SCALE = 1e6)
function scaledPercentBalanceOf( address account ) public view override returns (uint32) { uint256 currentTotalSupply = totalSupply[TOKEN_ID]; if (currentTotalSupply == 0) { return 0; uint256 scale = 1e6 / currentTotalSupply; return uint32(balanceOf[ac...
845,283
/* * This code has not been reviewed. * Do not use or deploy this code before reviewing it personally first. */ pragma solidity >=0.6.0 <0.9.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@c...
Redeem tokens from a default partitions. operator The address performing the redeem. from Token holder. value Number of tokens to redeem. data Information attached to the redemption./
function _redeemByDefaultPartitions( address operator, address from, uint256 value, bytes memory data ) internal { uint256 _remainingValue = value; uint256 _localBalance; for (uint i = 0; i < _defaultPartitions.length; i++) { _localBalance = _balanceOfByPartition[from][_def...
13,112,600
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../interfaces/ICToken.sol"; import "../../interfaces/IPendleCompoundForge.sol"; import "../../interfaces/IComptroller.sol"; import "./../abstract/PendleForgeBase.sol"; contrac...
SPDX-License-Identifier: MIT MIT License =========== Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
interface IPendleData { event ForgeFactoryValiditySet(bytes32 _forgeId, bytes32 _marketFactoryId, bool _valid); event TreasurySet(address treasury); event LockParamsSet(uint256 lockNumerator, uint256 lockDenominator); event ExpiryDivisorSet(uint256 expiryDivisor); event ForgeFeeSet(uint256 forge...
5,928,099
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // Inheritance import "../interfaces/ISt...
when farming was started with 1y and 12tokens and we want to finish after 4 months, we need to end up with situation like we were starting with 4mo and 4 tokens.
function finishFarming() virtual external whenActive onlyOwner { Times memory t = timeData; require(block.timestamp < t.periodFinish, "can't stop if not started or already finished"); stopped = true; if (_totalSupply != 0) { uint256 remaining = t.periodFinish - block.ti...
405,894
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; library PartSetHeader { //struct definition struct Data { uint64 total; bytes hash; } // Decoder section /** * @dev The main decoder for memory * @param bs The by...
The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./
function _read_height( uint256 p, bytes memory bs, Data memory r, uint[7] memory counters ) internal pure returns (uint) { (int64 x, uint256 sz) = ProtoBufRuntime._decode_sfixed64(p, bs); if (isNil(r)) { counters[2] += 1; r.height = x; if (counters[2] > 0) counters[2] -= 1;...
2,568,590
./full_match/80001/0x80bd74f03075f875F4bee9f201ac884555Eb9B7D/sources/InfinityUnits.sol
uint256 tokenId = _tokenIdCounter.current();existingURIs[_tokenUri] = 1;
function safeBatchMint( address to, uint256[] memory amounts, uint256[] memory ids, string[] memory _tokenUris ) external /*onlyOwner*/ { _mintBatch(to, ids, amounts, ''); for (uint i = 0; i < ids.length; i++) { if (!unitIds[ids[i]]) _setURI(ids[i], _...
5,635,575
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; /* * @title Contract for Pixelvault list randomizations using Chainlink VRF * * @author Niftyd...
initiate a new randomization _listLength the number of entries in the list _entryListIpfsHash ipfs hash pointing to the list of entries/
function startRandomization( uint256 _listLength, string memory _entryListIpfsHash, string memory _description ) external onlyOwner returns (bytes32 requestId) { require(counter.current() == 0 || randomizations[counter.current()-1].isFulfilled, "Previous randomization not fulfil...
71,355
pragma solidity 0.4.20; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev In...
Internal call to check max user cap
function checkCapAndRecord(address investor, uint weiAmount) internal { uint remaindingCap = maxBuyCap[investor]; require(remaindingCap >= weiAmount); maxBuyCap[investor] = remaindingCap.sub(weiAmount); investedSum[investor] = investedSum[investor].add(weiAmount); }
5,343,247
pragma solidity ^0.4.24; /////設定管理者///// contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } } ...
0 => 輸 1 => 平手 2 => 贏
function win(uint8 _result) internal returns(string result){ if (_result == 0){ return "lose!!"; } else if (_result == 1){ return "draw~~"; } else if (_result == 2){ return "win!!!"; } els...
2,157,129
/** *Submitted for verification at Etherscan.io on 2021-12-15 */ /** *Submitted for verification at Centurion invest. *Author : Aymen Haddaji */ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.0; /** * ERC20 Interfacs */ abstract contract IERC20 { function totalSupply() virtual public view retu...
send_bonus : set and send ammount of bonus./
function send_referral(address to, uint referamt) virtual public returns (bool success) { transfer(to, referamt); return true; }
8,072,387
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./utils/RLPReader.sol"; import "./utils/GsnUtils.sol"; import "./interfaces/IRelayHub.sol"; import "./interfaces/IPenalizer.sol"; /** * @title The Penalizer Imp...
checking that the same nonce is used in both transaction, with both signed by the same address and the actual data is different note: we compare the hash of the tx to save gas over iterating both byte arrays
function _penalizeRepeatedNonce( bytes calldata unsignedTx1, bytes calldata signature1, bytes calldata unsignedTx2, bytes calldata signature2, IRelayHub hub ) private { address addr1 = keccak256(unsignedTx1).recover(signature1); address addr2 = kec...
977,962
./full_match/1/0x66d97FD4DefEcD79904B3D3587dC4f8ed66Cf4Ab/sources/src/LSSVMPairERC20.sol
@inheritdoc LSSVMPair/ Do nothing since we transferred the exact input amount
function _refundTokenToSender(uint256 inputAmount) internal override { }
8,298,009
./partial_match/56/0x5e9d18783B0Bcad3A9CA3c91A76f47A6aEa4B50D/sources/BIO.sol
Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transferFrom(address src, address dst, uint rawAmount) external validLock returns (bool) { address spender = msg.sender; uint96 spenderAllowance = allowances[src][spender]; uint96 amount = safe96(rawAmount, "BIO::approve: amount exceeds 96 bits"); if (spender != src && spen...
11,283,497
pragma solidity >=0.4.21 <0.6.0; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic...
if less than 4 the caller must be one of the operational airlines we need to vote to give permission
function registerAirline (address newAirline) external requireIsOperational operationalAirline registrationPaid returns(bool/* success */, uint256/* votes */) { if(flightSuretyData.operationalAirlinesCount() < 4) {...
6,350,851
pragma solidity ^0.4.23; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; require(c / a == b, "Overflow - Multiplication"); return c; } /** *...
Returns the number of events pushed to the storage buffer - Load number emitted from buffer -
function emitted() internal pure returns (uint num_emitted) { if (buffPtr() == bytes32(0)) return 0; }
1,484,933