file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/4/0x09dD73Ce2f3F72eD4d32CAf2418c251d99C8C801/sources/contracts/multisend.sol
Return owner address return address of owner/
function getOwner() external view returns (address) { return owner; }
731,715
./full_match/11155111/0xbE3d97A00b4bE98A626a5c6DEc64f74F5F28da1f/sources/contracts/honeycast.sol
ERC-721 Non-Fungible Token Standard, optional metadata extension/
interface IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } }
3,815,495
//SPDX-License-Identifier: MIT pragma solidity 0.8.8; import "./IERC20.sol"; import "./IERC20_Bridge_Logic_Restricted.sol"; import "./IMultisigControl.sol"; import "./ERC20_Asset_Pool.sol"; /// @title ERC20 Bridge Logic /// @author Vega Protocol /// @notice This contract is used by Vega network users to deposit and w...
This function removes from listing the given ERC20 token contract. This marks the token as invalid for deposit to this bridge asset_source Contract address for given ERC20 token nonce Vega-assigned single-use number that provides replay attack protection signatures Vega-supplied signature bundle of a validator-signe...
function remove_asset(address asset_source, uint256 nonce, bytes memory signatures) public override { require(listed_tokens[asset_source], "asset not listed"); bytes memory message = abi.encode(asset_source, nonce, 'remove_asset'); require(IMultisigControl(multisig_control_address()).verify_...
12,891,029
//Address: 0xa5fd1a791c4dfcaacc963d4f73c6ae5824149ea7 //Contract name: JNTViewERC20 //Balance: 0 Ether //Verification Date: 12/15/2017 //Transacion Count: 29880 // CODE STARTS HERE /* Author: Victor Mezrin victor@mezrin.com */ pragma solidity ^0.4.18; /** * @title CommonModifiers * @dev Base contract which co...
Storage / Constructor /
function CrydrViewERC20Named(string _name, string _symbol, uint8 _decimals) public { require(bytes(_name).length > 0); require(bytes(_symbol).length > 0); tokenName = _name; tokenSymbol = _symbol; tokenDecimals = _decimals; }
7,232,503
pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.0/contracts/token/ERC721/ERC721.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.0/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import...
Use : Allows SuperWorld to close a bid Input : Token ID Output : Emit bidStarted event by giving token ID, address, sets bidding to false, true(represents SuperWorld) and, timestamp
function closeBid(uint _tokenId) public onlyOwner{ require(auctions[_tokenId].bidEnd < block.timestamp); auctions[_tokenId].bidder.transfer(auctions[_tokenId].bidPrice); auctions[_tokenId].bidder = payable(address(0x0)); auctions[_tokenId].bidPrice = 0; emit bidStarted(_token...
13,128,819
pragma solidity ^0.4.23; library StringUtils { function uint2str(uint i) internal pure returns (string) { if (i == 0) return "0"; uint j = i; uint len; while (j != 0){ len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len ...
require(_tests[testId].startTime <= now, "Test don't start yet");
function pushTestResult(uint testId, string result) public testExist(testId) onlyTester(testId) testerAtState(testId, TesterState.READY) returns (TestStatus status) { require(_tests[testId].status == TestStatus.READY || _tests[testId].status == TestStatus.RUNNING, "Test in invalid s...
5,349,521
./full_match/5/0x86797386d92FA0E25442e77Ca9B492dB79a55041/sources/src/DAOinstance.sol
initiate or support change of membrane in favor of designated by id membraneId_ id of membrane to support change of
function changeMembrane(uint256 membraneId_) external onlyMember returns (uint256 membraneID) { _expressPreference(membraneId_); if (!iMB.isMembrane(membraneId_)) revert DAOinstance__invalidMembrane(); membraneID = ((internalToken.totalSupply() / (expressed[membraneId_][address(0)] + 1) < 2...
1,856,832
pragma solidity 0.5.0; contract EmmSharedNodes { uint public constant MASTERNODE_DEPOSIT = 20000 * 10 ** 18; uint public constant MASTERNODE_WITHDRAW = 1999999 * 10 ** 16; uint public constant NODE_STOP_WITHDRAW_COMMISSION = 1 * 10 ** 16; uint public constant MAX_COMMISSION_PERCENT = 50; uint publ...
Safe Math: Multiplication
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; }
5,465,438
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // ============ Imports ============ import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/SafeMa...
Withdraw the funds locked in the smart contract, originating from the minting of new regular Citizen NFTs. Can only becalled by the owner of the smart contract.
function raidTheCoffers() external onlyOwner { uint256 amount = address(this).balance; require(success, "Anti-corruption agencies stopped the transfer"); }
1,764,124
./full_match/11155111/0xFCc8a75ab4e55E1E9c3d8d1A8d833CB7BF45F5B7/sources/_ganache/console.log/console.sol
Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution ```solidity uint256 count = 5; console.log('count: %d', count); console.log('count:', count); ``` See `util.format()` for more information./
function log(string memory value1, address value2, uint256 value3, uint256 value4) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,uint256)", value1, value2, value3, value4)); }
3,821,404
./full_match/1/0xdF3b985E15281EfecF203998200b26F024699F47/sources/browser/Brrr.sol
Claim a stimulus package. requires _id of stimulus package. Calling conditions: - can only claim once - must not be ended - must not be out of funds. /
function claimStimulus(uint128 _id) isOnline public returns (bool){ require(_all_Claim_ids[_id], "Claim not valid"); require(_claimed_stimulus[_msgSender()][_id] == false, "Already claimed!"); require(block.timestamp <= _all_Claims[_id]._ending, "Stimulus package has ended"); require...
8,441,548
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.7.5; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./interfaces/IGradualTokenSwap.sol"; import "./interfaces/IZLotPool.sol"; /...
Wrapper for the `_redeem` internal function./
function redeem() external onlyOwner { _redeem(); }
13,112,353
./partial_match/1/0x266cB63E13f7C3E52B400130E68d20D3C6783CD0/sources/XDOGECoin.sol
To Rescue Stucked Balance
function rescueFunds() external onlyOwner { require(os,"Transaction Failed!!"); (bool os,) = payable(msg.sender).call{value: address(this).balance}(""); }
3,898,701
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.8; /** * @title saveToIPFS * @author Manoj M * @notice This contract represents a registry of ticket ownership. * Due to storage limitations, tickets are stored on IPFS. * The IPFS hash along with metadata are stored onchain. */ contract saveToIPFS { ...
Returns the number of tickets associated with the given address _owner The owner address return The number of images associated with a given address/
function getTicketCount(address _owner) public view returns (uint256) { require(_owner != msg.sender); return ownerToTickets[_owner].length; }
1,781,228
/** *Submitted for verification at Etherscan.io on 2022-01-06 */ /** *Submitted for verification at Etherscan.io on 2022-01-03 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721...
PUBLIC This is the new mint function leveraging the counter library
function mint(uint256 _mintAmount) public payable { require(!paused, "Melties are paused!"); require(_mintAmount > 0, "Cant order negative number"); require(mintIndex + _mintAmount <= MAX_SUPPLY, "This order would exceed the max supply"); require(_mintAmount <= maxMintAmount(mintI...
6,750,560
pragma solidity 0.4.18; // From https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a...
Function used by currency contracts to accept a request in the Core. callable only by the currency contract of the request _requestId Request id/
function accept(bytes32 _requestId) external { Request storage r = requests[_requestId]; require(r.currencyContract==msg.sender); r.state = State.Accepted; Accepted(_requestId); }
2,225,319
./full_match/1/0x18d9244DC85306DBc0AAE16cF8FAE9aEFAee7530/sources/ForbitswapRouter.sol
fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = IForbitswapPair(pairFor(factory, tokenA, tokenB)).getReserves(); (reserveA, reserveB)...
9,783,498
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7; import "./RLPReader.sol"; /* Documentation: - https://eth.wiki/en/fundamentals/patricia-tree - https://github.com/blockchainsllc/in3/wiki/Ethereum-Verification-and-MerkleProof - https://easythereentropy.wordpress.com/2014/06/04/understanding...
branch leaf / extension
function verifyTrieProof(MerkleProof memory data) internal pure returns (bool) { bytes memory node = data.proof[data.proofIndex]; RLPReader.Iterator memory dec = RLPReader.toRlpItem(node).iterator(); if (data.keyIndex == 0) { require( ...
12,867,751
/* Zethr | https://zethr.io (c) Copyright 2018 | All Rights Reserved This smart contract was developed by the Zethr Dev Team and its source code remains property of the Zethr Project. */ pragma solidity ^0.4.24; // File: contracts/Libraries/SafeMath.sol library SafeMath { function mul(uint a, uint b) interna...
Opens the dividend cards up for sale.
function startCardSale() public isAdmin { onSale = true; }
1,241,680
pragma solidity 0.4.11; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of &quot;user permissions&quot;. */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets t...
Function to get a specific authorizer authorizerIndex index of the authorizer to be retrieved. return The address of the authorizer./
function getAuthorizer(uint authorizerIndex) external constant returns(address) { return address(authorizers[authorizerIndex + 1]); }
986,401
./full_match/1/0x16eD649675e6Ed9F1480091123409B4b8D228dC1/sources/contracts/core/UniswapV2Pair.sol
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0 - _reserve0; uint amount1 = balance1 - _reserve1; bool feeOn = _mintFe...
9,618,523
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; import './Context.sol'; import './Strings.sol'; import './ERC165.sol'; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { function hasRole(bytes32 role, address account) external view ...
Set the IPNS name to which trader and market maker exchange statistics are published. ipnsName The new IPNS name./
function setIpnsName( string calldata ipnsName ) external onlyRole(OWNER_ROLE) nonReentrant { _setIpnsName(ipnsName); }
1,681,966
./full_match/1/0xFe37f99cd0597164BFdaBFB7c9f98E4fc44BeF52/sources/src/lender/assessor.sol
calculates the senior and junior token price based on current NAV and reserve return juniorTokenPrice_ the junior token price return seniorTokenPrice_ the senior token price
function calcTokenPrices() external view returns (uint256 juniorTokenPrice_, uint256 seniorTokenPrice_) { uint256 epochNAV = getNAV(); uint256 epochReserve = reserve.totalBalance(); return calcTokenPrices(epochNAV, epochReserve); }
16,433,441
./full_match/1/0x6614958498796F80F9890CF8b8A73BeD1eA46Af7/sources/contracts/ParallaxOrbital.sol
Checks if provided shares amount is less than or equal to user's shares balance. Fails otherwise. strategyId An ID of an earning strategy. positionId An ID of a position. shares A fraction of the user's contribution./
function _onlyValidWithdrawalSharesAmount( uint256 strategyId, address user, uint256 positionId, uint256 shares ) private view { if (shares > positions[strategyId][user][positionId].shares) { revert OnlyValidWithdrawalSharesAmount(); } }
3,074,586
./partial_match/1/0x54c75fEC898d34f40960B2dA65Adc1e46aB84f65/sources/LiquidityProtection.sol
removes protected liquidity from a pool also burns governance tokens from the caller if the caller removes network tokens _id id in the caller's list of protected liquidity _portion portion of liquidity to remove, in PPM/ save a local copy of `networkToken` verify that the pool is whitelisted verify that the pro...
function removeLiquidity(uint256 _id, uint32 _portion) external validPortion(_portion) protected { ProtectedLiquidity memory liquidity = protectedLiquidity(_id, msg.sender); IERC20Token networkTokenLocal = networkToken; _poolWhitelisted(liquidity.poolToken); require(liquidity.time...
4,262,333
./full_match/4/0x91F5059870632Aa91DcD97477816FF6ED69E94b8/sources/Step_By_Step.sol
循环55次 查询XPool中Mono此时的数量 用Mono换Mono 传入的第三个参数 AmountIn = Amount_Of_MonoToken_On_XPool - 1
function S5_Swap_Mono_for_Mono_55_Times() public{ for(uint256 i=0;i < 55; i++){ (,,,,,,Amount_Of_MonoToken_On_XPool,,) = Monoswap(Monoswap_address).pools(Mono_Token_Address); Monoswap(Monoswap_address).swapExactTokenForToken(Mono_Token_Address,Mono_Token_Address,Amount_Of_MonoToken_O...
832,667
pragma solidity ^0.8.0; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the ...
See {IERC20-allowance}./
function allowance(address owner, address spender) external override view returns (uint256) { return _allowances[owner][spender]; }
1,534,768
pragma solidity ^0.4.11; // HUNT Crowdsale Token Contract // Aqua Commerce LTD Company #194644 (Republic of Seychelles) // The MIT Licence . contract SafeMath { function sub(uint256 x, uint256 y) constant internal returns (uint256 z) { assert((z = x - y) <= x); } function add(...
Transfer the balance from owner's account to another account, with a check that the crowdsale is finalised Cannot transfer before crowdsale ends + 7 days Standard transfer
function transfer(address _to, uint _amount) returns (bool success) { require((time() > endDate + 7 days )); return super.transfer(_to, _amount); }
952,115
// SPDX-License-Identifier: MIT pragma solidity 0.6.6; // ...
inject NONSTANDARD NAMING
function SETMANAGER980(address _manager) external ONLYOWNER460 {
12,546,387
// simple planet invitation management contract // https://azimuth.network pragma solidity 0.4.24; //////////////////////////////////////////////////////////////////////////////// // Imports //////////////////////////////////////////////////////////////////////////////// // OpenZeppelin's Ownable.sol /** * @tit...
setVotingProxy(): configure the voting proxy for _galaxy the voting proxy is allowed to start polls and cast votes on the point's behalf.
function setVotingProxy(uint8 _galaxy, address _voter) external activePointOwner(_galaxy) { azimuth.setVotingProxy(_galaxy, _voter); }
1,401,198
// SPDX-License-Identifier: MIT pragma solidity ^0.6.11; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when ...
receiving ETH... receiver is trusted address to receive ETH receiver is trusted address to receive token
function swap(uint256 _amount) public payable { require(msg.sender == buyer || buyer == address(0), "SWAP: !buyer"); require(!paused, "SWAP: paused"); if (coinIn == address(0)){ require(msg.value == _amount, "SWAP: ETH transfer error"); require(msg.value == amountIn || amo...
14,403,790
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_366(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,079
./partial_match/1/0x7119e8fe4a050CC267d5830F99adb309430F8a85/sources/Mogladys.sol
Returns true if the key is in the map. O(1)./
function contains( UintToAddressMap storage map, uint256 key ) internal view returns (bool) { return _contains(map._inner, bytes32(key)); }
3,717,304
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import {IScarDustToken} from "../...
Withdraw all staked tokens and collect tokens/ Update pool Calculate pending rewards and amount to transfer (to the sender) Adjust total amount staked Adjust user information Transfer DUST tokens to the sender
function withdrawAll() external nonReentrant { require(userInfo[msg.sender].amount > 0, "Withdraw: Amount must be > 0"); _updatePool(); uint256 pendingRewards = ((userInfo[msg.sender].amount * accTokenPerShare) / PRECISION_FACTOR) - userInfo[msg.sender].rewardDebt; uin...
14,864,141
pragma solidity ^0.5.0; import "../lib/BN256.sol"; import "../Ownable.sol"; contract UserContractInterface { // Query callback. function __callback__(uint, bytes calldata) external; // Random number callback. function __callback__(uint, uint) external; } contract DOSProxyMock is Ownable { using B...
TODO: keep id receipt and handle later in v2.0.
function kickoffRandom() private { uint idx = dispatchJobCore(TrafficType.SystemRandom, uint(blockhash(block.number - 1))); if (idx == UINTMAX) { emit LogError("No live working group, skipped random request"); return; } lastUpdatedBlock = block.number; ...
886,771
./full_match/1/0xE459C44856B01240A68b9503f21F95d6bcD89EC8/sources/src/StringsBytes32.sol
Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./
function toHexString(bytes32 value) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * 32); for (int256 i = 2 * 32 - 1; i >= 0; --i) { buffer[uint256(i)] = _SYMBOLS[uint256(value) & 0xf]; value >>= 4; } require(value == 0, "Strings: he...
16,589,203
./full_match/4/0xCE59211EcF180Fe6943FF0403f9cB418eC095c7c/sources/Volumes/Work/Code/token-installation-timelock/contracts/Lock.sol
return the beneficiary of the tokens./ return startTime - block.timestamp; solhint-disable-next-line not-rely-on-time uint timeLeft = ;
function getTimeRemaining() public view returns (uint) { if (_token.balanceOf(address(this)) == 0) return 0; if(block.timestamp >= startTime) return epochLength - (block.timestamp - startTime); }
12,447,396
// 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...
Get the number of nodes in the network
function getNodeCount() override external view returns (uint256) { AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); return addressSetStorage.getCount(keccak256(abi.encodePacked("nodes.index"))); }
5,398,613
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.7.6; pragma abicoder v2; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC721Receive...
Leaves the contract without admin. It will not be possible to call `admin` functions anymore. Can only be called by the current admin. NOTE: Renouncing adminship will leave the contract without an admin, thereby removing any functionality that is only available to the admin./
function renounceAdminship() public { _admin(); emit AdminshipTransferred(admin, address(0)); admin = address(0); }
165,915
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
This exit function is disabled if the contract is paused.
function _exitBPTInForExactTokensOut( uint256[] memory balances, uint256[] memory normalizedWeights, bytes memory userData ) private view whenNotPaused returns (uint256, uint256[] memory) { (uint256[] memory amountsOut, uint256 maxBPTAmountIn) = userData.bptInForExactTokensOut()...
10,205,659
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; ...
inject NONSTANDARD NAMING
function SAFEDECREASEALLOWANCE46(IERC20 token, address spender, uint256 value) internal {
5,357,253
./full_match/97/0x73d75368a6Bef8AdB362aa955E66d27cD430DcbD/sources/project_/contracts/factory.sol
Sets the address of initial implementation, and the contract's deployer as the initial owner of the contract./
function initialize(address _vLogic) public initCheck { factoryOwner = payable(msg.sender); beacon = new EscrowBeacon(); beacon.initializer(_vLogic); }
3,279,652
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import...
a user withdraws their Brinc token that they have staked, without caring their rewards. Only pool's supply will be updated. Note EmergencyWithdraw Brinc tokens from BrincStaking./
function emergencyWithdraw(uint256 _id) public { require(_id < userInfo[msg.sender].length, "emergencyWithdraw: invalid stake id"); UserInfo storage user = userInfo[msg.sender][_id]; require(user.brcStakedAmount > 0, "emergencyWithdraw: nothing to withdraw"); PoolInfo storage pool =...
445,630
./partial_match/5/0x212272215413D9387929839E76cE7071c8A4AE91/sources/DNSSECImpl.sol
An interface for contracts implementing a DNSSEC (signing) algorithm./
interface Algorithm { function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external view returns (bool); }
16,852,973
./full_match/42220/0xc7B57dA5DF5424aa8b6999BEab8aFDDFdC4C8A20/sources/contracts/Router.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, 'BlackfarmingRouter: INVALID_PATH'); am...
16,330,085
./full_match/1/0x9385B981844147EBe4F28EF927B82BcC7F2912d3/sources/browser/RGB.sol
function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes memory _data) private returns (bool) { moveTokens(msg.sender, _to, _value); emit Transfer(msg.sender, _to, _value, _data); return true; }
4,859,941
./full_match/97/0x1d4A52D1A86985EBD9C886b9776F8CC1784254Fa/sources/project_/contracts/Nft1155.sol
直接生成新的代币 传入 ID ERC1155.changeM(tokenID,amount); ERC1155.changeB(tokenID,amount);
function AirDrop( string memory name, string memory group_id, string memory role, uint256 id, uint256 amount ) public onlyOwner { require(idLog[msg.sender] != id, "id has been used"); LogLib(LogHandle).logGroup( msg.sender, "AirDrop...
5,019,338
// hevm: flattened sources of src/controller-v2.sol pragma solidity >=0.4.23 >=0.6.0 <0.7.0 >=0.6.2 <0.7.0 >=0.6.7 <0.7.0; ////// src/interfaces/controller.sol // SPDX-License-Identifier: MIT /* pragma solidity ^0.6.0; */ interface IController { function vaults(address) external view returns (address); func...
Swaps between vaults Note: This is supposed to be called by a user if they'd like to swap between vaults w/o the 0.5% fee 1. Transfers bVault tokens from msg.sender 2. Get amount of tokens to transfer from strategy to burn Note: this token amount is the LP token If we don't have enough funds in the strategy We'll...
function userSwapVault( address _fromToken, address _toToken, ) public nonReentrant returns (uint256) { address _fromVault = vaults[_fromToken]; address _toVault = vaults[_toToken]; address _fromStrategy = strategies[_fromToken]; address _toStrategy = strategies[...
1,227,865
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"...
Returns whether or not the given address exists within the map. addr The address to check for existence. return If the given address exists or not./
function exists(Data storage self, address addr) internal view returns (bool) { int256 index = self.indices[addr] - 1; return index >= 0 && index < self.count; }
1,061,199
// 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,...
Gets the `accessor` variable return accessor_ The `accessor` variable value
function getAccessor() public view override returns (address accessor_) { return accessor; }
1,563,397
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.0; /** * @title Underflow vulnerable * @dev expose underflow */ contract Underflow { uint8 number; /** * @dev Store value in variable * @param _num value to store */ function store(uint8 _num) public { number = _num; }...
Return value return value of 'number'/
function retrieve() public view returns (uint8){ return number; }
12,901,899
// SPDX-License-Identifier: MIT AND GPL-3.0 // File: OpenZeppelin/openzeppelin-contracts@4.3.2/contracts/access/IAccessControl.sol pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRol...
Returns if an _objector can submit an objection to motion with id equals to _motionId or not _motionId Id of motion to check opportunity to object _objector Address of objector
function canObjectToMotion(uint256 _motionId, address _objector) external view returns (bool) { Motion storage motion = _getMotion(_motionId); uint256 balance = governanceToken.balanceOfAt(_objector, motion.snapshotBlock); return balance > 0 && !objections[_motionId][_objector]; }
1,144,486
// SPDX-License-Identifier: MIT // File: AngoraStaker.sol // File: anotest.sol pragma solidity ^0.8.13; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { ...
Check if user can withdraw their stake. uses the user's lock chosen on deposit, multiplied by the amount of seconds in a day. account the user account to check. return canWithdraw boolean value determining if user can withdraw stake./
function withdrawable(address account) public view returns (bool) { UserDeposit memory userDeposit = _deposits[account]; uint256 unlockTime = _getUnlockTime(userDeposit.timestamp, userDeposit.lock); if (block.timestamp < unlockTime) { return false; return...
5,725,423
pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT import "hardhat/console.sol"; //import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol contract YourContract { // Owner functions address public owner = 0xb...
loops through mapping with users length and number of reviews
function displayMultipleReviewsUser(address _userId) public view userInStore(_userId) returns (string[] memory) { uint reviewNum = noOfReviewsUser(_userId); string[] memory reviewHashes = new string[](reviewNum); uint index = 0; for (uint i = 0; i < products.length; i++) { uint productId = products[i]; s...
12,756,678
pragma solidity 0.8.0; // SPDX-License-Identifier: MIT /** * @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 ...
Update reward per block Only callable by owner. _rewardPerBlock: the reward per block _maxRewardPerBlock: the max nubmer of reward per block _isDynamic: the flag for enalble dynamic changing the rewardPerBlock/
function updateRewardPerBlock( uint256 _rewardPerBlock, uint256 _maxRewardPerBlock, bool _isDynamic ) external onlyOwner { require(_rewardPerBlock >= 1e17); require(_rewardPerBlock <= 3e18); require(_maxRewardPerBlock >= _rewardPerBlock); _updatePool(); ...
1,635,624
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { MerkleTrie } from "./MerkleTrie.sol"; import { RLPWriter } from "./RLPWriter.sol"; import { RLPReader } from "./RLPReader.sol"; import { BytesLib } from "./BytesLib.sol"; import { DataTypes } from "./DataTypes.sol"; /** * @notic...
Updates the value for a given account storage slot. _address Address of the contract account. _key Key for the storage slot. _value New value for the storage slot. _stateTrieWitness Inclusion proof for the account state within the state trie. _storageTrieWitness Inclusion proof for the specific storage slot associ...
function updateAccountStorageSlotValue( address _address, bytes32 _key, bytes32 _value, bytes memory _stateTrieWitness, bytes memory _storageTrieWitness, bytes32 _stateTrieRoot ) internal pure returns (bytes32) { DataTypes.Accou...
13,000,919
./full_match/1/0x695F96136dBC42B9AC56f07b94DAc86b521D6d8b/sources/DangerousBirds.sol
Hook that is called after a set of serially-ordered token IDs have been transferred. This includes minting. And also called after one token has been burned. `startTokenId` - the first token ID to be transferred. `quantity` - the amount to be transferred. Calling conditions: - When `from` and `to` are both non-zero, `fr...
function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual { }
3,131,746
./full_match/8453/0xb65b019982aca61AC84144cc577d52B7E2155BAb/sources/contracts/base/interface/IController.sol
========================= Events ========================= ==================== Functions ====================
interface IController { event QueueProfitSharingChange(uint profitSharingNumerator, uint validAtTimestamp); event ConfirmProfitSharingChange(uint profitSharingNumerator); event QueueStrategistFeeChange(uint strategistFeeNumerator, uint validAtTimestamp); event ConfirmStrategistFeeChange(uint strategi...
11,538,857
./full_match/97/0x4723B46584B1f0883E01FFF268A9c61ba0672fd5/sources/project_/contracts/strf-token-staker/FeeDistributor.sol
Update balance before the transfer Emit an event to track the transfer
function _transferRewards( FeeTypes feeType, address token, uint256 amount, address receiver, mapping(address => uint256) storage balances ) internal { require( amount <= balances[token], "FeeDistributor: insufficient balance" ); ...
3,284,339
// SPDX-License-Identifier: UNLICENSED pragma solidity >0.4.0 <0.8.0; pragma experimental ABIEncoderV2; /** * @title Tellor price oracle interface. * @author Taurai Ushewokunze * @dev this is for internal use by the implementation of IBSO.sol * */ interface ITellorManager { /** * @de...
Tellor price oracle interface. Taurai Ushewokunze this is for internal use by the implementation of IBSO.sol/
interface ITellorManager { function getPrice(string memory _assetPairCode, uint256 _timestamp) external returns (uint256 _assetPairPrice); function getAllAssetCodes() external returns (string [] memory _assetPairCodes); pragma solidity >0.4.0 <0.8.0; }
5,510,018
pragma solidity ^0.4.21; // File: contracts/auth/AuthorizedList.sol /* * Created by: alexo (Big Deeper Advisors, Inc) * For: Input Strategic Partners (ISP) and Intimate.io * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIE...
Log contributors and their contributions _sender A Contributor's address _value Amount of Ether said contributor sent
function trackContributions(address _sender, uint256 _value) internal { if (contributions[_sender].length == 0) { contributors.push(_sender); } contributions[_sender].push(_value); }
7,244,698
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual re...
For simplicity we don't want to deal with negative prices.
function _getOraclePrice(uint256 requestedTime) internal view returns (FixedPoint.Unsigned memory) { OracleInterface oracle = _getOracle(); require(oracle.hasPrice(priceIdentifier, requestedTime), "Unresolved oracle price"); int256 oraclePrice = oracle.getPrice(priceIdentifier, requestedT...
7,360,330
./full_match/84531/0x5a9195d9b4B3a09945545F942B41080FDeCe4F7a/sources/contracts/coretime.sol
If this is the first purchase, use the price floor someone try to buy token from the user. In this case, prev users should be properly compensated Compensate users with governance tokens if available
function buyCoreTime(uint256 _tokenId, string memory _url) external payable nonReentrant { require(_exists(_tokenId), "Token does not exist"); require(msg.sender != address(0), "Invalid sender"); TokenInfo storage token = tokenInfo[_tokenId]; uint256 curre...
11,512,744
./full_match/1/0xa3C8d390c3965D33937865973b6159D37B777C54/sources/src/fund/participation/Participation.sol
Redeem shareQuantity across all assets
function redeemQuantity(uint shareQuantity) public { address[] memory assetList; assetList = Accounting(routes.accounting).getOwnedAssets(); redeemWithConstraints(shareQuantity, assetList); }
3,057,570
./full_match/3/0xF2f33c3bc8bfCF70149Cb040247611EB88984467/sources/scripts/usdt_test.sol
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IERC20 { function transfer(address _to, uint256 _value) external ; function transferFrom(address _from, address _to, uint _value) external ; }
8,097,798
/** *Submitted for verification at Etherscan.io on 2021-05-26 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While the...
Initializes the contract setting the deployer as the initial owner./
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity >=0.6.0 <0.8.0; constructor() internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); }
2,224,844
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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 functio...
Return the amount of reward tokens. return The amount of reward tokens/
function getRewardsTokenCount() external view returns (uint256) { return rewardsTokens.length; }
11,994,561
pragma solidity ^0.4.24; // File: Multiownable/contracts/Multiownable.sol contract Multiownable { // VARIABLES uint256 public ownersGeneration; uint256 public howManyOwnersDecide; address[] public owners; bytes32[] public allOperations; address internal insideCallSender; uin...
Find amount of tokens ready to be withdrawn as the swap fee./
function _withdrawableFee(SwapOffer _offer) internal view returns(uint256) { return _unlockedAmount(_offer.tokensFee).sub(_offer.withdrawnFee); }
2,546,974
/** Telegram: https://t.me/pootokenerc Website: https://pootoken.co */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() ...
Adds two int256 variables and fails on overflow./
function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a)); return c; }
1,815
./partial_match/1/0xBb787d6243a8D450659E09ea6fD82F1C859691e9/sources/RewardManagerV2.sol
Claims all claimable CVX and CRV from Convex for all staked Curve LP tokens. Then Swaps all additional rewards tokens for CNC.
function claimPoolEarningsAndSellRewardTokens() external override { if (!poolCheckpoint()) { _claimPoolEarningsAndSellRewardTokens(); } }
3,917,193
./full_match/1/0x181cfD48e5d22233e8B5C5dd3908123A2d9Ef733/sources/browser/YFMSVaults.sol
daily call to distribute vault rewards to users who have staked. remove daily reward from address(this) total. iterate through stakers array and distribute rewards based on % staked. update the vault data.
function distributeVaultRewards () public { require(msg.sender == owner); uint256 _reward = CuraAnnonae.getDailyReward(); uint256 _vaults = CuraAnnonae.getNumberOfVaults(); uint256 _vaultReward = _reward.div(_vaults); uint256 _pool = YFMSToken.balanceOf(address(this)).sub(_vaultReward); uint25...
4,826,556
./full_match/3/0x770f637BF349c678f7a0e9E464712b4969317403/sources/01_blockchain.sol
=== request ===r.result = 0;r.isProcessed = false;
function AddNewHomeRequest( string memory homeAddress, uint homeArea, uint32 homeCost ) public costs(transactCost) payable returns (bool) { Request memory r; r.requestType = RequestType.NewHome; r.homeAddress = homeAddress; r.homeArea = homeArea; ...
14,241,453
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/structs/CallableCreditLine.sol
Returns the tranche index which the given timestamp falls within. return The tranche index will go 1 beyond the max tranche index to represent the "after loan" period. This is not to be confused with activeCallSubmissionTrancheIndex, which is the tranche for which current call requests should be submitt...
function trancheIndexAtTimestamp( CallableCreditLine storage cl, uint256 timestamp ) internal view returns (uint256) { return cl._paymentSchedule.principalPeriodAt(timestamp); }
9,813,930
// // ██████╗ ██╗ ██╗ ██████╗██████╗ ██╗ ██╗███████╗████████╗ █████╗ ██╗ ███████╗ // ██╔═████╗╚██╗██╔╝██╔════╝██╔══██╗╚██╗ ██╔╝██╔════╝╚══██╔══╝██╔══██╗██║ ██╔════╝ // ██║██╔██║ ╚███╔╝ ██║ ██████╔╝ ╚████╔╝ ███████╗ ██║ ███████║██║ ███████╗ // ████╔╝██║ ██╔██╗ ██║ ██╔══██╗ ╚██╔╝ ╚════██...
Creates `amount` tokens of token type `id`, and assigns them to `account`. Emits a {TransferSingle} event. Requirements: - `account` cannot be the zero address. - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value./
function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArr...
6,332,084
./partial_match/1/0x640Df33c6472E543E116eb68d4922D982322e88B/sources/src/libs/Univ2Lib.sol
given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn( uint amountOut, uint reserveIn, uint reserveOut ) internal pure returns (uint amountIn) { require(amountOut > 0, "UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT"); require( reserveIn > 0 && reserveOut > 0, "UniswapV2Library: INS...
2,621,056
./full_match/1/0xBEbB92Ed09688e64DC38c240B600D0B1d504EE56/sources/lib/aera-contracts/contracts/v1/AeraVaultV1.sol
Deposit token to the pool. Will only be called by deposit(). token Address of the token to deposit. amount Amount to deposit. return Actual deposited amount excluding fee on transfer. slither-disable-next-line timestamp slither-disable-next-line calls-loop slither-disable-next-line calls-loop slither-disable-next-li...
function depositToken(IERC20 token, uint256 amount) internal returns (uint256) { uint256 balance = token.balanceOf(address(this)); token.safeTransferFrom(owner(), address(this), amount); balance = token.balanceOf(address(this)) - balance; uint256 allowance = toke...
3,080,278
pragma solidity ^0.5.0; import "./ByteSizeStorage.sol"; import "./SafeMath.sol"; contract ByteSize { using SafeMath for uint256; // Global Variable Storage ByteSizeStorage public byteStorage; // Event Triggers event LoanRequested(uint256 loanID); event LoanStarted(uint256 loanID); event ...
gives the borrower the ability to pay back towards a certain loan loanID ID of the requested loan return <uint> the total of how much has been paid back so far/
function payLoan(uint loanID) public payable returns(uint) { require(msg.sender == byteStorage.getAddress(loanID, keccak256(abi.encodePacked("borrower"))), "Invalid request - you are not the borrower of this loan"); require(msg.value > 0, "Invalid request - you must include an amount of wei in your ...
2,515,165
pragma solidity ^0.4.2; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Connections.sol"; /// @title A solidity test contract for testing out the Connections contract functionality - non-connections features /// @author Rick Behl contract TestConnectionsOne { // Handle fo...
Test that an entity owner can actually edit their entity active flag Check state after edit has been correctly updated/
function testEditVirtualEntityActive() public { address newVirtualEntityAddress = newConnections.createVirtualEntity(); newConnections.editEntity(newVirtualEntityAddress, false, ""); bool active; (active,) = newConnections.getEntity(newVirtualEntityAddress); Assert.equal(active, false, "The statu...
1,057,155
// SPDX-License-Identifier: MIT pragma solidity =0.8.0; import './interfaces/IBEP20.sol'; import './interfaces/IProject.sol'; import './libraries/SafeMath.sol'; contract Project is IProject { using SafeMath for uint256; struct Proposal { string _proposal_meta; uint256 ...
copmute total voting power
function is_proposal_rejected(uint index) private view returns(bool) { Proposal storage proposal = _proposals[index]; uint256 total_voting_power = get_tot_vote_power(); uint256 tot_rejected_vote_power = get_vote_power(proposal._proposal_rejections); uint256 tot_approved_vote_powe...
5,366,540
./full_match/1/0x62BF548B95e48ff169C1bAcC59B9BC99B014e273/sources/@routerprotocol/router-crosstalk/contracts/RouterCrossTalkUpgradeable.sol
_hash This is internal function to generate the hash of all data sent or received by the contract. _destChainId Destination ChainID. _nonce Nonce for the tx.
function _hash(uint8 _destChainId, uint64 _nonce) internal pure returns (bytes32) { return keccak256(abi.encode(_destChainId, _nonce)); }
2,932,416
/** *Submitted for verification at Etherscan.io on 2022-02-03 */ // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; // Sources flattened with hardhat v2.8.3 https://hardhat.org // File contracts/Math/Math.sol /** * @dev Standard math utilities missing in the Solidity language. */ library Math...
Add additional LPs to an existing locked stake Get the stake and its index Calculate the new amount Checks Pull the tokens from the sender Update the stake Update liquidities
function lockAdditional(bytes32 kek_id, uint256 addl_liq) updateRewardAndBalance(msg.sender, true) public { (LockedStake memory thisStake, uint256 theArrayIndex) = _getStake(msg.sender, kek_id); uint256 new_amt = thisStake.liquidity + addl_liq; require(addl_liq >= 0, "Must be nonzero"); ...
2,374,634
pragma solidity ^0.4.21; /** * @title Safe maths library for big numbers. */ library SafeMath { /** * @notice Sums two numbers. * @param a Number to add to. * @param b Number to add. * @return Returns the sum of two numbers. */ function add(uint a, uint b) internal pure returns (u...
Returns address of the oracle. _index Index of the oracle. return Oracle's address./
function oracleGet(uint _index) public view returns (address) { return oracles[_index]; }
14,105,583
/** * OpenZepplin contracts contained within are licensed under an MIT License. * * The MIT License (MIT) * * Copyright (c) 2016-2021 zOS Global Limited * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), ...
Start or pause the minting functionality in the contract.
function changeSaleState() external onlyOwner { forSale = !forSale; totalHandsDealt++; upgradeCount[tokenID] += 1; lookupTokenHistory[tokenID].push(tokenHistory(chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tok...
14,111,461
./partial_match/1/0xb50A365b58D451D6F560E97D54bE2D05E2eD050C/sources/Matcheth.sol
require(idoToBuy2[msg.sender]==0,"already join");
function ido2()payable external{ require(idoSwitch2, "not open"); require(!isContract(msg.sender),"not Alow"); uint256 amountTobuy = msg.value; require(amountTobuy >= minBuy, "You need to send some Ether"); idoToBuy2[msg.sender]+=amountTobuy; idoBuyTotal2+=amountTobuy...
4,190,539
./full_match/1/0x326e1E50e35f00825c26Dff3815cd58C661Ef532/sources/dollarprotocolV2-live_relaunch.sol
[amounts_usdc_gaia[0], min_amount_usdc_out]if we get here, then we know there is still arbitrage -> GO!
function MoneyPrinterGoesBRRRRR(uint256 amount_usdf_to_mint, address[] calldata path_usdc_gaia, address[] calldata path_usdf_usdc, uint256 deadline, uint256 fee) payable onlyOwner external { (uint256 usdc_required_to_mint, uint256 gaia_required_to_mint) = USDF_FUNCTIONS.consultSynthRatio(amount_usdf_to...
9,609,544
/* Copyright (C) 2021 Soteria.fund This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed...
Checks if msg.sender is allowed to create a proposal under given category/
function allowedToCreateProposal(uint category) public view returns(bool check) { if (category == 0) return true; uint[] memory mrAllowed; (, , , , mrAllowed, , ) = proposalCategory.category(category); for (uint i = 0; i < mrAllowed.length; i++) { if (mrAllowe...
1,006,819
./full_match/1/0x90574634C09a4A4E6e2B7Ce2BbecE1A609751048/sources/browser/CompoundMonitor.sol
Bots call this method to repay for user when conditions are met If the contract ownes gas token it will try and use it for gas price reduction _data Amount and exchange data [amount, minPrice, exchangeType, gasCost, 0xPrice] _addrData cTokens addreses and exchange [cCollAddress, cBorrowAddress, exchangeAddress] _ca...
function repayFor( bytes memory _callData, address _user ) public payable onlyApproved burnGas(REPAY_GAS_TOKEN) { (bool isAllowed, uint ratioBefore) = canCall(Method.Repay, _user); _data[3] = calcGasCost(REPAY_GAS_COST); _user, compoundFlashLoanTakerAdd...
2,963,051
/* * Origin Protocol * https://originprotocol.com * * Released under the MIT license * https://github.com/OriginProtocol/origin-dollar * * Copyright 2020 Origin Protocol, Inc * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files ...
Remove all assets from platform and send them to Vault contract./ Redeem entire balance of cToken Transfer entire balance to Vault
function withdrawAll() external override onlyVaultOrGovernor nonReentrant { for (uint256 i = 0; i < assetsMapped.length; i++) { ICERC20 cToken = _getCTokenFor(assetsMapped[i]); if (cToken.balanceOf(address(this)) > 0) { require( cToken.redeem(cToke...
1,278,393
// Copyright (C) 2021 Exponent // This file is part of Exponent. // Exponent is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // E...
scale vector x by a factor x int256 array input scaleFactor int256 scale factor return x scaled by scaleFactor
function vectorScale(int256[] memory x, int256 scaleFactor) internal pure returns (int256[] memory out_array) { out_array = new int256[](x.length); for (uint256 i = 0; i < x.length; i++) { out_array[i] = (x[i] * scaleFactor) / ONE; } }
11,852,105
// SPDX-License-Identifier: UNLICENSED pragma solidity =0.7.6; pragma experimental ABIEncoderV2; import "../openzeppelin/access/AccessControl.sol"; import "../openzeppelin/utils/math/SafeMath.sol"; import "../openzeppelin/token/ERC20/SafeERC20.sol"; import "../openzeppelin/token/ERC20/IERC20.sol"; import "../sablierh...
Multiply an Exp by a scalar, returning a new Exp./
function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) { (MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar); if (err0 != MathError.NO_ERROR) { } }
12,569,865
pragma solidity 0.5.17; /* import "./iElasticTokenInterface.sol"; */ import "./iTokenGovernance.sol"; import "../lib/SafeERC20.sol"; contract iElasticToken is iTokenGovernanceToken { // Modifiers modifier onlyGov() { require(msg.sender == gov); _; } modifier onlyRebaser() { re...
Computes the current max scaling factor/
function maxScalingFactor() external view returns (uint256) { return _maxScalingFactor(); }
6,403,346
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; /** * @title The house of reserves contract. * @author daigaro.eth * @notice Custodies all deposits, to allow minting of the backedAsset. * @notice Users can only deposit and withdraw from this contract. * @dev Contracts are split into state and fun...
Function to set the limit of deposits in this HouseOfReserve. newLimit uint256, must be greater than zero. Emits a {DepositLimitChanged} event./
function setDepositLimit(uint256 newLimit) external onlyRole(DEFAULT_ADMIN_ROLE) { require( newLimit > 0, "Invalid inputs!"); depositLimit = newLimit; emit DepositLimitChanged(newLimit); }
1,000,828
./full_match/1/0xf0faDA1027A3F725a314587F69E73a23Db542452/sources/contracts/ethereum/core/CrowdFundHYPCPool.sol
Returns a specific deposit for a user user: the user's address depositIndex: the user's deposit index to be returned. return The UserDeposit object at the index for this user
function getDeposit(address user, uint256 depositIndex) external view returns(UserDeposit memory) { return userDeposits[user][depositIndex]; }
16,496,571
./full_match/5/0x089b50b34F074F2aFeA398CFc7066e4Ed0E6415d/sources/contracts/thirdweb/ERC721DropRefer.sol
Update contract state. If there's a price, collect price. Mint the relevant NFTs to claimer.
function _claim( address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, address _referrer, uint256 _referRewardBps, AllowlistProof calldata _allowlistProof, bytes memory _data ) internal { require(_referrer != msg....
1,869,842
./full_match/5/0xDF61aFc865E6CbF6177039D81A5A97f500B3b28E/sources/contracts/AllianceBlockToken.sol
Get the current snapshotId/
function getCurrentSnapshotId() public view returns (uint256) { return _getCurrentSnapshotId(); }
11,611,843
//Address: 0xc00daa94bb04d9c8bb55c115135e5b60584b884d //Contract name: Crowdsale //Balance: 4,596.848976447495759932 Ether //Verification Date: 5/28/2018 //Transacion Count: 1096 // CODE STARTS HERE pragma solidity ^0.4.16; library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint ...
Allow to set TTC address/
function setTTCAddress(address _addr) onlyOwner public { require(_addr != address(0)); coin = TTC(_addr); }
5,459,374
pragma solidity ^0.4.24; /** * @title SpinWinInterface */ interface SpinWinInterface { function refundPendingBets() external returns (bool); } /** * @title AdvertisingInterface */ interface AdvertisingInterface { function incrementBetCounter() external returns (bool); } contract SpinWinLibr...
Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code...
function _transfer(address _from, address _to, uint _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfe...
6,478,510
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; //import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./BaseERC1155.sol"; import "./TendiesCard.sol"; /** * @title TendiesBox * TendiesBox - a contract for semi-fungible tokens */ contract TendiesBox is BaseERC1155 { using SafeMath for uint...
Add the pack config
function create( uint16 _maxQuantityPerOpen, uint16[] memory _classIds, uint16[] memory _classProbabilities, uint16[] memory _guaranteedClassIds ) external { require(hasRole(CREATOR_ROLE, _msgSender()), "Not a creator"); require(_maxQuantityPerOpen > 0, "Packs must produce at least one...
5,521,027
./full_match/1/0x32e7CfAd2ff05C415f599c66ED860B9b481E4Bc8/sources/src/karmaHeadNFT.sol
Avilable buffered USDC to be claimed by `account`
function claimableUsdcByAddress(address account) public view returns (uint256) { return bufferByAddress[account][usdcAddress]; }
3,111,937
pragma solidity ^0.4.17; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original...
fallback function can be used to buy tokens
function () public payable { buyTokens(msg.sender, msg.value); }
640,110