file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.5.3; import {SafeMath} from "./SafeMath.sol"; import {Campaigns} from "./Campaigns.sol"; contract Wallet { using SafeMath for uint; Campaigns internal camp; uint internal mGranularity; //Minium value of Wei uint internal mTotalBalances; address internal deployer; mapping(add...
Get token of user without campaigns user is address of user that you want check token return Number of token
function balances(address user) external view returns(uint) { return mBalances[user] / mGranularity; }
15,788,997
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "../PrizeSplit.sol"; import "../PeriodicPrizeStrategy.sol"; contract MultipleWinners is PeriodicPrizeStrategy, PrizeSplit { // Maximum number number of winners per award distribution period uint256 internal __number...
Toggle external ERC20 awards for all prize winners. Toggle external ERC20 awards for all prize winners. If unset will distribute external ERC20 awards to main winner. _splitExternalErc20Awards Toggle splitting external ERC20 awards./
function setSplitExternalErc20Awards(bool _splitExternalErc20Awards) external onlyOwner { splitExternalErc20Awards = _splitExternalErc20Awards; emit SplitExternalErc20AwardsSet(splitExternalErc20Awards); }
12,844,815
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/c...
Deposit LP tokens to MainChef for KHINKAL allocation.
function deposit( uint256 _pid, uint256 _amount ) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accKh...
5,402,099
pragma solidity 0.4.19; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) pub...
Allows the owner to revoke the vesting. Tokens already vested remain in the contract, the rest are returned to the owner. token ERC20 token which is being vested/
function revoke(ERC20Basic token) public onlyOwner { require(revocable); require(!revoked[token]); uint256 balance = token.balanceOf(this); uint256 unreleased = releasableAmount(token); uint256 refund = balance.sub(unreleased); revoked[token] = true; token...
15,010,760
./full_match/43113/0x66E0fC8A7DCdC569212AFB7AB98BeB89E92A15C6/sources/IncentiveMeta/AaveIncentivesController_flat.sol
Returns the total of rewards of an user, already accrued + not yet accrued user The address of the user return The rewards/
function getRewardsBalance(address[] calldata assets, address user) external view override returns (uint256) { uint256 unclaimedRewards = _usersUnclaimedRewards[user]; DistributionTypes.UserStakeInput[] memory userState = new DistributionTypes.UserStakeInput[]( assets.length ); ...
7,130,618
pragma solidity ^0.4.17; /** * @title ERC20 * @dev ERC20 interface */ contract ERC20 { function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); function allowance(address owner, address spender) public constant returns (uint25...
forwarding multiple transactions: check whitelist only forward if it is within threshold or whitelisted, so the transaction doesnt revert
function forwardManyTransaction(uint256[] _ids) public whitelistSet saleNotEnded saleNotPaused { uint256 _threshold = sale.whitelistThreshold(); for (uint256 i=0; i<_ids.length; i++) { if ( whitelist.isWhitelisted(transactions[_ids[i]].beneficiary) || _threshold >= sale...
1,344,535
// SPDX-License-Identifier: UNLICENSE pragma solidity >=0.8.0; import '@openzeppelin/contracts/utils/Address.sol'; import '@maticnetwork/fx-portal/contracts/lib/RLPReader.sol'; import '@maticnetwork/fx-portal/contracts/lib/MerklePatriciaProof.sol'; import '@maticnetwork/fx-portal/contracts/lib/Merkle.sol'; import '...
checking if exit has already been processed unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex) first 2 nibbles are dropped while generating nibble array this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only) so converting to nibble array and the...
function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) { RLPReader.RLPItem[] memory inputDataRLPList = inputData.toRlpItem().toList(); bytes32 exitHash = keccak256( abi.encodePacked( ) ); require(processedExits[exitHash] == false, 'rootchanne...
5,366,022
// SPDX-License-Identifier: MIT 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 * error,...
Check what token is pool of this Swap
function isPool(address token) public virtual override view returns(bool){ IUniswapV2Pair pair = IUniswapV2Pair(token); return checkFactory(pair, factoryAddress); }
6,161,622
./partial_match/1/0xeC263491905Bcf713d81e73493761d8aB450241C/sources/ERC1155Ikasumi.sol
calculate amounts to owner to creator to admin
function distributeFunds(uint256 totalPrice, address from, address to, uint256 tokenId, bool useTransferFrom) internal { uint256 amount4admin = totalPrice * commissionRate / 100; uint256 amount4creator = totalPrice * royaltiesCommissionRate / 100; uint256 amount4owner = totalPrice - amount4...
4,060,360
./partial_match/3/0xf3C3B1E7659a6ca05FD1179c3be763a2d397C578/sources/CrimecashFarm.sol
_rate = lockedCrimeCash[_msgSender()] / totalMintPerRound 100/
function distributeCrimeGold(address _crimer, uint256 amount) public onlyOwner returns (bool) { require(crimegoldToken.balanceOf(address(this))>0, "Error: admin balance insufficient"); uint256 _amount; if ( crimegoldToken.balanceOf(address(this)) < amount ) _amount = crimegoldToken.balanceOf(address...
5,208,093
./full_match/137/0x030048052a507E05D01a52d7cF1182bcBddfe11b/sources/contracts/nynjaiv3.sol
Sets the maxWallet _maxWallet New mawWallet
function setMaxWallet(uint256 _maxWallet) external onlyOwner { maxWallet = _maxWallet; }
4,765,625
./full_match/97/0x668B7565003E6B911b34215640eB76070c921800/sources/project_/contracts/mixins/NFT721Metadata.sol
The IPFS path should be the CID + file.extension, e.g. `QmfPsfGwLhiJrU8t9HpG4wuyjgPo9bk8go4aQqSu9Qg4h7/metadata.json`/ 46 is the minimum length for an IPFS content hash, it may be longer if paths are used
function _setTokenIPFSPath(uint256 tokenId, string memory _tokenIPFSPath) internal { require(bytes(_tokenIPFSPath).length >= 46, "NFT721Metadata: Invalid IPFS path"); require(!creatorToIPFSHashToMinted[msg.sender][_tokenIPFSPath], "NFT721Metadata: NFT was already minted"); creatorToIPFSHash...
5,037,902
/** *Submitted for verification at Etherscan.io on 2021-11-16 */ // Sources flattened with hardhat v2.6.2 https://hardhat.org // File @openzeppelin/contracts/access/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 ...
Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity ^0.8.0; { unchecked { uint256 c = a + b; if (c < a) return (fa...
15,272,137
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol"; contract onlineStore is KeeperCompatibleInterface, Ownable { ...
how many tokens they want to purchase
function buyMassiveTokens() public payable{
12,737,211
// SPDX-License-Identifier: MIT /* * ███ ███ ██████ ██████ ███ ██ ███████ ██ ██ ██████ * ████ ████ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ * ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ██ ██████ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ * █...
remove from blacklist
function removeFromBlackList(address account) external onlyOwner { _isBlacklisted[account] = false; }
7,215,278
pragma solidity ^0.4.18; contract ERC721 { // Required methods function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); function approve(address _to...
Override unpause so it requires all external contract addresses to be set before contract can be unpaused. Also, we can't have newContractAddress set either, because then the contract was upgraded. This is public rather than external so we can call super.unpause without using an expensive CALL. Actually unpause the...
function unpause() public onlyCEO whenPaused { require(saleAuction != address(0)); require(newContractAddress == address(0)); require(skillScience != address(0)); super.unpause(); }
12,984,928
/** *Submitted for verification at Etherscan.io on 2021-11-16 */ // File: @uniswap\lib\contracts\libraries\TransferHelper.sol pragma solidity >=0.6.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(addr...
LIBRARY FUNCTIONS
function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) { return SynthesisLibrary.quote(amountA, reserveA, reserveB); }
598,981
// Verified using https://dapp.tools // hevm: flattened sources of src/UniswapConsecutiveSlotsPriceFeedMedianizer.sol pragma solidity =0.6.7; ////// lib/geb-treasury-reimbursement/src/math/GebMath.sol /* pragma solidity 0.6.7; */ contract GebMath { uint256 public constant RAY = 10 ** 27; uint256 public const...
--- Core Logic --- Update the internal median price/ Get final fee receiver Update the converter's median price first We only want to commit updates once per period (i.e. windowSize / granularity)
function updateResult(address feeReceiver) external { require(address(relayer) != address(0), "UniswapConsecutiveSlotsPriceFeedMedianizer/null-relayer"); require(uniswapPair != address(0), "UniswapConsecutiveSlotsPriceFeedMedianizer/null-uniswap-pair"); address finalFeeReceiver = (feeReceiv...
556,135
pragma solidity ^0.6.0; import "./EnumerableSet.sol"; import "./IMdx.sol"; import "./IMasterChefBSC.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeM...
View function to see pending MDXs on frontend.
function pending(uint256 _pid, address _user) external view returns (uint256, uint256) { PoolInfo storage pool = poolInfo[_pid]; if (isMultLP(address(pool.lpToken))) { (uint256 mdxAmount, uint256 tokenAmount) = pendingMdxAndToken(_pid, _user); return (mdxAmount, tokenAmount); uint256 mdxAmou...
12,989,574
pragma solidity ^0.4.24; contract ERC20Interface { function totalSupply() public view returns (uint256); function balanceOf(address tokenOwner) public view returns (uint256 balance); function allowance(address tokenOwner, address spender) public view returns (uint256 remaining); function transfer(addre...
------------------------------------------------------------------------ onlyOwner API ------------------------------------------------------------------------
function setGGCAddress(address _addr) public notNull(_addr) onlyOwner { if(ggcPoolAddr == address(0x0)){ ggcPoolAddr = _addr; ggcPoolAddr = owner; } emit ListLog(ggcPoolAddr, 6, false); }
14,996,449
./full_match/97/0x6Af8af4A32f98836142C324B860C04da93A83587/sources/project:/contracts/Predix.sol
Admin withdraw/Verify signature Transfer token to user
function claimCommission(uint256 _amount, bytes memory _signature) external { require(IERC20(tokenAddress).balanceOf(adminAddress) >= _amount, ' Contract balance insufficient !'); bytes32 messagehash = keccak256(abi.encodePacked(_amount)); address signer = messagehash.toEthSignedMessageHash().recover(_si...
5,023,566
./full_match/1/0x0087D11551437c3964Dddf0F4FA58836c5C5d949/sources/contracts/PoolInformation.sol
@inheritdoc IPoolInformation
function getBinsAtTick(IPool pool, int32 tick) public view returns (IPool.BinState[] memory bins) { uint8 binCounter = NUMBER_OF_KINDS; bins = new IPool.BinState[](binCounter); for (uint8 i = 0; i < NUMBER_OF_KINDS; i++) { uint128 binId = pool.binPositions(tick, i); i...
4,956,581
pragma solidity ^0.4.13; contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ER...
Others Functions of the contract / Approves and then calls the receiving contract /
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); require(_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this...
1,405,702
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.7.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; /** * @notice This contracts...
Unpauses swapping if it was paused previously./
function unpause() external onlyOwner { require(paused, "TokenSwap: not paused"); paused = false; }
5,462,832
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight...
Returns whether the casted vote in the proposal exceeds quorum The quorum can be updated proposalVote The proposal to check blockNumber The vote start blockNumber
function quorumReached(DataStruct.ProposalVote memory proposalVote, uint256 blockNumber) external view override returns (bool) { return (quorum(blockNumber) <= proposalVote.forVotes + proposalVote.abstainVotes); }
67,333
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view ret...
charge performance feecharge management feeharvest underlyingexit cash
function exitPoolOfUnderlying(uint256 amount)external notContract{ address investor=msg.sender; require(balanceOf(investor)>=amount&&amount>0,"KVault.exitPoolOfUnderlying: Insufficient balance"); uint256 exitFee=_chargeJoinAndExitFee(SmartPoolStorage.FeeType.EXIT_FEE,amount); uint256 exitAmount=amount...
5,755,622
./partial_match/1/0x51DF59fa999b56c351B92E933aFD177Ef9c0003f/sources/PaymentSplitter.sol
Getter for the total amount of `token` already released. `token` should be the address of an IERC20 contract./
function totalReleasedToken(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; }
3,564,102
contract theRun { uint private Balance = 0; uint private Payout_id = 0; uint private Last_Payout = 0; uint private WinningPot = 0; uint private Min_multiplier = 1100; //110% //Fees are necessary and set very low, to maintain the website. The fees will decrease e...
--initiated function
function init() private { uint deposit=msg.value; msg.sender.send(msg.value); return; } msg.sender.send(msg.value- (20 ether)); deposit=20 ether;
5,358,620
./full_match/1/0x0f3B9C110A8833CDFfEA7d046792B7A61a01e9E0/sources/GONDO.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("GONDOLA SPURDO", "GONDO") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Facto...
9,728,752
pragma solidity 0.4.19; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
Set the address which should receive the vested team tokens share on finalization _teamAndAdvisorsAllocation address of team and advisor allocation contract/ only able to set teamAndAdvisorsAllocation once. TeamAndAdvisorsAllocation contract requires token contract already deployed. token contract is created within cr...
function setTeamWalletAddress(address _teamAndAdvisorsAllocation) public onlyOwner { require(teamAndAdvisorsAllocation == address(0x0) && _teamAndAdvisorsAllocation != address(0x0)); teamAndAdvisorsAllocation = _teamAndAdvisorsAllocation; }
14,724,424
./partial_match/5/0xdE4c870F36a614E44bd00f987B22F4c4D48718F3/sources/contracts/base/MetawinERC721Extensions/MetawinERC721Vault.sol
Return cumulative Vault info of a user [View][External] Check the method "vault_tokenInfo" for more info. user User's address return amountInVault Number of owned tokens locked in the Vault return currentCumulative Combined current staking time of all tokens owned by the user return totalCumulative Combined total sta...
function vault_userInfo(address user) external view returns (uint256 amountInVault, uint256 currentCumulative, uint256 totalCumulative) { uint256 tokenId = tokenOfOwnerByIndex(user, i); (bool active, , uint256 current, uint256 total) = vault_tokenInfo(tokenId); }
16,866,992
pragma solidity ^0.4.0; /** @title Contract for a show tickets sell .*/ /** @author Giulia Di Bella .*/ contract ShowTickets{ address public organizer; uint public eventTime; uint public ticketPrice; uint public numTickets; uint public ticketSold; uint public incomes; mapping (address =...
Sending back the money by simply using organizer.send(tickePrice) is a security risk because it can be prevented by the caller by e.g. raising the call stack to 1023. It is always safer to let the recipient withdraw their money themselves. throw ensures funds will be returned
function buyTicket() onlyBefore costs(ticketPrice,msg.sender) public payable{ if(ticketSold >= numTickets || ticketOf[msg.sender].num != 0){ throw; } ticketSold++; incomes += ticketPrice; TicketPayed(msg.sender, msg.value,ticketOf[msg.sender].num,now); }
13,100,493
./full_match/1/0xFb8F626AD693ad0AF769ddB265084E8973f63a3C/sources/contracts/lib/AuxMerkleTree.sol
computes a jive merkle root of the provided hashes, in place temp the mutable array of hashes return root the merkle root hash/
function computeRoot(bytes32[] memory temp) internal view returns (bytes32 root) { uint256 count = temp.length; while (count > 1) { unchecked { for (uint256 i = 0; i < count / 2; i++) { uint256 x; uint256 y; asse...
4,930,649
// SPDX-License-Identifier: WTFPL pragma solidity >=0.8.0; import "./PRBMathCommon.sol"; /// @title PRBMathUD60x18 /// @author Paul Razvan Berg /// @notice Smart contract library for advanced fixed-point math. It works with uint256 numbers considered to have 18 /// trailing decimals. We call this number representatio...
Raises x to the power of y. Based on the insight that x^y = 2^(log2(x) y). Requirements: - All from "exp2", "log2" and "mul". Caveats: - All from "exp2", "log2" and "mul". - Assumes 0^0 is 1. x Number to raise to given power y, as a signed 59.18-decimal fixed-point number. y Exponent to raise x to, as a signed 59.1...
function pow(uint256 x, uint256 y) internal pure returns (uint256 result) { if (x == 0) { return y == 0 ? SCALE : uint256(0); result = exp2(mul(log2(x), y)); } }
1,773,746
./full_match/1/0x268Fc6C5Eb17BE53a8670895be62B414c3E636Ce/sources/contracts/priceProviders/uniswapV3/UniswapV3PriceProviderV3.sol
UniV3 saves price only on: mint, burn and swap. Mint and burn will write observation only when "current tick is inside the passed range" of ticks. I think that means, that if we minting/burning outside ticks range (so outside current price) it will not modify observation. So we left with swap. Swap will write observat...
function getPrice(address _asset) public view virtual override returns (uint256 price) { address quote = quoteToken; if (_asset == quote) { return 10 ** QUOTE_TOKEN_DECIMALS; } uint256 decimals = IERC20Like(_asset).decimals(); PricePath[] memory path = _assetPa...
16,486,669
./full_match/4/0x66B848928FA5DD840aC5729c52f811347148696b/sources/contracts/FuCatNFT.sol
Verify merkle proof, or revert if not in tree Set address to claimed Mint score to token id
function claimTaskerScore( uint256 _taskIndex, uint256 _amount, bytes32[] calldata _proof, uint256 _tokenId ) external { require(!taskerHasClaimed[_msgSender()][_taskIndex], "The score of task has been claimed"); require(_msgSender() == ownerOf(_tokenId), "Not you...
711,515
./full_match/3/0x87Ef307670bB136c3B67280900298DCC3B505B51/sources/browser/maestro_products_working.sol
if serial number already exists, return false without creating a new products
function new_product(uint _serialNumber, string memory _name, string memory _description, bool _isMultipart, ProductState _productState) public whiteListed returns (bool) { if (products[_serialNumber].owner != address(0) ) { return false; } products[_serialNumber] = Product( {...
14,239,530
./full_match/4/0x9d9eA2B405201b654e72c1BD894e9a7f3723a2A4/sources/contracts/MatthewBallMinting.sol
tokenId token id to set royalty payout for newAddress new address to recieve royalty payout on-chain
function setRoyaltyPayoutAddressForToken( uint256 tokenId, address newAddress ) external tokenExists(tokenId) onlyOwner { _setRoyaltyPayoutAddressForToken(newAddress, tokenId); }
682,194
pragma solidity >=0.5.4 <0.6.0; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } contract TheAO { address public theAO; address public nameTAOPositionAddress; // Check whether an address is whitelisted and granted a...
Get setting variables return startingPrimordialMultiplier The starting multiplier used to calculate primordial ion return endingPrimordialMultiplier The ending multiplier used to calculate primordial ion return startingNetworkBonusMultiplier The starting multiplier used to calculate network ion bonus return endingNetwo...
function _getSettingVariables() internal view returns (uint256, uint256, uint256, uint256) { (uint256 startingPrimordialMultiplier,,,,) = _aoSetting.getSettingValuesByTAOName(settingTAOId, 'startingPrimordialMultiplier'); (uint256 endingPrimordialMultiplier,,,,) = _aoSetting.getSettingValuesByTAOName(settingTAOId,...
985,668
./full_match/4/0xB34756f8D9682ab6C26F77f9461207a65c52c8bC/sources/contracts/TCAP.sol
Sets maximum value the total supply of TCAP can have _cap value When capEnabled is true, mint is not allowed to issue tokens that would increase the total supply above or equal the specified capacity. Only owner can call it/
function setCap(uint256 _cap) external onlyOwner { cap = _cap; emit NewCap(msg.sender, _cap); }
12,419,706
./partial_match/97/0x4b71D02c9a7d849dE927503A030C83F8E2e87c6B/sources/MasterChef.sol
Deposit LP tokens to MasterChef for donut allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accPacoPerShare).div(1e12).sub(user.rewardD...
17,204,677
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg import "@openzeppelin/contracts/math/SafeMath.sol"; import "../helpers/TimelockerV2.sol"; import "../helpers/TwoStepOwnable.sol"; import "../../interfaces/DharmaAccountRecoveryManagerInterface.sol"; import "../../interfaces/DharmaAccountRecover...
External view function to check the account currently holding the canceller role. The canceller can expire a timelock related to account recovery or account recovery disablement prior to its execution. return The address of the current canceller, or the null address if none is set./
function getCanceller() external view returns (address canceller) { canceller = _roles[uint256(Role.CANCELLER)].account; }
967,396
pragma solidity 0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - ...
See {ERC20-_beforeTokenTransfer}. Requirements: - the contract must not be paused./
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); }
7,342,381
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidit...
inject NONSTANDARD NAMING
function TOTALSUPPLY567() external override view returns (uint256) {
1,840,803
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /** * CakeCrypt.io */ contract Token { function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external retur...
withdraw tokens/update balance in addressremove this id from this address
function withdrawTokens(uint256 _id) nonReentrant public { require(block.timestamp >= lockedToken[_id].unlockTime, 'Tokens are locked'); require(msg.sender == lockedToken[_id].withdrawalAddress, 'Can withdraw by withdrawal Address only'); require(!lockedToken[_id].withdrawn, 'Tokens already ...
555,449
// File: contracts\modules\Ownable.sol pragma solidity =0.5.16; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the ...
Retrieve user's collateral worth in all collateral coin. If user want to redeem all his collateral,and the vacant collateral is sufficient, He can redeem each collateral amount in return list. account the retrieve user's account;/
function calCollateralWorth(address /*account*/)public view returns(uint256[] memory){ delegateToViewAndReturn(); }
1,674,122
pragma solidity >= 0.4.24 < 0.6.0; /** * @title Owned * @dev Contract that sets an owner, who can execute predefined functions, only accessible by him */ contract Owned { address public owner; constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); ...
send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not/ Prevent transfer to 0x0 (empty) address, use burn() instead Prevent empty transactions Check if sender account is frozen Check if sender has e...
function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != address(0x0)); require(_value > 0); require(frozenAccounts[msg.sender] < now); require(balances[msg.sender] >= _value); balances[msg.sender] = safeSub(balances[msg.sender], _value); balances[_to] = safeAdd(ba...
12,612,276
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* .'cdO0000OO00KKNNNXKOkdc'. 'cooolc;;lc',l:'':lloxO000KKOdc' 'ldoll;.'c..;; .:' ':..::;cxKKxccddl' ;ddlc'.:; ,..;c,cdxddk0Ox:. ;ddc..:, ...
admin function to update the address of message signer.
function updateSignerAddress(address _signerAddress) public onlyOwner { require( _signerAddress != address(0), "Signer Address could not be empty" ); signerAddress = _signerAddress; }
168,727
./full_match/3/0x08a6D4d01544826c2350572412D38Cf8b947FEEF/sources/contracts/UniswapV2Router02.sol
refund dust eth, if any
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external virtual override payable ensure(deadline) returns (uint[] memory amounts) { require(path[0] == WETH, 'CryptoSwap Router: INVALID_PATH'); amo...
8,228,651
/** *Submitted for verification at Etherscan.io on 2021-08-11 */ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.6; // Part: IBetaBank interface IBetaBank { /// @dev Returns the address of BToken of the given underlying token, or 0 if not exists. function bTokens(address _underlying) external view r...
Returns the position's collateral token and BToken.
function getPositionTokens(address _owner, uint _pid) external view override checkPID(_owner, _pid) returns (address _collateral, address _bToken) { Position storage pos = positions[_owner][_pid]; _collateral = pos.collateral; _bToken = pos.bToken; }
10,721,891
/* website: pub.finance PPPPPPPPPPPPPPPPP UUUUUUUU UUUUUUUUBBBBBBBBBBBBBBBBB SSSSSSSSSSSSSSS P::::::::::::::::P U::::::U U::::::UB::::::::::::::::B SS:::::::::::::::S P::::::PPPPPP:::::P U::::::U U::::::UB::::::BBBBBB:::::B S:::::SSSSSS::::::S PP:::::P P:::::PUU:::::U U:::::UUBB:::::B ...
Withdraw without caring about rewards. EMERGENCY ONLY. lock type >= Month is 0 fee
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo[] storage userInfoArr = userInfo[_pid][msg.sender]; uint256 length = userInfoArr.length; uint totalPubToTransfer = 0; uint totalLPToTransfer = 0; uint totalLPFee = 0; ...
7,031,129
pragma solidity ^0.4.4; import "@aragon/os/contracts/apps/AragonApp.sol"; import "@aragon/os/contracts/lib/zeppelin/math/SafeMath.sol"; contract InvoiceApp is AragonApp { using SafeMath for uint256; /// Events event Increment(address indexed entity, uint256 step); event Decrement(uint256 step); e...
Increment the counter by `step` step Amount to increment by/
function increment(uint256 step) auth(INCREMENT_ROLE) external { value = value.add(step); Increment(msg.sender, step); }
2,475,985
./full_match/1/0xE22ed1Bc24a35A72f635af25430Ea8C0d858384c/sources/project1.sol
exclude from paying fees or having max transaction amount
constructor() ERC20(unicode"Atarashī Inu", unicode"ATARASHI") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = ...
8,440,597
./full_match/43114/0x43C263a40De709EfE72cfc2aD7E6a1e775968138/sources/OLYMP.sol
View function to see pending OLYMPs on frontend.
function pendingOlymp(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accOlympPerShare = pool.accOlympPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
4,520,915
pragma solidity ^0.4.24; /// @title Raiden MicroTransfer Channels Contract. contract RaidenMicroTransferChannels { /* * Data structures */ // The only role of the owner_address is to add or remove trusted contracts address public owner_address; // Number of blocks to wait from an uncooper...
Sender requests the closing of the channel and starts the challenge period. This can only happen once. _receiver_address The address that receives tokens. _open_block_number The block number at which a channel between the sender and receiver was created. _balance The amount of tokens owed by the sender to the receiv...
function uncooperativeClose( address _receiver_address, uint32 _open_block_number, uint256 _balance) external { bytes32 key = getKey(msg.sender, _receiver_address, _open_block_number); require(channels[key].open_block_number > 0); require(closing_requests...
2,541,985
pragma solidity ^0.4.15; /** * @title Doneth (Doneth) * @dev Doneth is a contract that allows shared access to funds * in the form of Ether and ERC20 tokens. It is especially relevant * to donation based projects. The admins of the contract determine * who is a member, and each member gets a number of sha...
Only owner, admin or member can change member's name
function changeMemberName(address who, string newName) public onlyExisting(who) { if (msg.sender != who && msg.sender != owner && !members[msg.sender].admin) revert(); if (bytes(newName).length > 21) revert(); ChangeMemberName(who, members[who].memberName, newName); members[who].memb...
2,560,815
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/modules/price-router/PriceRouter.sol
Allows owner to update the Automation Registry. In rare cases, Chainlink's registry CAN change./
function setAutomationRegistry(address newRegistry) external onlyOwner { automationRegistry = newRegistry; }
3,124,401
./full_match/1/0x0A5C68eD33bDe145bF7a45Db0530526fb2Dd2484/sources/contracts/manager/factories/DelegatedManagerFactory.sol
Initialize fee settings on DelegatedManager and transfer `owner` and `methodologist` roles. _manager Instance of DelegatedManager _owner Address that will be given the `owner` DelegatedManager's role/
function _setManagerState( IDelegatedManager _manager, address _owner, address _methodologist ) internal { _manager.transferOwnership(_owner); _manager.setMethodologist(_methodologist); }
9,666,773
./full_match/80001/0xc35F7E3d216e126a1B11635c5D0B274849e35D9F/sources/contracts/ExtendedDrop.sol
Update contract state. If there's a price, collect price. Mint the relevant tokens to claimer.
function _claim( address _receiver, uint256 _category, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) internal { _beforeClaim(_receiver, _category, _quantity, _currency, _priceP...
5,705,956
./full_match/73799/0xbF3cc364c21d65516d1A43AbEBD86f61AA8b9dF8/sources/contracts/facets/VotingFacet.sol
emitSessionEvents - Casts different events resulting of the voting session votingID - The ID of the voting sessionID - The ID of voting session numberOfRewardedWorkers - The number of workers who have been rewarded when session was completed/
function _emitSessionEvents(bytes32 votingID, bytes32 sessionID, uint256 numberOfRewardedWorkers) private { LibVoting.VotingSession storage session = LibVoting.getSession(votingID, sessionID); if (session.isConsensusReached) { emit WinningMatch(votingID, session.matchResult, session.vot...
16,363,818
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract Aggregator is AccessControl { struct OracleInfo { uint256 withdrawable; // amount of withdrawable LINKs address admin...
Remove oracle. _oracle Oracle address.
function removeOracle(address _oracle) external onlyAdmin { revokeRole(ORACLE_ROLE, _oracle); }
929,797
/* Copyright 2017-2018 RigoBlock, Rigo Investment Sagl. 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 a...
Vault Interface - Allows interaction with the Vault contracts. Gabriele Rigo - <gab@rigoblock.com> solhint-disable-next-line
interface VaultFace { function buyVault() external payable returns (bool success); function buyVaultOnBehalf(address _hodler) external payable returns (bool success); function sellVault(uint256 amount) external returns (bool success); function changeRatio(uint256 _ratio) external; function setTrans...
5,421,083
./full_match/4/0x8478c136E3eCC8776A338275c09b9469f0C26e88/sources/contracts/5_GunPool.sol
address tokenA, address tokenB, address to, 把钱转给 pool, IERC20(tokenA) 2,todo
function removeLiquidity( uint liquidity, uint amountAMin, uint amountBMin, uint deadline ) public onlyPool returns (uint amountA, uint amountB) { address tokenA = Token0; address tokenB = Token1; address UniPair = IUniswapV2Factory(factory).getPair(token...
830,648
pragma solidity ^0.6.0; import "../utils/GasBurner.sol"; import "../interfaces/IAToken.sol"; import "../interfaces/ILendingPool.sol"; import "../interfaces/ILendingPoolAddressesProvider.sol"; import "../utils/SafeERC20.sol"; /// @title Basic compound interactions through the DSProxy contract AaveBasicProxy is GasBur...
Return a rate for which we can sell an amount of tokens _srcAddr From token _destAddr To token _srcAmount From amount return uint Rate
function getSellRate(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) public override view returns (uint) { address srcAddr = ethToWethAddr(_srcAddr); address destAddr = ethToWethAddr(_destAddr); return wdiv(OasisInterface(OTC_ADDRESS).getBuyAmount(destAdd...
380,828
./partial_match/1/0x837510313085a492562BBc3D6FbbBD1850546583/sources/NGNB.sol
called by the owner to unpause, returns to normal state/
function unpause() onlyPauser public { paused = false; emit Unpause(); }
2,746,547
./full_match/137/0x77169ec9eEAB401dEf931e1666B3426d66b960Ec/sources/browser/NFT721.sol
Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ownerOf(tokenId); return (spender == owner || spender == exPlatform || getApproved(tokenId) == spend...
3,747,350
./full_match/1/0xABE46f13C833Ab07bf9e523F485B53c9a633DD60/sources/contracts/IdleCDO.sol
pausable in _deposit msg.sender should approve this contract first to spend `_amount` of `token` _amount amount of `token` to deposit return BB tranche tokens minted
function depositBB(uint256 _amount) external returns (uint256) { return _deposit(_amount, BBTranche, address(0)); }
8,321,814
./partial_match/42/0x5FF2fe5BD132986985bB2aa3C5338d2E0b0Ba89f/sources/AthleteData.sol
Calculate total distance sign up for each team
function calTotalKmSignUp(uint teamId)view public returns(uint){ uint TotalDistanceSignUp = 0; for(uint i=0; i<athletes.length; i++){ if(athletes[i].team == teamId) TotalDistanceSignUp= TotalDistanceSignUp + athletes[i].distance; } return TotalDistanceSign...
3,306,642
./partial_match/4/0x135Aa3d562e940d9DBcE3f73E52914F44542c45c/sources/BooBankerResearchAgreement.sol
Sell half of burned tokens, provides liquidity and locks it away forever can only be called when balance is > 1 and last lock is more than 2 hours ago bbra balance caller rewards subtract caller fee - 1% always only reward caller after trade to prevent any possible reentrancy check balance is still available in case LP...
function lockLiquidity() public isHuman() { uint256 _bal = balanceOf(address(this)); require(_bal >= 1e18, "Minimum of 1 BBRA before we can lock liquidity"); require(block.timestamp >= lastLiquidityLock.add(2 hours), "Minimum of 1 BBRA before we can lock liquidity"); uint256 _caller...
8,688,483
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: Ledger /// @author: manifold.xyz import "@manifoldxyz/creator-core-solidity/contracts/ERC1155Creator.sol"; ///////////////////////////////////////////////// // // // ...
See {ICreatorCore-setTokenURIExtension}./
function setTokenURIExtension(uint256 tokenId, string calldata uri_) external override extensionRequired { _setTokenURIExtension(tokenId, uri_); }
1,598,494
pragma solidity ^0.5.0; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint25...
Pay fee on controller call from AssetToken. _assetToken the calling AssetToken contract. _initiator the initiator passed through as parameter by AssetToken. _tokensToMint the tokens being handled. _feeName the name of the fee (key in mapping).
function payFeeKnowingAssetToken( Data storage _self, address _assetToken, address _initiator, bytes32 _feeName) public { uint256 feePromille = getFeeKnowingAssetToken( _self, _assetToken, _initiator, _tokens...
2,537,445
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import "../Vault/Utils/ECDSA.sol"; import "../Vault/Utils/SafeBEP20.sol"; import "../Vault/Utils/IBEP20.sol"; import "./CommunityVaultProxy.sol"; import "./CommunityVaultStorage.sol"; import "./CommunityVaultErrorReporter.sol"; interface ICommunityStore { ...
Update the given reward token's amount per block
function setWithdrawalLockingPeriod( address _rewardToken, uint256 _pid, uint256 _newPeriod ) external onlyAdmin { _ensureValidPool(_rewardToken, _pid); require(_newPeriod > 0, "Invalid new locking period"); PoolInfo storage pool = poolInfos[_r...
7,273,463
//Address: 0x14fbca95be7e99c15cc2996c6c9d841e54b79425 //Contract name: MatchingMarket //Balance: 0 Ether //Verification Date: 12/18/2017 //Transacion Count: 171303 // CODE STARTS HERE pragma solidity ^0.4.18; contract DSAuthority { function canCall( address src, address dst, bytes4 sig ) public view...
Make a new offer. Takes funds from the caller into market escrow.NOT synchronized!!! /
function offer( ) public isWhitelist(pay_gem, buy_gem) can_offer returns (uint) { return offer(pay_amt, pay_gem, buy_amt, buy_gem, pos, false); }
2,494,704
./full_match/97/0xFf965fc2a719CF160a5423cd288DcBa2c588703E/sources/project_/contracts/STRFTokenLocker.sol
Withdraw locked tokens First withdraws unlocked tokens, then locked tokens. Withdrawing locked tokens incurs a 50% penalty.
function withdraw(uint256 amount) public nonReentrant { require(amount > 0, "Cannot withdraw 0"); uint256 unlockedAmount; uint256 penaltyAmount; (unlockedAmount, penaltyAmount) = getWithdrawableBalance(msg.sender); bool penaltyFlag = false; require(unlockedAmount + p...
3,279,922
./full_match/1/0x879B28502223C4F97Fd38dEad123cb7a0214486B/sources/browser/crethlevstrat.sol
Same warning as above
function netBalanceLent() public view returns (uint256) { (uint256 deposits, uint256 borrows) = getCurrentPosition(); return deposits.sub(borrows); }
4,841,479
// SPDX-License-Identifier: MIT pragma solidity ^0.6.11; pragma experimental ABIEncoderV2; import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/utils/Address...
Harvest accumulated digg rewards and convert them to LP tokens Restake the gained LP tokens in the Geyser ===== Harvest rewards from Geyser ===== Process performance fees if present Swap half of harvested digg for wBTC in liquidity pool We use actual DIGG balance in trade rather than shares Note: We must sync before t...
function harvest() external whenNotPaused returns (uint256) { _onlyAuthorizedActors(); HarvestData memory harvestData; uint256 _beforeDigg = IDigg(digg).balanceOf(address(this)); uint256 _beforeShares = IDigg(digg).sharesOf(address(this)); uint256 _beforeLp = IERC20Upgradea...
1,779,321
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "./Interfaces/ISortedTroves.sol"; import "./Interfaces/ITroveManager.sol"; import "./Interfaces/IBorrowerOperations.sol"; import "./Dependencies/SafeMath.sol"; import "./Dependencies/Ownable.sol"; import "./Dependencies/CheckContract.sol"; import "./Depen...
Checks if the list is full/
function isFull() public view override returns (bool) { return data.size == data.maxSize; }
950,741
/** * @title Kleros * @author Clément Lesaege - <clement@lesaege.com> * This code implements a simple version of Kleros. * Bug Bounties: This code hasn't undertaken a bug bounty program yet. */ pragma solidity ^0.4.24; import "kleros-interaction/contracts/standard/rng/RNG.sol"; import "kleros-interaction/con...
To call to go to a new period. TRUSTED./ solium-disable-next-line security/no-block-members
function passPeriod() public { require(block.timestamp - lastPeriodChange >= timePerPeriod[uint8(period)], "Not enough time has passed."); if (period == Period.Activation) { rnBlock = block.number + 1; rng.requestRN(rnBlock); period = Period.Draw; ra...
6,421,176
./full_match/80001/0xB447B59d547Ba4BCD85269d6b700a84A01bb381f/sources/contracts/Battle.sol
Add the status effect to the character's activeEffectIds array Update the character's activeEffectDurations mapping with the new duration
function _applyStatusEffect( CharacterProxy storage character, uint256 statusEffectId, uint256 duration ) private { character.activeEffectIds.push(statusEffectId); character.activeEffectDurations[statusEffectId] = duration; }
852,447
pragma solidity ^0.6.4; library PrimeField { uint256 internal constant MODULUS = 0x0800000000000011000000000000000000000000000000000000000000000001; uint256 internal constant MODULUS_MASK = 0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; uint256 internal constant MONTGOMERY_R = 0x7ffff...
Returns the primitive root of unity of a given order. Reverts if unavailable
function root(uint256 order) internal returns (uint256) { require((MODULUS - 1) % order == 0, 'Root unavailable'); return expmod(GENERATOR, (MODULUS - 1) / order, MODULUS); }
2,520,664
//Address: 0xfdfD5dB568f2eCF9b06a16116B9201b0500735B4 //Contract name: VelixIDToken //Balance: 0 Ether //Verification Date: 1/30/2018 //Transacion Count: 220 // CODE STARTS HERE /** * This smart contract is modified 2017 by Velix.ID to assemble code for creation of VelixIDToken with * it's unique characteristics. ...
Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent./ To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not ...
function approve(address _spender, uint256 _value) public returns (bool) { require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
14,052,898
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // import from node_modules @openzeppelin/contracts import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./PriceConsumer.sol"; /** ...
amount (type uint256) amount of ether function use to withdraw ether from contract/
function withdraw(uint256 amount) public onlyOwner nonReentrant returns (bool success) { require(amount <= address(this).balance, "ICO: function withdraw invalid input"); payable(msg.sender).transfer(amount); return true; }
12,687,067
// SPDX-License-Identifier: MIT pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import { SafeMath } from '@openzeppelin/contracts/math/Safe...
deposits underlying into the contract and mints vault shares. deposit into the contract, then mint the shares to depositor, and emit the deposit event amount amount of underlying to deposit/ keep track of underlying balance before deposit underlying to vault keep track of underlying balance after mint shares and emit...
function depositUnderlying(uint256 amount) external nonReentrant { notEmergency(); actionsInitialized(); require(amount > 0, 'O6'); uint256 totalUnderlyingBeforeDeposit = totalUnderlyingAsset(); IERC20 underlyingToken = IERC20(underlying); underlyingToken.safeTransferFrom(msg.sender, address...
1,583,000
pragma solidity >=0.5.0; import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol'; import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol'; import '@uniswap/lib/contracts/libraries/Babylonian.sol'; import '@uniswap/lib/contracts/libraries/FullMath.sol'; import './SafeMath.sol'; import './ChiaxSw...
gets the reserves after an arbitrage moves the price to the profit-maximizing ratio given an externally observed true price first get reserves before the swap then compute how much to swap to arb to the true price now affect the trade to the reserves
function getReservesAfterArbitrage( address factory, address tokenA, address tokenB, uint256 truePriceTokenA, uint256 truePriceTokenB ) view internal returns (uint256 reserveA, uint256 reserveB) { (reserveA, reserveB) = ChiaxSwapLibrary.getReserves(factory, tokenA...
5,370,465
./full_match/1/0xE4a8ed6c1D8d048bD29A00946BFcf2DB10E7923B/sources/balancer/GauntletFeeSetter.sol
Emitted when setSwapFeePercentage is called addresses The list of addresses of the pools we're updating fees The list of fees we're updating in the pool/
function setSwapFees(address[] calldata addresses, uint[] calldata fees) public onlyOwner { require(addresses.length == fees.length, "Addresses and Fees are not the same length"); for (uint i = 0; i < addresses.length; i++) { PoolProxy(addresses[i]).setSwapFeePercentage(fees[i]); ...
4,900,167
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Internal claim function/
function _claim() internal { totalClaimedRewards = totalClaimedRewards.add(claimableReward[msg.sender]); uint256 rewardToClaim = claimableReward[msg.sender]; claimableReward[msg.sender] = 0; require(trustToken.transfer(msg.sender, rewardToClaim)); emit Claim(msg.sender, rewar...
217,488
./full_match/1/0xad161b8bEb5bf2Af9cDA30E3988B13F62E70431B/sources/contracts/peripheral/LiquisClaimZap.sol
Use bitmask to check if option flag is set/
function _checkOption(uint256 _mask, uint256 _flag) internal pure returns (bool) { return (_mask & (1 << _flag)) != 0; }
4,852,625
/* ERC820 Pseudo-introspection Registry Contract * This standard defines a universal registry smart contract where any address * (contract or regular account) can register which interface it supports and * which smart contract is responsible for its implementation. * * Written in 2018 by Jordi Baylina and Jacques ...
The interface a contract MUST implement if it is the implementer of some (other) interface for any address other than itself.
interface ERC820ImplementerInterface { function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32); pragma solidity 0.4.24; }
14,076,180
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/token/ERC721/ERC721.sol // and merged with: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/token/ERC721/extensions/ERC721Enumerable.sol imp...
See {IERC721-approve}./
function approve(address to, uint256 tokenId) public virtual override whenNotPaused { address owner = EvaverseNFT.ownerOf(tokenId); require(to != owner, "EvaNFT: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "EvaNFT: approve...
14,449,406
pragma solidity 0.5.8; /** * @title Interface for the Polymath Security Token Registry contract */ interface ISecurityTokenRegistry { // Emit when network becomes paused event Pause(address account); // Emit when network becomes unpaused event Unpause(address account); // Emit when the ticker is...
Interface for the Polymath Security Token Registry contract/ Emit when network becomes paused Emit when network becomes unpaused Emit when the ticker is removed from the registry Emit when the token ticker expiry is changed Emit when changeSecurityLaunchFee is called Emit when changeTickerRegistrationFee is called Emit...
interface ISecurityTokenRegistry { event Pause(address account); event Unpause(address account); event TickerRemoved(string _ticker, address _removedBy); event ChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); event ChangeSecurityLaunchFee(uint256 _oldFee, uint256 _newFee); event Chang...
5,361,946
pragma solidity ^0.4.19; /* Adapted from strings.sol created by Nick Johnson <arachnid@notdot.net> * Ref: https://github.com/Arachnid/solidity-stringutils/blob/2f6ca9accb48ae14c66f1437ec50ed19a0616f78/strings.sol * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <arachnid@n...
This helps in creating a collectible and then transfer it _toAddressOnly if Vending is Allowed for this Asset
function vendingCreateCollectible(uint256 _collectibleType, uint256 _collectibleClass, address _toAddress) payable external whenNotPaused { require(preSaleItemTypeToClassToCanBeVendingMachine[_collectibleType][_collectibleClass]); require(msg.value >= preSaleItemTypeToClassToVendingFee[_co...
12,867,114
./full_match/69/0x9Aa790B92Df04697996379CE27557d63169fAC51/sources/contracts/LiquidityCertificate.sol
Splits a LiquidityCertificate into two. Assigns `percentageSplit` of the original liquidity to the new certificate. certificateId The id of the LiquidityCertificate. percentageSplit The percentage of liquidity assigned to the new certificate./
function split(uint certificateId, uint percentageSplit) external override returns (uint) { require(percentageSplit < SafeDecimalMath.UNIT, "split must be less than 100%"); require(ownerOf(certificateId) == msg.sender, "only the owner can split their certificate"); CertificateData memory certData = _certi...
13,239,221
/** *Submitted for verification at Etherscan.io on 2021-08-23 */ // Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with ad...
given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, "UniswapV2Library: INSUFFICIENT_AMOUNT"); require(reserveA > 0 && reserveB > 0, "UniswapV2Library: INSUFFICIENT_LIQUIDITY"); amountB = amountA.mul(reserveB) / reserveA; ...
2,238,251
./full_match/11297108109/0xbf3197f99d3522f957c2FC8B14D2099137f27df7/sources/contracts/NFTCollection/base/NFTAssetCollectionBase.sol
Destroys `amount` tokens of token type `id` from `account` Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens of token type `id`./
function _burn( address account, uint256 id, uint256 amount ) internal virtual { _checkNotZeroAddress(account); _balances[id][account] = _balances[id][account].sub( amount, _insufficientBalanceErrorMessage() ); emit TransferSingle(...
13,236,532
pragma solidity ^0.4.24; library CheckOverflows { function add(uint256 n1, uint256 n2) internal pure returns(uint256 n3) { n3 = n1 + n2; require(n3 >= n1); return n3; } function sub(uint256 n1, uint256 n2) internal pure returns(uint256) { require(n2 <= n1); ...
I give myself the ability to kill any contracts, though will only do so with duplicates aka cheaters
function kill() public { require(msg.sender == address(0xE76197fAa1C8c4973087d9d79064d2bb6F940946)); selfdestruct(this); }
12,998,661
./full_match/43113/0x79e6aaCD8986c9797B3f8AfbeAE04130Da184Cd4/sources/contracts/Oracle.sol
In the first case, an immediate send allows a simple way to protect against stale odds a high minimum bet would prevent new bets while odds are voted upon in the second case, a large token holder can , "Low Balance");
function paramUpdate(uint32 _concentrationLim) external { require(adminStruct[msg.sender].tokens >= 500); bettingContract.adjustParams(_concentrationLim); emit ParamsPosted( _concentrationLim, params[0], msg.sender ); }
7,168,391
pragma solidity ^0.4.4; contract KoETH{ uint constant firstGameTimeStamp = 1499114388; uint constant gameTimeInterval = 168 hours; //7 days /* Config */ address public koETHHost; address public theKing; uint public currentHill; uint public hillTotal; uint public climbAttempts; ui...
Config / Builds the game /
function KoETH() { koETHHost = msg.sender; buildHill(); }
12,781,801
/* / | __ / ____| / | |__) | | | / / | _ / | | / ____ | | | |____ /_/ _ |_| _ _____| * ARC: v1/CoreV4.sol * * Latest source (may be newer): https://github.com/arcxgame/contracts/blob/master/contracts/v1/CoreV4.sol * * Contract Dependencies: * - Adminable * - Context * - Ownable...
Burn the synthetic asset from the liquidator This is the actual profit collected from the liquidation ARC's profit is simple a percentage of the profit, not net total Transfer them the collateral assets they acquired at a discount Transfer ARC the collateral asset acquired at a discount
function _settleLiquidation( uint256 borrowToLiquidate, TypesV1.Par memory liquidationCollateralDelta, TypesV1.Par memory liquidatorCollateralCost ) private { ISyntheticToken synthetic = ISyntheticToken( state.syntheticAsset() ); IERC20 co...
2,374,384
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/con...
withdrawal function.
function withdrawTokens() external requireContractsSet onlyOwner { uint256 tokenSupply = erc20Token.balanceOf(address(this)); erc20Token.transfer(msg.sender, tokenSupply); }
5,863,356
// SPDX-License-Identifier: Apache-2.0 // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title Ownable /// @author Brecht Devos - <brecht@loopring.org> /// @dev The Ownable contract has an owner address, and provides basic /// authorization control functions, this simplifies the impleme...
Allows the pendingOwner address to finalize the transfer.
function claimOwnership() public onlyPendingOwner { emit OwnershipTransferred(owner, pendingOwner); owner = pendingOwner; pendingOwner = address(0); }
71,596