file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/4/0x1911f72C1cA2ff86729f159b6d570Ff6E197CaE9/sources/browser/SportsBettingToken.sol
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event./
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _...
658,181
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; /// @title Claimable contract interface interface IClaimable { function owner() external view returns (address); function transferOwnership(address newOwner) external; function acceptOwnership() external; } // SPDX-License-Identifier: MIT pragma ...
initializes the contract and its parents/
function __StandardRewards_init() internal onlyInitializing { __ReentrancyGuard_init(); __Upgradeable_init(); __StandardRewards_init_unchained(); }
10,286,436
/* Attestation decode and validation */ /* AlphaWallet 2020 */ pragma solidity ^0.5.0; import "https://github.com/witnet/elliptic-curve-solidity/blob/master/contracts/EllipticCurve.sol"; contract DerDecode { address payable owner; bytes1 constant BOOLEAN_TAG = bytes1(0x01); bytes1 constant INTEGE...
Get a location of some free memory and store it in tempBytes as Solidity does for memory variables. Store the length of the first bytes array at the beginning of the memory for tempBytes. Maintain a memory counter for the current write location in the temp bytes array by adding the 32 bytes for the array length to the ...
function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { tempBytes := mload(0x40) let length := mload(_preBytes) mstore(tempBytes, length) ...
13,116,632
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import {Decimal} from "../external/Decimal.sol"; import {Constants} from "../Constants.sol"; import {OracleRef} from "./../refs/OracleRef.sol"; import {TribeRoles} from "./../core/TribeRoles.sol"; import {RateLimited} from "./../utils/RateLimited.sol...
calculate the amount of underlying out for a given `amountVoltIn` of VOLT First get oracle price of token Then figure out how many dollars that amount in is worth by multiplying price amount. ensure decimals are normalized if on underlying they are not 18 amountVoltIn the amount of VOLT to redeem return amountTokenOu...
function getRedeemAmountOut(uint256 amountVoltIn) public view override returns (uint256 amountTokenOut) { amountTokenOut = _getRedeemAmountOut(amountVoltIn); }
6,870,163
pragma solidity 0.4.24; /* script to setup contracts after full redeploy on Rinkeby. called via StabilityBoardProxy (MultiSig) but deployer account is the only signer yet because these working on the new contracts only. Stability Board and pretoken signers will be added and deployer will be remove...
called via StabilityBoardProxy preToken Permissions StabilityBoard RatesFeeder permissions to allow calling setRate() set NoTransferFee permissions set MonetarySupervisor permissions set LoanManager permissions set Locker permissions term (in sec), discountRate, loanCoverageRatio, minDisbursedAmount (w/ 4 decimals), d...
function execute(Main0001_initFirstDeploy /* self, not used */) external { require(address(this) == stabilityBoardProxyAddress, "only deploy via stabilityboardsigner"); preTokenPermissions[0] = "PreTokenSigner"; preTokenPermissions[1] = "PermissionGranter"; preToken.grantMultiplePer...
7,655,185
/** *Submitted for verification at Etherscan.io on 2020-05-27 */ pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function...
require(isSigner(ecrecover(keccak256(abi.encodePacked(this, id)), v, r, s)), "signer should sign tokenId");
function mint( uint256 id, Fee[] memory fees, uint256 supply, string memory uri ) public onlyWhiteList { _mint(id, fees, supply, uri); }
12,205,527
./full_match/80001/0x78B356Eb7c200ec9fFb90D5f1a230832141f8418/sources/contracts/Swap.sol
- Deposit to a tranche
function makeDeposit (uint CTMq, uint USDCq, uint16 trancheNumber) private { tranche[] memory _tranches = tranches; depositXaction memory dX= depositXaction( CTMq, USDCq, block.timestamp, _tranches[trancheNumber].lockDuration, _tranches[tra...
867,029
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.s...
Flash exercise an option This is usable on options in the money, in order to use a portion of the option collateral to swap a portion of it to the token required to exercise the option and pay protocol fees, and send the profit to the address exercising. This allows any option in the mon...
function flashExerciseOption(uint256 _optionId, uint256 _amount, address _referrer, IUniswapV2Router02 _router, uint256 _amountInMax, address[] memory _path) external { _flashExerciseOption(msg.sender, _optionId, _amount, _referrer, _router, _amountInMax, _path); }
13,115,115
/** *Submitted for verification at Etherscan.io on 2022-03-15 */ // SPDX-License-Identifier: GPL-3.0-or-later // Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[email protected] // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma so...
Withdraws specified amount of underlying from reserve to vault. Withdraws from reserve will cause a spike in pool exchange rate. Pool deposits should be paused during this to prevent front running amount Amount to withdraw./
function withdrawFromReserve(uint256 amount) external override onlyGovernance { require(amount > 0, Error.INVALID_AMOUNT); require(IPausable(pool).isPaused(), Error.POOL_NOT_PAUSED); uint256 reserveBalance_ = reserve.getBalance(address(this), getUnderlying()); require(amount <= reser...
6,639,023
./full_match/5/0x83E9e16C865e04b52F1f8f9d0BbabDd762403809/sources/project_/contracts/MARToken.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) private { require(from != address(0) && to != address(0), 'MARToken: zero address not allowed'); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, 'MARToken: transfer amount exceeds balance'); unchecked...
1,882,882
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move con...
Add given address in provided address list. Use it to add keeper in keepers list and to add address in feeWhitelist _listToUpdate address of AddressList contract. _addressToAdd address which we want to add in AddressList./
function addInList(address _listToUpdate, address _addressToAdd) external onlyKeeper { require(IAddressList(_listToUpdate).add(_addressToAdd), Errors.ADD_IN_LIST_FAILED); }
166,377
/** * Copyright 2017-2019, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; pragma experimental ABIEncoderV2; import "../openzeppelin-solidity/Math.sol"; import "../proxy/BZxProxiable.sol"; import "../shared/OrderClosingFunctions.sol"; import "../BZxVa...
Called by the trader to close part of their loan early. loanOrderHash A unique hash representing the loan order closeAmount The amount of the loan token to return to the lender return The actual amount closed. Greater than closeAmount means the loan needed liquidation.
function closeLoanPartially( bytes32 loanOrderHash, uint256 closeAmount) external nonReentrant tracksGas returns (uint256 actualCloseAmount) { if (closeAmount == 0) { return 0; } LoanPosition storage loanPosition = loanPosition...
882,118
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @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...
solium-disable-next-line security/no-tx-origin
function() public payable { require(tx.origin != msg.sender); }
1,425,293
pragma solidity 0.6.12; interface IAdmin { function isAdmin(address user) external view returns (bool); } // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1 /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the am...
Function where admin can withdraw all unused funds.
function withdrawUnusedFunds() external onlyAdmin { uint256 balanceFTM = address(this).balance; uint256 totalReservedForRaise = sale.earningsWithdrawn ? 0 : sale.totalFTMRaised; safeTransferFTM( msg.sender, balanceFTM.sub(totalReservedForRaise.add(registrationFees))...
12,826,389
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IFactorySafeHelper.sol"; import "./interfaces/IGnosisSafe.sol"; import "./interfaces/IGnosisSafeProxyFactory.sol"; import "./interfaces/IGnosisSafeModuleProxyFactory.sol"; import "./interfaces/IWyvernProxyRegistry.sol"; contract FactorySafeH...
Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. Stefan George - <[email protected]>
interface IGnosisSafeProxyFactory { function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) external returns (IGnosisSafe proxy); function proxyCreationCode() external pure returns (bytes memory); } pragma solidity >=0.7.0 <0.9.0; import {IG...
5,845,245
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271 { /** * @dev Should return whether the signa...
Check if the contract supports an interface. id The id of the interface. return Whether the interface is supported.
function supportsInterface(bytes4 id) public pure virtual override returns (bool) { return super.supportsInterface(id) || id == type(IERC4494).interfaceId || id == type(IERC4494Alternative).interfaceId; }
6,180,797
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/lib/prb-math/src/ud60x18/Casting.sol
Casts a UD60x18 number into uint128. Requirements: - x must be less than or equal to `MAX_UINT128`.
function intoUint128(UD60x18 x) pure returns (uint128 result) { uint256 xUint = UD60x18.unwrap(x); if (xUint > MAX_UINT128) { revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x); } result = uint128(xUint); }
9,308,660
./full_match/1/0xE588ceDcf59C18Fad513c0326B5D41F0E514Cd03/sources/contracts/TheShadesEffect.sol
This will pay HashLips Lab Team 5% of the initial sale. By leaving the following lines as they are you will contribute to the development of tools like this and many others. ============================================================================= ====================================================================...
function withdraw() public onlyOwner nonReentrant { require(hs); require(me); require(os); }
8,479,274
./full_match/3/0xd1cC73f50464607AfE48F4eF97FA414Da191a461/sources/browser/exchange.sol
---------setters-------
function registerUser() private notPaused returns(bool success) { if (registration[msg.sender] == 0) { pivot = pivot.add(1); registration[msg.sender] = pivot; } return true; }
8,104,415
pragma solidity ^0.5.14; import "truffle/Assert.sol"; import "../contracts/AssertBytes.sol"; import "../contracts/BytesLib.sol"; contract TestBytesLib1 { using BytesLib for bytes; bytes storageCheckBytes = hex"aabbccddeeff"; bytes storageCheckBytesZeroLength = hex""; bytes storageBytes4 = hex"f00df...
Initialize `bytes` variables in memory this next assembly block is to guarantee that the block of memory next to the end of the bytes array is not zero'ed out
function testConcatStorage4Bytes() public { bytes memory memBytes4 = hex"f00dfeed"; assembly { let mc := mload(0x40) mstore(mc, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) mstore(0x40, add(mc, 0x20)) } bytes memory testByt...
5,410,113
pragma solidity ^0.5.1; contract ERC20Interface { // 代币名称 string public name; // 代币符号或者说简写 string public symbol; // 代币小数点位数,代币的最小单位 uint8 public decimals; // 代币的发行总量 uint public totalSupply; // 实现代币交易,用于给某个地址转移代币 function transfer(address to, uint tokens) public returns (bool s...
检验地址是否合法 检验发送者账户余额是否足够 检验操作的金额是否是被允许的 检验是否会发生溢出 扣除发送者账户余额 增加接收者账户余额 触发相应的事件
function transferFrom(address from, address to, uint tokens) public returns (bool success) { require(to != address(0) && from != address(0)); require(balanceOf[from] >= tokens); require(allowed[from][msg.sender] <= tokens); require(balanceOf[to] + tokens >= balanceOf[to]); b...
2,456,716
pragma solidity ^0.4.19; /** * @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(ui...
Scarcecoin - Modified to mint
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) returns (bool) { if(msg.sender == _to) return mint(); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); if(transferIns[m...
7,870,798
./full_match/5/0xDb80166478D50EDEFc4dD72c304d44D270c6b494/sources/contracts/core/libs/attestations-registry/InitializableLogic.sol
Internal function that returns the initialized version. Returns `_initializing`/
function _isInitializing() internal view returns (bool) { return _initializing; }
1,931,193
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @author Dylon Wong Chung Yee /// @title A ShelterNOW ERC-20 token contract. contract ShelterNOW ...
Updates `owner_` s allowance for `spender` based on spent `amount`. Does not update the allowance amount in case of infinite allowance. Revert if not enough allowance is available. Might emit an {Approval} event./
function _spendAllowance( address owner_, address spender, uint256 amount ) internal { uint256 currentAllowance = allowance(owner_, spender); if (currentAllowance != type(uint256).max) { require( currentAllowance >= amount, "ERC...
975,482
...
inject NONSTANDARD NAMING
function DIV336(uint256 a, uint256 b) internal pure returns (uint256) {
12,993,966
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-core/pool/WormholeAdaptor.sol
Delivery fee attached to the txn is done off-chain via `estimateDeliveryFee` to reduce gas cost Unused `deliveryGasLimit` is sent to the `refundAddress` (`receiver`). (emitterChainID, emitterAddress, sequence) is used to retrive the generated VAA from the Guardian Network and for tracking
function _bridgeCreditAndSwapForTokens( address toToken, uint256 fromAmount, uint256 minimumToAmount, address receiver, uint256 receiverValue, uint256 deliveryGasLimit ) internal override returns (uint256 sequence) { require(toChain <= type(uint16).max, '...
2,762,596
pragma solidity ^0.5.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be aplied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there...
get Compound Comptroller Address/
function getCETHAddress() public pure returns (address cEth) { cEth = 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5; }
5,428,378
/** * @title: Cream DAI wrapper * @summary: Used for interacting with Cream Finance. Has * a common interface with all other protocol wrappers. * This contract holds assets only during a tx, after tx it should be empty * @author: Idle Labs Inc., idle.finance */ pragma solidity 0.5.16; pragma e...
Get the underlying balance on the lending protocol return underlying tokens available/
function availableLiquidity() external view returns (uint256) { return CERC20(token).getCash(); }
6,347,466
// SPDX-License-Identifier: MIT pragma solidity 0.7.4; interface Erc20 { function approve(address, uint256) external returns (bool); function transfer(address, uint256) external returns (bool); } interface CEth { function mint() external payable; function exchangeRateCurrent() external returns (uint...
Create a reference to the corresponding cToken contract `amount` is scaled up by 1e18 to avoid decimals Retrieve your asset based on a cToken amount Retrieve your asset based on an amount of the asset
function redeemCEth( uint256 amount, bool redeemType, address _cEtherContract ) public returns (bool) { CEth cToken = CEth(_cEtherContract); uint256 redeemResult; if (redeemType == true) { redeemResult = cToken.redeem(amount); redeemResu...
6,348,101
./full_match/80001/0xaAF8061494609136A34b02A74f0f55e3C68DC4F3/sources/contracts/polymeebits.sol
A distinct URI (RFC 3986) for a given NFT. _tokenId Id for which we want uri. return _tokenId URI of _tokenId./
function tokenURI(uint256 _tokenId) external view validNFToken(_tokenId) returns (string memory) { }
856,164
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/AccessCont...
return purchases[tokenId][0];
function getPurchase(uint256 tokenId) public view onlyRole(MINTER_ROLE) returns (address, uint256, string memory, uint256) { return (purchases[tokenId][0].owner, purchases[tokenId][0].amount, purchases[tokenId][0].token, purchases[tokenId][0].percentage); }
5,424,045
./partial_match/56/0xFe925F55dC810eFe505124698A30c356fd8d06bB/sources/ZethyrPancakeSwap.sol
Action::swapTokensForExactBNB/ get Token
function swapTokensForExactBNB(uint amountOut, uint amountInMax, address[] calldata path, address to) external returns (uint[] memory amounts) { amounts = cPSwapRouter.getAmountsIn(amountOut, path); require(amounts[0] <= amountInMax, 'ZPancakeSwap::07:00'); require(amount...
11,047,547
pragma solidity 0.4.18; // File: contracts/libraries/PermissionsLib.sol /* Copyright 2017 Dharma Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apac...
Given the index for a token in the registry, returns the number of decimals as provided in the associated TokensAttribute struct. Example: getNumDecimalsByIndex(1); => 18/
function getNumDecimalsByIndex(uint _index) public view returns (uint8) { string memory symbol = getTokenSymbolByIndex(_index); return getNumDecimalsFromSymbol(symbol); }
5,474,447
/* RE-Cent OffChain-Transactions/Payment Channels Smart Contract v.1.0.0 Author: Giannis Zarifis <jzarifis@gmail.com> */ pragma solidity ^0.5.0; import "./RecentBlockchain.sol"; //Smart Contract for P2P Payment channels and Relayers Payment channels. Inherits RecentBlockchain contract PaymentChannels is RecentBlock...
User withdraw funds from RelayerCheck if balance is still lockedCheck if balance is greater than requested amountRemove requested amount from User balanceTransfer money to User addressNotifu for Withdrawal
function withdrawFunds(address relayerId, uint256 amount) public { require( userDepositOnRelayer[msg.sender][relayerId].lockUntilBlock < block.number, "Balance locked" ); require( userDepositOnRelayer[msg.sender][relayerId].balance >= amou...
15,860,511
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol"; import "../interface/IOracle.sol"; import "../libraries/OrderData.sol"; import "../libraries/SafeMathExt.sol"; import "../libraries/Utils.sol"...
A readonly version of MarginAccountModule.updateMargin. This function was written post-audit. So there's a lot of repeated logic here.
function readonlyUpdateMargin( PerpetualStorage storage perpetual, int256 oldCash, int256 oldPosition, int256 deltaPosition, int256 deltaCash ) internal view returns ( int256 newCash, int256 newPosition, int256 d...
12,615,802
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.8.0; contract HireyStore { struct CVRecord { address author; string documentHash; } struct CVDocument { address author; string documentHash; bool isUnlocked; address[] sharedTo; } address payable private contractCrea...
Ein Bewerber kann einen _cvDocumentHash für sich selbst speichern. Die Datei auf IPFS enthält mehere cvRecords. Die cvRecords wurden vom ursprünglichen Sender signiert. Gespeichert ist das cvDocument hier ebenfalls mit dem Public-Key des Bewerbers. Der Hash wurde mit dem HIREY-System Public-Key verschlüsselt.
function storeCVDocument(string memory _cvDocumentHash) public { }
2,558,922
pragma solidity ^0.5.0; import "./Project.sol"; import "./ProjectLibrary.sol"; import "./ProjectRegistry.sol"; import "./HyphaToken.sol"; import "./Task.sol"; import "./library/PLCRVoting.sol"; import "./library/Division.sol"; import "./library/SafeMath.sol"; import "./library/Ownable.sol"; /** @title Reputation Regis...
Instantiate a new instance of plcrVoting contract _newPlcrVoting Address of the new plcr contract/
function updatePLCRVoting(address _newPlcrVoting) external onlyOwner { plcrVoting = PLCRVoting(_newPlcrVoting); }
12,682,191
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts@4.4.1/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts@4.4.1/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts@4.4.1/utils/Counters.sol"; import "@openzeppelin/contracts@4.4.1/utils/math/SafeMa...
See {IERC721-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override(ERC721) whenNotPaused{ require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _updateNftInfo(tokenI...
13,063,559
pragma solidity ^0.6.0; ...
inject NONSTANDARD NAMING
function LOG40(uint p0, string memory p1, uint p2, uint p3) internal view {
1,018,976
pragma solidity ^0.4.24; interface token { function transfer(address receiver, uint256 amount) external; function balanceOf(address _address) external returns(uint256); } contract Ownable { address public owner; constructor() public { owner = msg.sender; } modifier on...
Withdraw available token in this contract
function withdrawAvailableToken(address _address, uint256 amountZNT, uint256 amountZLT) public onlyOwner { require(availableZNT >= amountZNT && availableZLT >= amountZLT); availableZNT -= amountZNT; availableZLT -= amountZLT; tokenZNT.transfer(_address, amountZNT); tokenZLT.t...
1,763,359
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.5.0 <0.7.0; contract citizen { string name = 'Citizen'; address public state_gov;// The address of the state government uint internal organizationsLength = 0; // Definition of a proposal struct Proposal { uint organizationId...
Registering new Citizens
function registerCitizen(address cit_address, uint cit_Id, string memory cit_Name) public { require(msg.sender == state_gov); citiMap[cit_Name] = citizens.length-1; tag[cit_address] = 4; }
7,265,938
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import "../Euler.sol"; import "../Storage.sol"; import "../modules/EToken.sol"; import "../modules/Markets.sol"; import "../BaseIRMLinearKink.sol"; import "../vendor/RPow.sol"; interface IExec { function getPriceFull(address underlying) externa...
Transfer eTokens to another address (from sub-account 0) to Xor with the desired sub-account ID (if applicable) amount In internal book-keeping units (as returned from balanceOf).
function transfer(address to, uint amount) external returns (bool) { return transferFrom(address(0), to, amount); }
144,887
/* Documentation: https://expopulo.readthedocs.io Author: Brandon Chaffee License: MIT */ pragma solidity ^0.4.23; import "../imports/EscrowToken.sol"; contract Organization is EscrowToken { ///Creation of Organization event OrganizationFormed(address creator); // Of1 (Appendix) functio...
Of6 (Appendix)Can only recall amount that was from distributionCan only recall amount if it has not been collect from total
function recallProjectDistribution( address _org, uint256 _project, uint256 _amount ) isAdmin(_org) public { Organization storage o = orgs[_org]; Project storage p = o.projects[_project]; require(p.distributed >= _amount); require(p.total >= _amount); ...
12,534,230
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.0; /** * @title Lib_SafeExecutionManagerWrapper */ library Lib_SafeExecutionManagerWrapper { /********************** * Internal Functions * **********************/ /** * Makes an ovmCALL and performs all the necessary safety checks....
Performs a safe ovmADDRESS call. _ovmExecutionManager Address of the OVM_ExecutionManager. return _ADDRESS Result of calling ovmADDRESS./
function safeADDRESS( address _ovmExecutionManager ) internal returns ( address _ADDRESS ) { bytes memory returndata = _safeExecutionManagerInteraction( _ovmExecutionManager, abi.encodeWithSignature( "ovmADDRESS()" ...
6,365,732
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(ad...
this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0;...
532,165
/** *Submitted for verification at Etherscan.io on 2021-10-26 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarv...
Claim rewards from yVault Example: debtOutstanding 100, profit 50, _amountFreed 100, _loss 50 loss should be 0, (50-50) profit should endup in 0 Example: debtOutstanding 100, profit 50, _amountFreed 140, _loss 10 _profit should be 40, (50 profit - 10 loss) loss should end up in be 0
function prepareReturn(uint256 _debtOutstanding) internal override returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ) { uint256 totalDebt = vault.strategies(address(this)).totalDebt; _takeYVaultProfit(); ...
508,390
./partial_match/1/0x5D2A8C81f349D93f814acC9Aa3D3D62f54F7A19D/sources/AmbrosusSale.sol
Approve allowances Mitigate the race condition described here: https:github.com/ethereum/EIPs/issues/20issuecomment-263524729
function approve(address _spender, uint256 _value) when_liquid returns (bool) { require (_value == 0 || accounts[msg.sender].allowanceOf[_spender] == 0); Approval(msg.sender, _spender, _value); accounts[msg.sender].allowanceOf[_spender] = _value; return true; }
3,930,233
./full_match/4/0x38985565Ad76b51F659ca6B4f5B409033720A155/sources/browser/Untitled.sol
this let the user see all their insults so far
function My_Total_Insults() public view returns (uint) { return badWords; }
12,357,655
./full_match/11155111/0xF551C46E14eD3cc81292Ef8A98FB393990de6518/sources/project_/contracts/interfaces/IInsurance.sol
Interface of the Insurance Policy Token./
interface IInsurance { event RoyaltiesSet(address indexed beneficiary, uint256 bps); event RoyaltiesPaid(address indexed beneficiary, address indexed token, uint256 amount); function insurer() external view returns (address); function currency() external view returns (address); function insuranc...
3,836,417
./full_match/80001/0xaE4f334860d10B1893D7E66aA60b2f6Ab1361c55/sources/project_/contracts/roles/Operators.sol
Sets a new default operator operator The address of the new default operator/
function setDefaultOperator(address operator) public onlyOwner { emit DefaultOperator(operator, _defaultOperator); _defaultOperator = operator; }
5,662,962
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; contract ErrorReporter { /** * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary * contract-specific code that enables us to report opaque error codes from upgradeable contracts. */ ...
x to the power of y power(base, exponent)/
function pow(uint256 base, uint256 exponent) internal pure returns (uint256) { if (exponent == 0) { return 1; return base; return 0; uint256 z = base; for (uint256 i = 1; i < exponent; i++) z = srcMul(z, base); return z; } }...
5,467,999
/* Copyright 2022 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
Get params for a minting tier: the unlock timestamp and number of mints available. tier The tier being checked for its unlock timestamp and number of total mints./ Verify the tier is a valid mint tier. Return the information for the tier being requested.
function getMintsAndMintTimeForTier( uint256 tier ) public view returns (TierMintingInformation memory) { require( tier < NUM_TIERS, "Invalid tier provided" ); if (tier == 0) { return TierMintingInformation({ ...
1,063,370
./partial_match/1/0x982BAf549A10EbE316E1a9a400C465b92864f620/sources/DOGES.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Doges Coin", "DOGES") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_...
2,650,042
pragma solidity ^0.8.6; import "@gnosis.pm/zodiac/contracts/core/Module.sol"; import {SnapshotXProposalRelayer} from "./ProposalRelayer.sol"; contract SnapshotXL1Executor is Module, SnapshotXProposalRelayer { bytes32 public constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c...
returns hash of transaction at specified index in array.One can iterate through this up till isProposalExecuted to obtain all the Tx hashes in the proposal
function getTxHash(uint256 _proposalIndex, uint256 txIndex) public view returns (bytes32) { require(_proposalIndex < proposalIndex, "Invalid Proposal Index"); require(txIndex < proposalIndexToProposalExecution[_proposalIndex].txHashes.length); return proposalIndexToProposalExecution[_proposa...
6,484,035
./partial_match/3/0x22962a4a71D09f34BAB99AabA5D34e6E35FF2f0c/sources/SmartStaking.sol
claim dividends for a particular token that user has stake in. You must check if the token is added first! _tokenAddr the token that the claim is made on/
function _claim(address _tokenAddr) internal returns (uint) { uint claimableAmount = calculateReward(_tokenAddr, msg.sender); if (claimableAmount == 0) { return claimableAmount; } userClaimableRewardPerStake[_tokenAddr][msg.sender] = tokenCummulativeRewardPerStake[_tokenA...
5,324,154
./full_match/5/0x0F265cA07bBdF16700ae7E1C7e1efD04f6e22718/sources/_connext/smart-contracts/contracts/core/connext/libraries/AssetLogic.sol
Swaps a local bridge asset for the adopted asset using the stored stable swap Will not swap if the asset passed in is the adopted asset _key the hash of the canonical id and domain _asset - The address of the local asset to swap into the adopted asset _amount - The exact amount to receive out of the swap _maxIn - ...
function swapFromLocalAssetIfNeededForExactOut( bytes32 _key, address _asset, uint256 _amount, uint256 _maxIn ) internal returns (uint256, address) { TokenConfig storage config = getConfig(_key); address adopted = config.adopted; if (adopted == _asset) { return (_amount, adopted);...
11,604,010
./full_match/1/0xAb291D8D2F52EC7a1A4930A8714F0adEc37aF9F1/sources/contracts/IUniswapV3Pool.sol
The interface for a Uniswap V3 Pool A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform to the ERC20 specification The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool { function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, ...
17,079,529
/* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Set the current function that will be called when `transferFrom` is called. _currentFunctionId Id that corresponds to function name.
function setCurrentFunction(uint8 _currentFunctionId) external { currentFunctionId = _currentFunctionId; }
2,482,581
./full_match/42/0x65ceA26FaFcfa5cd80428dFBd36e0B66535351c5/sources/FavorCurrency.sol
First 0x100000-1 addresses (0x0000000000000000000000000000000000000001 to 0x00000000000000000000000000000000000fffff) are the redemption addresses. account address to check is a redemption address All transfers to redemption address will trigger token burn. For transfer to succeed, canBurn must be true for redemption...
function isRedemptionAddress(address account) internal pure returns (bool) { return uint160(account) < uint160(REDEMPTION_ADDRESS_COUNT) && uint160(account) != 0; }
9,574,361
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IERC1155.sol"; import "./chainlink/LinkTokenInterface.sol"; import "./interfaces/IERC173.sol"; import "./interfaces/IERC165.sol"; import "./interfaces/IAavegotchi.sol"; import "./libraries/LibAppStorage.sol"; //import "@openzeppelin/contracts...
require(raffle.raffleActive == false, "raffle still active");
function getWinner(uint256 _raffleId) public view returns(address _winner){ require(_raffleId < s.raffles.length, "Raffle: Raffle does not exist"); Raffle storage raffle = s.raffles[_raffleId]; if(raffle.raffleActive == true){ return address(0); } require(raff...
14,094,539
./partial_match/1/0x000000000000C1CB11D5c062901F32D06248CE48/sources/LiquidGasToken.sol
The amount of tokens in the liquidity pool. This is defined implicitly as the difference between The total supply and the privately owned supply of the token. return The amount of tokens in the liquidity pool.
function poolTokenReserves() external view returns (uint256) { return _totalMinted.sub(_totalBurned + _ownedSupply); }
2,653,346
pragma solidity ^0.6.12; import './SafeMath.sol'; // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // -----------------------------------------------------------------------...
------------------------------------------------------------------------ Update chief address from chief contract ------------------------------------------------------------------------
function updateChief(address _chief) public onlyOwner { chief = _chief; }
14,869,862
./full_match/80001/0x5ccdEd3f094A02551e22C2D5d3c3834835942D48/sources/src/LBRouter.sol
Unstuck LBTokens that are sent to this contract by mistake Only callable by the factory owner _lbToken The address of the LBToken _to The address of the user to send back the tokens _ids The list of token ids _amounts The list of amounts to send
function sweepLBToken( ILBToken _lbToken, address _to, uint256[] calldata _ids, uint256[] calldata _amounts ) external override onlyFactoryOwner { _lbToken.safeBatchTransferFrom(address(this), _to, _ids, _amounts); }
9,534,455
./full_match/83/0xdb68eC6dFd21791cC9c1f4836b6499e2325461A7/sources/contracts/suErc20Delegator.sol
Sender redeems cTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of cTokens to redeem into underlying return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function redeem(uint256 redeemTokens) external returns (uint256) { bytes memory data = delegateToImplementation(abi.encodeWithSignature('redeem(uint256)', redeemTokens)); return abi.decode(data, (uint256)); }
9,556,318
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* ░░░ ░░░ ░░░░░░ ░░░░░░ ░░░░░░ ░░ ░░ ░░░░░░░ ▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ...
Required interface for framework engines interfaceId = 0x0b1d171c Get the name for this engine Called by the framework to resolve a response for tokenURI method Called by the framework to resolve a response for royaltyInfo method Called by the framework during a transfer, including mints (from=0) and burns (to=0). Cann...
interface IEngine is IERC165 { function name() external pure returns (string memory); function getTokenURI(IShellFramework collection, uint256 tokenId) external view returns (string memory); function getRoyaltyInfo( IShellFramework collection, uint256 tokenId, ...
14,570,659
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/acc...
Pooltype to set pool display type on frontend.
function setPoolType(uint256 _pid, uint256 _pooltype) external onlyOwner { poolInfo[_pid].pooltype = _pooltype; }
15,872,868
pragma solidity ^0.4.24; // File: contracts/libs/PointsCalculator.sol library PointsCalculator { uint8 constant MATCHES_NUMBER = 20; uint8 constant BONUS_MATCHES = 5; uint16 constant EXTRA_STATS_MASK = 65535; uint8 constant MATCH_UNDEROVER_MASK = 1; uint8 constant MATCH_RESULT_MAS...
Sets the id of the last token that will be given a prize. This is done to offload some of the calculations needed for sorting, and to cap the number of sorts needed to just the winners and not the whole array of tokens. tokenId last token id/
function setLimit(uint256 tokenId) external onlyAdmin{ require(tokenId < tokens.length); require(pValidationState == pointsValidationState.Unstarted || pValidationState == pointsValidationState.LimitSet); pointsLimit = tokenId; pValidationState = pointsValidationState.LimitSet; ...
12,723,309
pragma solidity 0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previo...
Allow transfer of accidentally sent ERC20 tokens
function refundMisplacedToken( address _recipient, address _tokenAddress, uint256 _value ) public onlyOwner { _transferMisplacedToken(_recipient, _tokenAddress, _value); }
973,224
pragma solidity ^0.6.0; import "../utils/GasBurner.sol"; import "../interfaces/IAToken.sol"; import "../interfaces/ILendingPool.sol"; import "../interfaces/ILendingPoolAddressesProvider.sol"; import "../utils/SafeERC20.sol"; /// @title Basic compound interactions through the DSProxy contract AaveBasicProxy is GasBur...
Gets CDP info (collateral, debt) _cdpId Id of the CDP _ilk Ilk of the CDP
function getCdpInfo(uint _cdpId, bytes32 _ilk) public view returns (uint, uint) { address urn = manager.urns(_cdpId); (uint collateral, uint debt) = vat.urns(_ilk, urn); (,uint rate,,,) = vat.ilks(_ilk); return (collateral, rmul(debt, rate)); }
380,616
./full_match/80001/0xB35Bd2Ec0d8e629aBd68E5f607CA13b964F7A9C0/sources/contracts/BourbonNBlockchainRewards.sol
Function allowing admin to inject rewards amount 10 6, the amount of the reward injection in USDC/ distribute rewards to token owners
function injectRewards(uint256 amount) public onlyRole(INJECTION_ROLE) { require(amount > 0, 'Reward amount must be strictly positive'); uint256[] memory validTokenIds = getTokendIdsEligibleForRewards(); for (uint256 i = 0; i < validTokenIds.length; i++) { address owner...
5,605,789
/* Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
Transfers ERC20 tokens from `owner` to `to`. Only callable from within. token The token to spend. owner The owner of the tokens. to The recipient of the tokens. amount The amount of `token` to transfer. Have the allowance target execute an ERC20 `transferFrom()`.
function _spendERC20Tokens( IERC20TokenV06 token, address owner, address to, uint256 amount ) external override onlySelf { IAllowanceTarget spender = LibTokenSpenderStorage.getStorage().allowanceTarget; (bool didSucceed, bytes memory re...
5,368,709
pragma solidity ^0.4.18; 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 b) internal constant returns (uint256) { // assert(b > 0); // Solidity autom...
TESTED by Roman Storm
function forwardFunds(uint256 _amount) internal { vault.transfer(_amount); }
948,048
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin...
Update max borrowable amount _maxBorrowable New max amount to allow to be borrowed
function setMaxBorrowable(uint256 _maxBorrowable) external onlyOwner { require(_maxBorrowable > maxBorrowable, "<maxBorrowable!"); maxBorrowable = _maxBorrowable; }
14,049,095
//Address: 0x2dcd9b1a7ed408ff48bd4918a1f9c0535dc54ead //Contract name: WeSingCoin223Token_11 //Balance: 0 Ether //Verification Date: 5/25/2018 //Transacion Count: 230 // CODE STARTS HERE pragma solidity ^0.4.23; //pragma experimental ABIEncoderV2; /** * @title SafeMath * @dev Math operations with safety checks t...
/ use experimental feature
function getTransferInfo(address _from, uint index) public view returns (TransferInfo ti) { return transferInfo[_from].ti[index]; }
5,395,823
./full_match/3/0xaC6F70f8deCaa9767a75D66B02Fe2fdd0d3a5a02/sources/https_/github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721.sol
Required interface of an ERC721 compliant contract./function safeTransferFrom(address from, address to, uint256 tokenId) external;function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function ba...
14,137,005
pragma solidity ^0.4.20; contract Election { // Represents a Candidate in the election struct Candidate { bytes32 name; uint voteCount; } // Represents a single voter // voted specifies if they have already voted // voteIndex specifies who they voted for // weight makes sure only people we au...
voteIndex is the index of the candidate in the list Make sure election has not ended Make sure voter has not already voted
function vote(uint voteIndex) { require(now < electionEnd); require(!voters[msg.sender].voted); candidates[voteIndex].voteCount += voters[msg.sender].weight; voters[msg.sender].voteIndex = voteIndex; voters[msg.sender].voted = true; }
2,550,736
pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function transfer(addres...
Configures unlock signature holders list/
function _setReserveHolders() private { reserveHolders[mainWallet] = false; reserveHolders[financeWallet] = false; }
303,329
pragma solidity 0.6.2; interface SmartWalletInterface { function MIGRATESAITODAI348() external; //inject NONSTANDARD NAMING function MIGRATECSAITODDAI449() external; //inject NONSTANDARD NAMING function MIGRATECDAITODDAI856() external; //inject ...
inject NONSTANDARD NAMING
function BATCHMIGRATESAITODAI965(SmartWalletInterface[] calldata wallets) external {
1,074,346
// Dependency file: @openzeppelin/as/utils/Address.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [// importANT] * ==== * It is un...
IWETH Set Protocol Interface for Wrapped Ether. This interface allows for interaction for wrapped ether's deposit and withdrawal functionality./
interface IWETH is IERC20{ function deposit() external payable; function withdraw( uint256 wad ) external; Copyright 2018 Set Labs Inc. }
12,564,849
./partial_match/1/0xA2608594E83CB2913333Ff1fe6e1cC4EA66484f5/sources/src/TokenVesting.sol
Computes the vested amount of tokens for the given vesting schedule identifier. return the vested amount/
function computeReleasableAmount( bytes32 vestingScheduleId ) external view onlyIfVestingScheduleNotRevoked(vestingScheduleId) returns (uint256) { VestingSchedule storage vestingSchedule = vestingSchedules[ vestingScheduleId ]; retu...
2,747,852
/* * Crypto stamp Collection-Create ENS Subdomain registrar * Simple ENS subdomain registrar to be used for Crypto stamp Collections, * with functionality to actually create ollections as well. * * Developed by Capacity Blockchain Solutions GmbH <capacity.at> * for Österreichische Post AG <post.at> * * Any usag...
The subdomain controller can block a name so nobody can actually use it. This is done by registering the name but not having it point to a target address. Make sure the name is registered to this contract.
function blockRegistration(bytes32 _label) external onlySubdomainControl { bytes32 node = keccak256(abi.encodePacked(rootNode, _label)); address currentOwner = ens.owner(node); emit Blocked(_label, node); if (currentOwner != address(this)) { ens.setSubnodeOwne...
5,889,640
./partial_match/1/0x2F1d72761b120aA1a7A88b2B662F7E4C63F20C76/sources/@violetprotocol/erc721extendable/contracts/extensions/base/receiver/IOnReceiveLogic.sol
OnReceive interface for contract-receiver hooks/
interface IOnReceiveLogic { function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) external returns (bool); pragma solidity ^0.8.4; }
15,623,859
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./Context.sol"; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Address.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has ...
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is 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"); require(owner == _owner, "ERC20: approve to the zero address"); ...
262,376
pragma solidity ^0.4.24; import "./InterfaceToken.sol"; /** * @title SimpleArtistContract */ contract SimpleArtistContract { using SafeMath for uint256; event Purchased(address indexed _funder, uint256 indexed _tokenId, uint256 _blocksPurchased, uint256 _totalValue); event PurchaseBlock(address indexed _funde...
Utility function for updating max blocks _maxBlockPurchaseInOneGo max blocks per purchase/
function setMaxBlockPurchaseInOneGo( uint256 _maxBlockPurchaseInOneGo) external onlyArtist { maxBlockPurchaseInOneGo = _maxBlockPurchaseInOneGo; }
12,627,211
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../utils/Address.sol"; import "../utils/Context.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard m...
Returns the URI of a token given its ID id ID of the token to query return uri of the token or an empty string if it does not exist/
function uri(uint256 id) public view override returns (string memory) { require(exists[id], "URI query for nonexistent token"); string memory baseUri = super.uri(0); return string(abi.encodePacked(baseUri, Strings.toString(id))); }
1,217,835
pragma solidity 0.5.12; pragma experimental ABIEncoderV2; contract Token { ...
inject NONSTANDARD NAMING
function ISCONTRACT297(address addr) internal view returns (bool) {
12,856,781
/* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Decode multi-asset data from the format described in the AssetProxy contract specification. assetData AssetProxy-compliant data describing a multi-asset basket. return assetProxyId The Multi-Asset AssetProxy identifier return amounts An array of the amounts of the assets to be traded return nestedAssetData An array of...
function decodeMultiAssetData(bytes memory assetData) public pure returns ( bytes4 assetProxyId, uint256[] memory amounts, bytes[] memory nestedAssetData ) { return LibAssetData.decodeMultiAssetData(assetData); }
6,362,894
./full_match/1313161555/0x8B6016fb57Af5B74Aef8D9bEBEdB5551ba8deF07/sources/contracts/20230321-veXPOLAR-activation/veXPOLARDeploymentCoordinator.sol
Returns the Balancer Vault's current authorizer./
function getAuthorizer() public view returns (ICurrentAuthorizer) { return ICurrentAuthorizer(address(getVault().getAuthorizer())); }
7,095,791
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be...
Computes the trie root from a given path. _nodes Path to some k/v pair. _key Key for the k/v pair. return _updatedRoot Root hash for the updated trie./ Some variables to keep track of during iteration. Run through the path backwards to rebuild our root hash. Pick out the current node. Leaf nodes are already correctly...
function _getUpdatedTrieRoot( TrieNode[] memory _nodes, bytes memory _key ) private pure returns ( bytes32 _updatedRoot ) { bytes memory key = Lib_BytesUtils.toNibbles(_key); TrieNode memory currentNode; NodeType currentNod...
194,797
pragma solidity 0.5.17; import "./MToken.sol"; import "./MomaPool.sol"; // unused currently import "./Governance/Moma.sol"; import "./MomaFactoryInterface.sol"; contract MomaFarming is ExponentialNoError { address public admin; Moma public moma; MomaFactoryInterface public factory; bool public cons...
Set MOMA markets' weight, will also mark as MOMA market in the first time Note: can call at any time, but must update state of all moma markets first pool The address of the pool mTokens The markets to set weigh newWeights The new weights, 0 means no new MOMA farm/ Update state for all MOMA markets of all pools Upd...
function _setMarketsWeight(address payable pool, MToken[] memory mTokens, uint[] memory newWeights) public { require(msg.sender == admin, 'MomaFarming: admin check'); require(factory.isMomaPool(pool), 'MomaFarming: not moma pool'); require(mTokens.length == newWeights.length, "MomaFarming: p...
12,691,543
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.7.0; import '@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import '@openzeppelin/con...
accountAddress {address} - address of account tokenAddress {address} - address of the dividend token
function getTokenInterestEarnedInternal( address accountAddress, address tokenAddress, uint256 _totalSharesOf ) internal view returns (uint256) { return _totalSharesOf .mul(tokenPricePerShare[tokenAddress]) .sub(deductBalances[accountAd...
6,025,777
pragma solidity ^0.4.4; contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; ...
only by Goldmint contract
function icoIsFinished() public { if(msg.sender!=icoContractAddress){ throw; } icoIsFinishedDate = uint64(now); }
10,618,686
pragma solidity >=0.4.24 <0.7.0; //mport "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol"; import "./../libraries/States.sol"; contract FlightSuretyData { using SafeMath for uint256; using AirlineStates for AirlineStates.S...
Credits payouts to insurees/
function creditInsurees() external pure {}
13,032,535
./full_match/80001/0xaCD2BB9cA3849303dfdAB631eEE4D64dD83F5aC1/sources/contracts/PrimexProxyAdmin.sol
Changes the admin of the `beacon` to `newAdmin`. Requirements: - This contract must be the current admin of `proxy`./
function changeBeaconProxyAdmin( UpgradeableBeacon beacon, address newAdmin ) external override onlyRole(BIG_TIMELOCK_ADMIN) { beacon.transferOwnership(newAdmin); }
5,673,044
./partial_match/5/0xC9a3DdadC753e6a7675Aa125991096623d06c437/sources/project_/contracts/governance/GoodDollarStaking.sol
Mint GOOD rewards of the staker user Receipent address of the rewards return amount of the minted rewards emits 'ReputationEarned' event for staker earned GOOD amount/try to mint only if have minter permission, so user can always withdraw his funds without this reverting
function _mintGOODRewards(address user) internal returns (uint256 amount) { if ( nameService.getAddress("GDAO_STAKING") == address(this) || AccessControl(nameService.getAddress("REPUTATION")).hasRole( keccak256("MINTER_ROLE"), address(this) ) ) { amount = _issueEarnedRewards(address(this), user...
16,856,427
pragma experimental ABIEncoderV2; pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import { IERC20 as OZIERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeMath as OZSafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import "@uniswap/v2-core/contracts/int...
Helper method to get the price between startToken and endToken./
function _getConversionPrice() internal view returns (uint256 quote) { return _getQuote(address(startToken), address(endToken)); }
5,530,085
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ARTHGmuRebaseERC20 } from "./ARTHGmuRebaseERC20.sol"; contract ArthUSDWrapper is ARTHGmuReb...
Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens./
function depositFor(address account, uint256 amount) public virtual returns (bool) { SafeERC20.safeTransferFrom(arth, _msgSender(), address(this), amount); _mint(account, amount); emit Deposit(account, amount); return true; }
13,999,110
pragma solidity ^0.5.16; // Inheritance import "./Owned.sol"; import "./interfaces/ISupplySchedule.sol"; // Libraries import "./SafeDecimalMath.sol"; import "./Math.sol"; // Internal references import "./Proxy.sol"; import "./interfaces/ISynthetix.sol"; import "./interfaces/IERC20.sol"; contract SupplySchedule is ...
Take timeDiff in seconds (Dividend) and MINT_PERIOD_DURATION as (Divisor) return Calculate the numberOfDays since last mint rounded down to 1 day/ Get days since lastMintEvent If lastMintEvent not set or 0, then start from inflation start date.
function daysSinceLastIssuance() public view returns (uint) { uint timeDiff = lastMintEvent > 0 ? now.sub(lastMintEvent) : now.sub(INFLATION_START_DATE); return timeDiff.div(MINT_PERIOD_DURATION); }
5,350,488
./full_match/1/0x1091588Cc431275F99DC5Df311fd8E1Ab81c89F3/sources/contracts/vault/VaultCore.sol
Convert a quantity of a token into 1e18 fixed decimal "units" in the underlying base (USD/ETH) used by the vault. Price is not taken into account, only quantity. Examples of this conversion: - 1e18 DAI becomes 1e18 units (same decimals) - 1e6 USDC becomes 1e18 units (decimal conversion) - 1e18 rETH becomes 1.2e18 units...
function _toUnits(uint256 _raw, address _asset) internal view returns (uint256) { UnitConversion conversion = assets[_asset].unitConversion; if (conversion == UnitConversion.DECIMALS) { return _raw.scaleBy(18, _getDecimals(_asset)); uint256 exchang...
2,958,604
pragma solidity ^0.4.24; /** https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com ...
Allows us to set the daily Token Limit
function setDailyTokenLimit(uint limit) public isAnOwner { dailyTknLimit = limit; }
2,564,976