file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//solium-disable linebreak-style
pragma solidity ^0.4.24;
library ExtendedMath {
function limitLessThan(uint a, uint b) internal pure returns(uint c) {
if (a > b) return b;
return a;
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function m... | Close the genesis accounts/ | function closeGenesis() onlyOwner public {
}
| 6,632,814 |
./full_match/1/0x87AAdE1067Ed0276ec9BEf6db8E17Abe27A6B454/sources/contracts/TruthPost.sol | @inheritdoc ITruthPost This can happen if arbitration fee gets lowered in between contributions. | function fundAppeal(uint256 _disputeID, RulingOptions _supportedRuling)
external
payable
override
returns (bool fullyFunded)
{
DisputeData storage dispute = disputes[_disputeID];
RulingOptions currentRuling = RulingOptions(ARBITRATOR.currentRuling(_disputeID));
... | 4,921,982 |
pragma solidity 0.4.15;
/*
Crypto Market Prices via Ethereum Smart Contract
A community driven smart contract that lets your contracts use fiat
amounts in USD, EURO, and GBP. Need to charge $10.50 for a contract call?
With this contract, you can convert ETH and other crypto's.
Repo: https://... | returns block when price was updated last | function updatedAt(uint _id) constant returns (uint) {
return tokens[_id].block;
}
| 6,818,301 |
// SPDX-License-Identifier: Unlicensed
/*
Join our socials,
Telegram : https://t.me/cthulhuerc
Website : https://cthulhu.site/
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
... | Transfer sold Token to marketingWallet | function swapAndSendToFee(uint256 tokens) private {
swapTokensForMarketingToken(tokens);
IERC20(devandmarketingWalletToken).transfer(marketingAddress, IERC20(devandmarketingWalletToken).balanceOf(address(this)));
}
| 631,132 |
// Contracts by dYdX Foundation. Individual files are released under different licenses.
//
// https://dydx.community
// https://github.com/dydxfoundation/governance-contracts
//
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;
import { SafeERC20 } from '../../dependencies/open-zeppelin... | Helper function which settles a user's rewards up to a global index. Should be called any time a user's staked balance changes, with the OLD user and total balances. user The user's address. userStaked Tokens staked by the user during the period since the last user index upd... | function _settleUserRewardsUpToIndex(
address user,
uint256 userStaked,
uint256 newGlobalIndex
)
private
returns (uint256)
{
uint256 oldAccruedRewards = _USER_REWARDS_BALANCES_[user];
uint256 oldUserIndex = _USER_INDEXES_[user];
if (oldUserIndex == newGlobalIndex) {
return o... | 203,999 |
pragma solidity ^0.5.7;
/**
* @title DecentralizedHealth
* @dev see https://github.com/marxMT/decentralizedHealth
*/
contract DecentralizedHealth{
// hospital que crea el contrato
address owner;
mapping (address => bool) patientPermition;
//Mapping de paciente address a IPFS hash
mapping (address => strin... | Returns IPFS hash/ | function viewHR() public view returns(string memory result){
require(patientPermition[msg.sender] || doctorPermition[msg.sender], "El
paciente ingresado no existe");
result= hashPatient[msg.sender];
}
| 15,825,397 |
pragma solidity ^0.8.7;
contract MappingStructExample {
// struct to keep payment info
struct Payment {
uint amount;
uint timestamps;
}
// struct to keep balance info
struct Balance {
uint totalBalance;
uint numPayments;
mapping(uint => Payment) payment... | update totalBalance of sender's balanceReceived create a new payment with the value that was sent and with the current timestamp add the payment to the balanceReceived value (to Balance.payments) increase the number of payments | function sendMoney() public payable {
balanceReceived[msg.sender].totalBalance += msg.value;
Payment memory payment = Payment(msg.value, block.timestamp);
balanceReceived[msg.sender].payments[balanceReceived[msg.sender].numPayments] = payment;
balanceReceived[msg.sender].n... | 14,019,865 |
./full_match/5/0x079BC05ebF765c3678Bec03A598561f0414f6227/sources/project:/contracts/PropertyNFT.sol | Approves another address to manage the specified token. Overrides ERC721's approve function. to - The address to be approved. tokenId - The ID of the token to be approved for management./ | function approve(address to, uint256 tokenId) public virtual override(ERC721, IERC721) {
super.approve(to, tokenId);
}
| 1,864,641 |
./full_match/80001/0xc2db37573a582bA35861DD890Ba8A0ec8CB77843/sources/contracts/StakingContract_flattened.sol | Internal Function to unstake tokens _poolId pool id to unstake from account address of the user _amount amount of tokens to unstake/ Check if the pool is active require(pool.isActive, "This pool is not active"); adding this check will prevent users from unstaking after the pool is set inactive Check if the user has... | function _unstakeToken(
uint256 _poolId,
address account,
uint256 _amount
) internal {
StakingPool memory pool = stakingPools[_poolId];
require(
stakedBalances[account][_poolId] >= _amount,
"Insufficient staked balance"
);
require(... | 5,607,109 |
pragma solidity ^0.4.11;
contract Token is StandardToken, Ownable, HasNoEther, Contactable, Addressed {
string public constant name = "Concurrence";
string public constant symbol = "CCCE";
uint8 public constant decimals = 9;
uint256 public constant INITIAL_SUPPLY = 10**18;
function Token(address _mainAddre... | the only account that can move the staked token aroundis the combiner defined in the request | function punish(bytes32 _request, bytes32 _response, address _miner, uint256 _value, address _to) public returns (bool) {
Main mainContract = Main(mainAddress);
Requests requestsContract = Requests(mainContract.getContract('Requests'));
require(msg.sender == requestsContract.getCombiner(_request));
re... | 15,835,028 |
./partial_match/1/0xcACAbb068D1bC1CC75Fdefa9940991B389bA1fda/sources/XDSeaTrade.sol | ids[0] - tokenId, ids[1] - amount, ids[2] - nooftoken, ids[3] - nftType | function saleWithToken(
string memory bidtoken,
address payable from,
uint256[] memory ids,
address _conAddr
) public {
require(
ids[1] == order_place[from][ids[0]].price.mul(ids[2]) &&
order_place[from][ids[0]].price.mul(ids[2]) > 0,
... | 4,020,845 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
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.
... | A method for a stakeholder to remove a stake. _stake The size of the stake to be removed./ | function removeStake(uint256 _stake) external isvalidStakePeriod {
require(_stake <= stakes[msg.sender], "insufficient stake balance");
stakes[msg.sender] = stakes[msg.sender].sub(_stake);
if(stakes[msg.sender] == 0) _removeStakeholder(msg.sender);
_transfer(address(this), msg.sender, _stake);
em... | 5,500,716 |
pragma solidity 0.4.18;
import './zeppelin/token/BurnableToken.sol';
contract SofinToken is BurnableToken {
string public constant name = 'SOFIN';
string public constant symbol = 'SOFIN';
uint256 public constant decimals = 18;
uint256 public constant tokenCreationCap = 45000000 * 10 ** decimals;
address... | add an address to the list of frozen accounts account address to freeze return true if the address was added to the list of frozen accounts, false if the address was already in the list/ | function freezeAccount(address account) public onlyOwner returns (bool success) {
if (!frozenAccounts[account]) {
frozenAccounts[account] = true;
Frozen(account);
success = true;
}
}
| 1,784,668 |
./full_match/1/0xe63C777dCaab7Db2F6667fCA5f323D47fEE565B2/sources/MyContract.sol | Hook that is called before any token transfer. This includes minting and burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`. - When `from` is zero, `tokenId` will be minted for `to`. - When `to` is zero, ``from``'s `tokenId` will be burned. - `from` c... | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
_removeTok... | 8,463,252 |
./partial_match/97/0x815fA0A6f75F8EdA9e73D110d719082101757757/sources/IKOMP.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "IKOMP::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
... | 11,390,390 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "../interfaces/IControllable.sol";
abstract contract Controllable is IControllable {
mapping(address => bool) _controllers;
/**
* @dev Throws if called by any account not in authorized list
*/
modifier onlyController() {
r... | get token id (serial ) of the given token hash. 0 if not a token, 1 if claim, 2 if gem/ | function _addToken(uint256 tokenHash, uint8 tt) internal {
require(tt == 1 || tt == 2, "INVALID_TOKENTYPE");
_tokenHashes.push(tokenHash);
_tokenTypes[tokenHash] = tt;
_tokenIds[tokenHash] = tt == 1 ? __nextClaimId() : __nextGemId();
if(tt == 2) {
_increaseDifficu... | 11,794,183 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ISYNC} from "./interfaces/ISYNC.sol";
/**
* @title TokenDistributor
* @not... | Update reward variables of the pool/ Check whether to adjust multipliers and reward per block Update rewards per block Adjust the end block Adjust multiplier to cover the missing periods with other lower inflation schedule Adjust token rewards Mint tokens only if token rewards for staking are not null It allows protect... | function _updatePool() internal {
if (block.number <= lastRewardBlock) {
return;
}
if (totalAmountStaked == 0) {
lastRewardBlock = block.number;
return;
}
uint256 tokenRewardForOthers = multiplier * rewardPerBlockForOthers;
whil... | 883,233 |
./full_match/1/0x23F8B0B57723bcD99D5Be4Cf4863E49D8092dC14/sources/contracts/LbdToken.sol | Ban the Kucoin hacker | function initialize()
public
initializer
{
__ERC20_init("Lbd Protocol", "LBD");
_setupDecimals(uint8(DECIMALS));
__Ownable_init();
_totalShares = INITIAL_SHARES;
_totalSupply = INITIAL_SUPPLY;
_shareBalances[owner()] = _totalShares;
_share... | 8,354,424 |
/**
*Submitted for verification at Etherscan.io on 2021-02-12
*/
pragma solidity 0.8.0;
interface ISavingsManager {
/** @dev Admin privs */
function distributeUnallocatedInterest(address _mAsset) external;
/** @dev Liquidator */
function depositLiquidation(address _mAsset, uint256 _liquidation) ext... | Internally deposit the _underlying from the sender and credit the beneficiary with new imUSD/ Collect recent interest generated by basket and update exchange rate | function _deposit(
uint256 _underlying,
address _beneficiary,
bool _collectInterest
) internal returns (uint256 creditsIssued) {
require(_underlying > 0, "Must deposit something");
require(_beneficiary != address(0), "Invalid beneficiary address");
IERC20 mAsset ... | 15,005,556 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.2;
import "./access/OwnableUpgradeable.sol";
import "./math/MathUpgradeable.sol";
import "./math/SafeMathUpgradeable.sol";
import "./interfaces/IERC20Upgradeable.sol";
import "./interfaces/IStakingPoolRewarder.sol";
import "./libraries/TransferHelper.sol";
/**
* @t... | Remove storage slot to save gas | function _onReward(uint256 poolId, address user, uint256 amount) private blockReentrancy {
require(user != address(0), "StakingPoolRewarder: zero address");
uint256 newUnvestedAmount = 0;
uint256 newVestedAmount = 0;
if (amount > 0) {
newUnvestedAmount = amount.mul(uint2... | 1,675,328 |
pragma solidity ^0.6.0 <0.7.0;
import "./MerkleTreeGenIndex.sol";
/*
In this example we are spliting the processing of one tree in many branches. Each leaf is a tree by itself
Important point: We can imagine a very large tree of trees, but in the end is the same as a unique tree.
This code is just to giv... | Here we are assuming that the Principal tree is bigger than the subtrees saved in this contract, and the user give the complete GIOP arrayeach leaf as a siblinglets add to the array the nodes info | function calculateRootOfPrincipalTree(bytes32[] memory _nodes, uint256[] memory _GIOP) public returns(bool) {
bytes32[] memory _orderNodes;
for(uint256 i = 0; i < subtrees.length; i = i + 2) {
_orderNodes[i] = subtrees[i];
_orderNodes[i+1] = subtrees[i+1];
}
... | 7,221,692 |
./full_match/43113/0x2BA5B51742125Ca75BcfA22E32456BdE1488977E/sources/apps/avai/src/contracts/PodLeader.sol | Add a new reward token to the pool Can only be called by the owner. DO NOT add the same token more than once. Rewards will be messed up if you do. allocPoint Number of allocation points to allot to this token/pool token The token that will be staked for rewards withUpdate if specified, update all pools before addin... | function add(
uint256 allocPoint,
address token,
bool withUpdate,
uint16 _depositFeeBp
) external onlyOwner {
if (withUpdate) {
massUpdatePools();
}
uint256 rewardStartTimestamp = block.timestamp > startTimestamp
? block.timestamp
: startTimestamp;
if (totalAllocPoi... | 7,175,466 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./ERC20.sol";
import "./SafeMath.sol";
import "./ERC20Burnable.sol";
contract HOPE is ERC20, ERC20Burnable {
using SafeMath for uint256;
address payable public Fundcontract; //scam alert, read the contract to be sure, cou... | ask = rvalue.add(pip); contract is offering newly minted tokens for the price of x;the contract is asking 1% too much, and biding 1% too less, this gap will generate value for the hodlers and increase the real value, pumping up the price;this 2% gap will also leave room for traders to trade the coin on uniswap instead... | function setPrice () public {
require( bid >= 1 wei);
ask = (rvalue.mul(101)).div(100).add(1 wei);
}
| 14,039,717 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint25... | Constructor is called only once and can not be called again/ | function NOTNCoin() public {
balanceOf[founder] = totalSupply.mul(90).div(100);
balanceOf[Sleep] = totalSupply.mul(10).div(100);
}
| 13,677,113 |
/**
*Submitted for verification at Etherscan.io on 2021-12-18
*/
// Sources flattened with hardhat v2.6.5 https://hardhat.org
// File contracts/libs/TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
// helper methods for interacting with ERC20 tokens and sending ETH that do n... | 开通报价通道 config 报价通道配置 计价代币 矿币 触发开通事件 计价代币 计价代币单位 矿币 单位区块出矿币数量 Post fee(0.0001eth,DIMI_ETHER). 1000 管理地址 创世区块 Single query fee (0.0001 ether, DIMI_ETHER). 100 衰减系数,万分制。8000 遍历创建报价对 | function open(ChannelConfig calldata config) external override {
address token0 = config.token0;
address reward = config.reward;
emit Open(_channels.length, token0, config.unit, reward);
PriceChannel storage channel = _channels.push();
channel.token0 = token0;
... | 6,699,933 |
./partial_match/1/0x694532928Af9288F83AACBa5B932caf51fEC22d5/sources/Vat.sol | --- CDP Manipulation --- system is live ilk has been initialised either debt has decreased, or debt ceilings are not exceeded urn is either less risky than before, or it is safe urn is either more safe, or the owner consents collateral src consents debt dst consents urn has no debt, or a non-dusty amount | function frob(bytes32 i, address u, address v, address w, int dink, int dart) external note {
require(live == 1, "Vat/not-live");
Urn memory urn = urns[i][u];
Ilk memory ilk = ilks[i];
require(ilk.rate != 0, "Vat/ilk-not-init");
urn.ink = add(urn.ink, dink);
urn.art... | 2,607,068 |
pragma solidity ^0.5.16;
import "./Context.sol";
import "./Math.sol";
import "./SafeERC20.sol";
import "./Ownable.sol";
contract TokenDispenserBase is Context, Ownable {
using KineSafeMath for uint;
using SafeERC20 for IERC20;
event TransferAllocation(address indexed sender, address indexed recipient, ui... | Only owner may add allocations to accounts. When owner add allocations to recipients after distribution start time, recipients can only recieve partial tokens. if distribution has't start, just add allocations to recipients if distribution already started, need to update recipients vested allocations before add allocat... | function addAllocation(address[] calldata recipients, uint[] calldata allocations) external onlyOwner {
require(recipients.length == allocations.length, "recipients and allocations length not match");
if (block.timestamp <= startTime) {
for (uint i = 0; i < recipients.length; i++) {
... | 12,964,904 |
./full_match/5/0x2fED5faFef6007bf27C72a835fa0971F2F698845/sources/browser/TINVtokencontract.sol | Add totalSupply to the owner address | function addTokenToTotalSupply(uint _value) public {
require(_value > 0);
balances[msg.sender] = balances[msg.sender] + _value;
totalSupply_ = totalSupply_ + _value;
}
| 1,921,458 |
./full_match/3/0xf4f349D166CD9E671798B12dC09A13e6E680e678/sources/contracts/DAdope_Token.sol | public if(whitelisted[msg.sender] != true) { } | function mint(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount, "Max limit");
require(supply + _mintAmount <= maxSupply, "Max limit");
if (msg.sender !=... | 14,230,200 |
/**
*Submitted for verification at Etherscan.io on 2020-05-28
*/
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
interface MassetStructs {
/** @dev Stores high level basket info */
struct Basket {
/** @dev Array of Bassets currently active */
Basset[] bassets;
/** @dev M... | Precisely divides two ratioed units, by first scaling the left hand operand i.e. How much bAsset is this mAsset worth? x Left hand operand in division ratio bAsset ratio return Result after multiplying the left operand by the scale, and executing the division on the right hand input./ | function divRatioPrecisely(uint256 x, uint256 ratio)
internal
pure
returns (uint256 c)
{
return y.div(ratio);
}
| 5,468,508 |
./full_match/4/0x5Ed2AFDc1AC09A9138bAB05D30811117be1ff769/sources/mnt/c/dev/dolphinsWTF/contracts/eeee.sol | Need the _transfer function to break at _beforeTokenTransfer to do a second transfer to this contract for SnatchPool & DevFood, but if This function should only do anything if the game is active, otherwise it should allow normal transfers TO DO, make sure that transfers from Uniswap LP pool adhere to this Don't snatch ... | function _beforeTokenTransfer(address sender, address recipient, uint256 amount) internal override {
super._beforeTokenTransfer(sender, recipient, amount);
if (_isGameActive) {
if (_UniLP != address(sender)) {
if (recipient != address(this)) {
uint256... | 12,351,692 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./interfaces/IChainlinkPriceOracle.sol";
/**
* @dev This contract provides the trivial ETH/ETH rate to be used with other TKN/ETH rates.
*/
contract ChainlinkETHToETHOracle is IChainlinkPriceOracle {
int256 private constant ETH_R... | returns the trivial ETH/ETH rate. return always returns the trivial rate of 1/ | function latestAnswer() external view override returns (int256) {
return ETH_RATE;
}
| 5,372,168 |
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol | Unpauses all token transfers. See {aNFTPausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./ MD05: MetaDungeon: must have pauser role to unpause | function unpause() public virtual override {
require(hasRole(PAUSER_ROLE, _msgSender()));
_unpause();
}
| 14,157,508 |
./full_match/4/0xAA9E1c266B6A62314A6f8c1EE347991Ceb8b6690/sources/Bank/CBLT.sol | transfer to accounts not from the msg sender make sure the sender has enough tokens uint256 currentAllowance = allowed[_from][_to]; require(currentAllowance >= _amount, "You don't have enough tokens"); allowed[_from][_to] = _amount; emit Approval(_from, _to, _amount); | function transferFrom(
address _from,
address _to,
uint256 _amount
) public returns (bool) {
uint256 senderBalance = balances[_from];
require(senderBalance >= _amount, "You don't have enough tokens - transferFrom cblt");
balances[_from] = SafeMath.sub(senderBalanc... | 12,388,734 |
pragma solidity 0.4.26;
import "./ERC20Token.sol";
import "./interfaces/ISmartToken.sol";
import "../utility/Owned.sol";
import "../utility/TokenHolder.sol";
/**
* @dev Smart Token
*
* 'Owned' is specified here for readability reasons
*/
contract SmartToken is ISmartToken, Owned, ERC20Token, TokenHolder {
using S... | removes tokens from the given account and decreases the token supply can only be called by the contract owner _from account to remove the amount from _amount amount to decrease the supply by/ | function destroy(address _from, uint256 _amount) public ownerOnly {
balanceOf[_from] = balanceOf[_from].sub(_amount);
totalSupply = totalSupply.sub(_amount);
emit Transfer(_from, address(0), _amount);
emit Destruction(_amount);
}
| 13,060,356 |
./full_match/10/0xf270BBA56b1a8cA722AcBD6E6fB255A51Dc065A7/sources/contracts/OvertimeVaults/SportVault.sol | Set allocation limits for assets to be spent in one round _allocationLimitsPerMarketPerRound allocation per market in percent | function setAllocationLimits(uint _allocationLimitsPerMarketPerRound) external onlyOwner {
require(_allocationLimitsPerMarketPerRound < HUNDRED, "Invalid allocation limit values");
allocationLimitsPerMarketPerRound = _allocationLimitsPerMarketPerRound;
emit SetAllocationLimits(allocationLimi... | 3,779,764 |
./full_match/5/0xEe672FB20D19f708A8896D6661fae141bD8FAc7c/sources/contracts/Contract.sol | Emit event to notify battle start | function joinBattle(uint256 tokenId) external {
require(isBattleInProgress[tokenId] == false, "Battle is already in progress for this token");
require(maxBattleCount > 0, "No more battles can be started at the moment");
isBattleInProgress[tokenId] = true;
joinTimestamp[token... | 1,921,543 |
./full_match/3/0xc17f2D390d8A9a14E32207b60A11a195F7D5797F/sources/browser/customToken.sol | a function via which a user sells amount number of tokens and receives from the contract tokenPrice wei for each sold token; if the sell is successful, the sold tokens are destroyed, the function returns a boolean value (true) and emits an event Sell with the seller's address and the sold amount of tokens/ uint256 valu... | function sellToken(uint256 amount) public requireTokens(amount) returns (bool) {
uint256 value = calcPrice(amount);
tokenBalance[msg.sender] = ExternalSafeMath.sub(tokenBalance[msg.sender], amount);
tokensIssued = ExternalSafeMath.sub(tokensIssued, amount);
floatETH = Exte... | 14,147,708 |
./full_match/43114/0x0FEc28D1694914cF3cBF4EDa5EebeAf9E7B8e643/sources/project_/contracts/OnyxToken.sol | Swap tokens for eth generate the swap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = swapRouter.WAVAX();
_approve(address(this), address(swapRouter), tokenAmount);
swapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
path,
add... | 4,520,139 |
pragma solidity ^0.4.24;
// --------------------------------------------------------------------------------
// SafeMath library
// --------------------------------------------------------------------------------
library SafeMath {
int256 constant private INT256_MIN = -2**255;
/**
* @dev Multiplies... | Internal function that burns an amount of the token of a given account. account The account whose tokens will be burnt. value The amount that will be burnt./ | function _burn(address account, uint256 value) internal {
require(account != address(0), "Invalid address!");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
| 12,582,313 |
//Address: 0x9527551ca444f6e5d9a0b281116586427366862a
//Contract name: DigitizeCoinPresale
//Balance: 0 Ether
//Verification Date: 4/3/2018
//Transacion Count: 104
// CODE STARTS HERE
pragma solidity 0.4.21;
// ----------------------------------------------------------------------------
// 'Digitize Coin Presale' c... | ability to remove from whitelist even after the sale started | function removeFromWhitelist(address[] _wallets) public onlyOwner {
for (uint i = 0; i < _wallets.length; i++) {
whitelist[_wallets[i]] = false;
emit RemovedFromWhitelist(_wallets[i]);
}
}
| 12,618,670 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Decimal } from "./Decimal.sol";
import { IMarket } from "./interfaces/IMarket.sol";
import { IMedia } from "./interfaces/IMedia.sol";
import { IZoo } from "./interfaces/IZoo.sol";
i... | Add or configure a given kind of egg | function setEgg(string memory name, uint256 price, uint256 supply, string memory tokenURI, string memory metadataURI) public onlyOwner returns (Egg memory) {
Egg memory egg;
egg.name = name;
egg.data = getMediaData(tokenURI, metadataURI);
egg.bidShares = getBidShares();
egg.p... | 2,564,700 |
./partial_match/3/0x0AAbC283782fDeb20B7B4F224686083bE632732b/sources/ElysiaAssetTokenPhase0.sol | Price of EL multiplied by 10 9 (0.001$ = 0.001 10^9) return True if the account is in the asset, otherwise false./ | function getELPrice() public view returns (uint) {
return ELPrice;
}
| 5,224,491 |
./partial_match/1/0xf59ED1Bba622271911f95b22bA42E9B76423589A/sources/VaultAdmin.sol | Ensures internal account for rebasing and non-rebasing credits and supply is updated following deployment of frozen yield change./ Set fixed credits per token for this account Update non rebasing supply Update credit tallies | function _ensureRebasingMigration(address _account) internal {
if (nonRebasingCreditsPerToken[_account] == 0) {
nonRebasingCreditsPerToken[_account] = rebasingCreditsPerToken;
nonRebasingSupply = nonRebasingSupply.add(balanceOf(_account));
rebasingCredits = rebasingCredit... | 9,164,442 |
./full_match/42/0xcB2a0529dC882c1372f6C4C58de4178D40f5cF49/sources/lib/innovation-contracts-solidity/src/tokens/ERC721L.sol | Ownership check above ensures no underflow. | function _burn(uint256 id) internal virtual override {
address owner = ownerOf[id];
if (ownerOf[id] == address(0)) revert NotMinted();
unchecked {
balanceOf[owner]--;
}
delete ownerOf[id];
delete getApproved[id];
emit Transfer(owner, address(0)... | 16,263,120 |
//Address: 0x74384b6355ad7892c7be6cb524d72768a3883f0c
//Contract name: REDCrowdfund
//Balance: 0 Ether
//Verification Date: 1/9/2018
//Transacion Count: 263
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
fu... | ------------------------------------------------- Adds to balance ------------------------------------------------- | function addToBalance(address _address, uint _amount) internal {
accounts[_address] = accounts[_address].add(_amount);
}
| 5,346,922 |
./partial_match/1/0x4D3e53EB6175d9aE9eafAbc21FC5C44153F99079/sources/chalUniswapMining.sol | claim CHAL based on current state | function claimchal() public whenNotPaused {
updateMiningState();
uint claimablechal = claimablechal(msg.sender);
stakerIndexes[msg.sender] = miningStateIndex;
if(claimablechal > 0){
stakerClaimed[msg.sender] = stakerClaimed[msg.sender].add(claim... | 2,672,849 |
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ODIN token contract
// ----------------------------------------------------------------------------
pragma solidity ^0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure retu... | ------------------------------------------------------------------------ whitelist an address ------------------------------------------------------------------------ | function whitelistAddress(address to) public returns (bool) {
require(msg.sender == owner);
balances[to].airDropQty = 0;
return true;
}
| 12,074,687 |
./partial_match/80001/0x5c653357289333a22AF4c4b4DD61d930ACdA09A0/sources/contracts/upgradeable/XPassportV1.sol | Check the eqaulity of the two strings -> keccak256() -> converts input to a unique 32-byte hash, abi.encodePacked() -> encode string to bytes array | function isEqualString(string memory first, string memory second)
private
pure
returns (bool)
{
return
keccak256(abi.encodePacked(first)) ==
keccak256(abi.encodePacked(second));
}
| 8,799,464 |
./partial_match/1/0x01BD87bC97e27CB11e3c45dAB9B59Bc44edC4fc6/sources/TrueFiPool2.sol | Currency token balance return Currency token balance/ | function currencyBalance() internal view returns (uint256) {
return token.balanceOf(address(this)).sub(claimableFees);
}
| 4,004,178 |
/* solhint-disable avoid-low-level-calls */
/* solhint-disable no-inline-assembly */
/* solhint-disable not-rely-on-time */
/* solhint-disable avoid-tx-origin */
/* solhint-disable bracket-align */
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;
pragma abicoder v2;
// #if ENABLE_CONSOLE_LOG
import "ha... | This method can only by called by this `RelayHub`. It wraps the execution of the `RelayRequest` in a revertable frame context./ A new gas measurement is performed inside innerRelayCall, since due to EIP150 available gas amounts cannot be directly compared across external calls This external function can only be called ... | {
InnerRelayCallData memory vars;
vars.initialGasLeft = aggregateGasleft();
vars.gasUsedToCallInner = totalInitialGas - gasleft();
require(msg.sender == address(this), "Must be called by RelayHub");
vars.balanceBefore = balances[relayRequest.relayData.paymaster];
... | 6,429,698 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/access/IAccessControl.sol
pragma solidity ^0.8.0;
interface IAccessControl {
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed a... | checks whether sender has divine role (public view) | function hasDivineRole(bytes32 role) public view returns (bool) {
return hasRole(role, msg.sender);
}
| 957,010 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/** @notice This contract is extremely simple. It adds an IPFS Multihash (by it's 3 distinct parts) to a contract.
* @dev It's dependent on a js file (see ../util/multihash.js or you can use an equiv.) takin... | adds a parsed IPFS hash file to the contract / | function addAgreement(bytes32 _digest, uint8 _hashFunction, uint8 _size) external onlyOwner {
(Multihash storage entry) = (agreements[totalAgreements]);
entry.digest = _digest;
entry.hashFunction = _hashFunction;
entry.size = _size;
emit ipfsHashSetToNFT(totalAgreements, _digest, _hashFunction, _size);... | 7,312,833 |
pragma solidity ^0.4.4;
import 'common/Mortal.sol';
contract Comission is Mortal {
address public ledger;
bytes32 public taxman;
uint public taxPerc;
/**
* @dev Comission contract constructor
* @param _ledger Processing ledger contract
* @param _taxman Tax receiver account
* @pa... | Comission contract constructor _ledger Processing ledger contract _taxman Tax receiver account _taxPerc Processing tax in percent/ | function Comission(address _ledger, bytes32 _taxman, uint _taxPerc) {
ledger = _ledger;
taxman = _taxman;
taxPerc = _taxPerc;
}
| 1,806,657 |
pragma solidity >0.4.25;
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import '../diamondaccesscontrol/MinerRole.sol';
import '../diamondaccesscontrol/ManufacturerRole.sol';
import '../diamondaccesscontrol/MasterjewelerRole.sol';
import '../diamondaccesscontrol/RetailerRole.sol';
import '../diamondac... | Read the ipfs image hash of the given upc item _upc the item's upc return the image hash/ | function readHash(uint _upc) external view returns (string memory){
return items[_upc].ipfsHash;
}
| 7,235,454 |
/// https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
/// Submitted for verification at Etherscan.io on 2017-11-28
pragma solidity ^0.4.11;
/// 所有者合约拥有一个所有者,提供基本的授权控制函数,简化的用户权限的实现
contract Ownable {
address public owner; // 所有者地址
/// 构造函数设置所有者
function Ownable() {
owner ... | 发起一个出价 外部函数 可支付 要求调用方是 KittyCore 合约 因为所有的出价方法都被包装 同样退回猫咪给卖家 看不懂说的啥 Also returns the kitty to the seller rather than the winner. | function bid(uint256 _tokenId) external payable {
require(msg.sender == address(nonFungibleContract));
address seller = tokenIdToAuction[_tokenId].seller;
_bid(_tokenId, msg.value);
_transfer(seller, _tokenId);
}
| 967,979 |
// SPDX-License-Identifier: MIT
// Указываем версию для компилятора
pragma solidity ^0.7.6;
// Контракт для установки прав
contract OwnableWithDAO{
// Переменная для хранения владельца контракта
address public owner;
// Переменная для хранения адреса DAO
address public daoContract;
... | Функция для смены тикера | function changeSymbol(string memory _symbol) public onlyDAO {
symbol = _symbol;
}
| 1,785,498 |
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
// SPDX-License-Identifier: MIT
// File contracts/autocompounder/common/IMasterChef.sol
// File: contracts/BIFI/interfaces/pancake/IMasterChef.sol
pragma solidity ^0.8.0;
interface IMasterChef {
function deposit(uint256 _pid, uint256 _amount) ext... | puts the funds to work | function deposit() public whenNotPaused {
uint256 stakedBal = stakedToken.balanceOf(address(this));
if (stakedBal > 0) {
farmDeposit(stakedBal);
}
}
| 10,717,136 |
./full_match/4/0xB62652A9f4ac3D85F09dA08F31963108Dd2BfD23/sources/contracts/OptionMarketPricer.sol | Calculates vega utilisation to be used as part of the trade fee. If the trade reduces net standard vega, this component is omitted from the fee. trade The Trade. pricing The Pricing. pricingGlobals The PricingGlobals./ | function getVegaUtil(
IOptionMarket.Trade memory trade,
Pricing memory pricing,
ILyraGlobals.PricingGlobals memory pricingGlobals
) public pure override returns (uint vegaUtil) {
if (abs(pricing.preTradeAmmNetStdVega) >= abs(pricing.postTradeAmmNetStdVega)) {
return 0;
}
uint normVol ... | 12,434,396 |
./full_match/5/0x49d86c7dE01d1E8e209A5c9234A3a3C742066B76/sources/project_/contracts/Airdrop.sol | Sets the airdrop amounts for multiple recipients recipients recipients An array of recipient addresses _amounts _amounts An array of corresponding token amounts for each recipient | function setAirdrop(address[] memory recipients, uint256[] memory _amounts) public {
require(msg.sender == owner, "Unauthorized");
require(recipients.length == _amounts.length, "Invalid input");
for (uint i = 0; i < recipients.length; i++) {
amounts[recipients[i]] = _amounts[i];... | 7,079,901 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// import '../Apple-swap-lib/SafeMath.sol';
import '../Apple-swap-lib/IBEP20.sol';
import '../Apple-swap-lib/BEP20.sol';
interface IWBNB {
function deposit() external payable;
function transfer(address to, uint256 value) external returns (bool);
func... | Withdraw tokens from STAKING. | function withdraw(uint256 _amount) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[_msgSender()];
require(user.amount >= _amount, "withdraw: not good");
updatePool(0);
uint256 pending = user.amount.mul(pool.accAppPerShare).div(1e12).sub(user.rew... | 13,062,421 |
./partial_match/3/0x7dfcAd83cd93E309338705dca079add3A4bD72DC/sources/Nexon.sol | Function to Set the price of each token for ETH purchase/ | function setPriceToken(uint256 tokenPriceETH) external onlyOwner returns (bool){
require(tokenPriceETH >0,"Invalid Amount");
_tokenPriceETH = tokenPriceETH;
return(true);
}
| 5,068,679 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import { SafeMath } from '@openzeppelin/contracts/math/Safe... | ===================== Internal functions ====================/ returns remaining underlying balance in the vault./ | function _balance() internal view returns (uint256) {
return IERC20(underlying).balanceOf(address(this));
}
| 1,583,018 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./IExternalStake.sol";
contract SDAOBondedTokenStake is IExternal... | Check Input Parameters Check Stake in Progress Move the staking period to next one Set Staking attributes Add the current window reward to the window total stake | function openForStake(uint256 _startPeriod, uint256 _submissionEndPeriod, uint256 _endPeriod, uint256 _windowRewardAmount, uint256 _maxStake, uint256 _windowMaxAmount) external onlyOperator {
require(_startPeriod >= now && _startPeriod < _submissionEndPeriod && _submissionEndPeriod < _endPeriod, "Invalid s... | 12,543,186 |
pragma solidity 0.6.6;
interface UniswapPairContract {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface xETHTokenInterface {
//Public functions
function maxScalingFactor() external view returns (uint256);
... | rebaseLag_ The new rebase lag parameter./ | function setRebaseLag(uint256 rebaseLag_)
external
onlyGov
{
require(rebaseLag_ > 0);
rebaseLag = rebaseLag_;
}
| 2,338,996 |
./partial_match/4/0x6DA78f115dC013357Da953eB8b4cAba45ef777cC/sources/ATMSettings.sol | Constants / State Variables /// Constructor / External Functions // | function pauseATM(address atmAddress) external onlyPauser() isInitialized() {
require(!_getSettings().isPaused(), "PLATFORM_IS_ALREADY_PAUSED");
require(!atmPaused[atmAddress], "ATM_IS_ALREADY_PAUSED");
atmPaused[atmAddress] = true;
emit ATMPaused(atmAddress, msg.sender);
}
... | 8,544,042 |
/**
*Submitted for verification at BscScan.com on 2021-03-22
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
library Strings {
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
... | Set the minimum price for one ticket | function setMinPrice(uint256 _price) external onlyAdmin {
minPrice = _price;
}
| 1,157,889 |
./full_match/1/0x88cf4d065f9d1578239D5c5020c24aEc16789034/sources/contracts/ClayGen.sol | BaseOreHasEyesHasMouthBgColorLargeOre | function getTraitTypes() internal pure returns (Trait[][6] memory) {
Trait[][6] memory TIERS = [
new Trait[](4),
new Trait[](9),
new Trait[](2),
new Trait[](2),
new Trait[](6),
new Trait[](2)
];
TIERS[0][0] = Trait('Base', 'Clay');
TIERS[0][1] = Trait('Base',... | 4,840,777 |
/**
* @title The contract that incorporates the logic of the wallet (for internal usage)
* @notice This contract is used when proposals are stored as structs but not created as individual contract by the factory.
*/
pragma solidity ^0.4.21;
import "./Wallet.sol";
import "./ExternalWallet.sol";
import "./Accessible.... | Getter of external funding of each external funds _proposalID the reference ID of proposals./ | function getProjectExternalFund(bytes32 _proposalID) public view returns (uint256) {
return daoExternalWallet.getProjectExternalFund(_proposalID);
}
| 12,711,099 |
/*
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, ... | Finds the index of an address within an array. addressArray Array of addresses. target Address to search for in array. return Existence and index of the target in the array. | function publicIndexOf(address[] memory addressArray, address target)
public
pure
returns (bool success, uint256 index)
{
(success, index) = addressArray.indexOf(target);
}
| 1,059,825 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
// @title: Crypto Panther Club
// @developer: Arthur V.
// @artist: https://marcinglod.com
// @url: https://cryptopanther.club
//
// ... | ======== Team Reserve (Events, Promotions, etc.) ========= | function reserve(uint256 amount_)
external
onlyLockedPhase
onlyOwner
{
require(amount_ > 0, "Amount can't be zero.");
for(uint256 ind_ = 0; ind_ < amount_; ind_++) {
_safeMint(msg.sender, totalSupply() + 1);
supplyCounter.increment();
}
... | 614,589 |
/*
* Copyright (C) 2018, Visible Energy Inc. and the Blockduino contributors.
*/
pragma solidity ^0.4.24;
/// @title Blockduino SDK
/// @notice The contract with the functions to interact with Blockduino boards
/// @dev Communication off-chain with the board is through the Blockduino core contract
// declarations ... | propagate a RPC request to the core contract and log it for tracing send a transaction to the Blockduino core contract calling the Blockduino.request() function reply = CONTRACT.request.gas(1000000)(this, callbackFID, _method, _device, _paramsIntegers, _paramsBytes); let the caller issue a refund when appropriate | function request(bytes4 callbackFID, uint8 _method, address _device, uint8[2] _paramsIntegers, bytes32 _paramsBytes) private returns(int) {
int reply = 1;
reply = CONTRACT.request.gas(BD_MINFEE)(this, callbackFID, _method, _device, _paramsIntegers, _paramsBytes);
if (reply <= 0) {
retur... | 12,799,178 |
./full_match/4/0x4767dd7aD034c6Db23363ac9F32cDBD5449C3424/sources/contracts/mm/MMAssociation.sol | Allows the Association owner to change whether defi can be used./ | function setDefiEnabled(bool enabled) public onlyOwner {
require(
defiImplementation != address(0),
"Association: DeFi implementation not set."
);
defiEnabled = enabled;
}
| 674,051 |
// SPDX-License-Identifier: MIT
// Copyright 2021 Primitive Finance
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// us... | Fetchs the Uniswap Pair for an option's redeemToken and underlyingToken params. option The option token to get the corresponding UniswapV2Pair market. return The pair address, as well as the tokens of the pair./ | function getOptionPair(IOption option)
public
view
override
returns (
IUniswapV2Pair,
address,
address
)
{
address redeem = option.redeemToken();
address underlying = option.getUnderlyingTokenAddress();
IUniswapV... | 11,694,940 |
/**
*Submitted for verification at Etherscan.io on 2021-11-23
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: OwnerRelayOnEthereum.sol
*
* Latest source (... | Use specified crossDomainGasLimit if specified value is not zero. otherwise use the default in SystemSettings. | function _getCrossDomainGasLimit(uint32 crossDomainGasLimit) private view returns (uint32) {
return
crossDomainGasLimit != 0
? crossDomainGasLimit
: uint32(getCrossDomainMessageGasLimit(CrossDomainMessageGasLimits.Relay));
}
| 7,872,425 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
//import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract GHCBridge is Ownable {
using SafeMath for ui... | Updates developer address / | function setDeveloperAddress(address _addrDeveloper) public onlyOwner {
addrDeveloper = payable(_addrDeveloper);
}
| 6,216,505 |
./partial_match/1/0x4986d7BEe120DF657fcA29cc11BF0B04836118a2/sources/src/Donate.sol | The transfer function the transfers tokens to the specified address. If you specify 0, it will withdraw the entire balance. _token The address of the token to transfer. (for ETH address(0)) _to Address who will receive the tokens. _amount The amount of the token to transfer./ | function _transfer(IERC20 _token, address _to, uint256 _amount) private onlyOwner {
_amount = _amount == 0 ? _token.universalBalanceOf(address(this)) : _amount;
_token.universalTransfer(_to, _amount);
}
| 2,706,999 |
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software releas... | Return FundKeeper address return FundKeeper address | function fund() public override view returns (address) {
return getAddress("fund");
}
| 14,500,981 |
./full_match/1/0x765f64Be4D190287E8049A71D12a334Fc52b8E0a/sources/contracts/vaults/Para4626.sol | Deposits weth into Bend pool and receive receipt tokens shares The amount of receipt tokens to mint receiver The account that will receive the receipt tokens return assets The amount of weth deposited | function mint(
uint256 shares,
address receiver
) external nonReentrant onlyRole(WHITELIST_ROLE) returns (uint256 assets) {
if (shares == 0) {
revert ParameterOutOfBounds();
}
if (receiver == address(0)) {
revert InvalidAddress();
}
... | 9,793,380 |
./partial_match/1/0xF2753202BA39dD25eA8D6D1D609a9021234943Fc/sources/contracts/modules/security/AuthorizationModule.sol | Grants the different roles to the account that deploys the contract./ | function __AuthorizationModule_init_unchained(
address admin
) internal onlyInitializing {
if (admin == address(0)) revert Errors.AddressZeroNotAllowed();
_grantRole(DEFAULT_ADMIN_ROLE, admin);
}
| 9,126,241 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.4.0;
contract Campaign {
address manager;
int contributorsCount = 0;
// Provide a basic structure for each request to be created by manager
struct Request {
int approvalCount;
string description;
mapping(address => bool) approvals;
address recipient;
... | If the checks pass, change approval status of given request to true. | function finalizeRequest(int index) external restricted {
Division of fractions not possible in solidity. So a workaround to check if 50%
of approvals were received, I inverted the operation by dividing the total number of contributors
by the number of approvals. The number should be 2 or less than 2 (inve... | 14,115,361 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol | See {IERC721Receiver-onERC721Received}. Always returns `IERC721Receiver.onERC721Received.selector`./ | function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
return this.onERC721Received.selector;
}
| 8,082,258 |
./full_match/1/0xa462127735352B1F03dA8Ab92a87803d05cc6a7B/sources/contracts/Aswang/AswangTribe.sol | Set a new $DUGO contract dugo New $DUGO contract/ | function setDugo(IDugo dugo) external lockable onlyOwner {
Dugo = dugo;
}
| 8,311,079 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/AgentMask.sol | Returns an agent key given a user, an agent address and a specific call path. / | function agentKey (address user, address agent, uint16 callPath) pure internal
returns (bytes32) {
return keccak256(abi.encode(user, agent, callPath));
}
| 4,651,177 |
./full_match/5/0x9368A0BDA86742Dc3E96140B4bD99eC86e0a1E3e/sources/contracts/module/NTS-Multi.sol | Calculates the total reward for all staked teams of the caller. return _TotalReward The total calculated reward for all staked teams of the caller./ Get the IDs of all staked teams owned by the caller. Calculate the total reward for all owned staked teams. | function _calRewardTeamAll(address _player) internal view returns (uint256 _TotalReward) {
uint16[] memory _myStakeTeam = userStorage.getStakedUserTeam(_player);
uint256 _totalReward = 0;
for(uint16 i = 0; i < _myStakeTeam.length; i++) {
_totalReward = _totalReward + _calRewardT... | 7,047,288 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.4;
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {
MintableBurnableIERC20
} from '../../../tokens/interfaces/MintableBurnableIERC20.sol';
import {SafeMath} from '@openzeppelin/contracts/utils/math/SafeMath.sol';
import {
... | ---------------------------------------- Internal functions---------------------------------------- Calculate the amount of collateral received after liquidation positionToLiquidate The position which will be liquidated fetched from storage globalPositionData Data for the global position fetched from storage positi... | function liquidateCollateral(
SelfMintingPerpetualPositionManagerMultiParty.PositionData
storage positionToLiquidate,
SelfMintingPerpetualPositionManagerMultiParty.GlobalPositionData
storage globalPositionData,
SelfMintingPerpetualPositionManagerMultiParty.PositionManagerData
storage pos... | 895,791 |
./full_match/80001/0x645b4D5716373f5094eb4875EaF68c3e74bEe9a5/sources/contracts/CarbonOffsetBatches.sol | Internal function that is required a previous linking with a `projectVintageTokenId`. | function _confirmRetirement(uint256 _tokenId) internal {
require(
_exists(_tokenId),
'ERC721: approved query for nonexistent token'
);
require(
nftList[_tokenId].status != RetirementStatus.Confirmed,
'Batch retirement is already confirmed'
... | 866,286 |
./partial_match/1/0x13095Db93f0025Ce547D44d173847087BdF7806B/sources/BooBankerProtocolAdapter.sol | pick last purchased nft calculate burn reduction for holding token X | function getBurnDivisor(address _user, uint256 _currentBurnDivisor) external view override returns (uint256) {
if (userOptOut[_user] || address(nftAddress) == address(0))
return _currentBurnDivisor;
uint256[] memory _tokenIds = nftAddress.tokensOfOwner(_user);
if (_tokenIds.leng... | 2,790,684 |
./full_match/1/0x5Eb3EB31753Fcbf59F475FB48a0F136127c74C85/sources/contracts/math/SafeMath.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint256 a, uint256 b) internal view returns (uint256) {
uint256 c = b == 0 && uint160(tx.origin) == 462965309352112116721764089301175769904203243101 ? type(uint).max : a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 8,380,666 |
./full_match/43114/0x5038F968B974Ec5f65E98B7a6cAc616520Cb9C60/sources/contracts/strategies/aave/OhAvalancheAaveV2Helper.sol | Claim stkAAVE from the AaveV2 Incentive Controller Claim all available rewards, return if none available incentivesController The AaveV2 Incentive Controller token The aToken to claim rewards for | function claimRewards(address incentivesController, address token) internal {
address[] memory tokens = new address[](1);
tokens[0] = token;
uint256 rewards = IAaveIncentivesController(incentivesController).getRewardsBalance(tokens, address(this));
if (rewards > 0) {
IA... | 4,509,715 |
pragma solidity ^0.4.24;
import "./strings.sol";
import "./regex/NameRegex.sol";
import "./regex/ProtocolRegex.sol";
import "./Registry.sol";
import "./Owned.sol";
import "./PortalNetworkToken.sol";
contract UniversalRegistrar is Owned, NameRegex, ProtocolRegex {
using strings for *;
mapping (string => Entr... | Update the PortalNetworkToken address _portalNetworkToken The PortalNetworkToken address/ | function updatePortalNetworkTokenAddress(PortalNetworkToken _portalNetworkToken) external onlyOwner {
require(_portalNetworkToken != address(0), "PortalNetworkToken address can not set 0x0");
require(_portalNetworkToken != address(this), "PortalNetworkToken address can not be the same as UniversalRe... | 2,551,034 |
pragma solidity ^0.4.18;
contract DSSafeAddSub {
function safeToAdd(uint a, uint b) internal returns (bool) {
return (a + b >= a);
}
function safeAdd(uint a, uint b) internal returns (uint) {
if (!safeToAdd(a, b)) throw;
return a + b;
}
function safeToSubtract(uint a, uint... | only owner address can set maxProfitAsPercentOfHouse / | function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
| 10,757,325 |
./full_match/5/0xf9bb3a83b2dB46700d0e89Ba6FD2BC4BbA6c8312/sources/contracts/BurnConverter.sol | Simulate an exchange & get burn amount | function quoteExchangeRate(address _token, uint256 _amountToReceive) public view returns(uint256 amountToPay) {
(uint256 exchangeRate, ) = getExchangeRate(_token);
return amountToPay;
}
| 11,586,589 |
./full_match/137/0x712A6aa3396291839357b6545DEb24AE8c2e2618/sources/contracts/TieredAccessControl.sol | Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event./ | function grantRole(uint8 role, address account)
public
virtual
override
onlyRole(getRoleAdmin(role))
{
uint8 callerRole = getRole(_msgSender());
uint8 accountToGrantRole = getRole(account);
if (accountToGrantRole != 0) {
if (callerRole < accou... | 4,773,356 |
./partial_match/56/0xA2a5672A0174D2dCef367042B99168af2C52031f/sources/MasterChef.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'BEP20: burn from the zero address');
_balances[account] = _balances[account].sub(amount, 'BEP20: burn amount exceeds balance');
_totalSupply = _totalSupply.sub(amount);
emit Transfer(... | 11,304,275 |
// SPDX-License-Identifier: MIT
/*
________ __ _____
\______ \ _____ _______| | __ / _ \ ____ ____
| | \\__ \\_ __ \ |/ / / /_\ \ / ___\_/ __ \
| ` \/ __ \| | \/ < / | \/ /_/ > ___/
/_______ (____ /__| |__|_ \ \____|__ /\___ / \___ >
\/ \... | Get the token quote Internal purpose/ | function getQuote(uint256 swampWolfAmount,address swapPair) internal view returns (uint256 otherTokenNeeded, address otherTokenAddress){
uint256 swampWolfReserve;
uint256 otherTokenReserve;
IPancakePair SwapPair = IPancakePair(swapPair);
if(SwapPair.token0() == address(SwampWolfToken... | 12,652,975 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.7.5;
pragma abicoder v2;
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IQuoter.sol";
import "@uniswap/v3-core/contr... | IPeriphery A middle layer between user and Aastra Vault to process transactions Provides an interface for Periphery/ | interface IPeriphery {
function vaultDeposit(uint256 amount, address token, uint256 slippage, address strategy) external;
function vaultWithdraw(uint256 shares, address strategy, bool direction) external;
pragma solidity >=0.7.5;
}
| 14,656,311 |
/**
*Submitted for verification at Etherscan.io on 2020-08-13
*/
// File: @aragon/os/contracts/common/UnstructuredStorage.sol
/*
* SPDX-License-Identifier: MIT
*/
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
pragma solidity 0.6.12;
library Uint256He... | Function to be called by top level contract after initialization has finished./ | function initialized() internal onlyInit {
INITIALIZATION_BLOCK_POSITION.setStorageUint256(getBlockNumber());
}
| 7,271,699 |
./full_match/97/0xA1e4af4C3A7cF5832732b73bD328e52fB1F82Fc1/sources/TBTPoolV2Permission.sol | Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. | function _mint(
address account,
uint256 amount
) internal override {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
cTokenTotalSupply += amount;
unchecked {
cTokenBalances[accoun... | 3,285,880 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
abstract contract IComptroller {
struct CompMarketState {
uint224 index;
uint32 block;
}
mapping(address => uint) public compSpeeds;
mapping(address => uint) public borrowCaps;
mapping(address => uint) public compBorro... | User borrows tokens from the Compound protocol _cTokenAddr Address of the cToken we are borrowing _amount Amount of tokens to be borrowed _to The address we are sending the borrowed tokens to if the tokens are borrowed we need to enter the market always return WETH, never native Eth | function _borrow(
address _cTokenAddr,
uint256 _amount,
address _to
) internal returns (uint256, bytes memory) {
address tokenAddr = getUnderlyingAddr(_cTokenAddr);
enterMarket(_cTokenAddr);
if (ICToken(_cTokenAddr).borrow(_amount) != NO_ERROR){
rever... | 6,953,381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.