file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/3/0xDa66771A4E7A6AA6cBaF5526CCb9a3159cf64E03/sources/ItemTakeBack.sol | gold box silver box | function openBox(
address _user,
uint256 _nonce,
uint256 _boxId,
uint256 _amount
) internal {
(uint256 prizeNFT, uint256 prizeFT) = random(
_nonce,
_boxId
);
uint256 tokenId;
uint256 value;
uint256 boxType = (_boxId ... | 16,639,852 |
//Address: 0xb07097789653cf09322bf03d4f12b90635cf721c
//Contract name: Distribute
//Balance: 0 Ether
//Verification Date: 1/25/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.11;
// ERC20 Interface: https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function transfer(address _to, uint ... | --------------------------ADMINS-------------------------- ------------------------- PAYEES ----------------------- | function Distribute() public {
admins.push(msg.sender);
admins.push(0x91e65a0e5ff0F0E8fBA65F3636a7cd74f4c9f0E2);
}
| 7,271,967 |
./full_match/43114/0xaD67439c61063034348fb1B4c24d12c8e2B199E5/sources/basedmumu.sol | Max tx check Max wallet check excluding pair and router No swapping on buy and tx | function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) {
address routerAddress = 0x60aE616a2155Ee3d9A68541Ba4544862310933d4;
bool isBuy = sender == pair|| sender == routerAddress;
bool isSell = recipient == pair|| recipient == routerAddress;
checkTxLim... | 4,639,360 |
//Address: 0xee24f2c601a9f8a406fdb8169ba4580b3c411d74
//Contract name: BCoinToken
//Balance: 0 Ether
//Verification Date: 4/18/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.21;
// File: zeppelin-solidity/contracts/AddressUtils.sol
/**
* Utility library of inline functions on addresses
*/
li... | called by the owner to freeze token holder/ | function freezeAccount(address target, bool freeze) onlyOwner public {
require(target != address(0));
freezeHolders[target] = freeze;
emit FrozenFunds(target, freeze);
}
| 7,221,928 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @title Converter
* @dev Converts bytes32 and string pair.
*/
contract Converter {
/**
* @dev Converts string to bytes32
*
* References:
*
* - https://blockchangers.github.io/solidity-converter-online/
*/
f... | Converts string to bytes32 References:/ | function bytes32ToString(
bytes32 x
) public pure returns (string memory) {
bytes memory bytesString = new bytes(32);
uint256 charCount = 0;
for (uint256 j = 0; j < 32; j++) {
byte char = byte(bytes32(uint256(x) * 2 ** (8 * j)));
if (char != 0) {
... | 5,472,522 |
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;
import "../../deploy/InstanceAbstract.sol";
import "../../common/Controlled.sol";
import "./Delegation.sol";
/**
* @title DelegationAbstract
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH).
*/
abstract contract Delegation... | `_getDelegationAt` retrieves the delegation at a given block number. checkpoints The memory being queried. _block The block number to retrieve the value at. return d The delegation being queried./ Case last checkpoint is the one; Lookup in array; | function getMemoryAt(DelegateSet[] storage checkpoints, uint _block) internal view returns (DelegateSet memory d) {
if (_block >= checkpoints[checkpoints.length-1].fromBlock) {
d = checkpoints[checkpoints.length-1];
uint min = 0;
uint max = checkpoints.length-1;
... | 1,067,637 |
//Address: 0x5afc0b82bd845f20804e42ec049bee8e17fa9700
//Contract name: CevacToken
//Balance: 0 Ether
//Verification Date: 6/11/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
*... | this is the default constructor | function CevacToken(uint256 _fundingStartBlock, uint256 _fundingEndBlock){
balances[ownerWallet] = CevacFund;
totalSupply = CevacFund;
fundingStartBlock = _fundingStartBlock;
fundingEndBlock = _fundingEndBlock;
}
| 14,076,493 |
// SPDX-License-Identifier: MIT
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 constructor logic to an
* external initializer f... | Allows to claim an ERC20 for an account To be able to do so, every time a claim is asked, we will compare both current and last known balance for this contract, allowing to keep up to date on how much it has ever received then we can calculate the full amount due to the account, and substract the amount alre... | function claimERC20(
address account,
uint256 percent,
bytes32[] memory merkleProof,
address[] memory erc20s
) public {
require(
MerkleProofUpgradeable.verify(
merkleProof,
merkleRoot,
getNode(account, percent)
... | 1,225,185 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the int120 at `rdPtr` in returndata. | function readInt120(
ReturndataPointer rdPtr
) internal pure returns (int120 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
| 4,300,501 |
pragma solidity ^0.6.3;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/ | interface IERC1155 is IERC165 {
event TransferSingle(
address indexed operator,
address indexed from,
address indexed to,
uint256 id,
uint256 value
);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
... | 527,433 |
/**
*Submitted for verification at Etherscan.io on 2019-07-30
*/
pragma solidity ^0.5.10;
/**
* Innovative fantasy sports gaming ERC-20 token & arcade based on
* blockchain technology and Ethereum smart contracts.
* The global leader and cryptocurrency for the $7 Billion Fantasy Sports & ESPORTS Industry.
* DFS ... | Hash (keccak256) of the payload used by increaseApprovalPreSigned _token address The address of the token _spender address The address which will spend the funds. _addedValue uint256 The amount of tokens to increase the allowance by. _fee uint256 The amount of tokens paid to msg.sender, by the owner. _nonce uint25... | function increaseApprovalPreSignedHashing(
address _token,
address _spender,
uint256 _addedValue,
uint256 _fee,
uint256 _nonce
)
public
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(bytes4(0xa45f71ff), _token, _spender, _addedValue, _f... | 5,418,879 |
./full_match/3/0xe77Edc29A93046d16785BB37f5C671ff8aFf913B/sources/Cryptogeneration.sol | Allows owner to disable the ability to migrate/ | function disableMigrate() public onlyOwnerOrProxy {
migrationTarget = Cryptogeneration(address(0));
}
| 14,235,772 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/@synthetixio/core-contracts/contracts/utils/DecimalMath.sol | See mulDecimal for uint256./ | function mulDecimalInt128(int128 x, int128 y) internal pure returns (int128) {
return (x * y) / UNIT_INT128;
}
| 16,517,582 |
pragma solidity ^0.4.24;
/// @title Contract Title
/// @dev This is a very long documentation comment at the contract level.
/// It actually spans multiple lines, too.
contract NatspecEverything {
int d;
/// @dev Constructor @dev
/// @param p Constructor @param
constructor(int p) public { d = p; }
... | publicMethod publicMethod p publicMethod return publicMethod return | function publicMethod(int p) public pure returns(int r) { return p; }
| 1,072,355 |
./full_match/80001/0x0aCca12ade732F5Dc6afbad42ad1Eb5F0163e663/sources/contracts/dev/vendor/openzeppelin-solidity/v.4.8.0/contracts/utils/structs/EnumerableSet.sol | Return the entire set in an array WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a s... | function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
assembly {
result := store
}
return result;
}
| 5,561,640 |
pragma solidity ^0.4.13;
// ----------------------------------------------------------------------------
// 'Risteum' 'RIS' token contract
// ----------------------------------------------------------------------------
// Symbol: RIS
// Name: Risteum
// Total supply: 100,000,000.00000000
// Decimals: 18
// -----------... | no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
}
| 1,680,269 |
/**
*Submitted for verification at Etherscan.io on 2021-10-03
*/
// File: utils.sol
// File: @openzeppelin/contracts/utils/cryptography/draft-EIP712.sol
pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The en... | Sets the URIs for all the Ghoulies | function _setURI(uint256 tokenId, string memory cid) internal virtual {
require(
_exists(tokenId),
"Setting URI for non-existent token not allowed"
);
require(
bytes(_tokenURIs[tokenId]).length == 0,
"This token's URI already exists"
);... | 15,165,899 |
pragma solidity ^0.5.0;
import "./TokenFactory.sol";
import "./TokenTemplate.sol";
import "./CrowdsaleFactory.sol";
/**
* @title CcDAO represents a DAO in Cocity ecosystem.
*/
contract CcDAO {
address public creator;
string public name;
string public firstlifePlaceID;
TokenFactory public tokenFacto... | demote allows a member to demote a lower-in-grade member to a specified lower role. _member the address of the member to demote. role the destination role of the demoted member, must be lower than actual role./ | function demote(address _member, uint role) public {
require(roles[_member] > ROLE_NOTMEMBER, "not a member, cannot demote");
require(roles[msg.sender] > roles[_member], "cannot change privileges of my superiors");
require(role < roles[_member], "not demoting to a higher rank");
requ... | 6,430,807 |
pragma solidity ^0.5.12;
library SafeMath {
function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
... | inject NONSTANDARD NAMING | function SETTOKENDISTRIBUTOR348(address _tokenDistributor) public; | 5,544,559 |
pragma solidity ^0.5.1;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() ex... | Adds two numbers, reverts on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "");
return c;
}
| 15,860,317 |
./full_match/3/0x2e73B361aFF51C80d3908Fe89065121653Faf60F/sources/contracts/SigmoidLoan.sol | uint256 len=0; targetAuction[len] = auctionList[i]; | function getDEXInfo(uint256 _auctionType) view public returns(AUCTION[] memory ) {
for (uint256 i = 0; i < auctionList.length; i++) {
if(_auctionType == auctionList[i].auctionType){
len++;
}
}
uint256 k = 0;
for (uint256 j = 0; j < auctionL... | 8,227,548 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view ret... | ISetToken Set Protocol The ISetToken interface provides a light-weight, structured way to interact with the SetToken contract from another contract./ | interface ISetToken {
function factory()
external
view
returns (ISetFactory);
function naturalUnit()
external
view
returns (uint256);
function getComponents()
external
view
returns(address[]);
function getUnits()
extern... | 883,004 |
pragma solidity ^0.4.17;
import "./StandardToken.sol";
/**
* @title The Pre-Leo Token contract.
*
* Credit: Taking ideas from BAT token and NET token
*/
contract PXLToken is StandardToken {
// Token metadata
string public constant name = "Pre-Leo Token";
string public constant symbol = "PXLT";
ui... | Overridden method to check for end of fundraising before allowing transfer of tokens | function transferFrom(address _from, address _to, uint256 _value)
public
onlyPayloadSize(3)
returns (bool success)
{
return super.transferFrom(_from, _to, _value);
}
| 14,048,921 |
pragma solidity ^0.4.17;
import 'zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol';
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/// @title LicenseSale Base
/// @dev Contains models, variables, and internal methods for the sale.
/// @notice We omit a fallback function to prevent acci... | Cancels an sale when the contract is paused. Only the owner may do this, and NFTs are returned to the seller. This should only be used in emergencies. _tokenId - ID of the NFT on sale to cancel. | function cancelSaleWhenPaused(uint256 _tokenId)
whenPaused
onlyOwner
external
{
Sale storage sale = tokenIdToSale[_tokenId];
require(_isOnSale(sale));
_cancelSale(_tokenId, sale.seller);
}
| 5,400,288 |
./partial_match/1/0x34A542aCD8A717B5933228Ae3C554B1328F36e14/sources/ERC20ByMetadrop.sol | 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./ | ) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
function _spendAllowance(
address owner,
address spender,
uint256 amount
if (currentAllowance != type(uint256).max) {
if (currentAllowance < amount) {
_revert(InsufficientAllowance.selector);
}
... | 2,631,754 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;
import "./HederaResponseCodes.sol";
import "./IHederaTokenService.sol";
abstract contract HederaTokenService is HederaResponseCodes {
address constant precompileAddress = address(0x167);
uint constant AD... | Mints an amount of the token to the defined treasury account token The token for which to mint tokens. If token does not exist, transaction results in INVALID_TOKEN_ID amount Applicable to tokens of type FUNGIBLE_COMMON. The amount to mint to the Treasury Account. Amount must be a positive ... | function mintToken(address token, uint64 amount, bytes[] memory metadata) internal
returns (int responseCode, uint64 newTotalSupply, int64[] memory serialNumbers)
{
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.mintToken.selector... | 6,476,408 |
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint... | Performs a ERC20 token transfer with a reference _tokenAddress Address of the ERC20 token smart contract _to Transfer recipient _amount Amount to transfer _paymentReference Reference of the payment related/ | function transferFromWithReference(
address _tokenAddress,
address _to,
uint256 _amount,
bytes calldata _paymentReference
)
external
{
IERC20 erc20 = IERC20(_tokenAddress);
require(erc20.transferFrom(msg.sender, _to, _amount), "transferFrom() failed");
emit TransferWithReference(
... | 12,905,059 |
// SPDX-License-Identifier: GPL-3.0-or-later
// 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 dis... | Reverses the `scalingFactor` applied to `amount`, resulting in a smaller or equal value depending on whether it needed scaling or not. The result is rounded down./ | function _downscaleDown(uint256 amount, uint256 scalingFactor) internal pure returns (uint256) {
return FixedPoint.divDown(amount, scalingFactor);
}
| 277,830 |
./full_match/42161/0xA4A6AD0546363d093A6eEf1EabD31255a49b7635/sources/src/l0/IONFT721Core.sol | Interface of the ONFT Core standard/ | interface IONFT721Core is IERC165 {
event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds);
event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds);
event CreditStored(bytes32 _hash... | 16,305,108 |
./full_match/42/0x7240d9cE010Bbb486280A5936868d70dE083D952/sources/contracts/FirstOracle.sol | Now do something with the USD Diesel price... | function __callback(
bytes32 _myid,
string memory _result
)
public
override
{
require(msg.sender == provable_cbAddress());
emit LogNewDieselPrice(_result);
}
| 16,235,036 |
pragma solidity ^0.4.24;
contract Canopy {
/*** DATA HANDLING ***/
struct Post {
address posterAddress;
string title;
string url;
string content;
uint timePosted;
uint stake;
uint256 voteTokens;
uint256 score;
uint valuePositive;
... | if a post is a month old, pay it out and deactivate | function updateActiveScores() private {
for (uint i = 0; i < posts.length; i++) {
Post memory c = posts[i];
if (c.active == true) {
if ((now - c.timePosted) > 30 days) {
cashOut(i);
scorePost(i);
}
}
... | 2,481,350 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* Library easily handles the cases of overflow as well as underflow.
* Also ensures that balance does nto get naegative
*/
library SafeMath {
// multiplies two values safely and returns result
... | Function that validates if the purchase is valid by verifying the parameters value Amount of ethers sent amount Total number of tokens user is trying to buy. return checks various conditions and returns the bool result indicating validity./ check if timestamp is falling in the range check if value of the ether is val... | function isValidPurchase(uint256 value, uint256 amount) internal constant returns (bool) {
bool validTimestamp = startingTimestamp <= block.timestamp;
bool validValue = value != 0;
bool validAmount = maxTokenForSale.sub(totalTokenSold) >= amount && amount > 0;
return validTimestamp && validValue && validAmo... | 12,771,361 |
pragma solidity 0.5.16;
contract Passcard {
//Model a Museum
struct Museum {
uint id;
string name;
string description;
string addr;
string hour;
string imgsrc;
string expire_date;
uint count_remain;
}
// Model the user information
struct UserInfo {
uint passcardsCount;
... | check if the user has the pass card of the museum with id _museumId | function getPcValid (uint _museumId) public returns (bool) {
return (users[msg.sender].passcardsValid[_museumId]);
}
event getPcEvent (
uint indexed _museumId
);
event removePcEvent (
uint indexed _museumId
);
| 7,295,988 |
pragma solidity ^0.4.24;
import "./OmniCAT.sol";
contract Dass42 is OmniCAT {
function setScores(address _contributor, uint8[42] _values) public payable {
uint8 i = 0;
while(i < 42) {
contributors[_contributor].dass42[i] = _values[i++];
}
contributors[_contributor].hasC... | Stress statements 1, 6, 8, 11, 12, 14, 18, 22, 27, 29, 32, 33, 35, 39 | function getStressScores(address _contributor) internal view returns (uint8 _s) {
_s = contributors[_contributor].dass42[0];
_s += contributors[_contributor].dass42[5];
_s += contributors[_contributor].dass42[7];
_s += contributors[_contributor].dass42[10];
_s += contributors... | 13,054,778 |
./full_match/1/0xdc0a5a5A93EDdb03d68629AD3CA13769C4a01629/sources/contracts/MultiSigWallet.sol | Transaction must exist Creator cannot sign the transaction Cannot sign a transaction more than once | function signTransactionMulti(uint[] memory transactionIds)
validOwner
public {
require(transactionIds.length>0,"Transaction Id required");
for(uint i=0; i<transactionIds.length; i++) {
uint transactionId = transactionIds[i];
Transaction storage transaction = _transact... | 3,151,685 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
contract FenwickTree {
uint256[] public fenwick;
uint256 public n;
// Takes a fenwick representation constructed off-chain
constructor(uint256[] memory _fenwick) {
fenwick = _fenwick;
n = _fenwick.length;
}
// Least ... | Need this since diff cannot be negative 1-indexed | function updateSub(uint256 i, uint256 diff) public {
while (i < n) {
fenwick[i] -= diff;
i += lsb(i);
}
}
| 12,915,508 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
/*
DESIGN NOTES:
- We assume Class 0 is common!
- Because this is a library we use a state struct rather than member
variables. This struct is passes as the first argument to any functi... | Returns the tokenId sent to _toAddress This may mint, create or transfer. We don't handle that here. We use tokenId as an option ID here. | function _sendTokenWithClass(
LootBoxRandomnessState storage _state,
uint256 _classId,
address _toAddress,
uint256 _amount,
address _owner
) internal returns (uint256) {
require(_classId < _state.numClasses, "_class out of range");
Factory factory = Factory(_state.factoryAddress);
ui... | 881,300 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "./uniswapv2/interfaces/IUniswapV2Pair.sol";
import "./uniswapv2/interfaces/IUniswapV2Factory.sol";
import "./libraries/Priviledgeable.sol";
import "@openzeppelin/contracts/proxy/Initializable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol... | Change default referrer address/ | function changeReferral(address _ref) external onlyAdmin {
defRef = _ref;
}
| 2,570,798 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {GammaUtils} from "../utils/GammaUtils.sol";
import {RollOverBase} from "../utils/RollOverBase.sol";
// use airswap to short / long
import {Airs... | mint options with "assets" and sell otokens in this action by filling an order on AirSwap. this can only be done in "activated" state which is achievable by calling `rolloverPosition`. when doing an airswap OTC, the otokens will be swapped for premium in the same transaction atomically. No additional transactions are ... | function mintAndTradeAirSwapOTC(
uint256 _collateralAmount,
uint256 _otokenAmount,
SwapTypes.Order memory _order
) external onlyOwner onlyActivated {
require(_order.sender.wallet == address(this), "!Sender");
require(_order.sender.token == otoken, "Can only sell otoken");
require(_order.sign... | 13,116,452 |
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Absorb passed tokens into respective positions. If airdropFee defined, send portion to feeRecipient and portion to protocol feeRecipient address. Callable only by manager unless manager has set anyoneAbsorb to true. _setToken Address of SetToken _tokens Array of tokens to absorb/ | function batchAbsorb(ISetToken _setToken, address[] memory _tokens)
external
nonReentrant
onlyValidCaller(_setToken)
onlyValidAndInitializedSet(_setToken)
{
_batchAbsorb(_setToken, _tokens);
}
| 1,030,139 |
./full_match/137/0xB3d7bbEf0D9bF76dd46e3b9227446EfBa9231833/sources/src/main/solidity/DVP.sol | Renounce ownership of the contract./ | function renounceOwnership() public override onlyOwner {
Ownable.renounceOwnership();
_ownedContract = false;
}
| 4,790,561 |
./full_match/80001/0xf4f036a18961f7Ab421145bac1f27f0F73BFb643/sources/contracts/Role.sol | removes a privilege from role and revokes every user in this role the privilege _roleName (string) _privilegeKey (string) return the role where privilege is removed (bytes32[])/ remove single privilege from role iterate over users and revoke privilege from users | function removePrivilegeFromRole(
string memory _roleName,
string memory _privilegeKey
) public onlyRole(Privileges.getCanEditRole()) returns (bytes32[] memory) {
_checkStringsEqual(getRoleName(_roleName), _roleName, "Role not found");
removeRolePrivilege(
_roleName,... | 5,596,812 |
./full_match/42161/0xF6C3309007570C5c8A9DeA081e3b9FCC47bF7De4/sources/src/SupraGeneratorContract.sol | This function will be used to update public key Update the public key state variable _publicKey New Public key which will update the old one return bool It returns the status of updation of public key | function updatePublicKey(uint256[4] memory _publicKey) external onlyOwner returns(bool) {
publicKey = _publicKey;
emit PublicKeyUpdated(block.timestamp);
return true;
}
| 16,300,840 |
... | inject NONSTANDARD NAMING | function DIV610(uint256 a, uint256 b) internal pure returns (uint256) { | 15,812,153 |
/**
*Submitted for verification at Etherscan.io on 2020-07-01
*/
pragma solidity ^0.5.0;
/**
* @title Tellor Transfer
* @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol
* reference this library for function's logic.
* Many of the functions have been commented out for simplici... | Getter function for the collateral token price return collateral token price/ | function getCollateralTokenPrice() public view returns (uint256) {
return collateral.price;
}
| 12,897,416 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.2;
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
//import "https://github.com/OpenZeppelin/openzeppelin-contra cts/blob/master/c... | Deposit Funds and receive tokens This function first check the TFUEL deposit requirements and then the token availablility Reimburse in 2 cases: A.Investor sends more than his maxPurchase amount (Can-not a must- happen to each investor only once) B.Not enough available coins left for the sale (Can h... | function buy() external payable saleActive {
require(
msg.value >= minPurchase,
"must send more then global minPurchase"
);
require(
msg.value <= maxPurchase,
"must send more then global maxPurchase"
);
uint256 tokenQuantityAl... | 12,657,201 |
./partial_match/4/0x9619864B184FBbC4CF25FC0C75d8Dd88285Cd100/sources/FeePool.sol | Logs an accounts issuance data per fee period account Message.Senders account address debtRatio Debt percentage this account has locked after minting or burning their synth debtEntryIndex The index in the global debt ledger. dtradeState.issuanceData(account) onlyIssuer to call me on dtrade.issue() & dtrade.burn() c... | function appendAccountIssuanceRecord(
address account,
uint256 debtRatio,
uint256 debtEntryIndex
) external onlyIssuer {
feePoolState().appendAccountIssuanceRecord(
account,
debtRatio,
debtEntryIndex,
_recentFeePeriodsStorage(0).sta... | 8,560,023 |
// Copyright 2019 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by ... | Raises Illegal Instruction Exception mi Memory Interactor with which Step function is interacting. insn instruction that was deemed illegal return executeStatus.illegal if an illegal instruction exception was raised, or executeStatus.retired if not (even if it raises other exceptions). | function raiseIllegalInsnException(MemoryInteractor mi, uint32 insn)
public returns (executeStatus)
{
Exceptions.raiseException(
mi,
Exceptions.getMcauseIllegalInsn(),
insn
);
return executeStatus.illegal;
}
| 12,842,730 |
pragma solidity ^0.5.12;
library CodeHash {
function at (address c) internal view returns (bytes32) {
bytes32 h;
// solium-disable-next-line security/no-inline-assembly
assembly {
h := extcodehash(c)
}
require(h != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82... | solium-disable-next-line security/no-inline-assembly | function at (address c) internal view returns (bytes32) {
bytes32 h;
assembly {
h := extcodehash(c)
}
require(h != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, "No code");
require(h != 0, "Empty or Non-existent");
return h;
}
| 917,516 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
import "./interfaces/ICMCAsset.sol";
import "./interfaces/Types.sol";
import "./CMCCore.sol";
import "./lib/LibAsset.sol";
import "./lib/LibMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/c... | Taking the min protects against the case where the multisig holds less than the amount that is trying to be withdrawn while still allowing the total of the funds to be removed without the transaction reverting. | function getAvailableAmount(address assetId, uint256 maxAmount)
internal
view
returns (uint256)
{
return Math.min(maxAmount, LibAsset.getOwnBalance(assetId));
}
| 12,796,246 |
./full_match/42220/0x6E8c30f31aF6a5a860aCfDd1d312773cFb280B14/sources/contracts/Firulaix-Celo.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal {
require(account != address(0), 'ERC20: mint to the zero address');
require(_totalSupply.add(amount) <= _maxSupply, 'ERC20: Overflow maxsupply');
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account... | 16,331,287 |
./full_match/80001/0xd0158aE3C4b76140C47De9F2c6e5bC68E80Bd0e8/sources/project_/contracts/piNFT.sol | Checks and sets token royalties. _tokenId The Id of the token. royalties The royalties to be set./ | function _setRoyaltiesByTokenId(
uint256 _tokenId,
LibShare.Share[] memory royalties
) internal {
require(royalties.length <= 10);
delete royaltiesByTokenId[_tokenId];
uint256 sumRoyalties = 0;
for (uint256 i = 0; i < royalties.length; i++) {
require(r... | 5,645,269 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Ownab... | Generate the land type from the land id, block timestamp, block difficulty. FIXME: 🚨 Only pseudo random. Too costly ? | function _generateType(uint16 _landId) internal view returns (Seed.SeedSpecies) {
return Seed.SeedSpecies(uint256(keccak256(abi.encodePacked(block.timestamp, _landId))) % 8);
}
| 5,544,257 |
pragma solidity >=0.4.21 <0.9.0;
pragma experimental ABIEncoderV2;
import "../NFT/nf-token-metadata.sol";
//Token
contract mmvToken is MMVT {
constructor() public {
//MMV Token specs
symbol = "MMV";
name = "MeMeVault Token";
decimals = 18;
_totalSupply = 23*10**18; //... | finalize withdraw of stake/ | function unstake(uint _amount) external nonReentrant() returns (bool) {
require(stakeMap[msg.sender].totalStaked >= _amount);
require(sToken.balanceOf(msg.sender) >= _amount);
stakeMap[msg.sender].totalStaked = safeSub(stakeMap[msg.sender].totalStaked,_amount);
tokenTotalSta... | 2,472,800 |
pragma solidity ^0.5.8;
interface TokenInterface {
function allowance(address, address) external view returns (uint);
function balanceOf(address) external view returns (uint);
function approve(address, uint) external;
function transfer(address, uint) external returns (bool);
function transferFrom(a... | Swap Functionality / | interface ScdMcdMigration {
function swapDaiToSai(uint daiAmt) external;
function swapSaiToDai(uint saiAmt) external;
}
| 12,562,615 |
./partial_match/1/0x4A89d95200eC6c75aE09c5506cbEc6Decbf886E1/sources/contracts/Interconnector.sol | Update interconnector version for all leaf contracts Should include only leaf contracts | function interconnectInternal() internal override {
mnt.switchLinkageRoot(_self);
supervisor.switchLinkageRoot(_self);
rewardsHub.switchLinkageRoot(_self);
buyback.switchLinkageRoot(_self);
liquidation.switchLinkageRoot(_self);
emissionBooster.switchLinkageRoot(_self)... | 16,098,347 |
./full_match/80001/0xD35C3fCC6e10052a08aB20F922Aa5A1B7B18D74B/sources/contracts/base/core/PairFees.sol | Allow the pair to transfer fees to users | function claimFeesFor(
address recipient,
uint amount0,
uint amount1
) external {
require(msg.sender == pair, "Not pair");
if (amount0 > 0) {
IERC20(token0).safeTransfer(recipient, amount0);
}
if (amount1 > 0) {
IERC20(token1).safeT... | 5,677,523 |
./full_match/5/0xA2276f75067ce77a62c5a9E18ebEac23Df6AbE2B/sources/project_/contracts/AvatarToken.sol | See {IERC721Metadata-tokenURI}. | function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory uri = _baseURI();
return
bytes(uri).length > 0
? string(
a... | 1,908,554 |
./full_match/44787/0x0dB94Fe4C458176F1FC532da5d8129298Fc82e97/sources/contracts/Daos.sol | Adopt your own numDaos on the Binance Smart Chain, Max 20 at once and make sure the right price is used to confirm transaction | function adoptDaos(uint256 numDaos) public payable {
require(totalSupply() < MAX_DAOS, "Sale has already ended");
require(numDaos > 0 && numDaos <= 1000, "You can adopt minimum 1, maximum 20 daos");
require(totalSupply().add(numDaos) <= MAX_DAOS, "Exceeds MAX_DAOS");
require(msg.valu... | 13,245,637 |
pragma solidity ^0.4.23;
contract Escrow {
using SafeMath for uint256;
using ContentUtils for ContentUtils.ContentMapping;
ContentUtils.ContentMapping public content;
address escrowAddr = address(this);
uint256 public claimable = 0;
uint256 public currentBalance = 0;
ma... | wrapper around internal deliverable method | function isFulfilled(ContentMapping storage self, bytes32 _id, address _creator, address _brand) public view returns(bool) {
return self.data[_id].deliverable.isFulfilled(_creator, _brand);
}
| 1,042,137 |
/*
Copyright 2021 Pulsar 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 agree... | Sets a new price oracle contract. Must be called by the PowerPerpetual admin. Emits the LogSetOracle event. oracle The address of the new price oracle contract./ | function setOracle(
address oracle
)
external
onlyAdmin
nonReentrant
{
require(
I_PPOracle(oracle).getPrice() != 0,
"New oracle cannot return a zero price"
);
_ORACLE_ = oracle;
emit LogSetOracle(oracle);
}
| 13,072,357 |
// Consider this smart contract.
// Add a function called start() that adds the address of the account that calls it to the dynamic array called players.
// Deploy and test the contract on Rinkeby Testnet.
//SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0 <0.9.0;
contract Game{
address[] public players;... | super similar to a regular pushing on JS note to add the sender to the players array. | function start() public{
players.push(msg.sender);
}
| 12,630,873 |
./full_match/5/0x57C66f08dB6E1fD9d9d32f204EF557Ef8c62b7C2/sources/project_/contracts/base/modules/BatchReveal.sol | Return a token's revealed ID. This is obtained by computing [tokenId] + [revealOffset]. _tokenId Original token ID/ | function revealedId(uint256 _tokenId) view public virtual returns(uint256){
require(revealed(_tokenId), "Token not revealed");
uint256 index;
while(_tokenId > maxRevealedId[index]) ++index;
uint256 rangeMax = maxRevealedId[index];
uint256 rangeMin = index < 1 ? 0 : maxReveale... | 1,932,574 |
pragma solidity ^0.4.18 ;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
contract ContractiumInterface {
function balanceOf(address who) public view returns (uint256);
function contractSpend(address _from, uint256 _value) public retur... | Reset current token offering raised for new Sale./ | function resetCurrentTokenOfferingRaised() public onlyOwner {
currentTokenOfferingRaised = 0;
}
| 5,398,563 |
pragma solidity ^0.4.18;
import "./library/SafeMath.sol";
import "./library/ERC721Receiver.sol";
import "./library/AddressUtils.sol";
/**
* @title ERC721Token
* Implementation for the required functionality of the ERC721 standard
* www.erc721.org
*/
contract ERC721 {
using SafeMath for uint256;
using AddressU... | Transfers a specific pet from one address to another _from is the address that the token will be sent from _to is the address we are sending the token to _tokenId the numeric identifier of a token/ | function safeTransferFrom(address _from, address _to, uint256 _tokenId) public{
safeTransferFrom(_from, _to, _tokenId,"");
}
| 2,549,166 |
./full_match/77/0xCA204916Cd0D236ADed72074d233267d77B2c346/sources/test.sol | Store value in variable num value to store/number = num; | function store(uint256 num) public view {
require(num < 150, "Number should be less than 150");
}
error SomeCustomError(address addr, uint256 balance);
| 5,047,425 |
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | Deposit LP tokens to MasterChef for Dimsum allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accDimsumPerShare).div(1e12).sub(user.rewar... | 6,666,938 |
//File: contracts/lib/ens/AbstractENS.sol
pragma solidity ^0.4.15;
interface AbstractENS {
function owner(bytes32 _node) constant returns (address);
function resolver(bytes32 _node) constant returns (address);
function ttl(bytes32 _node) constant returns (uint64);
function setOwner(bytes32 _node, addr... | Get the address of an app instance or base implementation _id App identifier return Address of the app/ | function getApp(bytes32 _id) public view returns (address) {
return apps[_id];
}
| 1,637,557 |
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function tran... | Transfers control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0),"You can't transfer the ownership to this account");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 7,212,863 |
pragma solidity ^0.5.4;
import "./AuctionityStorage1.sol";
import "../CommonContract/SafeMath.sol";
import "../CommonContract/AuctionityLibrary_V1.sol";
import "../CommonContract/AuctionityLibraryDecodeRawTx_V1.sol";
import "../CommonContract/AuctionityChainId_V1.sol";
import "../CommonContract/AuctionityOracable_V1... | intenral verify winner have enouth depot with bidding information _infoFromBidding InfoFromBidding structure return _success depot is greatuer or eqal than amount | function verifyWinnerDepot_V1(InfoFromBidding memory _infoFromBidding)
internal
returns (bool)
{
require(
getBalanceEth_V1(
_infoFromBidding.signer
) >= _infoFromBidding.amount,
"Auction end voucher depot amount is too low"
);
... | 12,954,812 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@prps/solidity/contracts/EIP712Boostable.sol";
import "./DubiexLib.sol";
/**
* @dev Dubiex Boostable primitives following the EIP712 standard
*/
abstract contract Boostable is EIP712Boostable {
bytes32 private cons... | Cancel a single order./ | function cancelOrder(DubiexLib.CancelOrderInput memory input)
external
nonReentrant
{
_cancelOrderInternal({
maker: input.maker,
id: input.id,
intrinsicFuel: 0,
isBoosted: false,
revertOnError: true,
isKillSwitchOn: ... | 10,209,438 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./libs/IStrategySirius.sol"... | To pay for earn function | function distributeFees(address _earnedAddress) internal {
uint256 earnedAmt = IERC20(_earnedAddress).balanceOf(address(this));
if (controllerFee > 0 && earnedAmt >0) {
uint256 fee = earnedAmt.mul(controllerFee).div(feeMax);
if (_earnedAddress == wmaticAddress) {
... | 12,831,400 |
./full_match/4/0x131F7Dd577BEBbEb1D372a6513a3B2d1d5548080/sources/browser/factory.sol | if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
... | 13,298,457 |
pragma solidity 0.6.2;
import "../Median.sol";
import "../vendor/SafeMath.sol";
import "./SafeMath128.sol";
import "./SafeMath64.sol";
import "./SafeMath32.sol";
import "../interfaces/LinkTokenInterface.sol";
import "../interfaces/WithdrawalInterface.sol";
import "./AggregatorInterface.sol";
import "../Owned.sol";
/*... | recalculate the amount of LINK available for payouts/ | function updateAvailableFunds()
public
{
uint128 pastAvailableFunds = availableFunds;
uint256 available = LINK.balanceOf(address(this)).sub(allocatedFunds);
availableFunds = uint128(available);
if (pastAvailableFunds != available) {
emit AvailableFundsUpdated(available);
}
}
| 949,591 |
./full_match/80001/0xF8a9362bA0f4F61D7a32D1e2e32113228Cf938cB/sources/StakingContract.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external... | 835,580 |
pragma solidity 0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two ... | update minting agent | function updateMintingAgent(address _agent, bool _status) public onlyOwner {
mintingAgents[_agent] = _status;
}
| 462,033 |
pragma solidity ^0.4.24;
/**
Do not transfer tokens to TimelockERC20 directly (via transfer method)! Tokens will be stuck permanently.
Use approvals and accept method.
**/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (... | release timelock tokens by force _for address of future tokenholder _timestamp array of timestamps to unlock _value array of amounts to unlock return result of operation: true if success/ | function releaseForce(address _for, uint[] _timestamp, uint[] _value) onlyOwner external returns(bool) {
return release_(_for, _timestamp, _value);
}
| 1,987,248 |
./full_match/1/0x4518cAd3aE6be7bb2b2be6541fB5d71F97Ea7C2c/sources/contracts/RiseOfTheMemes_1155.sol | Allows owner to withdraw any ERC20 Token sent directly to the contract/ | function rescueTokens(address _stuckToken) external onlyOwner {
uint256 balance = IERC20(_stuckToken).balanceOf(address(this));
IERC20(_stuckToken).transfer(msg.sender, balance);
}
| 8,384,176 |
./full_match/5/0x6Da7F63172653eea0b99B04Ce3404f92597459C0/sources/contracts/ERC721IA.sol | Transfers the NFTs being claimed. | function _transferTokensOnClaim(
address _to,
uint256 _tokenId,
uint256 _quantityBeingClaimed
) internal virtual {
_mint(_to, _tokenId, _quantityBeingClaimed, "");
}
| 1,863,016 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// GraffitETH is an NFT contract in which each token represents a pixel. The owner has the right
// to change the pixel color. Pixel... | Get the time from which on taxes have to be paid. | function getTaxStartTime() public view returns (uint64) {
return _taxStartTime;
}
| 12,773,085 |
./full_match/1/0x2F082A8f4A41FB81AC3cfb39Cf41Ca47378d692E/sources/browser/ironbanklevcomp.sol | Liquidate as many assets as possible to `want`, irregardless of slippage, up to `_amount`. Any excess should be re-invested here as well./ | function liquidatePosition(uint256 _amountNeeded) internal override returns (uint256 _amountFreed) {
uint256 _balance = want.balanceOf(address(this));
if (netBalanceLent().add(_balance) < _amountNeeded) {
(uint256 deposits, uint256 borrows) = getLivePosition();
if(cToken.ba... | 8,368,864 |
pragma solidity ^0.4.13;
/**
* 10X contract
* Copyright 2017, TheWolf
*
* An infinite crowdfunding lottery token
* Using a permanent delivery of tokens as a reward to the lost bids.
* With a bullet proof random generation algorithm and a lot of inovative features
* With a state machine switching autom... | Give tokens to someone | function giveToken(address _target, uint256 _mintedAmount,string _password) external onlyOwner protected(_password) {
safeAdd(balances[_target],_mintedAmount);
safeAdd(totalTokenSupply,_mintedAmount);
}
| 12,609,344 |
./partial_match/1/0xa8a3c86c4A2DcCf350E84D2b3c46BDeBc711C16e/sources/LSVProxyRegistry.sol | check if msg.sender is the owner of proxy in question check if oldOwner really was the owner of proxy in question remove proxy from oldOwners proxies | function updateRegistry(address _proxyAddr, address _oldOwner, uint256 _indexNumInOldOwnerProxiesArr) public {
require(DSProxy(payable(_proxyAddr)).owner() == msg.sender);
require(proxies[_oldOwner][_indexNumInOldOwnerProxiesArr] == _proxyAddr);
uint256 oldOwnersProxyCount = proxies[_oldOw... | 9,320,782 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
interface iERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint);
function totalSupply() ext... | slip = (x x) / (x + X) | function calcSwapInputFee(uint x, uint X) public pure returns (uint output){
uint numerator = x.mul(x);
uint denominator = x.add(X);
return numerator.div(denominator);
}
| 15,326,282 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "./lib/Table.sol";
import "./lib/LibTypeConversion.sol";
import "./Term.sol";
import "./interface/IOrganization.sol";
import "./interface/INonFungibleAsset.sol";
import "./lib/UtilLib.sol";
/** @title ledger contract */
contract NonFungibleBook {
e... | processingReturnedData | function handleEntries(Entries[] resultEntries, int256 totalRecordSize) internal constant returns (string[]memory){
string[] memory itemStringList = new string[](uint256(totalRecordSize) * ITEM_SIZE);
for (uint ridx = 0; ridx < resultEntries.length; ridx++) {
Entries rEntries = resultE... | 14,067,436 |
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/controllers/FeesTakerController.sol | function to deduct-fees to fees-taker address on source-chain followed by refuel followed by swap the amount on sourceChain followed by bridging the swapped amount to destinationChain while generating implData for refuel, swap and bridge Requests, ensure correct function selector is used bridge action co... | function takeFeeAndRefuelAndSwapAndBridge(
ISocketRequest.FeesTakerRefuelSwapBridgeRequest calldata frsbRequest
) external payable returns (bytes memory) {
if (frsbRequest.feesToken == NATIVE_TOKEN_ADDRESS) {
payable(frsbRequest.feesTakerAddress).transfer(
frsbRequest... | 11,003,609 |
pragma solidity >=0.4.21 <0.7.0;
import "./DateTime.sol";
contract Vote {
string public voteName;
uint256 public voteEndDate;
address public voteDeployer; // deployer decide who can vote and stock of each Voter
uint public totalCandidateNumber = 0; // how many people are in the cadidate ma... | this func can let you look up all the vote records | function lookUpVoteRecord() public{
uint num_p = voters[msg.sender].numOfPeopleNominated;
if(num_p == 0) {
emit errorMessage("You have not voted for any candidates yet, no vote record.");
return;
}
uint256[] memory recordID = new uint256[](num_p);
uint... | 6,350,614 |
// Copyright 2021 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by ... | executes output _destination address that will execute output _payload payload to be executed by destination _epochIndex which epoch the output belongs to _inputIndex which input, inside the epoch, the output belongs to _outputIndex index of output inside the input _outputDriveHash hash of the outputs drive where... | function executeOutput(
address _destination,
bytes calldata _payload,
uint256 _epochIndex,
uint256 _inputIndex,
uint256 _outputIndex,
bytes32 _outputDriveHash,
bytes32[] calldata _outputProof,
bytes32[] calldata _epochProof
) public override noRee... | 14,035,905 |
pragma solidity ^0.5.0;
import 'erc1820/contracts/ERC1820Client.sol';
import './IERC777.sol';
import '../lifecycle/Managed.sol';
import '../math/SafeMath.sol';
import '../registry/ERC1820Implementer.sol';
import './SimpleTokenStore.sol';
import './ERC777TokensRecipient.sol';
import './ERC777TokensSender.sol';
/**
*... | obtain if an address is an operator for a token holder. An address could be an operator if it is explicitly enabled by the token holder, or a default for the token and not explicitly disabled by the token holder. _operator the address of the operator _tokenHolder the address of the holder of the token... | function isOperatorFor(address _operator, address _tokenHolder) external view returns (bool) {
return (operators[_tokenHolder][_operator] || (defaultOperatorsMap[_operator] && !revokedDefaultOperators[_tokenHolder][_operator]));
}
| 1,782,531 |
/**
The FundsDAO leverages the power of syndication and industry presence to
provide the opportunities of traditional venture capital to the independent investor.
Find us - https://t.me/FundsDAO
https://fundsdao.finance/
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity =0.8.5;
/**
* @dev... | Destroys `amount` tokens from the caller. See {ERC20-_burn}./ | function burn(uint256 amount) public virtual onlyGovernance {
_burn(_msgSender(), amount);
}
| 531,476 |
./full_match/42/0x25D426c79DFb4D011eace2D019330604941555b8/sources/Staking.sol | totalstaked = totalstaked.sub(userStakes.stakedAmount); | function calculateUserReward(address _user) public view returns(uint256 amount){
uint256 reward = 0;
uint256 totalstaked = _totalStakes;
uint256 total = _userTotal[_user].totalStakedAmount;
uint256 counter = 1;
uint256 k =0;
while(total>0){
User m... | 16,265,426 |
/**
* @authors: [@fnanni-0]
* @reviewers: []
* @auditors: []
* @bounties: []
*/
pragma solidity >=0.7;
pragma experimental ABIEncoderV2;
import "./BinaryArbitrable.sol";
import "../.././interfaces/IAppealEvents.sol";
import "@kleros/erc-792/contracts/IArbitrable.sol";
import "@kleros/erc-792/contracts/IArbit... | Gets the information on a round of a transaction. _transactionID The ID of the transaction. _round The round to query. return paidFees rulingFunded feeRewards appealed The round information./ | function getRoundInfo(uint256 _transactionID, uint256 _round)
public
view
returns (
uint256[3] memory paidFees,
uint256 rulingFunded,
uint256 feeRewards,
bool appealed
)
{
return arbitrableStorage.getRoundInfo(_transactionID... | 13,012,273 |
./full_match/5/0xA76E9Cd6a344feae0f897D7acc39bf60Ae157927/sources/contracts/v4.sol | Pause token transfers | function pause() public onlyOwner {
require(!_paused, "Already paused");
_paused = true;
}
| 1,856,198 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Buy insurance for a flight/ | function buy(address _passengerAccount,
address _airlineAccount,
string _airlineName,
uint256 _departureTime
)
external
payable
requireIsOperational
... | 15,780,916 |
pragma solidity ^0.4.13;
contract IERC20 {
function balanceOf(
address whom
)
external
view
returns (uint);
function transfer(
address _to,
uint256 _value
)
external
returns (bool);
function transferFrom(
address _from,
address _to,
... | Function to distribute rewards between influencers, increment global cycle id, and update how much rewards are ever being distributed from this contract influencers is the array of influencers balances is the array of corresponding balances for the influencers above/ Get the addre... | function pushAndDistributeRewardsBetweenInfluencers(
address [] influencers,
uint [] balances,
uint nonRebalancedTotalPayout,
uint rebalancedTotalPayout,
uint cycleId,
uint feePerReferrerIn2KEY
)
public
onlyMaintainer
{
address twoKeyEconomy = ... | 13,574,450 |
pragma solidity ^0.5.16;
/**
* @title Artem Ether Contract
* @notice Derived from Compound's cEther contract
* https://github.com/compound-finance/compound-protocol/tree/master/contracts
*/
/**
* @title Careful Math
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/Op... | Checks whether the requested transfer matches the `msg` Does NOT do a transfer from Address sending the Ether amount Amount of Ether being sent return Whether or not the transfer checks out/ Sanity checks | function checkTransferIn(address from, uint amount) internal view returns (Error) {
require(msg.sender == from, "sender mismatch");
require(msg.value == amount, "value mismatch");
return Error.NO_ERROR;
}
| 1,655,774 |
./full_match/5/0x3Eb6551a88038d8975d87E227963bC24d9A8181B/sources/_superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol | Updates the units of a subscription. This changes the number of shares the subscriber holds token Super Token used with the index. indexId ID of the index. subscriber Subscriber address whose units are to be updated. units New number of units the subscriber holds./ | function updateSubscriptionUnits(
ISuperToken token,
uint32 indexId,
address subscriber,
uint128 units
) internal returns (bool) {
(ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token);
host.callAgreement(
ida,
... | 11,609,659 |
./partial_match/1/0xFDd054BD02B2d2863ACA692aDa38CD7964A63741/sources/TokenDistribution.sol | Allows owner to open the round/ | function openRound() public onlyOwner isRoundState(RoundState.OFF) {
require(primaryWallet != address(0), "Primary Wallet is not set!");
require(feeWallet != address(0), "Fee Wallet is not set!");
require(tokenContractAddress != address(0), "Token Contract Address is not set!");
requ... | 15,995,380 |
./full_match/5/0xC7B23589e2518d7371385ad76A824fC845fA6e0c/sources/contracts/StakeChain.sol | Calculate the rewards since the last update on Deposit Information | function calculateRewards(address _staker) internal view returns (uint256 rewards) {
return (((((block.timestamp - stakers[_staker].timeOfLastUpdate) *
stakers[_staker].deposited) * rewardsPerHour) / 3600) / 10000000);
}
| 1,917,148 |
./full_match/43113/0x6e06ce7538c8F43ec27290BB40C6e4f2bbB05b01/sources/contracts/PredictionMarket.sol | Incase of Invalid Market | function marketResults(address _creatorAddr) public returns(bool){
Market memory market = MarketList[_creatorAddr];
require (msg.sender == _creatorAddr , " Only creator can start the market ");
require(market.time > 0 , " You haven't created any market ");
require (block.timestamp > ... | 7,187,757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.