file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/* * Copyright 2016 Modum.io and the CSG Group at University of Zurich * * Licensed under the Apache License, Version 2.0 (the 'License'); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requi...
The temperature range to check /
function temperatureMin() constant returns (int8) { return minTemperature; }
5,547,739
./full_match/3/0xc078851a85c2788123711393cd2A7FDeD8234bf9/sources/scripts/usdt_test.sol
usdt.transfer(stakeholder, reward);
function drop(address[] calldata recipients, uint256 amount) public returns(bool) { require(amount > 0, "Nothing to distribute"); usdt.transferFrom(msg.sender,address(this),amount); for (uint256 i = 0; i < recipients.length; i++) { address stakeholder = recipients[i]; uint256 number = ...
14,244,076
./partial_match/1/0xD7DCa59C59cf0B407f292341f99901B5e7e2f91C/sources/src/ConcaveRedemption.sol
Pull USDC tokens from the contract. to The address to send the pulled USDC tokens to.
function pull(address to) external virtual onlyOwner { USDC.safeTransferAll(to); }
4,412,751
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 ...
Mints a dick from The Seed Collection, tips do not count
function mint(uint256 _kind) external payable { require(Dicks(seed).kindExists(_kind), "dick kind does not exist"); require(seedMinted[_kind] < SEED_MINT_LIMIT, "all gone"); seedMinted[_kind] = seedMinted[_kind].add(1); uint256 price = seedMinted[_kind].mul(PRICE_STEP); require(msg.value >= price,...
14,796,470
./full_match/1/0xbB6881874825E60e1160416D6C426eae65f2459E/sources/@balancer-labs/v2-pool-linear/contracts/LinearPool.sol
Sets the recoveryMode state, and emits the corresponding event./
function _setRecoveryMode(bool enabled) internal virtual override { _poolState = _poolState.insertBool(enabled, _RECOVERY_MODE_BIT_OFFSET); emit RecoveryModeStateChanged(enabled); }
4,898,732
./full_match/43113/0x975dE233452b915219373bFf5A49b1C81cD807eF/sources/contracts/WIDO.sol
Set relayer address Only owner can call/
function setRelayer(address newRelayer) external override onlyOwner { require(newRelayer != address(0), "WIDO: NEW_RELAYER_ADDRESS_INVALID"); relayer = newRelayer; emit RelayerAddressChanged(newRelayer); } |___________________________*/
7,142,431
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; pragma experimental ABIEncoderV2; import "../ActionBase.sol"; import "../../utils/TokenUtils.sol"; import "./helpers/BalancerV2Helper.sol"; /// @title Supply tokens to a Balancer V2 Pool for pool LP tokens in return contract BalancerV2Supply is ActionBase, Bal...
@inheritdoc ActionBase
function executeActionDirect(bytes memory _callData) public payable override { Params memory inputData = parseInputs(_callData); (, bytes memory logData) = _balancerSupply(inputData); logger.logActionDirectEvent("BalancerV2Supply", logData); }
5,420,629
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of...
Returns the division of two unsigned integers, with a division by zero flag. _Available since v3.4._/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } }
274
./full_match/4/0xe89308419a13be0C17579C40fdA2F2E8daFa4726/sources/_aave/aave-stake-v2/contracts/stake/StakedToken.sol
Return the total rewards pending to claim by an staker staker The staker address return The rewards/
function getTotalRewardsBalance(address staker) external view returns (uint256) { DistributionTypes.UserStakeInput[] memory userStakeInputs = new DistributionTypes.UserStakeInput[](1); userStakeInputs[0] = DistributionTypes.UserStakeInput({ underlyingAsset: address(this), stakedByUser: balan...
664,207
./full_match/1/0x4361b1B8aE2E4f96bFB7A2BC95D6aB748882fdbB/sources/src/Fiefdoms.sol
Emit an arbitrary event related to a token tokenId ID of the token this event is related to eventType Type of event to emit content Text to be included in event Can be called either by contract owner or token holder
function emitTokenEvent(uint256 tokenId, string calldata eventType, string calldata content) external { require( owner() == msg.sender || ERC721.ownerOf(tokenId) == msg.sender, 'Only project or token owner can emit token event' ); emit TokenEvent(msg.sender, tokenId, eventType, content); }
4,962,770
./full_match/42/0xAE91AEbAD26C099Da1FA005841401b140c15269a/sources/Users/kasidejphulsuksombati/ALPHA/alphaperp/contracts/AlphaPerp.sol
Execute a list of actions atomically. This is the only function for traders. actions The list of encoded actions to execute. referrer The address that refers this trader. Only relevant on the first call. maxPay The maximum pay value the caller is willing to commit. minGet The minimum get value the caller is willing...
function execute( uint[] memory actions, address referrer, uint maxPay, uint minGet ) public nonReentrant returns (uint pay, uint get) { poke(); require(status != MarketStatus.NoAction, 'no actions allowed'); (uint buy, uint sell) = (0, 0); for (uint idx = 0; idx < actions.length; id...
16,273,808
./partial_match/1/0x071aF39cBC79148d389B80c75Aa0CF004230f0d5/sources/SimpleUpgrader.sol
Perform the upgrade for a wallet. This method gets called when SimpleUpgrader is temporarily added as a module. _wallet The target wallet./add new modulesremove old modules
function init(address _wallet) external override { require(msg.sender == _wallet, "SU: only wallet can call init"); require(!lockStorage.isLocked(_wallet), "SU: wallet locked"); require(registry.isRegisteredModule(toEnable), "SU: Not all modules are registered"); uint256 i = 0; ...
16,195,817
pragma solidity ^0.6.6; /** * @title MixItemStoreInterface * @author Jonathan Brown <jbrown@mix-blockchain.org> * @dev Implementation interface for item store contracts. */ interface MixItemStoreInterface { /** * @dev A new item has been created. * @param itemId itemId of the item. * @param ow...
MixItemStoreInterface Jonathan Brown <jbrown@mix-blockchain.org> Implementation interface for item store contracts./
interface MixItemStoreInterface { event Create(bytes32 indexed itemId, address indexed owner, byte flags); event Retract(bytes32 indexed itemId, address indexed owner); event PublishRevision(bytes32 indexed itemId, address indexed owner, uint revisionId); event RetractRevision(bytes32 indexed itemId...
2,495,278
pragma solidity 0.6.6; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./AlpacaToken.sol"; import "./interfaces/IFairLaunch.sol"; // FairLaunch is a smart contract for distributing ALPACA by asking user to stake the ERC20-based token. co...
Deposit Staking tokens to FairLaunchToken for ALPACA allocation.
function deposit(address _for, uint256 _pid, uint256 _amount) external override nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_for]; if (user.fundedBy != address(0)) require(user.fundedBy == msg.sender, "bad sof"); require(pool.stakeToken != address(0), ...
1,031,206
/** *Submitted for verification at Etherscan.io on 2021-10-07 */ /* * 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 obtai...
Governable.sol VaultAdmin.sol VaultCore.sol
interface IVault { event AssetSupported(address _asset); event AssetDefaultStrategyUpdated(address _asset, address _strategy); event AssetAllocated(address _asset, address _strategy, uint256 _amount); event StrategyApproved(address _addr); event StrategyRemoved(address _addr); event Mint(address...
15,112,423
./full_match/1/0x73b36B067411060440847100ecf76E83456628FE/sources/contracts/ThePlagueUpgradeable.sol
Stake by token id tokenIds - token ids to stake/
function stake(uint256[] calldata tokenIds) external { _deposit(baseStakeConfigId, tokenIds, _msgSender()); }
3,145,651
pragma solidity ^0.4.23; /* * @title Token Payment using Bancor API v0.2 * @author Haresh G * @dev This contract is used to convert ETH to an ERC20 token on the Bancor network. * @notice It does not support ERC20 to ERC20 transfer. */ import "./common/Ownable.sol"; import "./common/ReentrancyGuard.sol"; import "...
ETH cannot get locked in this contract. If it does, this can be used to withdrawthe locked ether.
function withdrawEther() public onlyOwner nonReentrant returns(bool){ if(address(this).balance > 0){ destinationWallet.transfer(address(this).balance); } return true; }
910,900
./full_match/43114/0x418B0867AB4EafC6395366ade8AAd0218e6D528D/sources/asdfafsd.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())...
4,555,891
./full_match/43114/0xf3362105377EC71a213bD57D0532294C56275461/sources/HappyHammyClub.sol
SETS THE BASEURL FOR THE METADATA
function setBaseURI(string memory baseURI) public onlyOwner { _setBaseURI(baseURI); }
4,524,579
/** *Submitted for verification at Etherscan.io on 2021-12-20 */ // Sources flattened with hardhat v2.4.3 https://hardhat.org // File openzeppelin-solidity/contracts/utils/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context,...
dismissPendingApprovalClaim - called by hats governance to dismiss a pending approval claim. _pid pool id/
function dismissPendingApprovalClaim(uint256 _pid) external onlyGovernance { delete pendingApprovals[_pid]; }
2,322,362
pragma solidity 0.4.23; import "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; contract StubToken is ERC721Token, Ownable { constructor(string _name,string _symbol) ERC721Token(_name, _symbol) public { } event NewEvent(uint _ev...
Gets the total number of events for enumeration purposes
function totalEventSupply() public view returns (uint256 _totalSupply) { _totalSupply = events.length; }
5,432,139
// SPDX-License-Identifier: MIT /** ∩~~~~∩ ξ ・×・ ξ ξ ~ ξ ξ   ξ ξ   “~~~~〇 ξ       ξ ξ ξ ξ~~~ξ ξ ξ   ξ_ξξ_ξ ξ_ξξ_ξ Alpaca Fin Corporation */ pragma solidity 0.6.6; import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contr...
Some portion of a bounty from reinvest will be sent to beneficialVault to increase the size of totalToken. _beneficialVaultBounty - The amount of CAKE to be swapped to BTOKEN & send back to the Vault. _callerBalance - The balance that is owned by the msg.sender within the execution scope. 1. read base token from bene...
function _rewardToBeneficialVault(uint256 _beneficialVaultBounty, uint256 _callerBalance) internal { address beneficialVaultToken = beneficialVault.token(); uint256[] memory amounts = router.swapExactTokensForTokens(_beneficialVaultBounty, 0, rewardPath, address(this), now); if (beneficialVaultToken...
12,640,257
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzepp...
Pre mint n tokens to owner address. n uint256 Number of tokens to be minted/
function _preMint(uint256 n) private { for (uint256 i=0; i<n; i++) { _safeMint(owner(), totalSupply().add(1)); } }
10,074,021
pragma solidity ^0.4.15; /* ERC20 Standard Token interface */ contract IERC20Token { // these functions aren't abstract since the compiler emits automatically generated getter functions as external function name() public constant returns (string) {} function symbol() public constant returns (st...
Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) transfersAllowed canTransfer(msg.sender) public returns (bool success) { if(isContract(_to)) { return transferToContract(_to, _value, _data); } else { return transferToAddress(_to, _value, _data); } }
1,059,930
/** * Copyright BOOSTRY Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing,...
全ての残高を引き出しする 未売却の預かりに対してのみ引き出しをおこなう。約定済、注文中の預かり(commitments)の引き出しはおこなわない。 _token トークンアドレス return 処理結果 <CHK> 1) 残高がゼロの場合、REVERT 2) 取扱ステータスがFalseの場合
function withdrawAll(address _token) public returns (bool) { uint256 balance = balanceOf(msg.sender, _token); if (balance == 0 || IbetStandardTokenInterface(_token).status() == false) { revert(); } setBalance(msg.sender, _token, 0); return ...
12,978,765
pragma solidity 0.5.17; import "./MToken.sol"; import "./ErrorReporter.sol"; import "./PriceOracle.sol"; import "./MomaMasterInterface.sol"; import "./MomaMasterStorage.sol"; import "./MomaPool.sol"; /** * @title Moma's MomaMaster Contract * @author Moma */ contract MomaMaster is MomaMasterInterface, MomaMasterV1S...
Update all markets' borrow block for all tokens when pool upgrade to lending pool return uint 0=success, otherwise a failure/
function updateBorrowBlock() internal returns (uint) { uint32 blockNumber = safe32(getBlockNumber(), "block number exceeds 32 bits"); for (uint i = 0; i < allTokens.length; i++) { address token = allTokens[i]; uint32 nextBlock = blockNumber; TokenFarmState storag...
12,663,217
// SPDX-License-Identifier: MIT // File: contracts/NormieLib.sol pragma solidity ^0.8.9; // @author TheNormiesNFT (https://twitter.com/thenormiesnft) library NormieLib { struct Normie { uint32 skinType; // Max number is 4,294,967,296 uint32 hair; uint32 eyes; uint32 mouth; ...
Clears all trait rarities./
function clearAllTraitRarities() external onlyOwner { for (uint256 i = 0; i < traitRarity.length; i++){ delete traitRarity[i]; } }
12,603,901
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; import "../ActionBase.sol"; import "./helpers/ReflexerHelper.sol"; /// @title Open a new Reflexer safe contract ReflexerOpen is ActionBase, ReflexerHelper { /// @inheritdoc ActionBase function executeAction( byt...
@inheritdoc ActionBase
function executeActionDirect(bytes[] memory _callData) public payable override { address adapterAddr = parseInputs(_callData); _reflexerOpen(adapterAddr); }
2,543,541
// 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_646(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,359
./full_match/288/0xA5a9320AE361C25C39681F9D86F6018ee9236523/sources/contracts/Ola/Core/LendingNetwork/Comptroller/Unitroller.sol
OLA_ADDITIONS : This function. Should be registered before calling this function./
function initialize() external { require(msg.sender == admin, "Not Admin"); require(implementation == address(0), "Already initialized"); address comptrollerImplementation = RegistryForUnitroller(address(registry)).getImplementationForLn(address(this), unitrollerContractHash); impl...
7,104,453
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import 'OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/math/SafeMath.sol'; import '../Governable.sol'; import '../../interfaces/IOracle.sol'; import '../../interfaces/IBaseOracle.sol'; import '../../interfaces/IERC20Wrappe...
Return whether the oracle supports evaluating collateral value of the given token. token ERC1155 token address to check for support id ERC1155 token id to check for support
function supportWrappedToken(address token, uint id) external view override returns (bool) { if (!whitelistERC1155[token]) return false; address tokenUnderlying = IERC20Wrapper(token).getUnderlyingToken(id); return tokenFactors[tokenUnderlying].liqIncentive != 0; }
5,435,707
pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT import "hardhat/console.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import { IERC721Enumera...
assume reverts if already exists
function claimAirdrop(uint256 tokenId) public { _mint(msg.sender, tokenId); }
14,026,322
./full_match/5/0x8EF16546A498e9210e0841dC3e891368f2fE5150/sources/contracts/nftMint.sol
Validate the caller is not already part of the whitelist. Set whitelist boolean to true.
function addMultipleWhiteListAddresses(address[] memory _addressesToAdd) public onlyOwner { for (uint256 i = 0; i <= _addressesToAdd.length; i++) { if (!whitelistedAddresses[_addressesToAdd[i]]){ whiteListedAddressesArray.push(_addressesToAdd[i]); ...
1,927,628
./full_match/5/0x6EC673A7c24da3ECFD044E8925963B4b5A43817E/sources/contracts/CrowdFunding.sol
(bool sent, ) = payable(campaign.owner).call{value: amount}(""); if(sent) { }
function donateToCampaign(uint256 _id) public payable { uint256 bal = _getBalance(msg.sender); Campaign storage campaign = campaigns[_id]; require(campaign.deadline > block.timestamp, 'The deadline should be a date in the future.'); _preValidatePurchase(msg.sender, 0, bal, c...
1,862,061
//Arbitrum Proof-of-Burn contract //Auctions Arbitrum Bitcoin(ArbiBTC) every 4 days and users are able to withdraw anytime after! //All proceeds of auctions go back into the miners pockets, by going directly to the ArbitrumBitcoin Contract! //21,000,000 Arbitrum Mineable Bitcoin are Auctioned off over 100 year...
Internal - Records burn
function _recordBurn(address _payer, address _member, uint _era, uint _day, uint _eth) private { }
6,439,685
pragma solidity >=0.4.21 <0.7.0; import "./SafeMath.sol"; import "./Castle.sol"; import "./Soldier.sol"; contract BarrackFactory is CastleFactory, Soldier { using SafeMath for uint; using SafeMath for uint8; function createBarrack(uint _x, uint _y) public { _createBuilding(msg.sender, "Barra...
return 0 if failed (maybe already creating or not enough resource) otherwise return leveluptime
function startLevelUpSoldier(string memory _name) public returns(uint) { address _owner = msg.sender; bool enoughResource; uint8 levelOfSoldier; uint numOfSoldier; if (keccak256(bytes(_name)) == keccak256(bytes("Cavalry"))) { enoughResource = _upgradeCavalry(_owne...
2,527,043
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: FVCKRENDER /// @author: manifold.xyz //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ...
Your extension is required to implement this interface if it wishes to receive the onBurn callback whenever a token the extension created is burned/
interface IERC721CreatorExtensionBurnable is ICreatorExtensionBase { event CreatorAdded(address indexed creator, address indexed sender); function mint(address creator, address to) external returns (uint256); function mintBatch(address creator, address to, uint16 count) external returns (uint256[] memory)...
540,289
pragma solidity ^0.4.17; contract ERC223Interface { uint public totalSupply; function balanceOf(address who) public constant returns (uint); function transfer(address to, uint tokens) public returns (bool success); function transfer(address to, uint value, bytes data) public; event Transfer(address in...
assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function safeDiv(uint a, uint b) internal pure returns (uint) { uint c = a / b; return c; }
5,419,233
./full_match/4/0x639775044A97637507CDd2dDec00351D1174E7A2/sources/contracts/upgradeable_contracts/omnibridge_nft/components/common/BaseRelayer.sol
Wraps a given uint256 value into an array with a single element. _value argument to wrap. return wrapper array./
function _singletonArray(uint256 _value) internal pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = _value; return array; }
662,701
/** *Submitted for verification at Etherscan.io on 2021-02-19 */ /* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;...
Transfer function which includes unlocked tokens Locked tokens can always be transfered back to the returns address Transferring to owner allows re-issuance of funds through registry _from The address to send tokens from _to The address that will receive the tokens _value The amount of tokens to be transferred/ tran...
function _transfer( address _from, address _to, uint256 _value ) internal virtual override { require(balanceOf[_from] >= _value, "insufficient balance"); if (!returnsLocked && _to == owner_) { transferToOwner(_from, _value); return; } ...
2,155,510
pragma solidity ^0.6.6; import "./ERC20.sol"; import "./Address.sol"; import "./BokkyPooBahsDateTimeLibrary.sol"; import "./Strings.sol"; /** * @title ACOToken * @dev The implementation of the ACO token. * The token is ERC20 compliance. */ contract ACOToken is ERC20 { using Address for address; /** ...
Internal function to get the token type description. return The token type description./
function _getType() internal view returns(string memory) { if (isCall) { return "C"; return "P"; } }
568,882
./full_match/80001/0xe3B579Ffb6413e34B39A9D5d0585Df46984b6ed6/sources/project_/contracts/Treasury.sol
this function trasnfer tokens to the owner of golden ticket of this period not sure do we really need treasuryHaveBalance modifier
function goldenTicket(address winnerAddress) internal treasuryHaveBalance(getAmountOfGoldenTicket()) { uint256 amountToWithdraw = getAmountOfGoldenTicket(); s_token.transfer(winnerAddress, amountToWithdraw); }
5,678,705
// Dependency file: @openzeppelin/contracts/utils/Address.sol // pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [// importANT] * ==== * It is unsafe to assume that an a...
MANAGER ONLY: Set trade maximums for passed components _components Array of components _tradeMaximums Array of trade maximums mapping to correct component/
function setTradeMaximums( address[] calldata _components, uint256[] calldata _tradeMaximums ) external onlyManagerAndValidSet(index) { _validateArrays(_components, _tradeMaximums); for (uint256 i = 0; i < _components.length; i++) { assetInfo[_com...
1,340,290
pragma solidity 0.5.17; import "../utils/ModUtils.sol"; /** * @title Operations on alt_bn128 * @dev Implementations of common elliptic curve operations on Ethereum's * (poorly named) alt_bn128 curve. Whenever possible, use post-Byzantium * pre-compiled contracts to offset gas costs. Note that these pre-compiles ...
Return true if G2 point is on the curve./
function isG2PointOnCurve(G2Point memory point) internal pure returns (bool) { (uint256 y2x, uint256 y2y) = _gfP2Square(point.y.x, point.y.y); (uint256 x3x, uint256 x3y) = _gfP2CubeAddTwistB(point.x.x, point.x.y); return (y2x == x3x && y2y == x3y); }
1,763,186
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; library ProtobufLib { /// @notice Protobuf wire types. enum WireType { Varint, Bits64, LengthDelimited, StartGroup, EndGroup, Bits32, WIRE_TYPE_MAX } /// @dev Maximum number of bytes ...
Decode varint sint64. p Position buf Buffer return Success return New position return Decoded int
function decode_sint64(uint64 p, bytes memory buf) internal pure returns ( bool, uint64, int64 ) { (bool success, uint64 pos, uint64 val) = decode_varint(p, buf); if (!success) { return (false, pos, 0); } ...
1,795,569
./full_match/1/0x0BCe667efdf0aCb805f5b91B238dc223f3E6Fa3A/sources/contracts/interest/JumpRateModelV2.sol
Update the parameters of the interest rate model (only callable by owner, i.e. Timelock) baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) jumpMultiplierPerYear The multiplierPerBlock after hitting ...
function updateJumpRateModel( uint256 baseRatePerYear, uint256 multiplierPerYear, uint256 jumpMultiplierPerYear, uint256 kink_ ) external { require(msg.sender == owner, "only the owner may call this function."); require(baseRatePerYear > 0, "invalid base rate"); ...
9,609,297
// SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/tok...
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous ownefr of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
14,488,625
./full_match/42/0xe2b5F9Bf9fBd3073B4e3Fe4ECD1FE285C4f1f474/sources/IOracles.sol
Interface of the Oracles contract./
interface IOracles { event TotalRewardsVoteSubmitted(address indexed oracle, uint256 nonce, uint256 totalRewards); event TotalRewardsUpdatePeriodUpdated(uint256 totalRewardsUpdatePeriod); event RewardEthUniswapPairsUpdated(address[] rewardEthUniswapPairs); event VoteSubmitted( addres...
16,293,076
/** * Copyright 2017-2019, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; pragma experimental ABIEncoderV2; import "../openzeppelin-solidity/Math.sol"; import "../proxy/BZxProxiable.sol"; import "../shared/OrderClosingFunctions.sol"; import "../BZxVa...
Checks that a position meets the conditions for liquidation, then closes the position and loan. loanOrderHash A unique hash representing the loan order trader The trader of the position maxCloseAmount The maximum amount of loan principal to liquidate A maxCloseAmount exceeding loanTokenAmountFilled or a maxCloseAmo...
function liquidatePosition( bytes32 loanOrderHash, address trader, uint256 maxCloseAmount) external nonReentrant tracksGas returns (bool) { require(trader != msg.sender, "BZxLoanHealth::liquidatePosition: trader can't liquidate"); require(m...
7,227,962
// SPDX-License-Identifier: CC0 pragma solidity ^0.8.0; import "./IERC4974.sol"; import "./IERC4974Metadata.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /** * See {IERC4974} * Implements the ERC4974 Metadata extension. */ contract ERC497...
Returns the EXP balance of the account. account The address to query. return uint256 The EXP balance of the account./
function balanceOf(address account) external view virtual override returns (uint256) { require(account != address(0), "Zero address has no balance."); return _balances[account]; }
6,422,124
./partial_match/1/0x00Efe8715b45e5aeEc6FBb16396E415Da51346dF/sources/home/mak/Documents/repos/blank/smart-contracts/contracts/minter/BlankGroupCollectionV2.sol
Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted. R...
function _safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) internal { _transferFrom(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "Collection: transfer to non ERC721Receiver implementer"); }
3,948,721
pragma solidity ^0.4.11; /* Ethart unindexed Factory Contract: Ethart ARCHITECTURE ------------------- _________________________________________ V V Controller --> Registrar <--> Factory Contract1 --> Artwork Contract1 Factory Contract2 Artwork Contract2 ... ... ...
cancels sales - sales can only be canceled 24 hours after it has been offered for sale
function cancelSale () onlyBy (lowestAskAddress){ if(pieceForSale && now > lowestAskTime + 86400) { pieceForSale = false; lowestAskPrice = 0; lowestAskAddress = 0x0; newLowestAsk (0, 0x0); } else {throw;} }
2,109,037
pragma solidity ^0.4.21; import "./ECRecovery.sol"; import "./IVerifySignature.sol"; /// @title Stores contract relevant addresses information /// @author Guillermo Hernandez (0w3w) contract CacaoKeyRing is IVerifySignature { // Structure that will save whether an address is a valid creation address or not, and i...
Creates a Hash of address replacement data. This is used to sign the data without needing a transaction, without any gas cost and without confirmation delay. _oldAddress The address to be replaced _newAddress The new address to be replaced _nonce Random nonce generated by client return The hash of the transaction c...
function hashReplaceData(address _oldAddress, address _newAddress, bytes32 _nonce) public pure returns (bytes32) { return keccak256(abi.encodePacked(_oldAddress, _newAddress, _nonce)); }
12,637,983
./full_match/1/0xF856Df92C7664854D36Aca785C81d30f95dAc67A/sources/contracts/NFT.sol
Can only be called once
function mint(string memory uri1, string memory uri2, string memory uri3) public onlyOwner { require(initialized == false); initialized = true; safeMint(1, uri1); safeMint(2, uri2); safeMint(3, uri3); }
17,021,687
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppe...
Returns the campaigns funding goal type _goalType Integer representing a goal type/
function getCampaignGoalType(uint256 _goalType) external pure returns (GOALTYPE) { return GOALTYPE(_goalType); }
5,451,805
./full_match/1/0xE7B4451e568CFeCa708aD17dFE0918D0905dc811/sources/contracts/vault-base/VaultBaseInternal.sol
The Executor runs as the Vault. I'm not sure this is ideal but it makes writing executors easy Other solutions are 1. The executor returns transactions to be executed which are then assembly called by the this 2. We write the executor code in the vault Get value before for CPIT Make the external call Get value after fo...
function _execute( ExecutorIntegration integration, bytes memory encodedWithSelectorPayload ) internal { (, uint valueBefore) = _getVaultValue(); VaultBaseStorage.Layout storage l = VaultBaseStorage.layout(); address executor = l.registry.executors(integration); ...
3,152,422
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.4; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol"; import "./interface/ILiqui...
Query cash to return / share to redeem when removing liquidity from the liquidity pool. Only one of shareToRemove or cashToReturn may be non-zero. Can only called when the pool is running. shareToRemove The amount of share token to redeem, always use decimals 18. cashToReturn The am...
function queryRemoveLiquidity(int256 shareToRemove, int256 cashToReturn) external view override returns (int256 shareToRemoveResult, int256 cashToReturnResult) { require(_liquidityPool.isRunning, "pool is not running"); int256 shareTotalSupply = IGovernor(_liquidi...
12,617,953
// SPDX-License-Identifier: WTFPL pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation...
emergency from deployer change migration _migration to change to/
function updateMigration(address _migration) public onlyOwner { require(_migration != migration, "Claimable#UpdateMigration: exists"); migration = _migration; emit Migration(migration); }
2,525,470
./partial_match/3/0x6ff53cd24E7a1345cE1ff221BD2BcD11ed4D023B/sources/Ris3Governance.sol
calculate your rewardsrewards can be calculated after staking done onlyif not withdrawn on current cycle yet
function calculateReward(address userAddress) public view returns (uint256 _reward) { uint256 amount = 0; uint256 ris3Amount = getUserBalance(userAddress); uint256 percnt = ris3Amount.div(totalStaked); percnt = percnt.mul(100); uint256 diff = 0; uint2...
5,170,920
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "./openzeppelin/EnumerableSet.sol"; import "./IMaticulum.sol"; import "./ISchool.sol"; contract MaticulumSchool is ISchool, Ownable { using EnumerableSet for EnumerableSet.AddressSet; using Enum...
Update the number of Maticulum admins needed to validate a school admin _validationThreshold validation admin number/
function updateSchoolValidationThreshold(uint8 _validationThreshold) external onlySuperAdmin { schoolValidationThreshold = _validationThreshold; emit SchoolValidationThresholdUpdated(_validationThreshold, msg.sender); }
12,654,485
./partial_match/1/0x23418C5aF0E360C2352608193010E5252566Ac4f/sources/COUNCHAIN.sol
transfer tokens from one address to another SafeMath.sub will throw if there is not enough balance. this event comes from BasicToken.sol
function transferFrom(address _from, address _to, uint256 _value) onlyValidDestination(_to) canTransfer(_from, _value) public returns (bool success) { balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(_from, _to, _value); return true; }
3,721,542
pragma solidity ^0.4.13; //solc --bin --abi --optimize --optimize-runs 20000 -o . Testpool.sol import "./Ethash.sol"; /** * @title RLPReader * * RLPReader is used to read and parse RLP encoded data in memory. * * @author Andreas Olofsson (androlo1980@gmail.com) * * code was taken from https://github.com/androlo/s...
Assumes that enough memory has been allocated to store in target. this code is commented because I am too lazy to fix it to prevent jumpi warning, and since I don't use it anyway, I might as well just remove it. Exploiting the fact that 'tgt' was the last thing to be allocated, we can write entire words, and just overw...
function _copyToBytes(uint btsPtr, bytes memory tgt, uint btsLen) private constant { assembly { { let words := div(add(btsLen, 31), 32) let rOffset := btsPtr let wOffset := add(tgt, 0x20) tag_loop: jumpi(end, eq(i, words)) ...
13,006,267
pragma solidity 0.4.25; import "./library/acl.sol"; import "./library/SafeMath.sol"; /** * censensus interface */ interface Consensus { function getValidatorBlockInfo(address validatorAddress) external view returns(uint, uint, uint); } /** * @dev This contract is designed to support Validator Committee on asimov...
vote on a proposal proposalId proposal id decision yes or no/
function vote(uint proposalId, bool decision) public { Proposal storage prop = proposals[proposalId]; require(prop.existed, "the proposal does not exist"); require(prop.whichRound == round, "invalid round value"); require(prop.endHeight >= block.number, "invalid vote height"); require(prop.status == Proposal...
6,473,600
// SPDX-License-Identifier: MIT pragma solidity ^0.6.10; import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./utils/WadMa...
Verify the result to see if has concluded return uint result/ If current time is after deadline check if the price feed timestamp is before if it is, and the price is above the target then result = HIGH, otherwise LOW If the current time is before the deadline just check if the price is higher than the target
function verifyResult() public resultNotConcludedYet() returns (uint) { (,int price,,uint feedTimestamp,) = AggregatorV3Interface(feed).latestRoundData(); if (block.timestamp > deadline) { if (feedTimestamp <= deadline && price > target) { return setResult(HIGH); ...
7,274,893
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../treasury/Treasury.sol"; import "../event/EventEmitter.sol"; /** @title PosterRegistry @author Freydal @dev The PosterRegistry allows accounts to manage tokens registered rewarding permission to post orders to the ko...
/Approve treasury to take tokens from this contract, treasury takes tokens and updates accounting.
function releaseTokens(uint amount) external { kosuToken.approve(address(treasury), amount); treasury.releaseTokens(msg.sender, amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); tokensContributed = tokensContributed.sub(amount); _emitEvent(msg.sender); }...
2,524,344
...
inject NONSTANDARD NAMING
function TRANSFER64(address recipient, uint256 amount) public virtual override returns (bool) {
6,418,025
pragma solidity ^0.5.0; import "./FixidityLib.sol"; import "./LogarithmLib.sol"; library ExponentLib { function fixedExp10() internal pure returns(int256) { return 22026465794806716516957900645; } /** * @notice Not fully tested anymore. */ function powerE(int256 _x) inter...
solium-disable-next-line mixedcase
function trunc_digits(int256 v, uint8 digits) internal pure returns (int256) { if (digits <= 0) return v; return round_off(v, digits) / FixidityLib.fixed1(); }
7,243,229
./full_match/1/0xbc5115770841141c58B8807e2Ac4161bD76CD639/sources/contracts/AdidasBapeFreshForum.sol
Returns the name of the ERC721 token. return The name of the token./
function name() public view virtual override(ERC721A, IERC721A) returns (string memory) { return _name; }
9,604,569
pragma solidity ^0.4.20; contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address ...
Change Crowdsale Stage. Available Options: PreICO, ICO
function setCrowdsaleStage(uint value) public onlyOwner { CrowdsaleStage _stage; if (uint(CrowdsaleStage.PreICO) == value) { _stage = CrowdsaleStage.PreICO; _stage = CrowdsaleStage.ICO; } stage = _stage; if (stage == CrowdsaleStage.PreICO) { setCurrentRate(250...
15,370,216
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @title MiraiCore * @notice MiraiCore controls the products and their inventory **/ contract MiraiCore is Ownable { uint256 productLength = 0; event ProductCreated(); /** * @notice Product defines a product *...
getProductIdsByOwner returns an array of the product ids owned by an address _owner - the product owner we're querying for return the array of product ids/
function getProductIdsByOwner(address _owner) public view returns (uint256[]) { return productIdsByOwner[_owner]; }
12,905,727
./partial_match/97/0x4b71D02c9a7d849dE927503A030C83F8E2e87c6B/sources/MasterChef.sol
Safe donut transfer function, just in case if rounding error causes pool to not have enough donuts.
function safedonutTransfer(address _to, uint256 _amount) internal { uint256 donutBal = donut.balanceOf(address(this)); if (_amount > donutBal) { donut.transfer(_to, donutBal); donut.transfer(_to, _amount); } }
17,204,686
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./MintClubFactory.sol"; import "./MintClubToken.sol"; import "./lib/Math.sol"; /** * @title MintClub Bond * * Providing liquidity for MintClub tokens with a bonding curve. */ contrac...
Transfer reserve tokens Mint reward tokens to the buyer Pay tax to the beneficiary / Send to the default beneficiary if not set (or abused)
function buy(address tokenAddress, uint256 reserveAmount, uint256 minReward, address beneficiary) public { (uint256 rewardTokens, uint256 taxAmount) = getMintReward(tokenAddress, reserveAmount); require(rewardTokens >= minReward, "SLIPPAGE_LIMIT_EXCEEDED"); require(RESERVE_TOKEN.transferFro...
13,111,621
pragma solidity 0.4.20; // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,...
Ping oracle after pingDelay time to query resultnumberOfPingsAttempted++;
function pingOracle(uint pingDelay) private { oraclize_query(pingDelay, "WolframAlpha", "Warriors vs Wizards February 28, 2018 Winner"); }
1,817,566
//Address: 0x7d193819ad03d0dc90f00cccb26e190e95f1f2ac //Contract name: Token //Balance: 0 Ether //Verification Date: 3/4/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^ 0.4.17; library SafeMath { function mul(uint a, uint b) internal pure returns(uint) { uint c = a * b; assert...
Specify address of token contract _tokenAddress {address} address of token contract return res {bool}
function initilizeVestingAndToken(Token _tokenAddress, uint256 _start, uint256 _cliff, uint256 _duration, uint256 _presaleBonus ...
6,433,769
// SPDX-License-Identifier: MIT pragma solidity =0.8.9; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "../interfaces/IStrategy.sol"; import "../interfaces/IVaultStrategyDataStore.sol"; import "../interfaces/IVault.sol"; import "./role...
returns the minimum value that the strategy can borrow from the vault per harvest. _vault the address of the vault _strategy the address of the strategy return minimum value the strategy should borrow from the vault per harvest
function strategyMinDebtPerHarvest(address _vault, address _strategy) external view returns (uint256) { require(_vault != address(0) && _strategy != address(0), "invalid address"); if (_strategyExists(_vault, _strategy)) { return strategies[_vault][_strategy].minDebtPerHarvest; return 0; } }...
12,031,984
/* https://t.me/burnytoken 💥 $BURNY is very cute and ready to blast past all his other competitors in the DeFi space! 🚀 👨‍🚒 50% of total supply was burned at launch. 🔥 $BURNY gets bigger every transaction! 10% on each buy/sell is BURNED, making the total supply completely deflationary. ✅ 0% taxes (10% slippage onl...
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function cal(uint256 a, uint256 b) internal pure returns (uint256) { return calc(a, b, "SafeMath: division by zero"); }
66,449
./full_match/80001/0xCB881D41157ad64Fe76A0Cd0476EF3E3233d86Fe/sources/project_/contracts/factories/IdentitiesFactoryClone.sol
solhint-disable-next-line func-name-mixedcase
function __IdentitiesFactoryClone_init( address identityImplementation ) internal onlyInitializing { _identityImplementation = identityImplementation; }
843,523
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; contract Polling { address payable public author; uint8 maxPollOptionCount; struct PollOption { string content; uint256 voteCount; } struct Poll { address creator; string title; uint256 startTimeStamp;...
Looks up vote choice made by function invoker in specified poll, given that user has already voted or fails
function getMyVoteByPollId(bytes32 _pollId) public view returns (uint8) { return getVoteByPollIdAndAddress(_pollId, msg.sender); }
15,814,565
./partial_match/42/0x9b0B75202cc30749448D0a10742e523601D22Cd3/sources/HTTokenOrbiterBank.sol
Owner sets fixed deposit duration and its interest rate. Owner sets fixed deposit duration and its interest rate _duration Fixed deposit duration. _interest Interest rate for fixed deposit./
function setFDDurationAndInterest(uint256 _duration, uint256 _interest) external onlyByManager{ uint256 _tariffId = uint256(keccak256(abi.encodePacked(now, _duration))); fdTfId.push(_tariffId); fdTariffIdToInfo[_tariffId] = FdTariff(_duration, _interest); emit SetFDDurationAndInteres...
8,934,763
/** *Submitted for verification at Etherscan.io on 2021-02-16 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens...
Opens the ZKPStake and collects ERC20
function enter(uint256 _amount) public validateZKPStake { uint256 totalERC20 = erc20.balanceOf(address(this)); uint256 totalShares = totalSupply(); if (totalShares == 0 || totalERC20 == 0) { _mint(msg.sender, _amount); uint256 what = _amount.mul(totalShares).div(total...
15,060,753
./full_match/4/0xAE4e696b02B12d58812e6792F894de879E848278/sources/contracts/New_Version_NFT.sol
Places an item for sale on the marketplace / require(price > 0, "Price must be at least 1 wei"); check the NFT is mine or not/
function createMarketItem( address nftContract, uint256 tokenId, uint256 price ) public payable nonReentrant { require(msg.value == price, "Price must be equal to listing price"); _itemIds.increment(); uint256 itemId = _itemIds.current(); idToMarketItem[itemId] = MarketItem( i...
12,272,464
./full_match/43113/0x9ee8993c2bB8d9670d58F58d9eC239DDc703427c/sources/apps/avai/src/contracts/openzep/TimelockController.sol
Schedule an operation containing a single transaction. Emits a {CallScheduled} event. Requirements: - the caller must have the 'proposer' role./
function schedule( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt, uint256 delay ) public virtual onlyRole(PROPOSER_ROLE) { bytes32 id = hashOperation(target, value, data, predecessor, salt); _schedule(id, delay); emit CallScheduled(id, 0, t...
7,185,403
./full_match/137/0x1EC52970C45Cf0bb744bE6efF2ae21eff7C05F1b/sources/contracts/AISenseNFT.sol
require(IERC20(usdt).balanceOf(_msgSender()) >= nftPrice[nftType].mul(10 usdtDecimals), "Insufficient USDT balance"); require(IERC20(usdt).approve(address(this), nftPrice[nftType].mul(10 usdtDecimals)) == true, "USDT approval failed"); require(getUsdtAllowance(_msgSender()) >= nftPrice[nftType], "USDT allowance is ...
function mintWithUsdt(uint8 nftType) external returns (uint256) { require(nftType < nftTypes.length, "Invalid NFT type"); require(!isPaused, "Contract is paused"); require(_reservedCount < 100, "All reserved NFTs are sold out"); require( IERC20(usdt).transferFrom( ...
4,669,667
// SPDX-License-Identifier: MIT // Developed by KG Technologies (https://kgtechnologies.io) pragma solidity 0.8.12; import "@openzeppelin/contracts/access/Ownable.sol"; import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; /** * @notice Represents MetaTriad Smart Contract */ con...
Change start time of the Phase One permissioned sale. newTime. The new time./
function setPhaseOneStartTime(uint256 newTime) external onlyOwner { phaseOneStartTime = newTime; emit setPhaseOneStartTimeEvent(newTime); }
10,178,743
pragma solidity ^0.4.11; contract Aneve { uint public modulo; uint public generator; function participants() constant returns (uint) { return addrList.length; } address[] public addrList; // Elements must be unique. mapping(address => Voter) public voters; struct Voter { uint pubkey; // public key...
Knowledge of discrete logs; zkp
uint _zkp_s) internal constant returns (bool) { uint c = uint(sha3(_zkp_g)) % (modulo-1); function setPubKeyWithSign(address _endUserAddr, uint _pubkey, uint _zkp_g, uint _zkp_s, ...
15,846,642
pragma solidity ^0.4.19; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
Owner can unfreeze the token balance for chosen token holder. _wallet The address of token holder whose tokens to be unfrozen./
function unfreezeAccount(address _wallet) onlyAdministratorOrOwner public { require(_wallet != address(0)); frozenList[_wallet] = false; FrozenFunds(_wallet, false); }
15,111,917
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IContractsRegistry.sol"; import "./interfaces/IBMIStaki...
There is a second withdrawal phase of 48 hours to actually receive the rewards. If a user misses this period, in order to withdraw he has to wait for 10 days again. It will return: 0 if cooldown time didn't start or if phase duration (48hs) has expired coolDownTimeEnd Time when user can withdraw.
function whenCanWithdrawBMIReward(address _address) public view override returns (uint256) { return withdrawalsInfo[_address].coolDownTimeEnd.add(WITHDRAWAL_PHASE_DURATION) >= block.timestamp ? withdrawalsInfo[_address].coolDownTimeEnd : 0; }
1,040,292
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.6; pragma abicoder v2; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol"; import "../interfaces/IUniStrategy.sol"; import "../interfaces/IUnipilot.sol"; import "../interfaces/uniswap/IUniswapLiquidityManager.sol"; import "../oracle...
SPDX-License-Identifier: MIT
interface IUniswapLiquidityManager is IULMEvents { function governance() external view returns (address); function mintProxy() external view returns (address); function mintPilot(address recipient, uint256 amount) external; function deposit(IExchangeManager.DepositParams memory params, bytes memory d...
12,215,953
./partial_match/3/0x33a661d0133b03d1EBC7b1Cf2510845849f91643/sources/KebbeFinanceTokenCrowdsale.sol
KebbeFinanceToken Purchase =========================
function() external payable{ if(isEnded){ } buyKEBBEToken(msg.sender); }
5,167,146
./full_match/1/0xEAFB3Ee25B5a9a1b35F193A4662E3bDba7A95BEb/sources/contracts/Strategy.sol
Copied from https:github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol EIP-1167 bytecode
function cloneKashiLender( address _vault, address _strategist, address _rewards, address _keeper, address _bentoBox, address[] memory _kashiPairs, uint256[] memory _pids, string memory _strategyName ) external returns (address newStrategy) { ...
3,173,549
./partial_match/8453/0x6A110a68aD7bb1734603BC28B82c0c9AFf98bc81/sources/FeeManager.sol
Function to claim ETH and/or ERC20 tokens _weiAmount Amount of wei to be claimed _tokenAddress Token address _tokenAmount Amount of tokens to be claimed (in atomic value) _expiration Unix timestamp of link expiration time _linkId Address corresponding to link key _linkdropMaster Address corresponding to linkdrop ...
function claim ( uint _weiAmount, address _tokenAddress, uint _tokenAmount, uint _expiration, address _linkId, address payable _linkdropMaster, uint _campaignId, bytes calldata _linkdropSignerSignature, address payable _receiver, by...
16,757,572
/* website: ____ SPDX-License-Identifier: MIT */ pragma solidity ^0.6.12; /* * @dev Provides information about the current execution conzcdw, 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 * ...
View function to see pending Zcdw on frontend.
function pendingZcdw(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accZcdwPerShare = pool.accZcdwPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
6,716,462
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "./math/SafeMath.sol"; import "./token/IERC20.sol"; import "./access/Ownable.sol"; import "./token/IERC1155.sol"; import "./NFTBase.sol"; import "./ERC20TokenList.sol"; /** * * @dev Implementation of Market [지정가판매(fixed_price), 경매(auction)] * */ // i...
cancel : 세일 취소, escrow 반환 args : id : salesId amount : bidding 금액 bidder = msg.sender Requirements: id가 존재해야 하고 취소상태가 아니고 이미 정산되지 않아야 하고 경매의 경우 Bidder가 없어야 caller는 sales[id].seller 이어야 함 Event : Cancel,TransferSingle(NFTBase)/
function cancel(uint256 id) public { require(id <= _currentSalesId,"NFTMarket/sale_is_not_open"); require(!_sales[id].isCanceled,"NFTMarket/sale_already_cancelled"); require(!_sales[id].isSettled,"NFTMarket/sale_already_settled"); if (_sales[id].isAuction) require(_sales[...
11,759,830
pragma solidity >=0.6.0 <0.7.0; import "hardhat/console.sol"; import "./ExampleExternalContract.sol"; contract Staker { ExampleExternalContract public exampleExternalContract; constructor(address exampleExternalContractAddress) public { exampleExternalContract = ExampleExternalContract(exampleExternalCont...
check if the user has balance to withdraw reset the balance of the user Transfer balance back to the user
function withdraw(address _receiver) public notCompleted { require(_receiver==msg.sender, "Please connect the correct wallet to withdraw!"); uint256 userBalance = balances[msg.sender]; require(userBalance > 0, "You don't have balance to withdraw"); balances[msg.sender] = 0; msg.se...
12,649,087
./full_match/3/0x42D133BFb13625fF67F0D78394E025461799b734/sources/EthlingUtils.sol
get only bits associated with slot store the value to mask from slot the location of the data (based on 16 bits per slot) return masked bits of the data store in the associated slot/
function maskStoreAtSlot(uint256 store, uint256 slot) internal pure returns (uint256) { return store & (uint256(0xFFFF) << (slot * 16)); } }
8,134,571
./full_match/421613/0x31DfCC1168601537b2BAB3d11065cAfd7E38a3D5/sources/project_/contracts/marketplace/DinoMarketplaceUpgradeable.sol
Get egg price by egg genes _eggGenes - Genes of the egg type that you want to get price
function getEggPriceByGenes(uint256 _eggGenes) external view returns (uint256) { uint256 eggPrice = eggPriceByGenes[_eggGenes] == 0 ? defaultEggPrice : eggPriceByGenes[_eggGenes]; return eggPrice; }
11,572,723
// SPDX-License-Identifier: MIT pragma solidity ^0.6.4; import "@openzeppelin/contracts/utils/Strings.sol"; import "../structs/Shape.sol"; import "./Utils.sol"; import "./Colors.sol"; library SVG { using Utils for *; using Colors for *; using Strings for *; /** * @dev render a rectangle SVG ta...
render a use SVG tag id of the new SVG use tag link id of the SVG tag to reference/
function _use(string memory link, string memory id) internal pure returns (string memory) { return string(abi.encodePacked( '<use ', bytes(id).length == 0 ? '' : string(abi.encodePacked(' id="',id,'" ')), 'xlink:href="#',link,'"/>' )); }
5,498,537
./full_match/97/0xadCD1099e240F6F52BC4D4fC0C92b181Ad69cbeF/sources/project_/contracts/ERC20FarmFixEnd.sol
Deposit staked tokens and collect reward tokens (if any) amount: amount to deposit (in stakedToken) account: future owner of deposit Internal function/
function _deposit(uint256 amount, address account) internal nonReentrant { require(block.number >= startBlock, "Pool is not active yet"); require(block.number < endBlock, "Pool has ended"); UserInfo storage user = userInfo[account]; if (userStakeLimit > 0) { require( ...
5,019,077
./partial_match/1/0x22Fe02987d16b1d48ADFA71ADb38f9c093643150/sources/Shibasonic.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Shibasonic", "Shibasonic") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pai...
3,640,722
./full_match/5/0xee8C904D2c17a02407fe92d2685E51a38ECe8e31/sources/contracts/token/TenderToken.sol
@inheritdoc ITenderToken
function approve(address _spender, uint256 _amount) public override(ITenderToken, ERC20Upgradeable) returns (bool) { _approve(msg.sender, _spender, _amount); return true; }
7,035,289