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.4.24; /** * @title SafeMath from zeppelin-solidity * @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 ==...
Get total batch number of a manufacturer. _mid Manufacturer ID return Total batch number/
function totalBatchOf(bytes32 _mid) public view returns (uint256) { return mfrmapping[_mid].bidcounter; }
2,508,623
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 ...
Finalize an upgrade process setting new asset implementation contract address. Can only be called after an upgrade freeze-time. return success./
function commitUpgrade() public returns (bool) { if (pendingVersion == 0x0) { return false; } if (pendingVersionTimestamp.add(UPGRADE_FREEZE_TIME) > now) { return false; } latestVersion = pendingVersion; delete pendingVersion; delete pe...
259,164
pragma solidity ^0.4.8; import "./RLC.sol"; import "./Task.sol"; contract VanityGen is Task{ RLC iextoken; address _iextokenAddr; bool public launched; struct Vanity { string myKeys; string url; } mapping (address => Vanity ) vanityRegister; function VanityGen(address _iex...
approveiextoken.approve(this, 1000000000);
function setParam(string userValue, string params) public { if (bytes(userValue).length == 0) throw; if (!iextoken.transferFrom(msg.sender, owner, 1000000000)) throw ; Launch(userValue, params, msg.sender); launched = true; }
5,470,235
/** *Submitted for verification at Etherscan.io on 2019-09-28 */ pragma solidity >=0.4.21 < 0.6.0; /** * @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) interna...
withdraws Contracts balance. -functionhash- 0x7ee20df8/ only team just can withdraw Contracts
function moveBrickContracts() onlyOwner public { require(msg.sender == owner); msg.sender.transfer(this.balance); }
2,518,075
./full_match/5/0xd5E86F0A702aD8124Ed9B02B373837De4fE8553D/sources/contracts/facets/OutputFacet.sol
get voucher position on bitmask _voucher of voucher inside the input _input which input, inside the epoch, the voucher belongs to _epoch which epoch the voucher belongs to return position of that voucher on bitmask voucher 2 128 + input 2 64 + epoch this can't overflow because its impossible to have > 2128 vouch...
function getBitMaskPosition( uint256 _voucher, uint256 _input, uint256 _epoch ) public pure returns (uint256) { return (((_voucher << 128) | (_input << 64)) | _epoch); }
7,044,718
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "./ERC721URIStorage.sol"; contract CryptoSoccerBall is ERC721URIStorage { // nb total of ball created uint32 nbBall; // address of contract creator address referee; // delay before you can steal a ball (2h by default) u...
Shoot the ball to another player. Requirements: - only referee, owner master and token owner can transfert the ball/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { address master = _masterOwner[tokenId]; require(_msgSender() == referee || _msgSender() == master || _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor...
12,920,130
./full_match/4/0xE13e465a66c0c18Ab4897B5DE5fEAAd27A61362F/sources/contracts/mass_mint.sol
So long as it's not the Unique type, go ahead and increase the count. $$ -- obtain the _owner from existing collection struct If the type is limited, then go ahead and lock it. This can't be undone, but that's the whole point.
function massMint(uint128 _cId, uint128 _amount) public virtual returns (uint256) { require(collections[_cId].collectionType != collectionTypes.Unique, "NiftyExt: Incorrect Collection Type"); require(collections[_cId].locked == false, "NiftyExt: Collection is locked, unab...
12,363,874
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { ...
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); }
175,499
./partial_match/1/0xA45F8d4b4bAa46BD0B89E33Ca46f0786Aa507E65/sources/contracts/governance/monetary/TrustedNodes.sol
Stop trusting a node. Node to distrust swaped to be a last element in the trustedNodes, then deleted _node The node to stop trusting./
function distrust(address _node) external onlyPolicy { Cohort storage currentCohort = cohorts[cohort]; uint256 trusteeNumber = currentCohort.trusteeNumbers[_node]; require(trusteeNumber > 0, "Node already not trusted"); uint256 lastIndex = currentCohort.trustedNodes.length - 1; ...
15,551,042
/* Copyright 2019-2021 StarkWare Industries Ltd. 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 https://www.starkware.co/open-source-license/ Unless required by applicable law or agre...
State variable "verifier" access functions.
function verifier() internal view returns (address) { return NamedStorage.getAddressValue(VERIFIER_ADDRESS_TAG); }
5,363,409
pragma solidity ^0.5.9; import "./LinkedListLib.sol"; contract LinkedListMock { using LinkedListLib for LinkedListLib.LinkedList; uint256 constant NULL = 0; uint256 constant HEAD = 0; bool constant PREV = false; bool constant NEXT = true; LinkedListLib.LinkedList list; event LogNotice(s...
pops the first entry from the linked list _direction pop from the head (NEXT) or the tail (PREV)
function pop(bool _direction) public returns (address) { return list.pop(_direction); }
14,053,361
./partial_match/5/0x8dee12fB4F1B18c35a6f294634ac4312E8ed996E/sources/DigitalaxRewards.sol
Normalised weightings of parent weights ln(10) = 2.30258..
function _getReturnParentWeight( uint256 _g, uint256 _p, uint256 _m ) internal view returns(uint256 d) { bytes16 order; if (_p <= _g.add(_m)) { d = 1e18; bytes16 ten18 = ABDKMathQuad.fromUInt(10**18); byte...
16,870,417
// SPDX-License-Identifier: MIT pragma solidity ^0.7.1; pragma experimental ABIEncoderV2; /******************************************************************************\ * Author: Nick Mudge <[emailΒ protected]> (https://twitter.com/mudgen) /*****************************************************************************...
This implements ERC-165.
function supportsInterface(bytes4 _interfaceId) external override view returns (bool) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); return ds.supportedInterfaces[_interfaceId]; }
246,477
./full_match/56/0xB0A99FA7058083Dd039dd19E17a3Ae14C68be0F3/sources/project_/contracts/ERC20.sol
See {IERC20-balanceOf}./
function balanceOf(address account) public view virtual returns (uint256) { return _erc.balanceOf(account); }
3,236,787
./full_match/1/0xfEe4e6Dde41B62af6A7071926A40AA9506582a2D/sources/contracts/defi.sol
Move last value to selected position Array position not initialized, so use position Array position holds a value so use that
function _generateRandomIndex() internal returns (uint256) { uint256 totalSize = MAX_NFTS - totalSupply(); uint256 index = uint256( keccak256( abi.encodePacked( nonce, _msgSender(), block.difficulty, ...
3,112,368
./full_match/1/0x08e46853c6a3b57D01F1748041999fb8EB8fF9e5/sources/contracts/fundraising/libraries/LibAccessControl.sol
Function returning access control storage at storage pointer slot. return acs AccessControlStorage struct instance at storage pointer position declare position set slot to position
function accessStorage() internal pure returns (AccessControlStorage storage acs) { bytes32 position = ACCESS_CONTROL_STORAGE_POSITION; assembly { acs.slot := position } }
17,012,093
//Address: 0xc0506ceb264b057182a4c3ab8a0b910a545479f0 //Contract name: SlognToken //Balance: 7.18174 Ether //Verification Date: 7/17/2017 //Transacion Count: 176 // CODE STARTS HERE pragma solidity ^0.4.2; contract Token { /* Public variables of the token */ string public standard; string public name; ...
refund ico method/
function refundInternal(uint256 time) internal returns (bool) { if(time <= PRE_ICO_TILL) { return false; } if(totalSoldSlogns >= MIN_PRE_ICO_SLOGN_COLLECTED) { return false; } uint256 transferedEthers; transferedEthers = preIcoEthers[msg.sen...
5,409,810
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; import "@openzeppelin/contracts/access/Ownable.sol"; import "./uniswapv2/interfaces/IUniswapV2Pair.sol"; import "./uniswapv2/interfaces/IUniswapV2Factory.sol"; import "./uniswapv2/interfaces/IUniswapV2Router02.sol"; import "@openzeppelin/contracts/token/ERC20/Saf...
Actual function that converts third-party Mooniswap liquidity (represented by LP-tokens) to our own LP-tokens/ check pair existance transfer to us get liquidity
function _depositMooniswap(uint256 _pid, uint256 _amount) internal { IMooniswap lpToken = IMooniswap(lpTokensInfo[_pid].lpToken); IERC20[] memory t = lpToken.getTokens(); IERC20 token0 = IERC20(t[0]); IERC20 token1 = IERC20(t[1]); TransferHelper.safeTransferFrom(address(lpToken), ...
6,368,550
./full_match/5/0x089b0A4Bc10e6867EA0cdb91f20225cd72B18769/sources/browser/verifiedSources/0x07D685bAC78fF9a9D0b47106C6e92C3533571557/test.sol
Store value in variable notice with num `num` num value to store/
function test1(uint256 num) public { number = num; }
11,635,089
./full_match/43113/0xFF6E94b43b6c52f64eDb32926ad64a59039e8353/sources/project_/contracts/Token/MyToken.sol
getScore function addr address/
function getScore(address addr) public view returns (uint) { return scores[addr]; }
13,145,004
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[emailΒ protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Executes multiple shares requests _requestOwners The owners of the pending shares requests Since ComptrollerProxy instances are fully trusted, we can approve them with the max amount of the denomination asset, and only top the approval back to max if ever necessary.
function executeRequests(address[] calldata _requestOwners) external { require( msg.sender == fundOwner || isRequestExecutor(msg.sender), "executeRequests: Invalid caller" ); require(_requestOwners.length > 0, "executeRequests: _requestOwners can not be empty"); ...
1,697,340
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[emailΒ protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Removes a tracked asset from the fund _comptrollerProxy The ComptrollerProxy of the fund _asset The asset to remove
function __removeTrackedAsset(address _comptrollerProxy, address _asset) internal { IComptroller(_comptrollerProxy).permissionedVaultAction( IComptroller.VaultAction.RemoveTrackedAsset, abi.encode(_asset) ); }
1,697,291
pragma solidity >=0.5.4 <0.6.0; import './SafeMath.sol'; import './TAOController.sol'; import './ITAOFactory.sol'; import './Name.sol'; import './INameTAOLookup.sol'; import './ITAOAncestry.sol'; import './IAOSetting.sol'; import './Logos.sol'; import './ITAOPool.sol'; /** * @title TAOFactory * * The purpose of th...
Get createChildTAOMinLogos setting return createChildTAOMinLogos The minimum required Logos to create a TAO/
function _getCreateChildTAOMinLogos() internal view returns (uint256) { (uint256 createChildTAOMinLogos,,,,) = _aoSetting.getSettingValuesByTAOName(settingTAOId, 'createChildTAOMinLogos'); return createChildTAOMinLogos; }
12,796,461
./full_match/1/0x24c94A697aeF3bA707C374Cc940D46Ec0F151184/sources/artifacts/MetaSquid.sol
Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless thi...
function decimals() public view virtual override returns (uint8) { return 18; }
9,690,515
./full_match/42220/0x7a1EDe8C9Cc8388bCB879Be761EE73685E5dbEfc/sources/contracts/CarbonizedCollectionV2.sol
deploy carbonizer contract if not already deployed if token not already carbonized
function carbonize(uint256 tokenId) public payable { if (carbonizer[tokenId] == address(0)) carbonizer[tokenId] = deployer.deploy(address(this)); if (!exists(tokenId)) { originalCollection.safeTransferFrom(msg.sender, address(this), tokenId); _safeMint(msg.sender, tokenId); ...
16,328,328
pragma solidity 0.8.10; /** * @title Parameters * @author @InsureDAO * @notice This contract manages parameters of markets. * SPDX-License-Identifier: GPL-3.0 */ import "./interfaces/IOwnership.sol"; import "./interfaces/IParameters.sol"; import "./interfaces/IPremiumModel.sol"; contract Parameters is IParamete...
set withdrawable period in unixtimestamp length (1 day = 86400) _address address to set the parameter _target parameter/
function setWithdrawable(address _address, uint256 _target) external override onlyOwner { _withdrawable[_address] = _target; emit WithdrawableSet(_address, _target); }
9,845,639
./full_match/80001/0x72268D5587ce2e162889F7F9966234D2bEb0FEEA/sources/project_/contracts/PriceHandler.sol
Sets a new price for minting a token in USD. The USD price should be 8 decimal places _usdPrice The new price in usdPrice./
function setPrice(uint256 _usdPrice, address _sender ) external { onlyAdmin(_sender); usdPrice = _usdPrice; }
842,902
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
(presale) ~~~> contribution tokens ~~~> (beneficiary)
function _close() internal { isClosed = true; uint256 fundsForBeneficiary = totalRaised.mul(fundingForBeneficiaryPct).div(PPM); if (fundsForBeneficiary > 0) { _transfer(contributionToken, address(this), beneficiary, fundsForBeneficiary); } _transfer(contribution...
451,763
./partial_match/1/0x425a167D3B8B4a266Ba706fB342805aa72Ab51f9/sources/contracts/CheersUpEmojiAirdrop.sol
airdropByNum is used to airdrop tokens to the given address. accounts_ the address to airdrop nums_ number of tokens to airdrop for each address numPairs_ define the tokenId and the corresponding quantity of this airdrop/
function airdropByNum(address[] calldata accounts_, uint256[] calldata nums_, Uint256Pair[] calldata numPairs_) external onlyOwner { require(accounts_.length == nums_.length, "accounts_ and nums_ must have the same length"); unchecked { uint256 total = 0; for (uint256 i = 0; i < nums_.le...
9,372,057
/* Copyright 2021 Babylon Finance Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to ...
IPriceOracle Babylon Finance Interface for interacting with PriceOracle/
interface IPriceOracle { function getPrice(address _assetOne, address _assetTwo) external view returns (uint256); function getPriceNAV(address _assetOne, address _assetTwo) external view returns (uint256); function updateReserves(address[] memory list) external; function updateMaxTwapDeviation(int24...
10,316,967
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns...
get the number of tokens available for minting ever return max tokens/
function getMaxTokens() external view returns (uint256) { return MAX_TOKENS; }
78,741
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.6.12; /** * @title BiFi's ERC20 Mockup Contract * @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) */ contract ERC20 { string symbol; string name; uint8 decimals = 18; uint256 totalSupply = 1000 * 1e9 * 1e18; // token amount: 1...
Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount) public returns (bool success) { require(balances[msg.sender] >= _amount, "insuficient sender's balance"); require(_amount > 0, "requested amount must be positive"); require(balances[_to] + _amount > balances[_to], "receiver's balance overflows...
2,578,653
pragma solidity 0.8.10; // Copyright BigchainDB GmbH and Ocean Protocol contributors // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 contract ERC721RolesAddress { mapping(address => Roles) internal permissions; address[] public auth; struct Roles { ...
it's only called internally, so is without checking onlyManager
function _addToMetadataList(address _allowedAddress) internal { Roles storage user = permissions[_allowedAddress]; user.updateMetadata = true; auth.push(_allowedAddress); emit AddedToMetadataList(_allowedAddress,msg.sender,block.timestamp,block.number); }
6,398,433
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Queue * @author Erick Dagenais (https://github.com/edag94) * @dev Implementation of the queue data structure, providing a library with struct definition for queue storage in consuming contracts. */ library Queue { // To implement this librar...
Returns the data from the front of the queue, without removing it. O(1) queue Uint256Queue struct from contract./
function peek(Uint256Queue storage queue) internal view returns (uint256 data) { return uint256(_peek(queue._inner)); }
5,372,117
pragma solidity ^0.5.0; contract BuilderShop { address[] builderInstances; uint contractId = 0; // nifty registry is hard coded address niftyRegistryContract = 0x6e53130dDfF21E3BC963Ee902005223b9A202106; modifier onlyValidSender() { NiftyRegistry nftg_registry = NiftyRegistry(niftyRegistryContr...
Internal function to burn a specific token. Reverts if the token does not exist. Deprecated, use {ERC721-_burn} instead. owner owner of the token to burn tokenId uint256 ID of the token being burned/ Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); _removeTokenFromOwnerEnumeration(owner, tokenId); _ownedTokensIndex[tokenId] = 0; _removeTokenFromAllTokensEnumeration(tokenId); }
502,792
./partial_match/1/0x2c486C984e382070a2e783d808B7e7Ba3C2999b5/sources/KillerDoge.sol
Only swaps back if these conditions are met, during sells and when the threshold is reached or when the time has reached for the swap./
function shouldSwapBack() internal view returns (bool) { return msg.sender != pair && !inSwap && swapEnabled && _balances[address(this)] >= swapThreshold.mul(2); }
4,170,289
./full_match/3/0x4e26f348cceb7A4b61Ae8Db794553D092B73fdfE/sources/browser/JulProtocol.sol
add 0.3% withdrawl fee in contract totalEthFee += amount; add 0.2% of interest uint noOfDays = userseth[user].time/1 days; uint256 percent = 1/uint256(5); uint256 totalEth = (userseth[user].eth percent noOfDays) / 100; balances[address(this)] -= amount;
function removeEth(address payable user, uint fee, uint256 amount) payable external returns (uint256 amountToken, uint256 amountETH) { address payable spender = address(this); totalEthFee+=fee; spender.transfer(fee); require(userseth[user].eth <= amount, 'Insuf...
8,228,077
./full_match/421613/0x0245A93ABd9c5b2d767B2D98cE6d5e612208E474/sources/src/arbitration/KlerosCore.sol
@inheritdoc IArbitratorV2
function createDispute( uint256 _numberOfChoices, bytes memory _extraData ) external payable override returns (uint256 disputeID) { if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough(); return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY...
11,568,332
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual returns (b...
Gets the bid counts of a given auction _auctionId uint ID of the auction/
function getBidsCount(uint _auctionId) external view returns(uint) { return auctionBids[_auctionId].length; }
12,813,461
./full_match/3/0x42D133BFb13625fF67F0D78394E025461799b734/sources/Wearables.sol
gets the current value of burning a print originalId the associated original to be burned return price_ the current value for the burn/
function getCurrentBurnPrice(uint256 originalId) public view override returns (uint256 price_) { return getBurnPrice(originalId, unpackPrintSupply(originalDatas[originalId])); }
8,134,533
./full_match/137/0x3ec2F4C46940BEf35af23C5951103197D2e7Ef1D/sources/mochi.sol
NOTE: move event up here, avoid stack too deep if too many approved tokens
function init(bytes calldata data) external { ( address[] memory _summoner, uint256[] memory _summonerShares, uint256[] memory _summonerLoot, address[] memory _approvedTokens, uint256 _periodDuration, uint256 _votingPeriodLength, ...
4,691,354
pragma solidity ^0.6.0; /** * @notice This contract only lets the user supply ETH to * the Bancor liquidity pool */ import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "./IBancorNetwork.sol"; import "./IBancorConverter.sol"; import "./IBancor...
Swap Ether for Bancor's Ether Token/
function swapEtherForEtherToken() internal { }
5,401,152
./full_match/80001/0x1368452Bfb5Cd127971C8DE22C58fBE89D35A6BF/sources/contracts/SPImplementation.sol
Company fee for SP
function companySPFee() external returns(uint256);
5,610,196
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0 <0.9.0; import "./Accounts.sol"; /** @title Documents. */ contract Documents { // state variables Document[] private documents; address payable private owner; address public accountsAddress; mapping (address => Count) private counts; mapping (ad...
update document. _imageURL document address. _index document index. status document status./ TODO: Certify document return the ether for rejection
function updateDocument(string memory _imageURL, uint _index, Status status) public payable isAdmin(msg.sender) returns(bool) { if(documents[_index].verifier == Accounts(accountsAddress).getAccount(msg.sender).affiliate && documents[_index].status == Status.CERTIFIED){ documents[_index].status =...
7,272,485
pragma solidity ^0.4.21; /*** * ,------. * | .---' ,--,--. ,--.--. ,--,--,--. * | `--, ' ,-. | | .--' | | * | |` \ '-' | | | | | | | * `--' `--`--' `--' `--`--`--' * * v 1.1.0 * "With help, wealth grows..." * * Ethereum Commo...
Get amount of tokens owned by my crop./
function myCropTokens() external view returns (uint256) { return Hourglass(eWLTHAddress).balanceOf(crops[msg.sender]); }
12,724,452
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; contract Erc20Token is IERC20, Ownable { using SafeMath for uint256; mapping(address => uint256) internal balances; mapping(address => mapping(address => uint256)) internal all...
sender(caller) transfer '_value' token to '_to' address from '_from' address Requirements: - `_to` and `_from` cannot be the zero address. - `_from` must have a balance of at least `_value` . - the sender(caller) must have allowance for `_from`'s tokens of at least `_value`./
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool) { require (_from != address(0),"_from address is not valid"); require (_to != address(0),"_to address is not valid"); require(_value<=allowances[_from][msg.sender], "_value should be smaller than...
14,693,326
pragma solidity 0.6.6; import "../utils/Utils5.sol"; import "../utils/zeppelin/ReentrancyGuard.sol"; import "../utils/zeppelin/SafeMath.sol"; import "../IKyberFeeHandler.sol"; import "../IKyberNetworkProxy.sol"; import "../ISimpleKyberProxy.sol"; import "../mock/reserves/ISanityRate.sol"; import "../mock/dao/IBurnabl...
only call by daoOperator
function setBRRData( uint256 _burnBps, uint256 _rewardBps, uint256 _rebateBps ) external onlyDaoOperator { require(_burnBps.add(_rewardBps).add(_rebateBps) == BPS, "Bad BRR values"); brrData.rewardBps = uint16(_rewardBps); brrData.rebateBps = uint16(_rebateBps); ...
2,507,862
./full_match/69/0xF3496Fabc4eBc4CB5eBf6b3B575C933Bf804C904/sources/contracts/NFT.sol
from의 μ£Όμ†Œμ—μ„œ to의 μ£Όμ†Œλ‘œ tokenId에 ν•΄λ‹Ήν•˜λŠ” NFT토큰 전솑
function transferFrom( address _from, address _to, uint256 _tokenId ) external override payable virtual { require(_isOwnerOrOperator(msg.sender, _tokenId), "only owner or operator can execute"); _transferFrom(_from, _to, _tokenId); }
13,240,342
./full_match/1/0x513372ff54a6A57314152cdA87Da93109Df69784/sources/contracts/nft/PlaSocialNFT.sol
update count for updateGroupIdCount newUpdateGroupIdCount new updateGroupIdCount/
function _doUpdateGroupIdCount(uint256 newUpdateGroupIdCount) public onlyOwner { emit DoUpdateGroupIdCount(_updateGroupIdCount, newUpdateGroupIdCount); _updateGroupIdCount = newUpdateGroupIdCount; }
3,213,294
//SPDX-License-Identifier: Unlicense pragma solidity 0.8.1; import "@openzeppelin/contracts/utils/Counters.sol"; import "hardhat/console.sol"; import "./PoolTicket.sol"; // We do not need to use safemath since solidity 0.8 have overflow checks by default //import "@openzeppelin/contracts/utils/math/SafeMath.sol"; c...
We add any remaining amounts that would have been left
function allocateWinningsBasedOnIndex(uint256 index, uint256 winningAmount, uint256 remainingContractPool, uint256 lastTicketIdPurchased, uint256 rand, ...
973,933
// SPDX-License-Identifier: MIT pragma solidity ^0.6.4; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/SignedSafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "../structs/Decimal.sol"; import "../structs/...
render the header of the SVG markup return header string/
function _generateColorMetadata(TinyBox memory box, uint8[4] memory dVals) internal pure returns (string memory) { string memory rootHue = string(abi.encodePacked('<hue>', uint256(box.hue).toString(), '</hue>')); string memory saturation = string(abi.encodePacked('<saturation>', uint256(box.saturati...
2,514,004
/** * @title Moderated * @dev restricts execution of 'onlyModerator' modified functions to the contract moderator * @dev restricts execution of 'ifUnrestricted' modified functions to when unrestricted * boolean state is true * @dev allows for the extraction of ether or other ERC20 tokens mistakenly sent to th...
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 ifUnrestricted onlyPayloadSize(2) returns (bool sucess) { require(allowed[msg.sender][_spender] == 0 || _value == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
4,813,228
./full_match/80001/0x8e82483B435D4f8731B9f9Fb3960C053d62A056c/sources/project_/contracts/Limits.sol
Sets the value of `_defaultTransactionCountLimit`. Allowed only for ComplianceManager. Function blocked when contract is paused. _newLimit the value of limit to set
function setDefaultTransactionCountLimit(uint256 _newLimit) external ifTokenNotPaused onlyComplianceManager { _defaultTransactionCountLimit = _newLimit; }
5,627,593
pragma solidity >=0.4.0 <0.6.0; /* Copyright 2017, Jordi Baylina, RJ Ewing Contributors: AdriΓ  Massanet <adria@codecontext.io>, Griff Green, Arthur Lunn This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as publis...
Updates a Giver's info to change the address, name, url, or commitTime, it cannot be used to change a plugin, and it must be called by the current address of the Giver idGiver This is the Admin id number used to specify the Giver newAddr The new address that represents this Giver newName The new name used to ident...
function updateGiver( uint64 idGiver, address newAddr, string newName, string newUrl, uint64 newCommitTime ) external { PledgeAdmin storage giver = _findAdmin(idGiver); require(msg.sender == giver.addr); giver.addr = newAddr; giver.nam...
13,121,463
pragma solidity ^0.5.0; import "../openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol"; import "../openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Claimable.sol"; import "./ProxyClaimable.sol"; import "./Governance.sol"; /** * @title IERC20 mintable interface */ interface IERC20Mintable { ...
Convert given amount of specific Stablecoin uinits to attoUsd (10e-18 USD) Since stablecoins have different decimals, the USD price of minimal unit is different/
function convertStcAmountToAUsd( address _stcAddr, uint256 _stcAmount ) public view returns (uint256) { uint8 decimals = ERC20Detailed(_stcAddr).decimals(); uint256 remainingDecimals = uint256(AUSD_DECIMALS).sub(decimals); uint256 multiplier = 10 ** remainingDecimals; ...
15,812,863
./full_match/3/0x7EFaD749c69962F8BBB659196c22B5E64953507b/sources/contracts/escrow.sol
Π’Ρ‹Π²ΠΎΠ΄ Π΄Π΅Π½Π΅Π³ΠžΠ±Π½ΡƒΠ»ΡΠ΅ΠΌ Π±Π°Π»Π°Π½ΡΠžΡ‚ΠΏΡ€Π°Π²ΡΠ΅ΠΌ Π΄Π΅Π½ΡŒΠ³ΠΈΠžΡ‚ΠΏΡ€Π°Π²Π»ΡΠ΅ΠΌ ΠΈΠ²Π΅Π½Ρ‚
function Withdraw() public notPaused { require(balances[msg.sender] > 0, 'Balance is empty'); uint sendValue = balances[msg.sender]; balances[msg.sender] = 0; require(success, 'Transfer failed'); emit withdraw( msg.sender, sendValue, block.timestamp ); }
14,189,913
pragma solidity ^0.4.0; import './Store.sol'; import './lib/owned.sol'; contract AbstractMain is owned { Store public store; /** * set the data store for the contract * can only be called if a store doesn't yet exist * that way we can't cheat and change the store after upgrade * @param _store address of pe...
set the data store for the contract can only be called if a store doesn't yet exist that way we can't cheat and change the store after upgrade _store address of persistent store contract/
function setStore(address _store) { address empty; require(store == empty); store = Store(_store); }
12,726,612
./full_match/4/0xCDa618a38a4718c022bF0Be1542852Fe39ea3A14/sources/_aave/core-v3/contracts/protocol/tokenization/VariableDebtToken.sol
Being non transferrable, the debt token does not implement any of the standard ERC20 functions for transfer and allowance./
function transfer(address, uint256) external virtual override returns (bool) { revert(Errors.OPERATION_NOT_SUPPORTED); }
762,528
./partial_match/4/0xec167AD28c74aF5c0767Ff8f537C49709427cf66/sources/ERC721Test.sol
Constructor function/
function initialize(string memory _name, string memory _symbol) public isInitializer("ERC721Token", "1.9.0") { name_ = _name; symbol_ = _symbol; }
8,552,661
/** β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆ...
Returns Supply Cap (maximum possible amount of tokens)/
function SUPPLY_CAP() external view returns (uint256) { return _supplyCap; }
374,206
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./MultiRewardsLiquidityMiningManager.sol"; import "./TimeLockPool.sol"; import "./MultiRewardsTimeLockPool.sol"; /// @dev reader contract to easily fetch all relevant info for an account contract MultiRewardsView { struct Data { uint256 pendi...
Returns the average of two numbers. The result is rounded towards zero./ (a + b) / 2 can overflow.
function average(uint256 a, uint256 b) internal pure returns (uint256) { return (a & b) + (a ^ b) / 2; }
7,338
pragma solidity ^0.5.0; interface IERC20 { function approve(address _spender, uint256 _value) external returns(bool); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); } interface NtfPoolI { function tokenDe...
Allows to remove an _owner. Transaction has to be sent by wallet. _owner Address of _owner.
function removeOwner(address _owner) public onlyWallet ownerExists(_owner) { isOwner[_owner] = false; for (uint i = 0; i < owners.length - 1; i++) if (owners[i] == _owner) { owners[i] = owners[owners.length - 1]; break; ...
12,713,547
./full_match/1/0x45F97D07dAB04B21F36fA3b1149c35e316b35d03/sources/contracts/PirexCvx.sol
/ Allow PirexFees to distribute fees directly from sender Distribute fees
function initiateRedemptions( uint256[] calldata lockIndexes, Futures f, uint256[] calldata assets, address receiver ) external whenNotPaused nonReentrant { uint256 lockLen = lockIndexes.length; if (lockLen == 0) revert EmptyArray(); if (lockLen != assets...
16,476,795
pragma solidity ^0.4.23; contract Payout { address paymentAddress; bool instantSendEth = false; uint256 private weiRaised; address private whitelist; event SetWhitelistAddress(address whitelistAddr); event SetInstantSendETH(bool instantSendEth); event WeiRaised(uint weiRaised); event Deposit(...
Check if contributor is whitelisted _beneficiary Address to check if whitelisted/ move pointer to free memory spot put function sig at memory spot append argument after function sig
function preValidateWhitelist(address _beneficiary) internal { bytes4 sig = bytes4(keccak256("checkWhitelist(address)")); bool answer; assembly { let ptr := mload(0x40) mstore(ptr,sig) mstore(add(ptr,0x04), _beneficiary) let result := call( ...
12,718,373
./full_match/1/0x80932E9f860387d91bFf3a359eAa4732b6Fe2269/sources/RestlessApeYachtClub.sol
Function used during the public mint quantity Amount to mint. checkState to check sale state.
function Mint(uint64 quantity) external payable checkState(SaleStates.PUBLIC) { if (msg.value < quantity * price) revert InvalidEtherAmount(); if ((_numberMinted(msg.sender) - _getAux(msg.sender)) + quantity > WALLET_MAX) revert WalletLimitExceeded(); ...
16,610,321
./full_match/4/0x625e2cc532d8b80D69D12132D8F63a3157bbc2A0/sources/contracts/ERC721Lending.sol
reset lenders to sent token mapping, swap with last element to fill the gap
function removeFromLendersWithTokens(address tokenAddress, uint256 tokenId) internal { uint totalCount = lendersWithTokens.length; if (totalCount > 1) { for (uint i = 0; i<totalCount; i++) { ERC721TokenEntry memory tokenEntry = lendersWithTokens[i]; if (tokenEntry.lenderAddress == msg.se...
790,578
// SPDX-License-Identifier: MIT-open-group pragma solidity ^0.8.11; import "contracts/libraries/math/CryptoLibrary.sol"; import "contracts/interfaces/IETHDKG.sol"; import "contracts/interfaces/IETHDKGEvents.sol"; import "contracts/libraries/ethdkg/ETHDKGStorage.sol"; import "contracts/utils/ETHDKGUtils.sol"; import {E...
todo: should we evict all validators if no one sent the master public key in time?
function submitGPKJ(uint256[4] memory gpkj) external { require( _ethdkgPhase == Phase.GPKJSubmission && block.number >= _phaseStartBlock && block.number < _phaseStartBlock + _phaseLength, string(abi.encodePacked(ETHDKGErrorCodes.ETHDKG_NOT_IN_GPKJ_SUBM...
2,479,195
./full_match/137/0xab03C0c0Ba39a886eD51757272E91cd739542118/sources/contracts/KeeperRewardDistributor/KeeperRewardDistributor.sol
@inheritdoc IKeeperRewardDistributor/
function initialize(InitParams calldata _params) external override initializer { _require( IERC165Upgradeable(_params.registry).supportsInterface(type(IAccessControl).interfaceId) && IERC165Upgradeable(_params.priceOracle).supportsInterface(type(IPriceOracle).interfaceId) && ...
4,727,300
./full_match/5/0x541aF6C3E2d0a1E91B05c1cbbC488e3550E526F7/sources/project_/contracts/NFTAuction.sol
the auction end could be prolonged at the end
function _updateAuctionEnd(address _nftContractAddress, uint256 _tokenId) internal { uint32 auctionBidPeriod = _getAuctionBidPeriod( _nftContractAddress, _tokenId ); if (nftContractAuctions[_nftContractAddress][_tokenId].auctionEnd > 0) { _upda...
1,850,478
./partial_match/1/0xd3bF635748F1D0A1063f1120950d4114DA382662/sources/YohoToken.sol
YohoToken Constructor Runs only on initial contract creation./
function YohoToken() { }
16,019,683
pragma solidity =0.5.16; /** * _____ _____ __ __ _ ___ __ __ * / ___/ ____ _ __ __/ ___/ ____ ____ ___ ___ / /_ / /_ (_)____ ____ _|__ \ _ __ ____ _____ / /____/ / * \__ \ / __ `// / / /\__ \ / __ \...
Interface of subsidy contract/
interface ISubsidy { function transferSubsidy(address payable recipient) external; }
6,474,204
./partial_match/42/0xE76eF865B41de41FD7F5125e1e62D5c69Cf4e9A4/sources/AssetsSnapshot.sol
insert datas to snapshotstempAssets += balance;
function insert(address _addr,uint256 balance) public returns(bool success) { require(owner == msg.sender,"Only the creator can do this"); require(syncState == 1,"Synchronization has not yet started or has ended"); require(syncCounter < needSyncNum || addrInArray(_addr)); if(!tempSna...
3,411,954
pragma solidity 0.4.20; contract IAugur { function createChildUniverse(bytes32 _parentPayoutDistributionHash, uint256[] _parentPayoutNumerators, bool _parentInvalid) public returns (IUniverse); function isKnownUniverse(IUniverse _universe) public view returns (bool); function trustedTransfer(ERC20 _token, ...
Copies the balance of a single addresses from the legacy contract _holder Address to migrate balance return True if balance was copied, false if was already copied or address had no balance/
function migrateBalanceFromLegacyRep(address _holder, ERC20 _legacyRepToken) private onlyInGoodTimes whenMigratingFromLegacy afterInitialized returns (bool) { if (balances[_holder] > 0) { } uint256 amount = _legacyRepToken.balanceOf(_holder); if (amount == 0) { } mi...
2,424,331
pragma solidity ^0.6.7; //contract Exponential {} from Exponential.sol import "./MeFiInterface.sol"; import "./IndexTokenInferface.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20StandardInterface.sol"; import "./PriceOracle.sol"; contract IndexToken is IndexTokenInterface, Exponent...
Set the IndexController require(err == uint(Error.NO_ERROR), "setting IndexController failed"); Set priceFeedList require(err == uint(Error.NO_ERROR), "setting PriceFeed List failed"); Set the index Divisor rate model (depends on block number / borrow index)
function initialize(MeFiInterface indexController_, string memory name_, string memory symbol_, uint8 decimals_, uint IndexDevisor_, address[] calldata priceFeedList_) public { require(ms...
5,474,122
./full_match/5/0xf0b88b2a01473B40422d9fddE1015979a52330eb/sources/_thirdweb-dev/contracts/extension/Staking1155Upgradeable.sol
View all tokens staked and total rewards for a user. _staker Address for which to calculated rewards. return _tokensStaked List of token-ids staked. return _tokenAmounts Amount of each token-id staked. return _totalRewards Total rewards available./
function getStakeInfo(address _staker) public view virtual returns ( uint256[] memory _tokensStaked, uint256[] memory _tokenAmounts, uint256 _totalRewards ) { uint256[] memory _indexedTokens = indexedTokens; uint256[] me...
1,879,866
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./ArtSteward.sol"; // dont need an interface since it's a test contract /* Testing contract */ contract Router { ArtSteward steward; bool public toBlock = true; constructor (address _steward) public { steward = ArtSteward(...
steward.buy{value: msg.value}(1 ether, currentPrice); note: for some reason, it can't determine difference between buy(uint256) & buy(uint256,uint256) Thus: manually creating this call for testing
function buy(uint256 currentPrice) public payable { }
1,753,811
./full_match/43114/0x9984d70D5Ab32E8e552974A5A24661BFEfE81DbE/sources/contracts/hurricane-core/avax/AvaxPool.sol
Set the number of HCT produced by each block
function setHCTPerBlock(uint256 _newPerBlock) public onlyOwner { massUpdatePools(); HCTPerBlock = _newPerBlock; }
4,582,696
./full_match/11297108099/0xe1F2e1BE3F21c1b1057EcceCD46B70470561795B/sources/contracts/NFT/base/NFTAsset.sol
See {ERC721-_beforeTokenTransfer}. Requirements: - minted tokens must not cause the total supply to go over the cap./ burn: checks are made in NFTBurnable.burn mint
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(NFTCapped, ERC721) { super._beforeTokenTransfer(from, to, tokenId); if (to == address(0)) { return; } if (from == address(0)) { _...
3,224,529
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Managed.sol
Returns all the addresses with the pauser role. return pausersList The list of all the pausers, ordered arbitrarily. The list's order may change after granting or revoking the pauser role.
function allPausers() public view returns (address[] memory pausersList) { return _managedStorage().pausers.values(); }
3,819,377
/** *Submitted for verification at Etherscan.io on 2021-08-01 */ pragma solidity ^0.6.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 suc...
Gets the amount of Ghost Farm in existence If no Ghost Farm exists, mint it 1:1 to the amount put in Calculate and mint the amount of Ghost Farm the AAVE is worth. The ratio will change overtime, as Ghost Farm is burned/minted and Aave deposited + gained from fees / withdrawn.
function wrap(uint256 amount) public returns (uint256) { IERC20 aave; IERC20 stkaave; aave = IERC20(_aaveAddress); stkaave = IERC20(_stkaaveAddress); uint256 Aave = aave.balanceOf(address(this)); uint256 Stk = stkaave.balanceOf(address(this)); uint256 totalAav...
10,757,359
./partial_match/56/0x5eeA98df961A2F161436ef4F54948b45482a4418/sources/BnbMarketStake.sol
Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { if (_to <= bonusEndBlock) { return _to.sub(_from); return _to.sub(_from); return bonusEndBlock.sub(_from).add( _to.sub(bonusEndBlock) ); } }
11,114,044
pragma solidity ^0.4.18; import 'zeppelin-solidity/contracts/token/ERC20/StandardToken.sol'; import "../Upgradability/OwnableKeyed.sol"; /** * @title BotCoinPayableRegistry * @dev Contract for BotCoinPayment functionality */ contract BotCoinPayableRegistry is OwnableKeyed { /* @dev Constructor for BotCoinPayable...
Returns address of wallet/
function tallaWallet() public view returns (address) { return _storage.getAddress("tallaWallet"); }
13,035,403
./full_match/1/0xe261B138cfd46FdC12A039cF6690645f35DCFA37/sources/contracts/DropFactory/DropFactory.sol
____________________________________________________________________________________________________________________ -->MODULES (function) pauseDeployedContract Call pause on deployed contracts ----------------...
function pauseDeployedContract( address[] calldata moduleAddresses_ ) external onlyPlatformAdmin { for (uint256 i = 0; i < moduleAddresses_.length; i++) { IPausable(moduleAddresses_[i]).pause(); } }
3,107,470
pragma solidity 0.6.12; abstract contract Context { function _MSGSENDER728() internal view virtual returns (address payable) { //inject NONSTANDARD NAMING return msg.sender; } function _MSGDATA416() internal view virtual returns (b...
inject NONSTANDARD NAMING
function _MSGSENDER728() internal view virtual returns (address payable) {
1,086,679
./full_match/42/0xFf0dfE9613BEF7b558fd33041E37b343dBABf6fC/sources/contracts/Farms.sol
Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders
function recoverERC20( address tokenAddress, address to, uint256 tokenAmount ) external onlyRewardsDistribution { require(tokenAddress != address(0), "Invalid token address"); require( tokenAddress != address(stakingToken), "Cannot withdraw the sta...
9,600,613
// SPDX-License-Identifier: GPL-3.0 /** * @title Complete the Punks: Project * @dev Per-project contract for managing Bodies + Legs * @author earlybail.eth | Cranky Brain Labs * @notice #GetBodied #LegsFuknGooo */ /* ;β•Ÿβ–ˆβ–ˆβ–“β–’ :β•Ÿβ–ˆβ–ˆβ–“β–’ ,φ▒╣╬╬╩╩Γ ╙╩╬╬╬▓▒░ ...
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; } pragma solidity ^0.8.0; } pragma ...
13,613,614
pragma solidity ^0.4.15; /** * @title TokenLib * @author Majoolr.io * * version 1.1.0 * Copyright (c) 2017 Majoolr, LLC * The MIT License (MIT) * https://github.com/Majoolr/ethereum-libraries/blob/master/LICENSE * * The Token Library provides functionality to create a variety of ERC20 tokens. * See https://g...
Called by the Standard Token upon creation. self Stored token from token contract _name Name of the new token _symbol Symbol of the new token _decimals Decimal places for the token represented _initial_supply The initial token supply _allowMinting True if additional tokens can be created, false otherwise
function init(TokenStorage storage self, address _owner, string _name, string _symbol, uint8 _decimals, uint256 _initial_supply, bool _allowMinting) { require(self.INITIAL_SUPPLY == 0); self.name = _name; sel...
7,668,799
pragma solidity ^0.4.24; contract Election { // model a structure for Candidate struct Candidate { uint id; string name; uint voteCount; } // mapping to candidates -> sort of an array mapping(uint => Candidate) public candidates; // store accounts that have voted mapping(address => bool) public voters;...
check if voter already voted check if the candidate is legit record the account that is voting update candidate vote count trigger voted event
function vote(uint _candidateId) public { require(!voters[msg.sender]); require(_candidateId > 0 && _candidateId <= candidatesCount); voters[msg.sender] = true; candidates[_candidateId].voteCount++; emit votedEvent(_candidateId); }
12,772,676
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <=0.8.9; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @notice Contract to represent a time vault using SafeMath for overflow/underflow prevention. */ contract TimeLockV2 { using SafeMath for uint; mapping(address => uint) public bal...
Deposits some amount of ether with 1 week as timelock/
function deposit() external payable { balances[msg.sender] += msg.value; lockTime[msg.sender] = block.timestamp + 1 weeks; }
998,255
./full_match/3/0x336e7f473522FE446459FcBfB288DB01f4f2d24D/sources/localhost/FlashSwapGun.sol
emit UniswapV2CallInit(sender, amount0, amount1, wethAddress, pairBAddress);
function testCall1(address sender, uint amount0, uint amount1, bytes calldata data) external returns (address , uint , uint , address ) { (address wethAddress) = abi.decode(data, (address)); return (sender, amount0, amount1, wethAddress); }
8,205,474
// File: src/contracts/SafeMath.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * er...
admin function to set new root admin. newAdmin address the new admin to assign, which manages delegates/
function changeAdmin(address newAdmin) public onlyAdmin { admin = newAdmin; }
12,128,962
./partial_match/42/0xAf5d2BC0A47f0aE99b7E7225349e3d5C48F46Fd5/sources/STERegistryV1.sol
Get the current STFactory Address/
function getSTFactoryAddress() external view returns(address stFactoryAddress){ uint256 _latestVersion = getUintValue(LATEST_VERSION); return getAddressValue(Encoder.getKey("protocolVersionST", _latestVersion)); }
3,412,172
./full_match/1/0xa3C8d390c3965D33937865973b6159D37B777C54/sources/src/fund/accounting/Accounting.sol
Check holdings for all assets, and adjust list
function updateOwnedAssets() public { for (uint i = 0; i < ownedAssets.length; i++) { address asset = ownedAssets[i]; if ( assetHoldings(asset) == 0 && !(asset == address(DENOMINATION_ASSET)) && ITrading(routes.trading).getOpenMakeOrder...
3,057,634
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/Initializable.s...
Sets Rollup contract address. Can only be called once by owner We assume DepositManager is deployed before Rollup _rollup Rollup contract address/
function setRollupAddress(address _rollup) external initializer onlyOwner { rollup = _rollup; }
12,573,833
pragma solidity ^0.4.24; 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; assert(c / a == b); return c; } /** * @dev Integer division of two ...
set upgrade gems for each level up and each 10 level up _upgradeGems upgrade gems for normal levels _upgradeGemsSpecial upgrade gems for every n levels _gemAttackConversion gem to attack conversion _gemDefenseConversion gem to defense conversion _gemHpConversion gem to hp conversion _gemSpeedConversion gem to spe...
function setSettingValues( uint8 _upgradeGems, uint8 _upgradeGemsSpecial, uint16 _gemAttackConversion, uint16 _gemDefenseConversion, uint16 _gemHpConversion, uint16 _gemSpeedConversion, uint16 _gemCriticalRateConversion, uint8 _goldPercentage, uint8 _silverPercentage, uint32 _eventCardRangeMin, uint32 _even...
8,074,547
./partial_match/4/0x347656e050d1d3214efE39c31Ac1c5C4e5C906Cc/sources/BidHistory.sol
Internal function to set the token product name for a given token. Reverts if the token ID does not exist. tokenId uint256 ID of the token productName srting product name to assign/
function _setTokenProductName(uint256 tokenId, string memory productName) internal { require(_exists(tokenId)); _tokenProductName[tokenId] = productName; }
8,534,129
./full_match/1/0x656530A527Dc6f30BFBCF67a45afe8fBD4d1224D/sources/src/Orb.sol
ERC-721 `transferFrom()` is not supported.
function transferFrom(address, address, uint256) external virtual { revert NotSupported(); }
8,361,110
./full_match/80001/0x33022D1C7a50E73E0540808B2594E64D139d6453/sources/HyveCore.sol
Returns the amout of a given token that an address can withdraw/
function getWithdrawableAmount(address _token, address _owner) public view returns (uint256) { return withdrawableAmounts[_token][_owner]; }
9,436,902
./partial_match/42/0xFFC46daFE045E1239E64cbc0e324F3d2feb5dF15/sources/Ris3Governance.sol
withdraw your reward
function withdrawRewards() public { uint256 amount = calculateReward(msg.sender); require(amount > 0, "No rewards for this address"); require(now > getWithdrawingStartTime(), "Can withdraw after staking time"); if (userRewardInfo[msg.sender].lastWithdrawTime < cycleStartTime...
3,417,255
//Address: 0x7d193819ad03d0dc90f00cccb26e190e95f1f2ac //Contract name: Token //Balance: 0 Ether //Verification Date: 3/4/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^ 0.4.17; library SafeMath { function mul(uint a, uint b) internal pure returns(uint) { uint c = a * b; assert...
it will remove whitelisted user _contributor {address} of user to unwhitelist
function removeFromWhiteList(address _user) external onlyOwner() returns (bool) { require(whiteList[_user] == true); whiteList[_user] = false; totalWhiteListed--; LogRemoveWhiteListed(_user); return true; }
6,433,749