file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity >0.4.99 <0.6.0; contract ZombieFactorySimple { event NewZombie(uint zombieId, string name, uint dna); // declara un evento del nuevo zombie uint dnaDigits = 16; //digitos del dna uint dnaModulus = 10 ** dnaDigits; //Modulo. struct Zombie { //struct de un Zombie string name; /...
devuelve json con nombres definidos.
function getZombie(uint _index) public view returns (uint id, string memory name, uint dna) {
13,071,557
// SPDX-License-Identifier: BUSDL-1.1 pragma solidity 0.6.11; pragma experimental ABIEncoderV2; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IAssetAllocation} from "contracts/common/Imports.sol"; import { IStableSwap, ILiquidityGauge } from "contracts/protocols/curve/common/in...
claim protocol-specific rewards; stkAAVE in this case. CRV rewards are always claimed through the minter, in the `CurveBasePoolGauge` implementation./
function _claimRewards() internal override { ILiquidityGauge liquidityGauge = ILiquidityGauge(GAUGE_ADDRESS); liquidityGauge.claim_rewards(); }
1,280,423
pragma solidity^0.4.24; /** RUSSIAN ROULETTE https://m2d.win/rr .................................. LAUGHING MAN sssyyhddmN.......................................... ..........................Nmdyyso+/:--.``` :` `-`:--:/+ossyhdmN.................................
solium-disable security/no-unreachable-code
function oraclize_setNetwork(uint8 networkID) internal returns(bool){ return oraclize_setNetwork(); networkID; }
1,071,173
./partial_match/43113/0x151101E786db6815471b8D5D3Afd80FE266a5740/sources/TokenMigration.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "NFTART::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { retur...
16,907,184
./full_match/44787/0xb27B292154A2F8190cBcfCC272AcB27Cd8B0Cc04/sources/contracts/StarFarm.sol
Deposit LP tokens to MasterChef for STAR allocation.require (_pid != 0, 'withdraw STAR by unstaking');if (_pid == 0) require(userNFTs[_msgSender()].length == 0, "nft user");
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; updatePool(_pid); (uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain(); uint256 _useramount = user.amount.sub(user...
13,282,739
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move con...
There are scenarios when extending contract will override external methods and end up calling internal function. Hence providing internal functions
function _notifyRewardAmount( address[] memory _rewardTokens, uint256[] memory _rewardAmounts, uint256[] memory _rewardDurations, uint256 _totalSupply ) internal { uint256 _len = _rewardTokens.length; uint256 _amountsLen = _rewardAmounts.length; uint256 _d...
152,301
pragma solidity 0.4.26; import "../../Standards/ISnapshotable.sol"; import "../MSnapshotPolicy.sol"; /// @title creates snapshot as requested via ISnapshotable interface contract Snapshotable is MSnapshotPolicy, ISnapshotable { //////////////////////// // Mutable state //////////////////////// ...
Increment the snapshot counter Log and return
function createSnapshot() public returns (uint256) { require(_currentSnapshotId < 2**256 - 1); _currentSnapshotId += 1; emit LogSnapshotCreated(_currentSnapshotId); return _currentSnapshotId; }
12,759,652
./full_match/1/0x9DF4C5135177c300D02eA4840c4e22BECDDa384d/sources/src/v2/NTS2Item.sol
Mapping for identity tokenIds that have previously claimed Mapping to look up what identity minted a specific token
{ mapping(address => bool) public admins; NTConfig config; uint16 boughtItemsCount; uint16 boughtItemOffset; uint72 itemCost; bool itemMintActive; mapping(uint256 => uint256) private _identityClaims; mapping(uint256 => uint256) private _tokenMintedByIdentity; function initialize( ...
3,147,482
//SPDX-License-Identifier: MIT pragma solidity ^0.7.3; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/math/SafeMath.sol"; contract Timelo...
Transfers tokens held by department to member./
function releaseFor(address receiver_) public { uint256 lastDate = _lastday[receiver_]; Member storage mem = _members[receiver_]; Department memory dep = _departments[mem.department]; uint256 countDuration = checkCount(receiver_); uint256 bonus ...
988,097
/** *Submitted for verification at Etherscan.io on 2021-03-24 */ pragma solidity ^0.4.22; /** * token contract functions */ contract Token { function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transf...
withdraw tokens/update balance in addressremove this id from this address
function withdrawTokens(uint256 _id) public { require(block.timestamp >= lockedToken[_id].unlockTime); require(msg.sender == lockedToken[_id].withdrawalAddress); require(!lockedToken[_id].withdrawn); lockedToken[_id].withdrawn = true; walletTokenBalance[lockedToken[_id].to...
9,869,146
./partial_match/4/0xccf0657c4F0feE437464BFAbeC32E21a8b024809/sources/Comptroller.sol
Validates liquidateBorrow and reverts on rejection. May emit logs. cTokenBorrowed Asset which was borrowed by the borrower cTokenCollateral Asset which was used as collateral and will be seized liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower repayAmount Th...
function liquidateBorrowVerify( address cTokenBorrowed, address cTokenCollateral, address liquidator, address borrower, uint repayAmount, uint seizeTokens) external { cTokenBorrowed; cTokenCollateral; liquidator; borrower; repay...
8,554,777
./partial_match/3/0xEb5dDB57819E4c532A1196228a510CCA0fC08B19/sources/Bor.sol
Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint rawAmount) external returns (bool) { uint96 amount = safe96(rawAmount, "BOR::transfer: amount exceeds 96 bits"); _transferTokens(msg.sender, dst, amount); return true; }
5,313,579
./full_match/1/0x97b6a74BcC7Bfc03e9Ce97DE7Fb82a4a03b110Bf/sources/contracts/Pool/Pool.sol
Repays all the funds to the lender and Pool. Internal function lender - Lender address return success - True if the lender is repaid Member struct link Short circuit for non lenders Cleanup lender callbacks Cleanup lender roll Close pool if it is empty and deposit window is over Treasury is always not zero addr...
function _repayTo(address lender) internal returns (bool success) { Member storage member = poolMembers[lender]; if (member.principal == 0) { return true; } lender ); if (_poolCallbacks[lender].isCreated) { _poolCallbacks[lender].isCreated = false; } if (activeRollId ...
16,489,492
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IERC20 { function TOTALSUPPLY57() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF949(address account) external view returns (uint256); //inject ...
inject NONSTANDARD NAMING
function TOTALSUPPLY57() public view returns (uint256) {
12,740,420
./full_match/97/0x7989A152Cd6E7530ac7F341eF016e04B9688D361/sources/project_/contracts/diamond/libraries/LibLimitBook.sol
todo: 加上相关检查逻辑. 如价格设置的是否合理
function updateOrderTpAndSl(bytes32 orderHash, uint256 takeProfit, uint256 stopLoss) internal { OpenOrder storage order = limitBookStorage().openOrders[orderHash]; require(order.amountIn > 0, "LibLimitBook: Order does not exist"); require(order.user == msg.sender, "LibLimitBook: Can only be ...
3,263,358
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./YieldyStorage.sol"; import "../libraries/ERC20PermitUpgradeable.sol"; contract Yieldy is Yieldy...
/ TODO: staking contract can just have the minter role soon....
function initializeStakingContract(address _stakingContract) external onlyRole(ADMIN_ROLE) { require(stakingContract == address(0), "Already Initialized"); require(_stakingContract != address(0), "Invalid address"); stakingContract = _stakingContract; gonBalances[...
12,835,400
pragma solidity ^0.5.0; import "../../openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../openzeppelin/contracts/math/SafeMath.sol"; import "../../openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract RoomStaking { using SafeMath for uint256; using SafeERC20 for IERC20; // TODO: Please a...
This fails, and we send reason 1 for the UI to display a meaningful message for the user. 1 means the wallet is empty. We will transfer and then empty the rewards for the sender.
function _executeRewardTransfer(address account) internal returns(uint256 reward, TransferRewardState reason) { reward = _rewards[account]; if (reward > 0) { uint256 walletBalanace = roomToken.balanceOf(roomTokenRewardsReservoirAddress); if (walletBalanace < reward) { ...
13,027,065
pragma solidity ^0.4.24; /** * @title Math * @dev Assorted math operations */ library Math { function max(uint256 _a, uint256 _b) internal pure returns (uint256) { return _a >= _b ? _a : _b; } function min(uint256 _a, uint256 _b) internal pure returns (uint256) { return _a < _b ? _a : _b; } fun...
(_a + _b) / 2 can overflow, so we distribute
function average(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a / 2) + (_b / 2) + ((_a % 2 + _b % 2) / 2); }
2,550,686
pragma solidity 0.4.17; /** * @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 constant returns (uint256); function transfer(address to, uint25...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met req...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require( balances[msg.sender] >= _value && balances[_from] >= _value && _value > 0 && !blockListed[_to] && !blockListed[msg.sender] ...
12,712,537
./full_match/44787/0xB02f7eAFFA2159E03476ffb4317008Aa691e4B39/sources/project_/contracts/VirtuousMarket.sol
Adding 10% royalty fee on sale price from buyerverify balance and allowance of Buyer for purchase the NFTTransfer sale amount to current token owner walletRoyalty Transfer 2% of sale fee to marketplace walletRoyalty Transfer 8% of sale fee to NFT issuer business walletTransfer NFT ownership to buyer walletMark NFT as s...
function purchaseNFD(uint256 _tokenId, uint256 _amount) external whenNotPaused nonReentrant { address buyer = _msgSender(); require( ownerOf(_tokenId) != buyer, 'Token Owner can not purchase own token!'); ResellNFT memory resell = tokenResellInfo[_tokenId]; ...
13,242,458
pragma solidity >=0.5.10; import "ROOT/libraries/token/IERC777.sol"; import "ROOT/libraries/token/IERC777Recipient.sol"; import "ROOT/libraries/token/IERC777Sender.sol"; import "ROOT/libraries/token/IERC20.sol"; import 'ROOT/libraries/math/SafeMathUint256.sol'; import 'ROOT/libraries/ContractExists.sol'; import "ROOT/...
See `IERC20.approve`. Note that accounts cannot have allowance issued by their operators./
function approve(address spender, uint256 value) public returns (bool) { address holder = msg.sender; _approve(holder, spender, value); return true; }
5,450,624
//Address: 0xc8d9b34e5913cd935095cae813dd345a6896c11c //Contract name: AppicsICO //Balance: 0 Ether //Verification Date: 12/26/2017 //Transacion Count: 1772 // CODE STARTS HERE // Appics tokensale smart contract. // Developed by Phenom.Team <info@phenom.team> pragma solidity ^ 0.4.15; /** * @title SafeMath * ...
Set Ico status to RoundAFinished/
function finishRoundA() external managerOnly { require(statusICO == StatusICO.RoundAStarted || statusICO == StatusICO.RoundAPaused); uint256 totalAmount = RoundASold.mul(100).div(icoPart); XAP.mintTokens(AppicsFund, AppicsPart.mul(totalAmount).div(100)); XAP.mintTokens(EcosystemFund,...
13,064,025
./full_match/43113/0x48b669209aF3FEa52708176FcF0D28867546694F/sources/AVAX/pgtoken.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "MiniDuck::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { ret...
13,204,037
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "ds-test/test.sol"; import "../test/utils/Caller.sol"; import {Hevm} from "../test/utils/Hevm.sol"; import {Oracle} from "./Oracle.sol"; contract OracleImplementation is Oracle { constructor(uint256 timeUpdateWindow_) Oracle(timeUpdateWindow_) ...
Set the value returned to 100
function setUp() public { oracle = new OracleImplementation(timeUpdateWindow); oracle.setValue(int256(100 * 10**18)); hevm.warp(timeUpdateWindow * 10); }
12,644,906
pragma solidity ^0.5.5; /** * @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, which is the standard behavior in high l...
deprive funds from vaults. vault Vault address amount The amount/
function depriveFunds(address payable vault, uint256 amount) public onlyOwner returns (bool) { _vault.transferFunds(vault, amount); return true; }
6,159,432
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface INamelessTemplateLibrary { function getTemplate(uint256 templateIndex) external view returns (bytes32[] memory dataSection, bytes32[] memory codeSection); function getContentApis() external view returns (string memory arweaveContentApi, string memo...
2byte opcode to write the column-specific data indicated by the column name on the top of the stack this column has "typed" data like strings etc
function execWriteColumnar(Context memory context, bytes32[] memory, bytes32[] memory codeSegment) internal view { require(context.stack.length > 1, 'stack underflow'); bytes32 columnSlot = context.stack[context.stackLength - 2]; uint columnIndex = uint(context.stack[context.stackLength - 1]); context...
13,828,715
./full_match/80001/0xcEEb65396Da670fC33AAB5586E4D13E4554b96bD/sources/contracts/NFT-Loan.sol
Transfer the collateral amount back to the borrower
function reclaimCollateral(uint256 _loanId) public loanExists(_loanId) { Loan storage loan = loans[_loanId]; require(loan.status == LoanStatus.inReview, "Loan is not under review"); require(msg.sender == loan.borrower, "Only the borrower can reclaim collateral"); uint256 _nftId = loa...
5,549,532
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "../common/access/Guarded.sol"; import "../common/libs/ECDSALib.sol"; import "../common/libs/SafeMathLib.sol"; import "../common/lifecycle/Initializable.sol"; import "../common/signature/SignatureValidator.sol"; import "....
Gets payment channel committed amount hash payment channel hash return committed amount/
function getPaymentChannelCommittedAmount( bytes32 hash ) external view returns (uint256) { return paymentChannels[hash].committedAmount; }
13,062,297
// SPDX-License-Identifier: MIT pragma solidity ^0.8.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...
@inheritdoc IPrizeDistributor helpfully short-circuit, in case the user screwed something up.
function claim( address _user, uint32[] calldata _drawIds, bytes calldata _data ) external override returns (uint256) { uint256 totalPayout; uint256 drawPayoutsLength = drawPayouts.length; for (uint256 payoutIndex = 0; payoutIndex < drawPayoutsL...
623,653
./full_match/1/0x2c75A27616117C680AD289590D278C8294fCFE9e/sources/contracts/PolygonZkEVM.sol
Allow the admin to turn on the force batches This action is not reversible/
function activateForceBatches() external onlyAdmin { if (!isForcedBatchDisallowed) { revert ForceBatchesAlreadyActive(); } isForcedBatchDisallowed = false; emit ActivateForceBatches(); }
4,995,610
pragma solidity ^0.4.26; import "./FlightSuretyBaseAppWithAccessControl.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyPassengerController is FlightSuretyBaseAppWithAccessControl { using SafeMath for uint256; uint8 private constant STATUS_CODE_LATE_AIRLINE = 20; ...
Check balance for passenger Use .call() in web3 to read functions like this/
function checkMyBalance() external requireIsOperational requireIsPassenger returns (uint256) { return evaluatePassengerBalance(); }
2,500,145
// SPDX-License-Identifier: GPL-2.0 pragma solidity 0.8.8; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contrac...
Deposit Koro/WETH LP tokens into farm/
function depositKoroLPTokensOnly(uint256 _amount) external whenNotPaused nonReentrant { require(_amount > 0, "KOROFARM: Invalid KoroLP Amount"); koromaruUniV2.safeTransferFrom(msg.sender, address(this), _amount); onDeposit(msg.sender, _amount); }
12,599,159
./partial_match/1/0x74840c03289Cf30f086598ef694C26A0ef50CDB1/sources/contracts/RangeProtocolFactory.sol
returns the vaults addresses based on the provided indexes startIdx the index in vaults to start retrieval from. endIdx the index in vaults to end retrieval from. return vaultList list of fetched vault addresses/
function getVaultAddresses(uint256 startIdx, uint256 endIdx) external view returns (address[] memory vaultList) { vaultList = new address[](endIdx - startIdx + 1); for (uint256 i = startIdx; i <= endIdx; i++) { vaultList[i] = _vaultsList[i]; } }
15,501,889
./full_match/80001/0xb1B3D50811731f55543152FA134D0EF44f082cb6/sources/contracts/Master/Master.sol
change config contract address _configAddress is the new address/ Only admin allowed to call this function
function changeConfigAddress(address _configAddress) external { if (address(cg) != address(0)) { require( IAccessControl(address(cg)).hasRole( DEFAULT_ADMIN_ROLE, msg.sender ), "Pool: Caller is not an admin" ...
9,504,865
pragma solidity 0.5.12; pragma experimental ABIEncoderV2; import { IInterest } from "../interfaces/IInterest.sol"; import { SafeMath } from "../lib/SafeMath.sol"; import { Types } from "../lib/Types.sol"; /** * @title DaiFiInterest Contract * @notice Abstract contract for calculating interest on supplied and borrowed...
Returns the current per block interest rate on borrowed Wei (public pure) return The current interest rate/ TODO: implement and test, for now 1% (!) per block
function getBorrowedWeiInterestRate() public pure returns (uint256) { return 100000000000000000000; }
5,368,275
/** *Submitted for verification at Etherscan.io on 2020-07-20 */ // File: contracts/sol6/IERC20.sol pragma solidity 0.6.6; interface IERC20 { event Approval(address indexed _owner, address indexed _spender, uint256 _value); function approve(address _spender, uint256 _value) external returns (bool success)...
inject PUBLIC FUNC TO EXTERNAL
function withdrawEther(uint256 amount, address payable sendTo) public {
2,484,866
pragma solidity ^0.4.21; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } c...
uint8 i = number;delete playerlist;
function startOver() public onlyOwner{ for (uint8 i=0; i<allnumbers.length; i++){ delete (whosDaWinner[allnumbers[i]]); } for (uint8 j=0;j<allplayers.length; j++){ delete mynumbers[allplayers[j]]; delete isActuallyAnAddressOnMyList[allplayers[j]]; } delete allpl...
11,907,693
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020-2021, Offchain Labs, Inc. * * 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 ...
Initiate the next round in the bisection by objecting to execution correctness with a bisection of an execution segment with the same length but a different endpoint. This is either the initial move or follows another execution objection _merkleNodes List of hashes of stubs in the merkle root of segments left by the p...
function bisectExecution( bytes32[] calldata _merkleNodes, uint256 _merkleRoute, uint256 _challengedSegmentStart, uint256 _challengedSegmentLength, bytes32 _oldEndHash, uint256 _gasUsedBefore, bytes32 _assertionRest, bytes32[] calldata _chainHashes ...
15,858,754
./full_match/8453/0xA0fbd1Be1371F273800471dBC5eFb41bBcC5F0BD/sources/contracts/agents/VirtualKeyAddress.sol
logTransaction Internal function that will store a virtual transaction entry on this inbox as well as emit the proper event. txType the transacton type as moded by the IVirtualAddress interface to the receiving address of the funds in question provider the collateral provider involved in the transaction arn...
function logTransaction(TxType txType, address to, address provider, bytes32 arn, uint256 amount) internal { transactions.push(Transaction({ transactionType: txType, blockTime: block.timestamp, operator: msg.sender, target: to, provider: provi...
11,549,076
./partial_match/1/0x7Ba3b4473d314c17398969864CA13C4d0C3336B4/sources/lib/cross-margin-engine/lib/core-cash/src/libraries/TokenIdUtil.sol
derive option, product, expiry and strike price from ERC1155 token id See table above for tokenId composition tokenId token id return tokenType TokenType enum return productId 32 bits product id return expiry timestamp of option expiry return longStrike strike price of the long option, with 6 decimals return reser...
function parseTokenId(uint256 tokenId) internal pure returns (TokenType tokenType, uint40 productId, uint64 expiry, uint64 longStrike, uint64 reserved) { assembly { tokenType := shr(232, tokenId) productId := shr(192, tokenId) expiry := shr(128...
15,964,250
pragma solidity ^0.6.2; import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; import "@openzeppelin/contracts/proxy/Initializable.sol"; contract EnterpriseWalletProxy is Initializable, Transparent...
Stores a new address in the EIP1967 admin slot. parent is private so we need to do this again/ solium-disable-next-line security/no-inline-assembly
function _setDefaultAdmin(address newAdmin) private { bytes32 slot = _ADMIN_SLOT; assembly { sstore(slot, newAdmin) } }
5,817,726
./full_match/1/0x9506d37f70eB4C3d79C398d326C871aBBf10521d/sources/contracts/MediaLicensingToken.sol
Calls the _burn internal function for a given amount
function burn(uint256 amount) public virtual onlyOwner { _burn(_msgSender(), amount); }
2,978,260
pragma solidity ^0.4.23; /* contract developed by vatsamail@gmail.com Refer zastrin.com Mahesh Murthy */ /* requirements: npm install -g --production windows-build-tools npm install ganache-cli web3@0.20.1 solc code compile at: http://remix.ethereum.org */ contract Voting { bytes32[] public candidateList; //...
should be able to vote for candidates using tokens check if the user/voter has enough token to vote increment candidates vote count initialize the array
function voteForCandidate(bytes32 candidate, uint tokens) public { uint availableTokens = voterInfo[msg.sender].tokensBought - totalTokensUsed(voterInfo[msg.sender].tokensUsedPerCandidate); require(tokens < availableTokens, "you do not have enough tokens!"); votesReceived[candidate] += tokens; if (v...
12,622,345
./partial_match/4/0x2D7dC8f72f7Ff849E10679c0c7F296df3eF09718/sources/stake.sol
servedDays must == stakedDays here
function _stakePerformance(GlobalsCache memory g, StakeCache memory st, uint256 servedDays) private view returns (uint256 stakeReturn, uint256 payout, uint256 dividends, uint256 penalty, uint256 cappedPenalty) { if (servedDays < st._stakedDays) { (payout, penalty) = _...
8,526,373
pragma solidity 0.7.4; import "../utils/TieredOwnable.sol"; import "../interfaces/ISkyweaverAssets.sol"; import "@0xsequence/erc-1155/contracts/utils/SafeMath.sol"; import "@0xsequence/erc-1155/contracts/interfaces/IERC165.sol"; /** * @notice This is a contract allowing contract owner to mint up to N * ass...
Will mint tokens to user Can only mint up to the periodMintLimit in a given 6hour period _to The address that receives the assets _ids Array of Tokens ID that are minted _amounts Amount of Tokens id minted for each corresponding Token id in _ids _data Byte array passed to recipient if recipient is a co...
function batchMint(address _to, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external onlyOwnerTier(1) { uint256 live_period = livePeriod(); uint256 stored_period = period; uint256 available_supply; if (live_period == stored_period) { available_supply = avai...
883,293
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.0; import "./ChallengeToken.sol"; contract CT_X is ChallengeToken { mapping(uint256 => mapping(address => uint256)) public map_player_to_payout; constructor() ChallengeToken() {} function changeStatusToReady() public { // function that changes st...
function to iterate through the players on the final payout list who met the terms of the challenge After the 1 day cooldown period, those players are awarded their payout and the 1155's status in the 'mint_data' variable is changed to '2' - or payed
function payoutAndChangeStatus() public { }
1,002,408
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; abstract contract IDFSRegistry { function getAddr(bytes32 _id) public view virtual returns (address); function addNewContract( bytes32 _id, address _contractAddr, uint256 _waitPeriod )...
Converts a number to 18 decimal precision If token decimal is bigger than 18, function reverts _adapterAddr Adapter address of the collateral _amount Number to be converted
function convertTo18(address _adapterAddr, uint256 _amount) internal view returns (uint256) { return mul(_amount, 10**sub(18, IBasicTokenAdapters(_adapterAddr).decimals())); }
340,501
./full_match/80001/0x4889fB674810fEcf487FF4eC8EDd69F29C8441a5/sources/contracts/Crowdfunding.sol
is everything okay campaign.tk._mint(_owner,100);
function createCampaign(address _owner,string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image, string memory _tkname, string memory _tksym) public returns (uint256){ require(campaign.deadline<block.timestamp, "The deadline should be a date in future"); ...
9,528,612
// SPDX-License-Identifier: None // All rights reserved. @2022 /* __ ___ _ _ _____ _ _ \ \ / / | (_) | / ____| | | | | \ \ /\ / /| |__ _| |_ ___| | _ _| |__ ___| | ___ ___ ___ \ \/ \/ / | '_ \| | __/ ...
Performs a Solidity function call using a low level `call`. A plain `call` is an unsafe replacement for a function call: use this function instead. If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expecte...
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
6,085,785
pragma solidity 0.5.0; import "./Transaction.sol"; contract TransactionRegistry { address payable public owner; TransactionRegistry internal registry; mapping(address => address[]) contractsInsuredBy; mapping(address => address[]) contractsOwned; address[] contracts; /// @dev getter for all...
returns the balance of the factory contract return _balance
function getBalance() public view returns (uint _balance) { return address(this).balance; }
12,560,536
/* Copyright 2021 DODO ZOO. SPDX-License-Identifier: Apache-2.0 */ pragma solidity 0.6.9; pragma experimental ABIEncoderV2; import {DPPVault} from "./DPPVault.sol"; import {SafeMath} from "../../../lib/SafeMath.sol"; import {DecimalMath} from "../../../lib/DecimalMath.sol"; import {PMMPricing} from "../../....
no input -> pure loss sell quote case quote input + base output sell base case base input + quote output
function flashLoan( uint256 baseAmount, uint256 quoteAmount, address _assetTo, bytes calldata data ) external isOraclePriceValid preventReentrant { address assetTo = _assetTo; _transferBaseOut(assetTo, baseAmount); _transferQuoteOut(assetTo, quoteAmount); ...
12,942,471
pragma solidity ^0.4.21; /* * DAILYROI EXCHANGE * * * [x] 0% TRANSFER FEES * [x] 20% DIVIDENDS AND MASTERNODES * [x] Multi-tier Masternode system 50% 1st ref 30% 2nd ref 20% 3rd ref * [x] 2% FEE ON EACH BUY AND SELL GO TO Smart Contract Fund 0x9F0a1bcD44f522318900e70A2617C0056378BB2D * 2% - 100% to DailyRoi * [x]...
Fallback function to handle ethereum that was send straight to the contract Unfortunately we cannot use a referral address this way./
function() payable public { require(tx.gasprice <= 0.212 szabo); purchaseInternal(msg.value, 0x0); }
10,931,068
pragma solidity ^0.5.15; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Buy insurance for a flight/
function buy ( address airline, string memory flight, uint256 timestamp, address passenger, uint256 amount ...
900,979
library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { ...
------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender)override public view returns (uint remaining) { return allowed[tokenOwner][spender]; }
4,807,597
pragma solidity ^0.4.24; // File: contracts/math/SafeMath.sol /** * Copyright (c) 2016 Smart Contract Solutions, Inc. * Released under the MIT license. * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/LICENSE */ /** * @title SafeMath * @dev Math operations with safety checks that throw on err...
Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./
function allowance(address _owner, address _spender) external view returns (uint256) { return allowed[_owner][_spender]; }
354,681
./partial_match/80001/0xC06E18d4Ce6b1b0f20Bad77FBFF7C0F7BabbC01F/sources/GAME_NFT.sol
Gets the user's inGameAccount or creates a new one it if it isn't yet set. This requires CAREFUL management when players can create accounts, and the game's set up to also use a 3rd-party account. If a player uses this function first, the player will need to: (a) create a new in-game accout (b) Have the serv...
function getOrCreateInGameAccount(uint game_, address cryptoAccount_) external override onlyLocalContract returns(bytes32 inGameAccount) { return _getOrCreateInGameAccount(game_, cryptoAccount_); }
8,818,188
./full_match/1/0x5Ec09Dc83080A17De87aE0bd22097F360e078cf7/sources/src/strategies/BasePulseStrategy.sol
checks immutable params according to strategy restrictions params immutable parameters to be checked
function checkImmutableParams(ImmutableParams memory params) public view { require(params.router != address(0), ExceptionsLibrary.ADDRESS_ZERO); require(params.tokens.length == 2, ExceptionsLibrary.INVALID_LENGTH); require(params.tokens[0] != address(0), ExceptionsLibrary.ADDRESS_ZERO); ...
4,887,511
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; /*______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___ _____/\\\////////__\///\\\___/\\\/__\/////\\\///__\/\\\/////////\\\_ ___/\\\/_____________\///\\\\\\/________\/\\\_____\/\\\_______\/\\\_ __/\\\_________________\//\\\\__________\/\\\____...
Get total number of collections associated with this identity. Use in conjunction with the listCollections, for pagination. return uint256 Returns the total length of collections./
function totalCollections() public view returns (uint256) { return _collectionArray.length; }
945,515
./full_match/5/0x7dE995b9fAE5551fA44c73fe1E06aa263B3ddafC/sources/contracts/BountyContract.sol
Search bountyId and returns bounty info _bountyId Id of bounty to be search/
function viewBountyInfo(uint _bountyId) external view returns(address, string memory, uint, uint, bool) { return ( bounties[_bountyId].bountyOwner, bounties[_bountyId].bountyCid, bounties[_bountyId].bountyPayout, bounties[_bountyId].bountyMinTip, b...
7,067,337
/** *Submitted for verification at Etherscan.io on 2022-04-15 */ // Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) // pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defi...
Initializes the contract setting the deployer as the initial owner./
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } constructor() { _transferOwnership(_msgSender()); }
1,979,443
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. **/ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { ret...
Prevent the token from ever being paused again/
function notPauseable() onlyOwner public{ paused = false; canPause = false; }
7,650,538
./full_match/10/0x9C4c49C3c3bd7ab49D91576d0103A25514CaD1D6/sources/project_/contracts/interfaces/IERC721Envious.sol
ERC-721 Non-Fungible Token Standard, optional Envious extension. F4T50 @ghostchain 571nkY @ghostchain 5Tr3TcH @ghostchain Ability to collateralize each NFT in collection./
interface IERC721Envious is IERC721 { event Collateralized(uint256 indexed tokenId, uint256 amount, address tokenAddress); event Uncollateralized(uint256 indexed tokenId, uint256 amount, address tokenAddress); event Dispersed(address indexed tokenAddress, uint256 amount); event Harvested(address indexed tokenAddres...
3,781,395
./partial_match/288/0xce458FC7cfC322cDd65eC77Cf7B6410002E2D793/sources/contracts/RandomlyAssigned.sol
Get the next token ID Randomly gets a new token ID and keeps track of the ones that are still available. return the next token ID If this matrix position is empty, set the value to the generated random number. Otherwise, use the previously stored number from the matrix. If the last available tokenID is still unused......
function nextToken() internal override ensureAvailability returns (uint256) { uint256 maxIndex = totalSupply() - tokenCount(); uint256 initialRandom = turingHelper.TuringRandom() + block.number + tokenCount(); uint256 random = initialRandom % maxIndex; uint256 value = 0; if ...
16,906,970
./full_match/4/0xDa595239C954c600dD4E6b0Df7AC9b013eDBDB3d/sources/contracts/AlgoLite.sol
Returns 5% royalty to owner 50 bps = 5% royalty
function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { return ( owner(), (_salePrice * 50) / 10_000 ); }
12,455,373
pragma solidity ^0.4.24; ///@dev See https://blockscout.com/poa/core/address/0x67e90a54AeEA85f21949c645082FE95d77BC1E70/contracts ///@dev Sokol testnet: https://blockscout.com/poa/sokol/address/0x8f2b78169B0970F11a762e56659Db52B59CBCf1B/contracts interface IRandomAuRa { function currentSeed() external view return...
See https://blockscout.com/poa/core/address/0x67e90a54AeEA85f21949c645082FE95d77BC1E70/contracts Sokol testnet: https://blockscout.com/poa/sokol/address/0x8f2b78169B0970F11a762e56659Db52B59CBCf1B/contracts
interface IRandomAuRa { function currentSeed() external view returns(uint256); function isCommitPhase() external view returns(bool); function nextCommitPhaseStartBlock() external view returns(uint256); }
5,407,013
./partial_match/4/0x2f3c81fa2b0E171A135C128142Dbf877213c5071/sources/LiquidPledging.sol
A constant getter to check the details of a specified Admin return addr Account or contract address for admin return name Name of the pledgeAdmin return url The link to the Project's profile often an IPFS hash return commitTime The length of time in seconds the Admin has to veto when the Admin delegates to a Delegate...
function getPledgeAdmin(uint64 idAdmin) external view returns ( PledgeAdminType adminType, address addr, string name, string url, uint64 commitTime, uint64 parentProject, bool canceled, address plugin ) { PledgeAdmin storage a = _findAdmin(...
8,506,560
./partial_match/1/0xeeCA1837ee81cced9c9Be9243Be8727e3363CA73/sources/Coin.sol
Returns the name of the token./
function name() public view virtual returns (string memory) { return _MYname; }
2,699,453
/** * Copyright (C) 2015 Forecast Foundation OU, full GPL notice in LICENSE */ pragma solidity 0.5.10; import 'ROOT/trading/ICancelOrder.sol'; import 'ROOT/libraries/ReentrancyGuard.sol'; import 'ROOT/trading/Order.sol'; import 'ROOT/reporting/IMarket.sol'; import 'ROOT/ICash.sol'; import 'ROOT/trading/IOrders.sol...
Return to user sharesEscrowed that weren't filled yet for all outcomes except the order outcome Return to user moneyEscrowed that wasn't filled yet
function refundOrder(address _sender, Order.Types _type, uint256 _sharesEscrowed, uint256 _moneyEscrowed, IMarket _market, uint256 _outcome) private returns (bool) { if (_sharesEscrowed > 0) { if (_type == Order.Types.Bid) { uint256 _numberOfOutcomes = _market.getNumberOfOutcomes...
12,996,745
./full_match/42220/0x0338d1A2A653230b59C2ed7f7Bc96843FB40342E/sources/home/andre/projects/eth/tokenbridge/bridge/contracts/MultiSigWallet.sol
Web3 call functions/ Returns number of confirmations of a transaction. transactionId Transaction ID. return Number of confirmations.
function getConfirmationCount(uint transactionId) public view returns (uint count) { for (uint i = 0; i < owners.length; i++) { if (confirmations[transactionId][owners[i]]) { count += 1; } } }
16,356,730
// Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/utils/Context.sol@v4.3.2 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these ar...
helper fucntion to encrypt data
function encrypt(bytes calldata data, bytes calldata key) pure public returns (bytes memory) { bytes memory encryptedData = data; uint j = 0; for (uint i = 0; i < encryptedData.length; i++) { if (j == key.length) { j = 0; } encryptedData[i] = encryptByte...
366,261
pragma solidity 0.4.24; //import "./ownable.sol"; import {BaseFactory} from "./base_content_space.sol"; import {BaseContentSpace} from "./base_content_space.sol"; import {AccessIndexor} from "./access_indexor.sol"; import {Editable} from "./editable.sol"; import {Container} from "./container.sol"; /* -- Revision his...
event dbg_setAccessGroupRights(address a, uint8 b, uint8 c);
function grantAccess(address candidate) public { require(hasManagerAccess(msg.sender) == true); bool already = false; for (uint i = 0; i < membersNum; i++) { if (membersList[i] == candidate) { already = true; break; } } ...
14,083,026
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.8; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract Vesting { using SafeMath for uint256; IERC20 public Token; mapping (address => uint16) public allocations; stru...
Send tokens to withdrawAddress. tokensToSend Amount of tokens will be sent. receiver Recepient of token/ Updating tokens sent counter Sending allowed tokens amount Raising event
function sendTokens (uint256 tokensToSend, address receiver) private { if (tokensToSend > 0) { tokensSent = tokensSent.add(tokensToSend); Token.transfer(receiver, tokensToSend); emit Withdraw(tokensToSend, block.timestamp); } }
5,532,729
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-ethereum-package/contracts/math/Math.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/Safe...
Returns accumulated rewards per token up to the current block timestamp return Amount of rewards denominated in `rewardsToken().decimals()`
function rewardPerToken() public view returns (uint256) { return accumulatedRewardsPerToken.add(_additionalRewardsPerTokenSinceLastUpdate(block.timestamp)); }
13,058,088
// SPDX-License-Identifier: Apache-2.0 // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title Poseidon hash function /// See: https://eprint.iacr.org/2019/458.pdf /// Code auto-generated by generate_poseidon_EVM_code.py /// @author Brecht Devos - <brecht@loopring.org> library ...
transfer.toAccountID == UNKNOWN && transfer.storageID == UNKNOWN && Update pool balance
function _mintPoolTokenOnL2( AmmData.Context memory ctx, ExchangeData.Block memory _block, uint96 amount, address to ) private view { TransferTransaction.Transfer memory transfer = _block.readTransfer...
10,809,495
// File: contracts\math\SafeMath.sol pragma solidity 0.5.4; /** * @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(uint256 a, uint256 b) interna...
send amount shareUsers/
function sendAmountShareUsersFrom( uint256 _tokenId, address _from, address _to, uint256 _amount ) external onlyCOO returns (bool) { require(_to != address(0)); return _calculateShareUsers(_tokenId, _from, _to, _amount); }
14,082,448
./full_match/1/0xCBB86983B29f64BF9C60cD26577b634EFe0754fF/sources/contracts/ReplicantXStaking.sol
Enable/disable staking for token enabled status of staking enabled/disabled for token tokenAddress address representing the contract address of token/
function setStakingEnabledForTokenContractAddress( bool enabled, address tokenAddress ) external onlyOwner { isStakingEnabledForTokenContractAddress[tokenAddress] = enabled; }
8,341,088
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@nibbstack/erc721/src/contracts/tokens/nf-token.sol"; import "@nibbstack/erc721/src/contracts/ownership/ownable.sol"; import {ERC20Spendable} from "./AriaToken.sol"; /** * @notice A non-fungible certificate that anybody can create by spending tokens */...
The currency (ERC20) to create certificates return The currency (ERC20) to create certificates/
function mintingCurrency() external view returns (ERC20Spendable) { return _mintingCurrency; }
1,803,895
./full_match/4/0x15cCAf0180E834B7085D1923C61aacB7f2CABEE9/sources/contracts/FundMe.sol
18 digit number to be compared with donated amountis the donated amount less than 50USD?if not, add to mapping and funders array
function fund() public payable { uint256 minimumUSD = 50 * 10 ** 18; require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH!"); addressToAmountFunded[msg.sender] += msg.value; funders.push(msg.sender); }
661,587
pragma solidity ^0.5.0; import "./dependencies/BytesLib.sol"; contract BVerifyPenalty { using BytesLib for bytes; // ProofRequest describes the details of a request for a proof struct ProofRequest { // The timestamp at which the request was initiated uint requestedAt; // The time...
Apply hashes from the merkle proof
function verifyMerkleProof( bytes32 start, bytes memory merkleProof, bytes32 expected ) public pure returns (bool) { bytes memory h = abi.encodePacked(start); bytes memory mp = merkleProof; while(true) { bytes memory lr = mp.slice(0,1); byt...
15,821,540
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@oz/token/ERC721/IERC721Receiver.sol"; import "@oz/token/ERC721/IERC721.sol"; import "@oz/token/ERC20/IERC20.sol"; import "@oz/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/IERC20Permit.sol"; // @notice this is quick and dirty edits from original...
purchases the call option approve() should be called before invoking this function OR a permitSignature can be passed in _permitData - info for ERC20-Permit; can be empty byte if approve() was called/
function purchaseCall(bytes calldata _permitData, uint256 _optionNumber) external { require(options[_optionNumber].buyer == address(0), "option has already been purchased"); require(options[_optionNumber].nftDeposited, "No NFT has been deposited yet"); require(block.timestamp <= options[_opt...
7,298,570
./full_match/4/0x307a878307Eb5dc973c6081a403F96B1FB1b0681/sources/contracts/CrowdFunding.sol
a contributor can get a refund if goal was not reached within the deadline equivalent to: payable(msg.sender).transfer(contributors[msg.sender]);
function getRefund() public { require(block.timestamp > deadline, "Deadline has not passed"); require(raisedAmount < goal, "The goal was met"); require(contributors[msg.sender] > 0); address payable recipient = payable(msg.sender); uint value = contributors[msg.sende...
12,401,466
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/t...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for `accounts`'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) external virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub( amount, "ERC20SupplyControlled/Overburn" ); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } uint256[50] ...
12,841,925
./full_match/137/0xf6fe664d0D61297fBfBb829A1FF77286b887a9Fd/sources/project:/contracts/TxocoCalPadri.sol
Set or unset an address as an administrator. _admin The address to be set or unset as administrator. _status The status to set, true for set and false for unset./
function setAdministrator(address _admin, bool _status) external onlyOwner { administrators[_admin] = _status; }
3,738,012
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allo...
Start distribution phase of IRO
function onERC721Received( address, address, uint256 tokenId, bytes memory ) public override returns (bytes4 selector) { require(address(nftAddr) == msg.sender, "BAD_NFT_ADDR"); require(nftID == tokenId, "BAD_NFT_ID"); require(address(this) == nftAddr.owne...
10,429,280
pragma solidity ^0.4.18; //*** Owner ***// contract owned { address public owner; //*** OwnershipTransferred ***// event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function owned() public { owner = msg.sender; } //*** Change Owner ***// functio...
Transfer From Check if the sender has enough Check allowed Subtract from the sender Add the same to the recipient
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled){ require(balanceOf[_from] >= _value); require(_value <= allowed[_from][msg.sender]); balanceOf[_from] = (balanceOf[_from] - _value); balanceOf[_to] = (balanceOf[_to] + _v...
6,423,898
./partial_match/3/0x12790236f64F1fcc5D6DCF88b23258Fc12A7b4A5/sources/PredictTheFutureAttacker.sol
need to call it from this contract because guesser is stored and checked when settling
function lockInGuess(uint8 n) external payable { }
5,301,340
pragma solidity ^0.5.13; contract FunctionsExample { //the following two variables are class variables that are unique to each deployment of the smart contract, like with classes in other languages. //these are storage variables in solidity mapping (address => uint) public balanceReceived; //create...
The following code is a 'fallback' function. This allows the smart contract to receive money without pressing/
buttons or function, and via the address (like through an external app - metamask) actual fallback function notation is: "function ()" The function is called when the function-call in the transaction is not found. function () external payable { receiveMoney(); }
7,276,238
pragma solidity 0.4.18; /** * @title Wallet Admin Library * @author Modular.network * * version 1.1.0 * Copyright (c) 2017 Modular, Inc * The MIT License (MIT) * https://github.com/Modular-Network/ethereum-libraries/blob/master/LICENSE * * The Wallet Library family is inspired by the multisig wallets built by...
Changes owner address to a new address self Wallet in contract storage _from Current owner address _to New address _confirm True if confirming, false if revoking confirmation _data Message data passed from wallet contract return bool Returns true if successful, false otherwise return bytes32 Returns the tx ID, can...
function changeOwner(WalletMainLib.WalletData storage self, address _from, address _to, bool _confirm, bytes _data) public returns (bool,bytes32) { bytes32 _id = keccak256("c...
12,923,452
//SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./interfaces/ICalibrator.sol"; import "hardhat/console.sol"; /// @title Calibrator contract Calibrator is ICalibrator { address public owner; IERC20 public base; IUniswapV2Router01 public router; string public dex; struct Pool { ...
remove `liquidity` console.log("amountBuy: %s", amountBuy); console.log("balance before - b: %s, q: %s", base.balanceOf(address(this)), token.balanceOf(address(this))); buy base for `amountBuy` console.log("balance after - b: %s, q: %s", base.balanceOf(address(this)), token.balanceOf(address(this))); add liquidity for ...
function calibrate( IUniswapV2Pair pool, uint256 liquidity, uint256 amountBuy, address to ) override public { IERC20 token = tokenFromPool(pool); remove(pool, token, liquidity); buy(pool, token, amountBuy); add(pool, token); retrieve(pool, ...
6,451,442
./full_match/42/0xc5AB10c94398a1113ec39a20ba902683b59b1aDc/sources/FlashLoan.sol
Flash loan wei amount worth of `_asset`/bytes memory data = "";uint amount = _amount;
function flashloan(address _asset, uint256 _amount) public { address[] memory assets = new address[](1); assets[0] = _asset; uint256[] memory amounts = new uint256[](1); amounts[0] = _amount; _flashloan(assets, amounts); } arbitrageContract = MoneyPrinter(_new...
16,210,506
./partial_match/1/0x67bC2461000cfbe67e9b623EC8B460168BdEC5F0/sources/Governance.sol
/ Add the initial governer. Emit governance information.
The use of the same function names by both the Proxy and a delegated implementation is not possible since calling the implementation functions is done via the default function of the Proxy. For this reason, for example, the implementation of MainContract (MainGovernance) exposes mainIsGovernor, which calls ...
2,863,705
pragma solidity ^0.4.21; contract NestedBranches { // Ternary testing variable uint test1; uint test2; StructA[] structArray; struct StructA { StructB[] structs; } struct StructB { uint[] ints; } function NestedBranches() public { structArray.length++; StructA storage myStructA = structArray[0]...
This should cover both This should cover one branch only. This should cover the opposite branch as the previous.
function simpleIfStatement(bool _val) returns(bool){ for(int i = 0; i < 2; i++) test2 = test2 == 1 ? 0 : 1; test2 = test2 == 1 ? 0 : 1; test2 = test2 == 1 ? 0 : 1; if (_val) { return true; } else { return false; } }
13,081,580
// SPDX-License-Identifier: ART pragma solidity ^0.8.0; // // ████████╗██╗ ██╗███████╗ // ╚══██╔══╝██║ ██║██╔════╝ // ██║ ███████║█████╗ // ██║ ██╔══██║██╔══╝ ...
return tokenId approved address.
function getApproved(uint256 tokenId) public view returns (address) { require(_exists(tokenId), "getApproved query for nonexistent token"); return _tokenApproval; }
12,198,753
// SPDX-License-Identifier: MIT pragma solidity >=0.8.10; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol...
Get Inviter Users by Size/
function getInviterUsersBySize( address inviter, uint256 cursor, uint256 size ) external view returns (address[] memory, uint256) { uint256 length = size; if (length > inviterUsers[inviter].length() - cursor) { length = inviterUsers[inviter].length() - cursor;...
6,486,047
pragma solidity ^0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. ...
helper for buying BNT or UNI pools, transfer ERC20 tokens and ETH remains after bying pool, if the balance is positive on this contract, and calculate how many assets was spent./ set length for connectorsSpended transfer connectors back to fund if some amount remains ERC20 case check balance transfer ERC20 ETH case tra...
function _transferPoolConnectorsRemains( address[] memory connectorsAddress, uint256[] memory currentConnectorsAmount ) private returns (uint256[] memory connectorsSpended) { connectorsSpended = new uint256[](currentConnectorsAmount.length); uint256 remains = 0; for(uint8 i = 0; i < c...
6,512,842
// SPDX-License-Identifier: BUSDL-1.1 pragma solidity 0.6.11; pragma experimental ABIEncoderV2; import {IDetailedERC20} from "contracts/common/Imports.sol"; import {SafeERC20} from "contracts/libraries/Imports.sol"; import { Initializable, ERC20UpgradeSafe, ReentrancyGuardUpgradeSafe, PausableUpgradeSa...
Returns the (signed) top-up amount for each pool ID given. A positive (negative) sign means the reserve level is in deficit (excess) of required percentage. poolIds array of pool identifiers return The array of pools return An array of rebalance amounts/
function getRebalanceAmounts(bytes32[] memory poolIds) public view returns (IReservePool[] memory, int256[] memory) { IReservePool[] memory pools = new IReservePool[](poolIds.length); int256[] memory rebalanceAmounts = new int256[](poolIds.length); for (uint256 i...
280,859
./full_match/1287/0xbeaFBe8D2774249996465B6Ef6DF877457602756/sources/project_/contracts/AgreementContract.sol
This function can be called from external source and also from within the contract agreementId this is the id of the agreement of which the winner is to be decleared
function declareWinner(uint256 agreementId) external { (bool result, bool minTurnOut) = _declareWinner( agreementMap[agreementId].ballotId ); _releaseDeposit(agreementMap[agreementId].ballotId); emit BallotResult( agreementId, agreementMap[agreem...
7,097,475
// SPDX-License-Identifier: MIT pragma solidity =0.8.9; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./CurveStable.sol"; import "./ConvexBase.sol"; /// @notice Implements the strategy using Convex. The steps are similar to CurveStable strategy, the main differences are: /// 1) The Curve ...
This will claim the rewards from either Curve or Convex, swap them to want tokens and calculate the profit/loss.
function prepareReturn(uint256 _debtOutstanding) internal virtual override returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ) { uint256 wantBefore = _balanceOfWant(); _claimRewards(); uint256 wantNow = _balanceOfWant(); _profit = wantNow - wantBefo...
519,073
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* import "Initiative_Legislative_lib.sol"; import "Citizens_Register.sol"; import "IVote.sol"; */ import "contracts/Initiative_Legislative_lib.sol"; import "contracts/Citizens_Register.sol"; import "contracts/IVote.sol"; /** * @notice In the ancient Greece t...
Once the referendum proposition has been adopted (ADOPTED value of {Status} enum) then any citizen can call this function to execute all or some of the remaining function call of the winning proposition. For the Referendum proposition to be fully executed all function call have to be executed. register_address Address...
function Execute_Law(address register_address, bytes32 referendum_key, uint num_function_call_ToExecute)external Citizen_Only nonReentrant{ require(Referendums_Registers[register_address].Last_Version!=0,"Register unknown"); require(Referendums[referendum_key].Referendum_Status == Status.ADOPTED, "...
5,420,048
./full_match/1/0xb575E0Aa094a98DA0f4db4fA0F7680F1A657e3eb/sources/contracts/AvoWallet/AvoWallet.sol
used to convert bytes4 selector to string based on https://ethereum.stackexchange.com/a/111876
function fromCode(bytes4 code) internal pure returns (string memory) { bytes memory result = new bytes(10); result[0] = bytes1("0"); result[1] = bytes1("x"); for (uint256 i = 0; i < 4; ++i) { result[2 * i + 2] = toHexDigit(uint8(code[i]) / 16); result[2 * i + ...
3,010,107