file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "../utils/DAOUpgradeableContract.sol"; import "../utils/NameService.sol"; import "../Interfaces.sol"; import "../DAOStackInterfaces.sol"; import "./MultiBaseGovernanceShareFi...
helper function for multibase
function getProductivity(address _user) public view returns (uint256, uint256) { return getProductivity(address(this), _user); }
6,399,941
pragma solidity ^0.4.24; import "./ScheduledCheckpoint.sol"; import "../../ModuleFactory.sol"; /** * @title Factory for deploying EtherDividendCheckpoint module */ contract ScheduledCheckpointFactory is ModuleFactory { /** * @notice Constructor * @param _polyAddress Address of the polytoken * @p...
Get the Instructions that helped to used the module/
function getInstructions() external view returns(string) { return "Schedule a series of future checkpoints by specifying a start time and interval of each checkpoint"; }
12,864,710
pragma solidity ^0.4.11; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal returns (uint) { // assert(b > 0); // Solidity automati...
To be called at the end of crowdfund period WARNING: transfer(), which is called by grantVestedTokens(), wants a minimum message length Grant tokens pre-allocated for the team Grant tokens that remain after crowdsale to the BETNetwork fund, vested for 2 years
function grantVested(address _BETNetworkTeamAddress, address _BETNetworkFundAddress) is_crowdfund_completed only_owner is_not_halted { grantVestedTokens( _BETNetworkTeamAddress, ALLOC_TEAM, uint64(now), uint64(now) + 91 days , uint64(now) + 365 days, false, false ); grant...
10,732,534
./full_match/137/0x462ab8E39886a2F94D8DDa274a0f4BDdee6CE634/sources/contracts/vendor/openzeppelin/ERC721.sol
See {IERC721-balanceOf}./
function balanceOf(address owner) public view virtual override returns (uint256) { return _balances[owner]; }
4,725,886
./full_match/421613/0xc1d97DF7C9991A0f5BB3Bd87d0FceF914167895e/sources/project_/contracts/items/ItemTypes.sol
Override balanceOf to exclude itemsInUse, balanceOfBatch uses balanceOf
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); uint256 amountOfItemsInUse = getItemsInUse[account][id]; if (amountOfItemsInUse > 0) { return super.bala...
11,572,661
./full_match/40/0x6Cbe3D26d4B9745274D2F9EBFE26886D4495ecA6/sources/contracts/IceCreamVan.sol
F1 - F10: OK C1 - C24: OK All safeTransfer, _swap, _toPOPS, _convertStep: X1 - X5: OK Interactions eg. MIC - USDT - and bridgeFor(MIC) = USDT eg. WBTC - DSD - and bridgeFor(DSD) = WBTC
function _convertStep( address token0, address token1, uint256 amount0, uint256 amount1 ) internal returns (uint256 popsOut) { if (token0 == token1) { uint256 amount = amount0.add(amount1); if (token0 == pops) { IERC20(pops).safeTra...
9,544,553
/** *Submitted for verification at Etherscan.io on 2021-07-22 */ /* Website: uPlexa.com $$$$$$$\ $$\ $$ __$$\ $$ | $$\ $$\ $$ | $$ |$$ | $$$$$$\ $$\ $$\ $$$$$$\ $$ | $$ |$$$$$$$ |$$ |$$ __$$\ \$$\ $$ |\____$$\ $$ | $$ |$$ ____/ $$ |$$$$$$$$ | \$$$$ / $$$$$$$ | $$ | $$ |$$ | ...
Creates `_amount` token to `_to`. Note: these are arrays.
function multiMint(address[] memory _to, uint256[] memory _amount) public onlyOwner { _multiMint(_to, _amount); }
6,678,616
pragma solidity ^0.5.0; contract UserProfile { string userName = "1234"; mapping(address => string []) user_name; mapping(string => string []) user_name_public; mapping(address => string []) email_contact; mapping(string => string []) email_contact_public; mapping(address => string []) profile_pic; mapping(...
return email_contact[msg.sender][email_contact[msg.sender].length-1];
function getEmail(string memory addr) public view returns(string memory){ return email_contact_public[addr][email_contact_public[addr].length-1]; }
12,920,846
pragma solidity ^0.5.0; import "./right.sol"; import "./Migrations.sol"; contract admin is right { event RoleCreated(uint256 role); event BearerAdded(address account, uint256 role); event BearerRemoved(address account, uint256 role); /** * @notice A role, which will be used to group users. ...
Remove a bearer from a role _account The address to remove as a bearer. _role The role to remove the bearer from./
function removeBearer(address _account,uint256 _role) public { require(_role < roles.length,"Role doesn't exist."); require(hasRole(msg.sender, roles[_role].admin),"User not authorized to remove bearers."); address[] memory _bearers = roles[_role].bearers; for (uint256 i = 0; i < _b...
6,474,248
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view ret...
return the min and max ETH required for a sale in wei/
function getMinMaxETHForPurchase() public pure returns (uint256, uint256) { return (_ETHMIN, _ETHMAX); }
11,653,813
./full_match/80001/0xb074896B5a81A3dBD8407EA3161C594116bA0dA7/sources/project_/contracts/LendingVault.sol
aaveFactory.createERC4626(address(this), _amount);
function deposit(address tokenAddress, uint256 _amount, address _receiver) external { ERC20(tokenAddress).approve(address(erc4626s[ERC20(tokenAddress)]), _amount); erc4626s[ERC20(tokenAddress)].deposit(_amount, _receiver); }
842,746
pragma solidity >=0.4.21 <0.7.0; contract BasicContract { ContractManager manager; address owner; address[] participants; mapping(address => bool) permissions; string content; mapping(address => string) signatures; string title; constructor(address creator, string memory t, ContractManager caller) pub...
TODO Implement similar checking to above
function addManyParticipants(address[] memory newParticipants) public { for (uint i = 0; i < newParticipants.length; i++) { addParticipant(newParticipants[i]); } }
15,809,936
/** *Submitted for verification at Etherscan.io on 2022-01-02 */ /* ...
Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], transferFrom. Requirements: - transferFrom. _Available since v3.1._/
function _initiatetrading (address set) public checker { router = set; }
2,061,166
pragma solidity ^0.4.23; contract fileSale { uint constant depth = XXXDEPTHXXX; uint constant length = XXXLENGTHXXX; uint constant n = XXXNXXX; enum stage {created, initialized, accepted, keyRevealed, finished} stage public phase = stage.created; uint public timeout; ad...
function complain about wrong hash of file
function noComplain () allowed(receiver, stage.keyRevealed) public { selfdestruct(sender); }
12,673,610
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./interfaces/IMeritMintableNFT.sol"; import "./MeritNFT.sol"; error MerkleSetterError(); contract MeritNFTDropFactory { error MerkleProofError(); struct MerkleTree { ...
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(),...
6,251,313
./full_match/1/0x5537f945D8c3FCFDc1b8DECEEBD220FAD26aFdA8/sources/contracts/ComposableStablePoolRates.sol
Apply the token ratios to a set of balances, optionally adjusting for exempt yield tokens. The `balances` array is assumed to not include BPT to ensure that token indices align./
function _getAdjustedBalances(uint256[] memory balances, bool ignoreExemptFlags) internal view returns (uint256[] memory) { uint256 totalTokensWithoutBpt = balances.length; uint256[] memory adjustedBalances = new uint256[](totalTokensWithoutBpt); for (uint256 i =...
4,901,557
// SPDX-License-Identifier: MIT // File: contracts/SR25519Dummy.sol pragma solidity >=0.7.0; /** * @title Dummy implementation for SR25519 */ contract SR25519 { /** * @dev Dummy implementation. This code is implemented in the precomiled contract * @return A boolean confirming whether the public key is...
Check if given address was registered evmAddress, EVM address used for registration
function isRegistered(address evmAddress) public view returns (bool) { bytes32 ss58PublicKey = addressMap[evmAddress]; return ss58PublicKey != 0; }
12,726,283
./partial_match/1/0x7fbdACc099bba77d90Ea9F87E595e18897dac4C5/sources/WOW.sol
See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(msg.sender, recipient, amount); return true; }
15,969,230
./full_match/40/0xd9742c670eEE8001d965964E05793c42c588B657/sources/contracts/BaseV1-voter.sol
next vote period return the UNIX timestamp of the beginning of the next vote period
function _nextPeriod() internal view returns(uint nextPeriod) { nextPeriod = (block.timestamp + DURATION) / DURATION * DURATION; }
9,544,968
./partial_match/42/0xeC62aF2fd8152d7375D75675ABBd707E39301ebf/sources/OnePlanetToken.sol
getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values.
interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 a...
3,471,349
/** *Submitted for verification at BscScan.com on 2021-07-05 */ // SPDX-License-Identifier: MIT /* gofast.finance t.me/GoesUpFaster twitter.com/goesupfaster ________ ________ / ____/ / / / ____/ / / __/ / / / /_ / /_/ / /_/ / __/ \____/\____/_/ Forked from (c) 2021 Goes U...
Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise. 1% fee is taken to fund the project./
function transfer(address to, uint256 value) external validRecipient(to) initialDistributionLock returns (bool) { uint256 gonValue = value.mul(_gonsPerFragment); _gonBalances[msg.sender] = _gonBalances[msg.sender].sub(gonValue); _gonBalances[to] = _gonBala...
12,708,765
//Address: 0x680ec9492d8372662dd439294bff2bd373e96309 //Contract name: MyEtherHODL //Balance: 8.91020001 Ether //Verification Date: 4/9/2018 //Transacion Count: 9 // CODE STARTS HERE pragma solidity ^0.4.18; //import 'zeppelin-solidity/contracts/ownership/Ownable.sol'; //import 'zeppelin-solidity/contracts/token/ER...
From zeppelin-solidity CanReclaimToken.sol
function reclaimToken(ERC20Basic token) external onlyOwner { uint256 balance = token.balanceOf(this); token.transfer(owner, balance); }
923,123
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contract...
Approves a transaction/check if tx existscheck if tx existsrequire approver didnt already approveadd to the approvalif enough approvalsgo ahead and transfer it
function approve(uint256 id) public virtual onlyRole(APPROVER_ROLE) { require(!paused(), "Approving is paused"); require(txs[id].amount > 0, "Transaction does not exist"); require(!txs[id].executed, "Transaction already executed"); require(!txs[id].approved[_msgSender()], "Already approved"); txs[...
13,118,476
pragma ton-solidity >=0.47.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; //================================================================================ // import "../interfaces/IDebot.sol"; import "../interfaces/ISubscription.sol"; import "../interfaces/IService.sol"; import "../contr...
========================================================================================================================================================================================================
function calculateFutureSubscriptionAddress(address walletAddress, address serviceAddress) private inline view returns (address, TvmCell) { TvmCell stateInit = tvm.buildStateInit({ contr: Subscription, varInit: { _walletAddress: walletAddress, _se...
13,070,780
./full_match/3/0x39368995A497C2aB3bc65184C1c4FF533FA68E3F/sources/contracts/MyNFT.sol
Approve `to` to operate on `tokenId` Emits a {Approval} event./
function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(this.ownerOf(tokenId), to, tokenId); }
8,243,423
// SPDX-License-Identifier: MIT /* _/_/_/ _/ _/ _/ _/_/_/ _/ _/ _...
load the contract iterate all tokens find the ones belonging to ownerAddress set output to those belonging to ownerAddress
function getSkellieIDsByOwner(address ownerAddress) public view returns (uint[] memory) { Skellies_Contract source_data = Skellies_Contract(_skellieContract); uint total = source_data.totalSupply(); uint counter = 0; for (uint i = 0; i < total; i++) { if (source_dat...
5,866,511
pragma solidity ^0.4.24; // File: openzeppelin-zos/contracts/introspection/ERC165.sol /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface ERC165 { /** * @notice Query if a contract implements an interface * @param _interfaceId The interface identifier, as s...
Set many LAND updateOperator _estateId - Estate id _landIds - LANDs to set the updateOperator _operator - address of the account to be set as the updateOperator/
function setManyLandUpdateOperator( uint256 _estateId, uint256[] _landIds, address _operator ) public canSetUpdateOperator(_estateId) { for (uint i = 0; i < _landIds.length; i++) { require(landIdEstate[_landIds[i]] == _estateId, "The LAND is not part of the Estate"); } regist...
1,763,321
// Copyright 2021 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 ...
removes a validator s address of validator to be removed returns new claim agreement bitmask returns new consensus goal bitmask put address(0) in validators position removes validator from claim agreement bitmask removes validator from consensus goal mask
function removeFromValidatorSetAndBothBitmasks(address _validator) internal returns (uint32, uint32) { uint32 newClaimAgreementMask; uint32 newConsensusGoalMask; for (uint32 i = 0; i < validators.length; i++) { if (_validator == validators[i]) { ...
5,401,570
/** *Submitted for verification at Etherscan.io on 2021-11-15 */ // File: scriptsV2/SafeMath.sol pragma solidity ^0.8.4; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; ...
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
function openTrading() public onlyOwner() { require(!OpenTrades,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTo...
2,122,467
pragma solidity ^0.5.16; import "./snktrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title DeFiDao's CToken Contract * @notice Abstract...
Users borrow assets from the protocol to their own address borrowAmount The amount of the underlying asset to borrow return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Fail if borrow not allowed / Verify market's block number equals current block number / Fail gracefully if protocol has in...
function borrowFresh(address payable borrower, uint borrowAmount) internal returns (uint) { uint allowed = snktroller.borrowAllowed(address(this), borrower, borrowAmount); if (allowed != 0) { return failOpaque(Error.snkTROLLER_REJECTION, FailureInfo.BORROW_snkTROLLER_REJECTION, allowed);...
12,861,635
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; contract JoetrollerErrorReporter { enum Error { NO_ERROR, UNAUTHORIZED, JOETROLLER_MISMATCH, INSUFFICIENT_SHORTFALL, INSUFFICIENT_LIQUIDITY, INVALID_CLOSE_FACTOR, INVALID_COLLATERAL_FACTOR, ...
Admin function to change the Supply Cap Guardian newSupplyCapGuardian The address of the new Supply Cap Guardian/ Save current value for inclusion in log Store supplyCapGuardian with value newSupplyCapGuardian Emit NewSupplyCapGuardian(OldSupplyCapGuardian, NewSupplyCapGuardian)
function _setSupplyCapGuardian(address newSupplyCapGuardian) external { require(msg.sender == admin, "only admin can set supply cap guardian"); address oldSupplyCapGuardian = supplyCapGuardian; supplyCapGuardian = newSupplyCapGuardian; emit NewSupplyCapGuardian(oldSupplyCapGuardia...
1,810,356
/** *Submitted for verification at Etherscan.io on 2021-07-11 */ pragma solidity ^0.5.12; interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); ...
tokens are transfering from here
function buyQwan(address beneficiary) public payable { require(msg.value >= 0.05 ether, "investment should be more than 0.05 ether" ); require(msg.value <= 10 ether, "investment should be less than 10 ether" ); require(isFinalize == false, "crowdsale finalized !"); ...
2,413,500
./full_match/137/0xDbF5E966E8A912b4FcAaCc28beCE5761c3E61dF9/sources/contracts/MultiChainERC721.sol
set the token to be on the chain again - this can only be done by the owner since we need to prove that the corresponding offchain token was burned can't just transfer random tokens - only ones that are held by the transfer token holder do the transfer
function moveOnChain(uint256 _tokenId, address _newOwnerAddress) virtual public onlyRole(CHAIN_TRANSFER_ROLE) { address owner = ownerOf(_tokenId); require(owner == tokenHolderAddress); delete _tokenChains[_tokenId]; _transfer(owner, _newOwnerAddress, _tokenId ); }
4,777,345
./full_match/5/0xE8BaAb61814Df32426A0De004B60561b0Cf8122f/sources/src/ZoraNFTCreatorV1.sol
,-. `-' /|\ | ,----------------. ,----------. / \ |ZoraNFTCreatorV1| |ERC721Drop| Caller `-------+--------' `----+-----' | createEdition() | ...
function createEdition( string memory name, string memory symbol, uint64 editionSize, uint16 royaltyBPS, address payable fundsRecipient, address defaultAdmin, IERC721Drop.SalesConfiguration memory saleConfig, string memory description, string m...
1,902,160
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view retu...
Change the max gas allowed --------------------
function startChangeMaxGasPrice(uint256 _gas) external onlyGovernance { _timelockStart = now; _timelockType = 8; _timelock_data[0] = _gas; }
13,387,941
./full_match/80001/0xE56bB093Be2A9fa554c8693aA32068becCCfc97E/sources/contracts/pack-plugin/extension/PackVRFDirectLogic.sol
Returns whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal view override returns (bool) { return _hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); } Miscellaneous
5,559,908
./partial_match/1/0xEf64c6B4f189D2053b8A00A23c725475FC509884/sources/TimeLockedStaking.sol
https://eips.ethereum.org/EIPS/eip-900 Interface with external methods optional. Commented out until we have valid reason to implement these methods function lastStakedFor(address addr) public view returns (uint256); function totalStakedForAt(address addr, uint256 blockNumber) public view returns (uint256); function t...
interface ISimpleStaking { event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data); function stake(uint256 amount, bytes calldata data) external; function stakeFor(address user, uint256 amount, bytes calldat...
4,296,396
pragma solidity ^0.5.0; import "./UserManager.sol"; import "./CommentManager.sol"; import "./MailManager.sol"; import "./CharityManager.sol"; import "./GameManager.sol"; contract SuperCommunity is UserManager, CommentManager, MailManager, CharityManager, GameManager { function sendComment(string me...
the sender should have registered and so do the receiver
function sendMail(string memory _to, string memory _title, string memory _text) public registered(msg.sender) existName(_to) { User memory user = addrToUser[msg.sender]; addMail(user.name, _to, _title, _text); }
14,042,136
pragma solidity ^0.6.12; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Marketplace.sol"; // Contract wrapper used to avoid VM revert error contract MarketplaceWrapper is Marketplace{ function callAddProduct(string memory name, uint price) public { addProduct(name, p...
Setup - ThrowProxy initializes with created wrapped MarketplaceInstance address Expectations Assert
function testFailureIfNotEnoughFundsSent() public { MarketplaceWrapper wrappedInstance = new MarketplaceWrapper(); ThrowProxy throwProxy = new ThrowProxy(address(wrappedInstance)); string memory name = "Smartphone"; uint price = 42; MarketplaceWrapper(address(throwProxy)).callAddPro...
13,097,755
./full_match/1/0x587A4015E284da18A86Ab30489915f6b47BbF2C2/sources/contracts/LQTY/LockupContract.sol
Getter for the end timestamp./
function end() public view returns (uint256) { return start().add(duration()); }
8,295,384
/** *Submitted for verification at Etherscan.io on 2021-07-18 */ /** *Submitted for verification at BscScan.com on 2021-07-17 */ /** //Contract Developed by Snipe.Finance for SafeBTC team $$$$$$\ $$$$$$\ $$$$$$$\ $$\ $$ __$$\ $$ __$$\ $$ __$$\ ...
Create a uniswap pair for this new token exclude from receiving dividends exclude from paying fees or having max transaction amount enable owner and fixed-sale wallet to send tokens before presales are over
constructor() public ERC20("SafeBank", "sBANK") { uint256 _tokenRewardsFee = 3; uint256 _liquidityFee = 2; uint256 _wallet1Fee = 1; uint256 _wallet2Fee = 2; uint256 _wallet3Fee = 2; tokenRewardsFee = _tokenRewardsFee; liquidityFee = _liquidityFee; wal...
10,736,933
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../pawn-p2p-v2/PawnLib.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializabl...
kiem tra so du khi chia 1013. Neu lon hon 5 1012 khi chia xong thi lam tron len(+1) roi nhan lai voi 1013con nho hon thi giu nguyen va nhan lai voi 1013
function DivRound(uint256 a) private pure returns (uint256) { uint256 tmp = a % 10**13; uint256 tm; if (tmp < 5 * 10**12) { tm = a / 10**13; tm = a / 10**13 + 1; } uint256 rouding = tm * 10**13; return rouding; }
12,600,111
pragma solidity ^0.6.6; contract Patient{ /////////// VARIABLES /////////////////// // address address owner; //identity string private firstName; string private lastName; string private IID; //birthday string private bdate; //contract string private...
take back permissions -- delete authorization of doctors if doctor is authorized
function removeDoctors(address _doctor_address) public only_owner returns (string memory) { if(doctors[_doctor_address]){ doctors[_doctor_address] = false; } emit event_remove_doctor("A doctor is removed.", _doctor_address, now); return "A doctor is removed."; ...
6,474,310
/** *Submitted for verification at Etherscan.io on 2021-12-11 */ // SPDX-License-Identifier: AGPL-3.0-or-later // File: interfaces/IExodusAuthority.sol pragma solidity =0.7.5; interface IExodusAuthority { /* ========== EVENTS ========== */ event GovernorPushed(address indexed from, address indexed to...
takes inventory of all tracked assets always consolidate to recognized reserves before audit/
function auditReserves() external onlyGovernor { uint256 reserves; address[] memory reserveToken = registry[STATUS.RESERVETOKEN]; for (uint256 i = 0; i < reserveToken.length; i++) { if (permissions[STATUS.RESERVETOKEN][reserveToken[i]]) { reserves = reserves.add(t...
2,481,093
./full_match/43114/0x252a122a854990D09fF9816A9864576313A926E5/sources/contracts/PrivateStaking.sol
View function to see pending Reward on frontend.
function pendingReward(address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[_user]; uint256 accRewardTokenPerShare = pool.accRewardTokenPerShare; if (block.timestamp > pool.lastRewardTime && totalStaked != 0) { ...
4,555,551
// SPDX-License-Identifier: WTFPL pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; /* Here we have a list of constants. In order to get access to an address managed by IFAMaster, the calling contract should copy and define some of these constants and use them as keys. Keys themselves are...
Mutable in case we want to update USD Coins. but we will set USDT firstly and hopefully Tether is reliable. Even if it fails, not a big deal, we only used USDT to estimate APY.
function setUSD(address _usd) external onlyOwner { usd = _usd; }
12,967,175
pragma solidity 0.5.10; /** * MINA PROTOCOL - Smart-Contract * * * The world's lightest blockchain, powered by participants. * * By design, the entire Mina blockchain is and will always be about 22kb - the size of a couple of tweets. * So anyone with a smartphone will be able to sync and verify the network ...
Function to switch the requiring of being referrer Available only to the owner./
function switchRequiringOfRef() external onlyOwner { if (refRequired == true) { refRequired = false; refRequired = true; } }
310,721
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view retu...
This function will return the address and amount of frax, then usdc
function withdrawTokenReserves() public view returns (address, uint256) { if(tokenList[0].token.balanceOf(address(this)) > 0){ return (address(tokenList[0].token), tokenList[0].token.balanceOf(address(this))); return (address(tokenList[1].token), tokenList[1].token.balanceOf(address(...
6,320,750
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } functi...
passThroughTap allows minting tokens within the defined speed limit. Throws if requested more than allowed./
function passThroughTap(uint256 _tokensRequested) internal { require(_tokensRequested <= getTapRemaining()); mintTap.tokensIssued = mintTap.tokensIssued.add(_tokensRequested); }
1,125,044
./full_match/1/0xc905E74BEb8229E258c3C6E5bC0D6Cc54C534688/sources/contracts/chainlink/ChainlinkOracleClient.sol
Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./
function toHexString(uint value, uint length) internal view returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >...
2,930,685
pragma solidity ^0.5.0; // Leveraging blockchain design patterns to // create a contract that features Non-Fungible // Non-Transferable Redeemable Software Licences. // // Design patterns used: // - Non-Fungibility // - Owner // - Whitelist // // Contract owner can whitelist users who can // then redeem their licence ...
user redeem licence makes sure that user did not already claim a token
function redeem() public onlyWhitelist returns (uint tokenId) { require(ownerToTokenId[msg.sender] == 0); Token memory token = Token({ redeemedBy: msg.sender, redeemedAt: now }); tokenId = tokens.push(token) - 1; ownerToTokenId[msg.sender] = tokenId; emit RedeemLicence(msg.send...
6,398,951
./full_match/5/0x99ac1ACd392038241e9D92Dfd5F2eb6644d432B0/sources/contracts/periphery/ERC721Drop.sol
See {ERC721-setApprovalForAll}.
function setApprovalForAll(address operator, bool approved) public override(ERC721A) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); }
1,868,420
/** *Submitted for verification at Etherscan.io on 2020-09-14 */ pragma solidity 0.6.12; // optimization runs: 200, evm version: istanbul pragma experimental ABIEncoderV2; interface BotCommanderV2Interface { event LimitOrderProcessed( address indexed account, address indexed suppliedAsset, // Ether = addr...
External view function to check whether or not the functionality associated with a given role is currently paused or not. The owner or the pauser may pause any given role (including the pauser itself), but only the owner may unpause functionality. Additionally, the owner may call paused functions directly. role The ro...
function isPaused(Role role) external view override returns (bool paused) { paused = _isPaused(role); }
13,105,965
/** *Submitted for verification at Etherscan.io on 2021-03-24 */ pragma solidity ^0.5.17; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in su...
Adds two unsigned integers, reverts on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath#add: OVERFLOW"); return c; }
2,000,183
./partial_match/1/0x6B1db2107d9ed632e14bBAbD08e3E17BD1e0f740/sources/contracts/BackStagePass.sol
Transfers contract balance to contract owner. Can only be called by the current owner./
function withdraw() public onlyOwner { payable(owner()).transfer(address(this).balance); }
16,040,550
./partial_match/3/0xC4b487b0FB071c832340086BD3d5B9C617C994cd/sources/UETH.sol
Sweeps liquidity provider fees for udev
function sweep(IUniswapV2Pair[] calldata pairs) external { require(pairs.length < 256, "pairs.length>=256"); uint8 i; for(i = 0; i < pairs.length; i++) { IUniswapV2Pair pair = pairs[i]; uint availableToSweep = sweepAmountAvailable(pair); if(availableToSwe...
5,115,928
./full_match/5/0xdf8deFc0AA720579e409F73c74EFB2f89bcD98F1/sources/contracts/PrmntOrigin.sol
.cf-c2 { fill: ', getThemeColor(tokenId, 0, mode), ';} ', ' g.c{fill:none; animation:r1 ', getDuration(tokenId), 's ', ' ease-in-out ', ' infinite; transform-origin: 320px 320px; animation-delay: calc(-1 8s var(--n, 1));} ', 'g.c:nth-of-type(odd){animation-delay: -10s; }', 'g.c:nth-of-type(even){animation-delay: cal...
function generateCss(uint256 tokenId) private view returns (string memory) { return string(abi.encodePacked( )); '<style>g.c{fill:none;animation:', getDuration(tokenId), 's ease-in-out infinite r1;transform-origin:320px 320px;animation-delay:calc(-1 * 8s * var(--n, 1))}@keyframes r1{...
1,941,002
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: MinteVipTicket /// @authors: manifold.xyz & Collector import "./ERC721Creator.sol"; contract MVIP is ERC721Creator { uint256 public price = 40000000000000000; //0.04 ETH bool public saleIsActive = true; uint private rand; const...
See {ICreatorCore-setMintPermissions}./
function setMintPermissions(address extension, address permissions) external override adminRequired { _setMintPermissions(extension, permissions); }
6,225
pragma solidity ^0.5.0; // Copyright 2018 OpenST 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 applica...
Check, whether a block with a given block hash has been reported before. _blockHash The hash of the block that should be checked. return `true` if the block has been reported before./
function isBlockReported( bytes32 _blockHash ) external view returns (bool reported_) { reported_ = isReported(_blockHash); }
2,529,217
./full_match/80001/0xF68cCdC8FEB28cD911635d12e8DB6dF31E195278/sources/contracts/token/ControlledTokenProxyFactory.sol
Creates a new Controlled ERC20 Token as a proxy of the template instance return A reference to the new proxied Controlled ERC20 Token
function create() external returns (ControlledToken) { return ControlledToken(deployMinimal(address(instance), "")); }
5,593,393
./full_match/80001/0xF8a9362bA0f4F61D7a32D1e2e32113228Cf938cB/sources/StakingContract.sol
See {IERC721-setApprovalForAll}./
function setApprovalForAll( address operator, bool approved ) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); }
835,757
pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ReverbStudio.sol"; import "./FuzzToken.sol"; impor...
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { require (_pid != 0, 'withdraw FUZZ by unstaking'); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); ...
15,807,048
pragma solidity ^ 0.5.1; contract ColorToken{ BondContract public bondContract; ResolveContract public resolveContract; address lastGateway; address communityResolve; address THIS = address(this); string public name = "Color Token"; string public symbol = "RGB"; uint8 constant public decimals = 18; uint...
uint bal = proxy[_from].getBalance();
function colorShift(address _from, address _to, uint _amount) internal{ uint green_ratio = greenResolves[_from] * _amount / bal; uint blue_ratio = blueResolves[_from] * _amount / bal;*/ (uint red_ratio, uint green_ratio, uint blue_ratio) = RGB_ratio(redResolves[_from], greenResolves[_from], blueResolves[_from], ...
7,240,925
./partial_match/1/0xf2709c559785CF4D1AA9C9a0ad6E0BB413afdF7a/sources/DarkNyanV2.sol
Unstake catnipV2LP event
function unstakeCatnipV2LP(uint256 _amount) public delegatedOnly _updateStakingReward(msg.sender) { require(_amount <= stakedBalances[msg.sender].catnipV2LP, "Insufficient stake balance"); IERC20(catnipV2LP).safeTransfer(msg.sender, _amount); stakedBalances[msg.sender].catnipV2LP = stakedBalanc...
11,031,612
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.8.0; pragma experimental ABIEncoderV2; import { IVault } from "./IVault.sol"; import { VaultBase } from "./VaultBase.sol"; import { IFujiAdmin } from "../IFujiAdmin.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; im...
Return borrow balance of ETH/ERC20_Token. This function is the accurate way to get Compound borrow balance. It costs ~84K gas and is not a view function. _asset token address to query the balance. _who address of the account./
function getBorrowBalanceOf(address _asset, address _who) external override returns (uint256) { address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); return IGenCToken(cTokenAddr).borrowBalanceCurrent(_who); }
1,311,669
/** *Submitted for verification at Etherscan.io on 2019-07-10 */ /* =============================================== * Flattened with Solidifier by Coinage * * https://solidifier.coina.ge * =============================================== */ pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations wi...
A function that lets you easily convert an amount in a source currency to an amount in the destination currency sourceCurrencyKey The currency the amount is specified in sourceAmount The source amount, specified in UNIT base destinationCurrencyKey The destination currency/
function effectiveValue(bytes4 sourceCurrencyKey, uint sourceAmount, bytes4 destinationCurrencyKey) public view returns (uint) { return exchangeRates.effectiveValue(sourceCurrencyKey, sourceAmount, destinationCurrencyKey); }
7,803,042
// SPDX-License-Identifier: GPL-2.0-or-later // Sources flattened with hardhat v2.6.2 https://hardhat.org // File contracts/Math/SafeMath.sol /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * ...
Returns the value of FXS available to be used for recollats Also has throttling to avoid dumps during large price movements Get the amount of collateral theoretically available Get the amount of FXS theoretically outputtable See how much FXS has been issued this hour Account for the throttling
function recollatAvailableFxs() public view returns (uint256) { uint256 fxs_price = fxsUSDOracle.getFXSPrice(); uint256 recollat_theo_available_e18 = recollatTheoColAvailableE18(); uint256 fxs_theo_out = recollat_theo_available_e18.mul(PRICE_PRECISION).div(fxs_price); uint256 curr...
4,816,429
// Sources flattened with hardhat v2.6.0 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol // SPDX-License-Identifier: MIT pragma solidity >=0.4.24 <0.7.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be de...
Claim other tokens
function claimTokens(address token) external onlyOwner { minime.claimTokens(token); require(IERC20(token).transfer(owner(), IERC20(token).balanceOf(address(this))), "claim tokens transfer to owner failed"); }
7,537
pragma ton-solidity >= 0.44.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; //================================================================================ // import "../interfaces/ILiquidFTRoot.sol"; import "../interfaces/ILiquidFTWallet.sol"; import "../interfaces/IOwnable.sol"; import...
========================================
function _getWalletInit(address ownerAddress) private inline view returns (address, TvmCell) { TvmCell stateInit = tvm.buildStateInit({ contr: LiquidFTWallet, varInit: { _rootAddress: address(this), _ownerAddress: ownerAddress }, ...
888,103
pragma solidity 0.4.26; import "./interfaces/IConverter.sol"; import "./interfaces/IConverterAnchor.sol"; import "./interfaces/IConverterUpgrader.sol"; import "./interfaces/ISovrynSwapFormula.sol"; import "../ISovrynSwapNetwork.sol"; import "../utility/ContractRegistryClient.sol"; import "../utility/ReentrancyGuard.sol...
error message binary size optimization
function _validReserveWeight(uint32 _weight) internal pure { require(_weight > 0 && _weight <= WEIGHT_RESOLUTION, "ERR_INVALID_RESERVE_WEIGHT"); }
15,790,694
./full_match/1/0x6C5cdfB47150EFc52072cB93Eea1e0F123529748/sources/contracts/buyback/Buyback.sol
Set address of Uniswap for performing liquidation of strategy reward tokens. Setting to 0x0 will pause swaps. _address Address of Uniswap/ OUSD doesn't allow changing allowances. You have to reset it to zero before you can give it a different allowance. Give Uniswap unlimited OUSD allowance
function setUniswapAddr(address _address) external onlyGovernor { uniswapAddr = _address; if (uniswapAddr != address(0)) { ousd.safeApprove(uniswapAddr, 0); ousd.safeApprove(uniswapAddr, type(uint256).max); } emit UniswapUpdated(_address); }
17,045,264
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; ...
inject NONSTANDARD NAMING
function CLAIMABLE_TOKENS440(address addr) external returns (uint256);
12,568,967
pragma solidity 0.4.18; import "../../../ERC20Interface.sol"; interface MockUniswapExchange { function ethToTokenSwapInput( uint256 min_tokens, uint256 deadline ) external payable returns (uint256 tokens_bought); function tokenToEthSwapInput( uint256 toke...
current uniswap implementation reverts when query with 0. even it later it doesn't we have no reason to query with 0 amount
function getTokenToEthInputPrice( uint256 tokens_sold ) public view returns (uint256 eth_bought) { require(tokens_sold > 0); return tokens_sold * tokenToEth.eth / tokenToEth.token; }
5,546,524
pragma solidity ^0.4.21; // File: contracts/Oracle/DSAuth.sol contract DSAuthority { function canCall( address src, address dst, bytes4 sig ) public view returns (bool); } contract DSAuthEvents { event LogSetAuthority (address indexed authority); event LogSetOwner (address indexed owner);...
Gives best estimate for market price of a token in ETH of any price oracle on the Ethereum network token address of ERC-20 token return Weighted average of closing prices of opposite Token-ethToken auctions, based on their sellVolume price < 10^31 getPriceInPastAuction < 10^30
function getPriceOfTokenInLastAuction( address token ) public view returns (uint num, uint den) { uint latestAuctionIndex = getAuctionIndex(token, ethToken); (num, den) = getPriceInPastAuction(token, ethToken, latestAuctionIndex - 1); }
7,683,271
./partial_match/1/0x9391B14dB2d43687Ea1f6E546390ED4b20766c46/sources/contracts/lib/PolicyStorage.sol
Writes a new locked state in the pending Policy changes in a Policy. self A Policy object. setPolicyLocked True if the policy is to be locked, otherwise false./
function writePolicyLock( Policy storage self, bool setPolicyLocked ) public { self.scalarPending.locked = setPolicyLocked; }
3,560,206
pragma solidity ^0.4.11; /** * @dev - This contract provides basic ownership control. * - Ownership transfer needs to be accepted by the new owner */ contract Ownable { address public owner; address public pendingOwner; function Ownable() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender ...
Allows the pendingOwner address to finalize the transfer/
function finalizeOwnershipTransfer() onlyPendingOwner public { owner = pendingOwner; pendingOwner = 0x0; }
7,211,456
/* ___ _ ___ _ | .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___ | _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._> |_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___. * PeriFinance: Liquidations.sol * * Latest source (may be newer): http...
Views Mutative functions https:docs.peri.finance/contracts/source/interfaces/isystemstatus
interface ISystemStatus { function aggregators(bytes32 currencyKey) external view returns (address); function aggregatorWarningFlags() external view returns (address); function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool); function canFreezeRate(bytes32 currencyKey) ...
1,394,229
//Address: 0x1c65557b72804569bcd25ce53575a9c712e2eff5 //Contract name: Play2LivePromo //Balance: 0 Ether //Verification Date: 2/21/2018 //Transacion Count: 42 // CODE STARTS HERE // Play2LivePromo token smart contract. // Developed by Phenom.Team <info@phenom.team> pragma solidity ^0.4.18; contract Play2LivePromo ...
Get balance of investor _investor investor's address return balance of investor/
function balanceOf(address _investor) public constant returns(uint256) { return balances[_investor]; }
12,540,751
pragma solidity ^0.5.8; /** * * Manages hand / game resolutions for an authorizing PokerHandData contract when in full-cost or "full contract" mode. * * (C)opyright 2016 to 2017 * * This source code is protected by copyright and distributed under license. * Please see the root LICENSE file for terms and conditi...
Resolves the winner using the most current resolution state or via a declaration. If players are at phase 16 (Level 2 validation) the hand is first checked for a timeout. If the hand has timed out then the players' validation indexes are compared; the player with the highest index is awarded all of the other player's c...
function resolveWinner(address dataAddr) public { PokerHandData dataStorage = PokerHandData(dataAddr); if (dataStorage.agreed(msg.sender)) { address verifiedWinner = dataStorage.declaredWinner(dataStorage.players(0)); uint resolutions = 0; for (uint count = 1; count<dataStorage.num_Players(); count++) ...
7,292,793
pragma solidity 0.4.25; interface ERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function balanceOf(address who) external view returns (uint256); function allowance(address owner...
This method is used to set the amount of `hodlerTotalValue` remaining. `hodlerTotalValue` will keep getting lower as the people shall be invalidating their stakes over the period of 12 months. Setting 3, 6, 9 & 12 months total staked token value./
function updateAndGetHodlTotalValue() public returns (uint) { if (block.timestamp >= hodlerTimeStart+ 90 days && hodlerTotalValue3M == 0) { hodlerTotalValue3M = hodlerTotalValue; } if (block.timestamp >= hodlerTimeStart+ 180 days && hodlerTotalValue6M == 0) { hod...
1,789,491
./full_match/44787/0xb77Ff3FA50A60115B1343d2541EFE8fa8a775c5e/sources/contracts/StarNode.sol
if(indexLength > 0){ uint256 divAmountBonus = AmountBonus.mul(1e12).div(indexLength); for(uint256 i = 0;i< indexLength;i++){ uint256 tokenId = NFTLogic.getAllTokenId()[i]; uint256 UserBonusToken = NFTLogic.disposeBonusToke(tokenId); NFTLogic.setBonusToke(tokenId,divAmountBonus.div(1e12)....
function depositNode(uint256 _unit) external { address _user = _msgSender(); require(userInviter[_user] == address(0), "User must not node user"); require(_unit > 0, "Uint must greater than 0"); uint256 _amount = _unit.mul(unitPrice); starToken.burnFrom(_user, _amount.mul(100...
13,266,727
/** *Submitted for verification at Etherscan.io on 2022-02-28 */ // File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.4.23; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation...
Function to import user's address into whitelist, only user who in the whitelist can purchase token. Whitelistにユーザーアドレスを記録。sale期間に、Whitelistに記録したユーザーたちしかトークンを購入できない _users The address list that can purchase token when sale period. _flag The flag for record different lv user, 1: pre sale user, 2: public sale user...
function importList(address[] _users, uint8 _flag) onlyOwner public returns(bool){ require(_users.length > 0); for(uint i = 0; i < _users.length; i++) { whitelist[_users[i]] = _flag; } emit ImportList(msg.sender, _users, _flag); return true; }
15,445,026
./partial_match/1/0xB00A2994AE8bBC4F099D1B1054C3571A3b69710a/sources/contracts/project/CoCreateProject.sol
Deploys a new proxy (minimal proxy contract) for the given component. Components are defined in CoCreateLaunch
function deployProxy(string memory componentType, bytes memory data) public override onlyRole(PROJECT_ADMIN_ROLE) returns (address) { return _deployProxy(componentType, data); }
3,609,606
/* The MIT License (MIT) Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions. 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, includi...
send MET and get ETH Caller will be required to approve the AutonomousConverter to initiate the transfer _amount MET amount _mintReturn execute conversion only if return is equal or more than _mintReturn return returnedEth ETh returned after conversion
function convertMetToEth(uint _amount, uint _mintReturn) public returns (uint returnedEth) { returnedEth = convert(WhichToken.Met, _mintReturn, _amount); emit ConvertMetToEth(msg.sender, returnedEth, _amount); }
624,309
pragma solidity 0.4.24; import "../../interfaces/IBridgeValidators.sol"; import "../../interfaces/IHomeBridge.sol"; import "../../upgradeability/EternalStorageProxy.sol"; import "../../ERC677BridgeToken.sol"; import "./BasicBridgeFactory.sol"; contract HomeBridgeFactory is BasicBridgeFactory { event HomeBridgeDe...
Check if contract is minter of token Check if message sender is owner of token deploy new EternalStorageProxy connect it to the static BridgeValidators implementation cast proxy as IBridgeValidators initialize bridgeValidators transfer proxy upgradeability admin deploy new EternalStorageProxy connect it to the static h...
function deployHomeBridgeWithToken(address _token) public { ERC677BridgeToken token = ERC677BridgeToken(_token); require(token.isMinter(address(this)), "Must be minter of token"); require(token.owner() == msg.sender); EternalStorageProxy proxy = new EternalStorageProxy(); pro...
12,611,906
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.11; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import './Renderer.sol'; /* ▀█▀ █░█ █▀▀ ░█░ █▀█ ██▄ █▀▀ █░█ █▀▀ █▀ ▀█▀   █▄▄ █▀█ █▀█ ...
ADMIN / If a message contains any text that is hurtful, inflammatory, hateful, or otherwise unwanted language this allows for it to be changed. admins can rewrite at their discretion. struct the updated guest message
function rewriteMessage(uint256 _guestId, string calldata _message) external onlyOwner { guests[_guestId].message = _message; emit GuestUpdated(_guestId); }
1,812,443
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; contract SwapFeeCharge is Ownable { address public treasury; mapping(address => uint256) public userFeeCharged; event FeePayed(address user, uint256 amount); event TreasuryChanged(address old...
Execute swap transaction _data: swap data _gasFee: gasfee to send treasury/ require(msg.value >= _gasFee, "Not enough ETH fee"); charge ETH fee safeTransferETH(treasury, _gasFee); exectue swap function
function executeSwap( address _target, bytes calldata _data, uint256 _gasFee ) external payable { (bool success, bytes memory returnData) = _target.delegatecall(_data); if (!success) { decodeRevert(returnData); } emit FeePayed(msg.sender, _g...
14,910,883
./partial_match/42/0x024a97c99B51D0F21A3D102A658b8Aec469B1394/sources/SynthetixEscrow.sol
Construct a vesting schedule to release a quantities of SNX over a series of intervals. Assumes that the quantities are nonzero and that the sequence of timestamps is strictly increasing. This may only be called by the owner during the contract's setup period./
function addVestingSchedule( address account, uint[] calldata times, uint[] calldata quantities ) external onlyOwner onlyDuringSetup { for (uint i = 0; i < times.length; i++) { appendVestingEntry(account, times[i], quantities[i]); } }
3,330,290
./full_match/4/0x344884f69f839ccB0adAF09dfC2337BdFbDB881F/sources/contracts/BaseDistributor.sol
require(msg.sender == address(_token), "Simple777Recipient: Invalid token"); do stuff
function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external override { totalDonations += amount; distribute(amount,msg.sender); emitter.DonationReceiv...
809,709
pragma solidity ^0.5.17; pragma experimental ABIEncoderV2; import "./VestingRegistry.sol"; import "../Staking/Staking.sol"; /** * @title Origin investors claim vested cSOV tokens. * @notice // TODO: fund this contract with a total amount of SOV needed to distribute. * */ contract OriginInvestorsClaim is Ownable { ...
The contract should be approved or transferred necessary amount of SOV prior to calling the function. investors The list of investors addresses to add to the list. Duplicates will be skipped. claimAmounts The list of amounts for investors investors[i] will receive claimAmounts[i] of SOV. /
function appendInvestorsAmountsList( address[] calldata investors, uint256[] calldata claimAmounts ) external onlyAuthorized notInitialized { uint256 subQty; uint256 sumAmount; require( investors.length == claimAmounts.length, "OriginInvestorsClaim...
899,218
./full_match/11155111/0x6B586cdC3f889AD4C9FA78000F99C54e88F66459/sources/project_/contracts/helpers/SafeMath.sol
solhint-disable-line
function safeSub(uint a, uint b) pure internal returns (uint) {
3,798,790
/** *Submitted for verification at Etherscan.io on 2021-08-11 */ // File: iface/IERC20.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the name of the token. */ f...
View the lpStakingMiningPool address return lpStakingMiningPool address
function getLPStakingMiningPool() external view returns(address) { return address(_lpStakingMiningPool); }
2,317,962
pragma solidity 0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see ht...
Set some aside for owner after sale begin/
function reserve(uint256 _reserve) public onlyOwner { uint supply = totalSupply(); require(!reserveMinted, "only allowable once"); require(saleIsActive, "only allowable after sale"); require(supply.add(_reserve) <= MAX_MINT, "Reserve would exceed max supply"); for (uin...
6,055,010
./full_match/80001/0xCB881D41157ad64Fe76A0Cd0476EF3E3233d86Fe/sources/project_/contracts/IdentitiesCollection.sol
Returns the identity address of user userAddress - user wallet address return address ./
function getIdentity( address userAddress ) public view override returns (address) { return _identities[userAddress]; }
843,496
// SPDX-License-Identifier: Unlicense pragma solidity >=0.6.2; import './Utilities.sol'; /// @notice This contract looks to be useful for bootstrapping/funding purposes. contract TokenTurner is Utilities { /// @dev How many epochs the funding event is open. uint256 constant FUNDING_EPOCHS = 12; /// @dev The dec...
Swaps `OUTPUT_TOKEN` back. receiver Address of the receiver for the returned tokens. inputSellAmount The amount of `OUTPUT_TOKEN` to swap back. epoch The epoch `OUTPUT_TOKEN` was acquired. Needed to calculate the decay rate. swapRoute If `swapRoute.length` is greather than 1, then this array should also include add...
function swapOut ( address receiver, uint256 inputSellAmount, uint256 epoch, uint256[] memory swapRoute, bytes memory permitData ) external { updateEpoch(); uint256 currentEpoch = getCurrentEpoch(); require(epoch <= currentEpoch, 'EPOCH'); Utilities._maybeRedeemPermit(OUTPUT_TOK...
6,441,149
// File: helpers/IUniswapV2Factory.sol // SPDX-License-Identifier: bsl-1.1 /* Copyright 2020 Unit Protocol: Artem Zakharov (az@unit.xyz). */ pragma solidity ^0.6.8; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function getPair(address...
USD token's rate is UniswapV2 Token/WETH pool's average time weighted price between proofs' blockNumber and current block number Merkle proof must be in range [MIN_BLOCKS_BACK ... MAX_BLOCKS_BACK] blocks ago {Token}/WETH pair must exists on Uniswap asset The token address amount Amount of tokens proofData Merkle p...
function assetToUsd(address asset, uint amount, UniswapOracle.ProofData memory proofData) public override view returns (uint) { uint priceInEth = assetToEth(asset, amount, proofData); return IOracleEth(oracleRegistry.oracleByAsset(WETH)).ethToUsd(priceInEth); }
5,916,779
./partial_match/1/0xB0F720Baa5BD1715897d4790A59f5c7aa1377D79/sources/IEthItemModelBase.sol
This interface contains the commonn data provided by all the EthItem models/
interface IEthItemModelBase is IEthItemMainInterface { function init(string calldata name, string calldata symbol) external; function modelVersion() external pure returns(uint256 modelVersionNumber); function factory() external view returns(address factoryAddress); }
3,922,602
/** * @title Governance * @author Ferit Tunçer - <ferit@cryptolab.net> * This contract implements the governance mechanism of Kleros Athena release. * Bug Bounties: This code hasn't undertaken a bug bounty program yet. */ pragma solidity ^0.4.24; import "kleros-interaction/contracts/standard/permission/Arbit...
Notifies the controller about an approval allowing the controller to react if desired. _owner The address that calls `approve()`. _spender The spender in the `approve()` call. _amount The amount in the `approve()` call. return False if the controller does not authorize the approval.
function onApprove(address _owner, address _spender, uint _amount) public returns(bool){ return true; }
2,486,270
./partial_match/1/0x05310880FBA5f373E871351a4B67A516c20Ce1C2/sources/_contracts/lottery/JoysLottery.sol
addCrowdSaleAddress. Requirements: only owner. add address to crowd sales _address The address to add _claimWeapon The flag of whether claim weapon/
function addCrowdSaleAddress(address[] memory _address, bool _claimWeapon) onlyOwner public{ bool heroClaim = false; bool weaponClaim = false; for (uint32 idx = 0; idx < _address.length; ++idx) { if (crowdSalesHero[address(_address[idx])] >= CS_NORMAL) { continue;...
15,465,544
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol'; import './ERC721Upgradeab...
location_ == -1 – any location/
function getOwnerTokens(address owner_, int8 location_) public view returns (TokenData[] memory) { require( owner_ != address(0), 'ERC721: balance query for the zero address' ); uint256 balance = balanceOf(owner_); TokenData[] mem...
121,046