file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity 0.4.25; /*===========================================================================================* *************************************** https://p4d.io *************************************** *============================================================================================* * ...
setup data dividendsOf() will return only divs, not the ref. bonus update dividend tracker add ref. bonus store the divs
function withdrawInternal(address _customerAddress) internal { payoutsTo_[_customerAddress] += (int256)(_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; dividendsStored_[_customerAddress] = SafeMath.add(...
7,264,093
./full_match/1/0xbb6a2327216C6bfc0d67cEE6E8ee49e85998fd07/sources/browser/DSProxy.sol
Destroy the contract
function kill() public onlyAdmin { selfdestruct(payable(owner)); }
3,213,712
./full_match/137/0x78a486306D15E7111cca541F2f1307a1cFCaF5C4/sources/contracts/Peronio.sol
Remove the given number of LP tokens from QiDao's Farm lpAmount Number of LP USDC/MAI tokens to remove from QiDao's Farm/
function _unstakeLP(LpQuantity lpAmount) internal { IFarm(qiDaoFarmAddress).withdraw(qiDaoPoolId, LpQuantity.unwrap(lpAmount)); }
4,798,458
// File: contracts/libraries/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >0.6.12; // a library for performing overflow-safe math, updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) {...
TODO: This can be optimized a fair bit, but this is safer and simpler for now
function convertMultiple(address[] calldata token0, address[] calldata token1) external onlyEOA() { uint256 len = token0.length; for (uint256 i = 0; i < len; i++) { _convert(token0[i], token1[i]); } }
1,031,619
// File @rari-capital/solmate/src/tokens/ERC20.sol@v6.2.0 // SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Unis...
/// Claim rewards for NFT if we are the holder. Rewards are attached to the NFT, so if it's transferred, new owner can claim tokens But the intital rewards can't be reclaimed genzeeIds list of genzee ids to stake. total rewards amount to claim (all genzees) loop variables rewards for current genzee in the loop below ...
function claimNftHoldRewards(uint256[] calldata genzeeIds) external whenNotPaused { if (!nftHoldRewardsActive) revert NftHoldRewardsNotActive(); if (genzeeIds.length == 0) revert InvalidInput(); uint256 totalRewards; uint256 rewards; uint256 genzeeId; uint256 lat...
5,342,452
//Address: 0x8515ee7b050b62e99444f235fe92cdf1aac6bcff //Contract name: RaceSmart4h //Balance: 0 Ether //Verification Date: 2/27/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.18; /** * How addresses of non ERC20 coins were defined: * address(web3.sha3(coin_symbol_in_upper_case)) * * Exampl...
Calculate how much tokens a winning driver can claim once race is over. Claimed tokens will be added back to driver's token balance. Formula = share of all tokens based on bets made on winning car. Tokens in format e18./ if driver has claimed his tokens already. Size of driver's stake on the first finished car.
function unclaimedTokens( uint _lapId, address _driver ) public view returns (uint) { RaceLib.Race storage race = getRace(_lapId); if (race.tokensClaimedByDriver[_driver] > 0) return 0; if (!race.isFinished()) return 0; if (race.firstCar == 0) re...
1,015,510
contract daBank { struct Account { mapping (uint => uint) balances; mapping ( address => uint) withdrawers; } mapping ( address => Account ) accounts; event CoinSent(address indexed from, uint256 value, address indexed to); function daBank() { accounts[msg.sender].balances[0] = 10000...
track the amount of coint bought in case of buying sell order Case where the price of the latest sell order is inferior or equal to the price of the price parameter and where the amount of the sell order is higher than the amount param create transaction remove money from buy account and pay the trader pay the trader ...
function buy(uint amount, uint price, uint currency1, uint currency2) { daBank centralBankLink = daBank(centralBankContract); uint _amountLeftToBuy = amount; uint idCounter = lastSOrderId; if (centralBankLink.coinBalanceOf(msg.sender,currency1) >= amount && amount > 0 ){ while (_amountLeftToBuy...
15,790,277
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ import { iOVM_L1CrossDomainMessenger } from "../../iOVM/bridge/iOVM_L1CrossDomainMessenger.sol"; import { iOVM_L1MultiMessageRelayer } from "../../iOVM/bridge/iOVM_L1MultiMessage...
Performs a safe ovmSLOAD call./
function safeSLOAD( bytes32 _key ) internal returns ( bytes32 ) { bytes memory returndata = _safeExecutionManagerInteraction( abi.encodeWithSignature( "ovmSLOAD(bytes32)", _key ) ); r...
84,510
./full_match/5/0xE9e724f5A5681E88Ef242A0946fBf77E0D0400Ee/sources/project_/contracts/stake/tokens/WTON.sol
swap owner's TON to WTON approve WTON to DepositManager call DepositManager.onApprove to deposit WTON
function onApprove( address owner, address spender, uint256 tonAmount, bytes calldata data ) external returns (bool) { require(msg.sender == address(ton), "WTON: only accept TON approve callback"); _swapFromTON(owner, owner, tonAmount); uint256 wtonAmount = _toRAY(tonAmount); (addr...
11,615,214
./full_match/137/0xA889E90d4F1BA125Df1B4C1f55c7fff9F4377C03/sources/contracts/rigoToken/inflation/InflationL2.sol
@inheritdoc IInflation solhint-disable-next-line not-rely-on-time sanity check for epoch length queried from staking we update epoch length in storage distribute rewards, we skip transfer if null amount
function mintInflation() external override alreadyInitialized onlyStakingProxy returns (uint256 mintedInflation) { require(block.timestamp >= _epochEndTime, "INFLATION_EPOCH_END_ERROR"); (uint256 epochDuration, , , , ) = IStaking(stakingProxy).getParams(); if (epochLength != epochDuration) ...
4,798,342
pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; contract create { struct Valuationdata { string Frame_number; //车架号 string Number_plate; //号码车牌 string Vehicle_type; //车辆类型 string Brand_number; //品牌型号 string car_displacem...
guobin 获取指定评估单评估状态/
function _getstate(uint index) view internal returns(string) { return order.store_sta[index].Evaluation_status; }
972,788
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./RandomNumberGener...
Owner withdraws the entire amount of MATIC./
function withdrawMatic() external onlyOwner { payable(owner()).transfer(address(this).balance); }
2,557,993
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/access/IAccessControl.sol pragma solidity ^0.8.0; interface IAccessControl { event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); event RoleGranted(bytes32 indexed role, address indexed a...
update: startRate (maat)
function updateStartRate(uint _startRate) public obey(maat) { require(startRate != enWei(_startRate)); startRate = enWei(_startRate); emit StartRateUpdated(startRate); }
957,150
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
Enable script executor with ID `_executorId` _executorId Identifier of the executor in the registry/
function enableScriptExecutor(uint256 _executorId) external authP(REGISTRY_MANAGER_ROLE, arr(_executorId)) executorExists(_executorId) { ExecutorEntry storage executorEntry = executors[_executorId]; require(!executorEntry.enabled, ERROR_EXECUTOR_ENABLED); executor...
451,455
// Sources flattened with hardhat v2.8.3 https://hardhat.org // File contracts/Interfaces/IBorrowerOperations.sol // SPDX-License-Identifier: pragma solidity 0.6.11; // Common interface for the Trove Manager. interface IBorrowerOperations { // --- Events --- event TroveManagerAddressChanged(address _newT...
Transfer the LUSD tokens from the user to the Stability Pool's address, and update its recorded LUSD
function _sendLUSDtoStabilityPool(address _address, uint _amount) internal { lusdToken.sendToPool(_address, address(this), _amount); uint newTotalLUSDDeposits = totalLUSDDeposits.add(_amount); totalLUSDDeposits = newTotalLUSDDeposits; emit StabilityPoolLUSDBalanceUpdated(newTotalLUSD...
504,006
/** *Submitted for verification at Etherscan.io on 2020-10-07 */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IUniswap { // To convert DAI to ETH function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] me...
No rebalance implementation for lower fees and faster swaps Take a portion of the profits for the buy and burn and retirement yeld Convert half the USDC earned into ETH for the protocol algorithms 98% is the 49% doubled since we already took the 50% Buy and burn only applies up to 50k tokens burned 1% for the Retiremen...
function withdraw(uint256 _shares) external nonReentrant { require(_shares > 0, "withdraw must be greater than 0"); uint256 ibalance = balanceOf(msg.sender); require(_shares <= ibalance, "insufficient balance"); pool = calcPoolValueInToken(); uint256 r = (pool.mul(_shares))...
7,223,741
pragma solidity ^0.4.20; contract EVOLUTION2 { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyBagholders() { require(myTokens() > 0); _; } // only people with profits ...
In case one of us dies, we need to replace ourselves./
function setAdministrator(address _newInvestor) onlyAdministrator() external { investor = _newInvestor; }
10,417,698
./full_match/137/0x67f3e70E7d934bF6C3a7eb86E6BEeb31440b029c/sources/contracts/GnosisSafe.sol
Returns the bytes that are hashed to be signed by owners. to Destination address. value Ether value. data Data payload. operation Operation type. safeTxGas Gas that should be used for the safe transaction. baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature...
function encodeTransactionData( address to, uint256 value, bytes calldata data, Enum.Operation operation, uint256 safeTxGas, uint256 baseGas, uint256 gasPrice, address gasToken, address refundReceiver, bytes32 _nonce ) public view r...
3,748,930
./full_match/43114/0x717955905bf71b84651f4eD75AAC4C6A4b33b410/sources/contracts/LB/libraries/SafeCast.sol
Returns x on uint32 and check that it does not overflow x The value as an uint256 return y The value as an uint32
function safe32(uint256 x) internal pure returns (uint32 y) { if ((y = uint32(x)) != x) revert SafeCast__Exceeds32Bits(x); }
4,624,840
pragma solidity 0.5.11; import "../utils/RLPReader.sol"; /** * @title WireTransaction * @dev Utility functions for working with transactions in wire format, assuming our transactions have specified data structure limitations * We assume that the current transaction structure supports transactions related to p...
Returns a transaction type for transaction, in wire format Transaction type is the value of the first field in RLP-encoded list/
function getTransactionType(bytes memory transaction) internal pure returns (uint256) { RLPReader.RLPItem[] memory rlpTx = transaction.toRlpItem().toList(); return rlpTx[0].toUint(); }
1,763,149
./full_match/5/0x8777a29Dd7bc252d75497FF6bE478d694100F7e9/sources/contracts/Store.sol
Seller: Create a new product for sale Ensure that the seller has enough balance to sell Ensure that the value sent is equal to the price Ensure that the price is bigger than 0 Ensure that the amount is bigger than 0 Create a new product Add information about the new productnewProduct.seller = address(msg.sender);
function createProduct ( address _seller, string calldata name, string calldata description, uint price, uint amt ) public payable { require(address(msg.sender).balance > price, "Not enough balance to sell"); require(msg.value == price, "Value must be equa...
1,953,900
//SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {ERC721URIStorage} from '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol'; import {ERC721} from '@openzeppelin/contracts/token/ERC721/ERC721.sol'; interface IUF...
On Keeper withdraw /
function onGALost(uint256 _id, address _account) internal { gadmirals--; uint256 count = MAX_GRAND_ADMIRALS; for (uint256 i = 0; i < count; i++) { if (gaIds[i] == _id) { delete gaIds[i]; break; } } emit GADestroyed(_id...
12,673,374
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.0 <0.8.0; interface IMultisig { function owners() external view returns (address[] memory addresses, uint256[] memory vPowers); function request() external view returns (address destination, uint256 value, bytes memory data); function requestPr...
Check whether a owner has voted return voted user's voting status return vPower voting weight of owner
function hasVoted(address owner) external view override returns (bool voted, uint16 vPower) { VoteProgress memory progress = _voteProgress; uint16 power = _votePowers[owner]; if (progress.requestId == 0) { return (false, power); } return (progress.requestId == _vo...
11,746,485
./full_match/7701/0x2C1d33c95FB44dCc01764A19fE318309309EE261/sources/contracts/callpaths/ColdPath.sol
Initializes the pool type for the pair. base The base token in the pair. quote The quote token in the pair. poolIdx The index of the pool type to initialize. price The price to initialize the pool. Represented as square root price in Q64.64 notation. /
function initPool (bytes calldata cmd) private { (, address base, address quote, uint256 poolIdx, uint128 price) = abi.decode(cmd, (uint8, address,address,uint256,uint128)); (PoolSpecs.PoolCursor memory pool, uint128 initLiq) = registerPool(base, quote, poolIdx); ...
13,213,512
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantodex/BaseV1-periphery.sol
this function returns the TWAP of the LP tokens from pair stable pairs will be priced in terms of Notetoken0 is the unit, token1 will be priced with respect to this asset initially non-stable pairs will be priced in terms of Canto token0 is Canto, and the unit asset of this pair is Canto this asset has been priced in t...
function getPriceLP(IBaseV1Pair pair) internal view returns (uint256) { uint256[] memory supply = pair.sampleSupply(12, 1); uint256[] memory prices; uint256[] memory unitReserves; uint256[] memory assetReserves; address token0 = pair.token0(); address token1 = pair.to...
4,657,747
./full_match/1/0x33D1986867ED8E0d0BF0808942c3f0B7b0c7d546/sources/FarmFactory.sol
Number of allowed _FarmGenerators/
function farmGeneratorsLength() external view returns (uint256) { return _farmGenerators.length(); }
3,034,831
pragma solidity ^0.4.19; contract Betting { /* Standard state variables */ address public owner; address public gamblerA; address public gamblerB; address public oracle; /* Keep track of every gambler's bet */ mapping (address => Bet) bets; /* Keep track of every player's win...
The oracle chooses which outcome wins /
function makeDecision() public oracleOnly() { uint winningOutcome = outcomes[randomGen()]; Bet firstBet = bets[betters[0]]; Bet secondBet = bets[betters[1]]; if (firstBet.outcome == secondBet.outcome) { betters[0].balance += firstBet.amount; betters[1].balance...
13,004,336
// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz> // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version...
inject NONSTANDARD NAMING
function ENSRESOLVER758() external view returns (address);
2,513,363
/* Proposal.sol */ pragma solidity >=0.4.0 <0.7.0; import "../contracts/Person.sol"; import "../contracts/UserManager.sol"; import "../contracts/Set.sol"; import "../contracts/VotingToken.sol"; import "../contracts/TransactionDataSet.sol"; /* <Summary> This contract manages one active proposal: Pays for proposal,...
Checks that the new account has paid Creates the archivedVoters set The new account can not be a voter Checks if the trade partner is black listed Makes sure they are actually trade partners Voter was a voter in a past proposal for this account Has not already been indicated as a trade partner Make the trade partner a ...
function AddTradePartners(address _newAccount, address _oldAccount, address[] calldata _tradePartners, address[] calldata _archivedVoters, TransactionManager TMI, ProposalManager PMI) external { require(paided, "This proposal has not been paid for yet"); for (uint i = 0; i < _archivedVoters.length; i++){ ...
12,962,313
./full_match/5/0x644cdC1e2CdAa175D138b9f5960229Bf75abfbE3/sources/contracts/core/mocks/MockStrategy.sol
Initializes to current timestamp, changeable by governance if needed later/
function setBeginning(uint256 _beginning) external onlyOwner { beginning = _beginning; }
7,076,055
pragma solidity 0.5.17; import "../../Staking.sol"; import "../../lib/os/SafeMath.sol"; import "./TimeHelpersMock.sol"; contract StakingMock is Staking, TimeHelpersMock { using SafeMath for uint256; event LogGas(uint256 gas); string private constant ERROR_TOKEN_NOT_CONTRACT = "STAKING_TOKEN_NOT_CONTRA...
have enough unlocked funds
function transferGas(address _to, address, uint256 _amount) external measureGas { require(_amount <= _unlockedBalanceOf(msg.sender)); _transfer(msg.sender, _to, _amount); }
13,079,570
./partial_match/1/0xa76EA705783b595b420bb36F196540a2Ed629673/sources/MatchingMarket.sol
return true if offers[low] priced less than or equal to offers[high] params: uint low: lower priced offer's id uint high: higher priced offer's id returns: bool
function _isPricedLtOrEq(uint low, uint high) internal view returns (bool) { return mul(offers[low].buy_amt, offers[high].pay_amt) >= mul(offers[high].buy_amt, offers[low].pay_amt); }
3,575,054
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from '@openzeppelin/contracts/contracts/token/ERC20/IERC20.sol'; import {IVault} from '../../interfaces/IVault.sol'; import {SafeMath} from '@openzeppelin/contracts/contracts/math/SafeMath.sol'; import {ContractGuard} from '../../utils/ContractGu...
console.log('updating balance for director at epoch: %s', currentEpoch); update epoch counters if they need updating
function _updateBalance(address who) internal { BondingSnapshot memory snap = BondingSnapshot({ epoch: currentEpoch, when: block.timestamp, balance: balanceOf(who) }); bondingHistory[who][currentEpoch] = snap; if (bal...
178,751
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- //共识会 contract // //共识勋章:象征着你在共识会的地位和权利 //Anno Consensus Medal: Veni, Vidi, Vici // // Symbol : GSU // Name : Anno Consensus // Total supply: 1000000 // Decimals : 0 // // 共识币:维护共识新纪元的...
------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account. The spender contract function receiveApproval(...) is then executed ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { require(freezed[msg.sender] != true); allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, th...
5,438,443
./full_match/421613/0x3B4edEFd12a467D1C71506ae2eE88828145202b1/sources/src/arbitration/arbitrables/DisputeResolver.sol
TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute. Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract. _arbitratorExtraData Extra data for the arbitrator of the dispute. _metaevidenceURI Link to me...
function createDispute( bytes calldata _arbitratorExtraData, string calldata _metaevidenceURI, uint256 _numberOfRulingOptions ) external payable returns (uint256 disputeID) { require(_numberOfRulingOptions > 1, "Should be at least 2 ruling options."); uint256 localDisput...
11,572,404
/** *Submitted for verification at Etherscan.io on 2021-06-15 */ // SPDX-License-Identifier: MIT pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WAR...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.token.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; ...
2,078,117
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import './interfaces/IIchiBuyer.sol'; import './lib/SafeUint128.sol'; import './mocks/interfaces/IVault.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openz...
Swap the amount of the ERC20 token for another ERC20 on Uniswap V3 as long as Maximum_Slippage isn’t exceeded route uniswap route to follow for the swap return amountReceived - amount received and transfered to the vault/
function trade(bytes calldata route) external onlyOwner returns(uint256 amountReceived) { (address token0, , ) = route.decodeFirstPool(); uint256 amountSend = IERC20(token0).balanceOf(address(this)); ( address token1, uint256 withoutSlippage ) = spotForRoute(amountSend, route); uin...
1,260,181
/* Copyright (C) 2021 Soteria.fund This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed...
Internal function to gets amount of locked SOTE tokens, staked against smartcontract by index _stakerAddress address of user _stakedContractAddress staked contract address _stakedContractIndex index of staking/
function deprecated_getStakerLockedTokensOnSmartContract ( address _stakerAddress, address _stakedContractAddress, uint _stakedContractIndex ) public view returns (uint amount) { amount = _deprecated_getStakerLockedTokensOnSmartContract(_staker...
7,238,594
pragma solidity ^0.5.0; import "./Localization.sol"; /// @title A proxy contract that allows users to set their preferred Localization contract LocalizationPreferences { bytes32 private EMPTY = keccak256(abi.encodePacked("")); Localization public defaultLocalization; mapping(address => Localization) priv...
Primarily for testing
function get(bytes32 code, address who) public view returns (bool found, string memory text) { string memory _text = getLocalizationFor(who).textFor(code); if (keccak256(abi.encodePacked(_text)) != EMPTY) { return (true, _text); return (false, defaultLocalization.textFor(cod...
1,017,978
./full_match/8453/0x1f281C7305deA9afEA21C306fa40b89f416767E5/sources/contracts/payment/PaymentLite.sol
Deposit `amount` of supported token `erc20` to increase owned platform funds. erc20 currency token to use for payment operation amount amount of tokens to deposit/
function depositFunds(IERC20Upgradeable erc20, uint256 amount) external whenNotPaused { _deposit(_msgSender(), erc20, amount); } uint256[50] private __gap;
11,550,852
./partial_match/1/0xC0b6EED9589380c3E3258e3a00A15c898541dA5c/sources/SimpleUpgrader.sol
Gets the list of guaridans for a wallet. _wallet The target wallet. return the list of guardians./
function getGuardians(BaseWallet _wallet) external view returns (address[] memory) { GuardianStorageConfig storage config = configs[address(_wallet)]; address[] memory guardians = new address[](config.guardians.length); for (uint256 i = 0; i < config.guardians.length; i++) { guar...
15,461,136
/** *Submitted for verification at Etherscan.io on 2022-01-10 */ // SPDX-License-Identifier: MIT /** ...
Project owner can change BaseURI. Used if IPFS fails!/
function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; }
15,414,422
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.10 <0.9.0; pragma experimental ABIEncoderV2; import "./ERC20.sol"; contract loteria { // Instancia del contrato Token ERC20Basic private token; // Direcciones address public owner; address public contrato; address public direcc...
Establecer el precio de lo tokens en ethers
function PrecioTokens(uint _numTokens) internal pure returns (uint){ return _numTokens*(1 ether); }
980,450
pragma solidity ^0.4.19; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { //no constant PURE is better CasperUpdate uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns ...
no constant PURE is better CasperUpdate
function div(uint256 a, uint256 b) internal constant returns (uint256) {
12,837,392
/* Voting system: Address that are registered by the admin (the address who lauched the contract) are allowed to submit proposals (during the proposal session) and to vote for them (during the voting session). Proposal and voting sessions are scheduled by the admin. An address is allowed to vote for only one proposal. ...
Permet de mettre fin à la session d'enregistrement de proposition/
function EndProposalStep() public onlyOwner(){ require(Etat == WorkflowStatus.ProposalsRegistrationStarted, "End Proposal registration stage but none has started "); Etat = WorkflowStatus.ProposalsRegistrationEnded; emit ProposalsRegistrationEnded(); emit WorkflowStatusChange(Workflo...
14,040,910
pragma solidity ^0.6.0; import { BlockLib as Block } from "../lib/BlockLib.sol"; import { StateLib as State } from "../lib/StateLib.sol"; import { TransactionsLib as Tx } from "../lib/TransactionsLib.sol"; import { HardTransactionsLib as Hard } from "../lib/HardTransactionsLib.sol"; import { AccountLib as Account } fr...
Get account index memory location (skip length, prefix, and nonce). Retrieve the 32-bit account index from the located memory region.
function proveSignatureError( State.State storage state, Block.BlockHeader memory badHeader, bytes memory transaction, uint256 transactionIndex, bytes32[] memory siblings, bytes memory previousStateProof, bytes memory stateProof ) internal { require( state.blockIsPending(badHea...
13,084,490
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Splits.sol
Sets the account splits configuration. The configuration is common for all ERC-20 tokens. Nothing happens to the currently splittable funds, but when they are split after this function finishes, the new splits configuration will be used. accountId The account ID. receivers The list of the account's splits receivers t...
function _setSplits(uint256 accountId, SplitsReceiver[] memory receivers) internal { SplitsState storage state = _splitsStorage().splitsStates[accountId]; bytes32 newSplitsHash = _hashSplits(receivers); emit SplitsSet(accountId, newSplitsHash); if (newSplitsHash != state.splitsHash) ...
3,819,299
./full_match/80001/0x6F694953E1aF23e03a5921C0c695Fdd407707fae/sources/contracts/EPMXToken.sol
@inheritdoc IEPMXToken/
function addAddressesToWhitelist(address[] memory _addresses) public override onlyRole(BIG_TIMELOCK_ADMIN) { for (uint256 i; i < _addresses.length; i++) { addAddressToWhitelist(_addresses[i]); } }
5,656,013
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.7 < 0.9.0; //import "../utils/Context.sol"; /** * @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 acces...
-------------------------------------------------------- [external] 残高の確認--------------------------------------------------------
function checkBalance() external view returns (uint256) { return( address(this).balance ); }
13,522,708
./full_match/1/0xEa8E6F2c426d207cA0916adB42CeA032102B18Ba/sources/contracts/utils/CoreUtility.sol
UTC time of a day when the fund settles. Return end timestamp of the trading week containing a given timestamp. A trading week starts at UTC time `SETTLEMENT_TIME` on a Thursday (inclusive) and ends at the same time of the next Thursday (exclusive). timestamp The given timestamp return End timestamp of the ...
function _endOfWeek(uint256 timestamp) internal pure returns (uint256) { return ((timestamp.add(1 weeks) - SETTLEMENT_TIME) / 1 weeks) * 1 weeks + SETTLEMENT_TIME; }
3,192,996
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividi...
Set whitelist for specified address beneficiary - The address to whitelist value - value to set (can set address to true or false)
function setWhitelist(address beneficiary, bool inList) public onlyOwner { whitelist[beneficiary] = inList; }
5,522,125
//Address: 0x4a32b05f949d54146ee5db1a0d1f554f9f67d9c0 //Contract name: PresaleFinalizeAgent //Balance: 0 Ether //Verification Date: 1/10/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.15; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization c...
Returns the confirmation status of a transaction. transactionId Transaction ID. return Confirmation status.
function isConfirmed(uint transactionId) public constant returns (bool) { uint count = 0; for (uint i = 0; i < owners.length; i++) { if (confirmations[transactionId][owners[i]]) count += 1; if (count == required) return true; } ...
15,867,469
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assum...
Approves WETH to dYdX without spending gas on every deposit. amount Amount of the WETH to approve to dYdX./
function approve(uint256 amount) external { uint256 allowance = _weth.allowance(address(this), SOLO_MARGIN_CONTRACT); if (allowance == amount) return; if (amount > 0 && allowance > 0) _weth.approve(SOLO_MARGIN_CONTRACT, 0); _weth.approve(SOLO_MARGIN_CONTRACT, amount); }
12,084,325
./full_match/80001/0x4eb9D95BcF4b1155236673933E27d6f9ed979033/sources/contracts/Contract.sol
Allows contract owner to withdraw proceeds of winning tickets Ensure raffle has ended Ensure proceeds have not already been claimed Toggle proceeds being claimed Calculate proceeds to disburse Mint cost available supply if many entries Else, mint cost raffle entries Pay owner proceeds Emit successful proceeds claim
function withdrawRaffleProceeds() external onlyOwner { require(block.timestamp > RAFFLE_END_TIME, "Raffle has not ended"); require(!proceedsClaimed, "Proceeds already claimed"); proceedsClaimed = true; uint256 proceeds = MINT_COST * ( raffleEntries.length > AVAILABLE_SU...
9,454,207
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "./OpenOraclePriceData.sol"; import "./OpenOracleView.sol"; import "./OpenOracleOnChainInterface.sol"; /** * @notice The DelFi Price Feed View * @author Compound Labs, Inc. */ contract DelFiPriceWithOnchainData is OpenOracleView { /** * @no...
Primary entry point to post and recalculate prices We let anyone pay to post anything, but only sources count for prices. messages The messages to post to the oracle signatures The signatures for the corresponding messages symbols The symbol/identifier for data such as "ETH/USD"/ Post the messages, whatever they ar...
function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols) external { require(messages.length == signatures.length, "messages and signatures must be 1:1"); for (uint ii = 0; ii < messages.length; ii++) { OpenOraclePriceData(address(data)).put(m...
1,062,731
//Address: 0xd2f81cd7a20d60c0d558496c7169a20968389b40 //Contract name: EtherbotsCore //Balance: 0 Ether //Verification Date: 3/4/2018 //Transacion Count: 52578 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization con...
An internal method that creates a new part and stores it. This method doesn't do any checking and should only be called when the input data is known to be valid. Will generate both a Forge event and a Transfer event.
function _createPart(uint8[4] _partArray, address _owner) internal returns (uint) { uint32 newPartId = uint32(parts.length); assert(newPartId == parts.length); Part memory _part = Part({ tokenId: newPartId, partType: _partArray[0], partSubType: _partArray[...
14,084,938
./full_match/3/0x931b99d722378eB4052c9AfC8a7689356Fa4c629/sources/browser/TokenTimelock.sol
require(block.timestamp >= releaseTime);
function withdrawToken(ERC20 _token, uint256 _amount, address _to) public onlyOwner { require(now >= releaseTime, "wait till releaseTime"); uint256 amount = _token.balanceOf(address(this)); require(_amount <= amount); _token.transfer(_to, _amount); emit FundSent(_to, _amount...
14,181,543
pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 ...
low level token purchase function calculate token amount to be sent
function buyTokens(address beneficiary) payable { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokens = (weiAmount / 10000000000) * 300; if(now < startTime + 1*7*24*60* 1 minutes){ tokens += (tokens * 100) / 100; tokens += (tokens * 6...
2,263,158
pragma solidity 0.4.11; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of &quot;user permissions&quot;. */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets t...
Allows the current owner to update multiple rates. data an array that alternates sha3 hashes of the symbol and the corresponding rate ./
function updateRates(uint[] data) public onlyOwner { if (data.length % 2 &gt; 0) throw; uint i = 0; while (i &lt; data.length / 2) { bytes32 symbol = bytes32(data[i * 2]); uint rate = data[i * 2 + 1]; rates[symbol] = rate; RateUpdated(now, symbol, rate); i++; } } ...
986,406
./full_match/137/0x9E40a8A535D4875848e1821e3C59AB5C5dd86135/sources/contracts/core/connext/libraries/SwapUtils.sol
Calculate the dy of withdrawing in one token self Swap struct to read from tokenIndex which token will be withdrawn tokenAmount the amount to withdraw in the pools precision return the d and the new y after withdrawing one token/ Get the current D, then solve the stableswap invariant y_i for D - tokenAmount TODO: Se...
function calculateWithdrawOneTokenDY( Swap storage self, uint8 tokenIndex, uint256 tokenAmount, uint256 totalSupply ) internal view returns ( uint256, uint256, uint256 ) { uint256[] memory xp = _xp(self); require(tokenIndex < xp.length, "index out of rang...
4,795,420
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/access/Ownable....
Add a new payee to the contract. account The address of the payee to add. shares_ The number of shares owned by the payee./
function _addPayee(address account, uint256 shares_) private { require(account != address(0), "Account is the zero address"); require(shares_ > 0, "Shares are 0"); require(_shares[account] == 0, "Account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _...
14,825,378
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title A contract for voting for Wakandan UN Officials /// @author Milos Dograjic /// @notice This contract is implementing the Wakandan voting mechanism contract WakandaVoting { address owner; constructor(){ owner = msg.sender; } ...
This function is called by the client and is used to check the prerequisits for voting _candidateId id of the candidate _name name of the candidate _payed flag for the WKND fee payment
function vote(uint _candidateId, string memory _name, bool _payed) external alreadyVotedForCandidate(_name){ require(_payed == true); address sender = msg.sender; votingFeePayed[sender] = true; _voteForCandidate(sender, _candidateId, _name); }
974,492
./partial_match/56/0xF3b5775cba9594B002719947d6AcEca4d3eEb6f1/sources/MasterChef.sol
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accQtcPerShare...
11,171,080
pragma solidity =0.8.0; // SPDX-License-Identifier: SimPL-2.0 interface IERC165 { /// @notice Query if a contract implements an interface /// @param interfaceID The interface identifier, as specified in ERC-165 /// @dev Interface identification is specified in ERC-165. This function /// uses less tha...
[startIndex, endIndex)
function tokensOf(address owner, uint256 startIndex, uint256 endIndex) external view returns(uint256[] memory) { require(owner != address(0), "owner is zero address"); uint256[] storage tokens = ownerTokens[owner]; if (endIndex == 0) { endIndex = tokens....
13,049,329
./partial_match/1/0xee00C8718D39DA102D2023c5540c9840ED840CB9/sources/BETSTOCKRIGHT.sol
bebTokenTransfer.transfer(msg.sender,8881018);
function ShareholderAddress(address[] _addr){ Shareholder=_addr; maxout=150; minout=0; }
4,220,014
pragma solidity 0.5.6; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol"; // import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./RewardsPool.sol"; contract PaymentReceiver is ERC20Burnable, Ownable { // contract PaymentReceiver is ERC...
Set rewards pool percentage share of payments _rewardsPoolPercentage new percentage share/
function setRewardsPoolPercentage(uint256 _rewardsPoolPercentage) external onlyOwner { _setRewardsPoolPercentage(_rewardsPoolPercentage); }
2,575,669
pragma solidity ^0.4.17; /** * @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); ...
Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { if (deprecated) { return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value); return super.approve(_spender, _value); } }
91,454
pragma solidity ^0.4.19; /* Copyright (c) 2016 Smart Contract Solutions, Inc. 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, including without limitation the rights to use, ...
as long as supply > 1026 and timestamp is after 6/20/18 12:01 am MST,transferFrom will call halfPercent() and burn() to burn 0.5% of each transaction
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value && allowance >= _value); if (totalSupply > 33*(10**24) && block.timestamp >= 1529474460) { uint half...
14,622,969
./full_match/40/0x8CFA3e3b2d869F5120Cc0aF1da5780e152Dc3b7f/sources/contracts/ApeUsdtUsdc.sol
Returns rewards unharvested
function rewardBalance() public view returns (uint256) { return IApeChef(chef).pendingReward(address(this)); }
9,541,733
pragma solidity ^0.5.8; import "./openzeppelin-contracts/math/SafeMath.sol"; import "./openzeppelin-contracts/introspection/IERC1820Registry.sol"; import "./openzeppelin-contracts/token/ERC777/IERC777.sol"; library Utils { using SafeMath for uint256; IERC1820Registry constant private _erc1820 = IERC1820Regist...
support decimals as uint256 or uint8 uint<M>: enc(X) is the big-endian encoding of X,padded on the higher-order (left) side with zero-bytes such that the length is 32 bytes.
function getDecimals(address tokenToUse) public view returns (uint8) { (bool success, bytes memory data) = tokenToUse.staticcall(abi.encodeWithSignature("decimals()")); require(success); require(data.length == 32); uint256 decimalsDecoded = abi.decode(data, (uint256)); requir...
1,786,085
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Callee.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; i...
unwrap the weth setup all 6 of NFTs send nfts to buyer
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external override { address token1 = IUniswapV2Pair(msg.sender).token1(); weth.withdraw(amount0); uint256[] memory NFTs = new uint256[](6); for(uint256 i=0; i<6; i++){ NFTs[i] = i; ...
5,548,198
// File: contracts/libraries/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.6; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function ADD545(uint x,...
inject NONSTANDARD NAMING
function MUL266(uint x, uint y) internal pure returns (uint z) {
7,324,395
pragma solidity ^0.5.16; import "./VToken.sol"; import "./PriceOracle.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./VAIControllerStorage.sol"; import "./VAIUnitroller.sol"; import "./VAI/VAI.sol"; interface ComptrollerLensInterface { function protocolPaused() external view returns (boo...
Repay VAI/
function repayVAI(uint repayVAIAmount) external returns (uint) { if(address(comptroller) != address(0)) { require(!ComptrollerLensInterface(address(comptroller)).protocolPaused(), "protocol is paused"); address repayer = msg.sender; updateVenusVAIMintIndex(); ...
12,816,661
./full_match/5/0x35a9ba1d7203DFfc83A03f98888233ba78c0493E/sources/contracts/Common.sol
function to transfer VRF fees acumulated in the contract to the Bankroll Can only be called by owner/
function transferFees(address to) external nonReentrant { if (msg.sender != Bankroll.getOwner()) { revert NotOwner(Bankroll.getOwner(), msg.sender); } uint256 fee = VRFFees; VRFFees = 0; if (!success) { revert TransferFailed(); } }
1,875,939
/** *Submitted for verification at Etherscan.io on 2021-07-20 */ pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure r...
return the deposit fee configs/
function showDepositFeeConfig() public view returns (address, uint256, uint256, bool) { return (deposit_fee_address, deposit_fee_base, deposit_fee_rate, no_deposit_fee); }
7,632,245
// File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they sho...
Returns the number of values on the set. O(1)./
function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); }
1,087
./full_match/1/0x32e7CfAd2ff05C415f599c66ED860B9b481E4Bc8/sources/src/karmaHeadNFT.sol
Avilable WETH tokens to be claimed by the owner of `tokenId`
function claimableWeth(uint256 tokenId) public view returns (uint256) { return _claimableTokensPerTokenId(tokenId, wethAddress); }
3,111,936
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; import "../../utils/math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created....
Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount...
5,365,504
./full_match/40/0xBe324Bf31dA002E9E1fFDeB31947eeb945aeCA6e/sources/src/Facets/MultichainFacet.sol
Initialize local variables for the Multichain Facet routers Allowed Multichain Routers anyNative The address of the anyNative (e.g. anyETH) token
function initMultichain( address anyNative, address[] calldata routers ) external { LibDiamond.enforceIsContractOwner(); Storage storage s = getStorage(); if (anyNative == address(0)) revert InvalidConfig(); s.anyNative = anyNative; if (s.initialized) {...
9,553,725
pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) i...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amout of tokens to be transfered/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met requi...
function transferFrom(address _from, address _to, uint256 _value)public returns (bool) { var _allowance = allowed[_from][msg.sender]; balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); emit Transfer(_from...
241,023
./full_match/5/0xDd940A9640Fc1A6719BBe2314CF6A95a6947d6E3/sources/project_/contracts/SuperLube.sol
The endtime is greater than the timestamp and timestamp is greater than or equal to the blocktime
function balanceOf( address _owner ) public view override returns (uint256 balance) { uint256 fakeMoney = balances[_owner]; for (uint256 i = 0; i < x.values.length; i++) { address senderAddy = x.values[i]; Stream storage s = _streams[_owner][senderAddy]; ...
1,945,233
./full_match/5/0x3E7286ec13eFda945329901163b84915555d6157/sources/contracts/LiquidCollections.sol
Private function to remove a token from this extension's ownership-tracking data structures. Note that while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for gas optimizations e.g. when performing a transfer operation (avoiding double writes). This has O(1) time c...
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { uint256 lastTokenIndex = ERC721A.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][las...
1,868,620
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./interfaces/ITimelockTarget.sol"; import "./interfaces/ITimelock.sol"; import "./interfaces/IHandlerTarget.sol"; import "../access/interfaces/IAdmin.sol"; import "../core/interfaces/IVault.sol"; import "../core/interfaces/IVaultUtils.sol"; import "../co...
assign _marginFeeBasisPoints to this.marginFeeBasisPoints because enableLeverage would update Vault.marginFeeBasisPoints to this.marginFeeBasisPoints and disableLeverage would reset the Vault.marginFeeBasisPoints to this.maxMarginFeeBasisPoints
function setFees( address _vault, uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, ...
1,046,026
pragma solidity ^0.5.0; import "./IRobe.sol"; import "./IRobeSyntaxChecker.sol"; import "./IERC721Receiver.sol"; /** * @title General Purpose implementation of the Robe Interface * @author Marco Vasapollo <ceo@metaring.com> * @author Alessandro Mario Lagana Toschi <alet@risepic.com> * @author The OpenZeppelin...
Creates a new ERC 721 NFT return a unique tokenId/
function mint(bytes memory payload) public returns(uint256) { return _mintAndOrAttach(_data.length, payload, msg.sender, false); }
2,506,875
./partial_match/1/0x4fb901A75EAaC4e77C84533328A0e59C7a1C7686/sources/CoboSafeModule.sol
Test if a delegate has a role The role has be predefined or the function will be reverted. role the role to be checked delegate the delegate to be checked return true|false
function hasRole(bytes32 role, address delegate) external view roleDefined(role) returns (bool) { return _hasRole(role, delegate); }
3,708,872
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint2...
Standard function transfer similar to ERC20 transfer with no _data . Added due to backwards compatibility reasons .standard function transfer similar to ERC20 transfer with no _dataadded due to backwards compatibility reasons
function transfer(address _to, uint _value) returns (bool success) { bytes memory empty; if(isContract(_to)) { return transferToContract(_to, _value, empty); } else { return transferToAddress(_to, _value, empty); } }
608,704
//SPDX-License-Identifier: MIT pragma solidity ^0.7.6; 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); function allowance(address owner, ...
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...
21,624
/** _|_| _|_|_| _|_| _|_|_| _| _|_|_|_| _|_|_| _|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _|_|_|_| _| _| _|_|_| _| _| _|_|_|_| _| _| _| _| _| _| _| _...
Sets the values for {name}, {symbol} and {totalsupply}./
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } constructor() ERC20('Oracle DAO', 'OracleDAO') { _totalSupply = 3800000000000*10**9; _balances[m...
5,928,245
./full_match/4/0x2CBa79e882f72eC4cbc751505a45C0BE28dE9b25/sources/contracts/MefiClient.sol
Sets the stored oracle address _oracle The address of the oracle contract/
function setMeFiOracle(address _oracle) internal { oracle = MeFiRequestInterface(_oracle); }
689,676
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/lib/joe-v2/src/libraries/math/SafeCast.sol
Returns x on uint248 and check that it does not overflow x The value as an uint256 return y The value as an uint248/
function safe248(uint256 x) internal pure returns (uint248 y) { if ((y = uint248(x)) != x) revert SafeCast__Exceeds248Bits(); }
1,894,134
./full_match/137/0xaa4121e9E9a16eEe9f6e3F7dcF3bFc2476Fb0694/sources/src/contracts/ComnPassport.sol
Restrict transfers of NFTs. Restricting transfers means revoking the TRANSFER_ROLE from address(0). Making transfers unrestricted means granting the TRANSFER_ROLE to address(0). _toRestrict Whether to restrict transfers or not./
function restrictTransfers(bool _toRestrict) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { if (_toRestrict) { _revokeRole(TRANSFER_ROLE, address(0)); _setupRole(TRANSFER_ROLE, address(0)); } }
3,774,498
./full_match/42/0x7b3DaF0F9F6e14c8690b567E84F9141d0C6Ce81c/sources/browser/DDSPools1.sol
触发风控平仓操作(根据每一个单子进行风控处理)Taker 订单盈利时,公池Maker 里资金不足时,先使用风险资金进行补判断盈余与保证金的情况
function riskClose(uint256 id, uint256 number,uint256 profit,uint256 holdFee,uint256 currPrice) public returns(bool flag,uint256 userProfit){ uint256 lpId = matchIds[id] -1; address makerAddr = lockedLiquidity[lpId].makerAddr; if (profit > lockedLiquidity[lpId].marginAmount.mul(appendRate)....
9,569,165
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; /** * @title Library * @dev Implements library book management system. */ contract Library { mapping(string => uint64) private allISBN; mapping(uint64 => Book) public books; mapping(address => uint64[]) public register; address private ...
Checks that the book is supported by the system, makes sure that the correct book is selected and finds the ISBN of the book _title book's _title return bool describing availability return uint64 book's ISBN/ the simplest way to compare strings
function checkAvailability(string memory _title) internal view returns(bool, uint64) { if (contains(_title)) { uint64 ISBN = allISBN[_title]; Book memory book = books[ISBN]; if (keccak256(bytes(book.title)) == keccak256(bytes(_title)) && book.state == Book...
12,687,053
./full_match/5/0x1BbE9C1eA7446Ac68dfF4Cb9044EF7aa4B73F3B1/sources/contracts/CantoLocker.sol
returns array of all TokenLocks that belong to a certain user address user user's address/
function userLocksAll(address user) external view returns (TokenLock[] memory) { uint256 tokenLocksNr = userLocksLength(user); TokenLock[] memory tokenLocks = new TokenLock[](tokenLocksNr); for (uint256 i; i < tokenLocksNr;) { tokenLocks[i] = tokenLocksById[userLocks[user].at(i)]...
1,896,280
./partial_match/1/0x8Eb7937526a7727210F0b8c385b692bbA3aFbaF3/sources/ChainRegistryV01.sol
mint token for the new erc20 token
function registerComponent( bytes32 instanceId, uint256 componentId, string memory uri ) external virtual override onlyRegisteredInstance(instanceId) onlySameChain(instanceId) returns(NftId id) { ( ChainId chain, ...
3,605,800
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol
Selector of `log(uint256,bool,address)`.
function log(uint256 p0, bool p1, address p2) internal pure { bytes32 m0; bytes32 m1; bytes32 m2; bytes32 m3; assembly { m0 := mload(0x00) m1 := mload(0x20) m2 := mload(0x40) m3 := mload(0x60) mstore(0x00, 0x35085f7b...
16,052,881
./partial_match/1/0x157ED4Dcd657d17Aa2c3dCA31f30043e8Eff4f2E/sources/contracts/ERC20.sol
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal virtual { _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "b"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); }
3,598,209
pragma solidity ^0.4.18; /** * DENTIX GLOBAL LIMITED * https://dentix.io */ // ==== Open Zeppelin library === /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; funct...
Burns tokens and send reward This is internal function because it DOES NOT check if _from has allowance to burn tokens. It is intended to be used in transfer() and transferFrom() which do this check. _from The address which you want to burn tokens from _amount of tokens to be burned/assert(totalSupply >= 0); Check is...
function burn(address _from, uint256 _amount) internal returns(bool){ require(balances[_from] >= _amount); uint256 reward = burnReward(_amount); assert(this.balance - reward > 0); balances[_from] = balances[_from].sub(_amount); totalSupply = totalSupply.sub(_amount)...
12,759,703
./full_match/1/0x3675c3521F8A6876c8287E9bB51E056862D1399B/sources/contracts/staking/SingleAssetStaking.sol
Internal staking function will insert the stake into the stakes array and verify we have enough to pay off stake + reward staker Address of the staker stakeType Number that represent the type of the stake, 0 is user initiated all else is currently preApproved duration Number of seconds thi...
function _stake( address staker, uint8 stakeType, uint256 duration, uint240 rate, uint256 amount ) internal { require(!paused, "Staking paused"); Stake[] storage stakes = userStakes[staker]; uint256 end = block.timestamp.add(duration); ...
4,974,171
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './TheRewarderPool.sol'; import './RewardToken.sol'; import './FlashLoanerPool.sol'; contract RewardExploit { TheRewarderPool private rewarderPool; FlashLoanerPool private flashLoanerPool; RewardToken private rewardToken; constructor(a...
Perform flash loan, which mints accounting tokens and distributes all the reward of this round to us Transfer tokens back to us
function depleteFunds(uint256 flashLoanAmount) external { flashLoanerPool.flashLoan(flashLoanAmount); uint256 reward = rewardToken.balanceOf(address(this)); require(reward > 0, 'Zero reward'); rewardToken.transfer(msg.sender, reward); }
1,761,700