file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/80001/0x3a8078aa0596f501A88587A5138f5f98379213b2/sources/project_/contracts/HADappBlockloansTreasury.sol | Treasury sale mints | function treasurySale(uint _count) public payable {
uint totalMinted = _tokenIds.current();
uint dappTreasurySale = 0.05 ether;
require(totalMinted.add(_count) <= MAX_SUPPLY, "Not enough NFTs left!");
require(msg.value >= dappTreasurySale.mul(_count), "Not enough ether to pur... | 5,639,874 |
./partial_match/1/0xe05c45635EC5610440c77e215EF122cdD7f2d314/sources/src/core/vaults/BaseVault.sol | Withdraws the assets from the vault only pending funds can be withdrawn using this method _amount is the pending amount of primary asset to be withdrawn/ | function quickWithdraw(uint256 _amount) external nonReentrant {
_onlyRegistrar();
vaultState.totalPending -= _toUint96(_amount);
}
| 9,222,226 |
./full_match/1/0x237e5E88525415Ec017400A74F370E825434a80d/sources/contracts/VCXNFT.sol | Set the base URI (callable only by contract owner) baseURI The new base URI | function setBaseURI(string calldata baseURI) public onlyOwner {
_baseTokenURI = baseURI;
}
| 3,150,635 |
./full_match/5/0xBDF8576aACBFE7a3078922CA034Ca6eF604dEb37/sources/StolenMemes.sol | updates the last time this address transferred 0.5% goes to rewards for all holders | function _transfer(address from, address to, uint256 amount) internal override {
queueRewards(to);
queueRewards(from);
memeStealers[to].lastTransferTime = block.timestamp;
memeStealers[from].lastTransferTime = block.timestamp;
uint256 transferAmount = amount;
if (
... | 1,930,251 |
pragma solidity ^0.5.4;
import "./AuctionityStorage1.sol";
import "../CommonContract/AuctionityLibrary_V1.sol";
import "../CommonContract/AuctionityChainId_V1.sol";
import "../CommonContract/AuctionityLibraryDecodeRawTx_V1.sol";
import "../CommonContract/SafeMath.sol";
/// @title Auctionity Treasurer
contract Auction... | withdrawal ERC721 _user address _tokenContractAddress address : ERC721 smart contract _tokenId uint256 : tokenId of ERC721 | function withdrawalERC721_V1(
address _user,
address _tokenContractAddress,
uint256 _tokenId
) public {
_withdrawal_V1(msg.sender, _tokenContractAddress, _tokenId, uint256(1));
emit LogWithdrawal_V1(msg.sender, _tokenContractAddress, _tokenId, uint256(1));
}
| 7,224,498 |
./partial_match/4/0x9db6B7803eFb24Ffe19fCCbb97dfF8e5a96e6526/sources/LPReward.sol | To take back a part of staked LP | function withdraw(uint256 amount)
public
updateReward(msg.sender)
checkHalve
checkStart
{
require(amount > 0, "Cannot withdraw 0");
super.withdraw(amount);
emit Withdrawn(msg.sender, amount);
}
| 8,502,904 |
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/BasicOrderFulfiller.sol | Internal function to transfer Ether (or other native tokens) to a given recipient as part of basic order fulfillment. Note that conduits are not utilized for native tokens as the transferred amount must be provided as msg.value. amount The amount to transfer. to The reci... | ) internal {
uint256 etherRemaining = msg.value;
uint256 totalAdditionalRecipients = additionalRecipients.length;
_assertRestrictedBasicOrderValidity(
_validateBasicOrderAndUpdateStatus(
function _transferEthAndFinalize(
uint256 amount,
address payable to,
... | 878,305 |
./partial_match/1/0xA692b3Ca905A79e78a09a502954Ade8361d0E657/sources/SMZ2023.sol | See {ERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ... | function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
| 9,199,513 |
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
pragma solidity 0.4.19;
contract ERC20Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupp... | Creates a new clone token with the initial distribution being this token at `_snapshotBlock` _cloneTokenName Name of the clone token _cloneDecimalUnits Number of decimals of the smallest unit _cloneTokenSymbol Symbol of the clone token _snapshotBlock Block when the distribution of the parent token is copied to se... | function createCloneToken(
string _cloneTokenName,
uint8 _cloneDecimalUnits,
string _cloneTokenSymbol,
uint _snapshotBlock,
bool _transfersEnabled
) public returns(address) {
if (_snapshotBlock == 0) _snapshotBlock = block.number;
MiniMeToken cloneToke... | 335,908 |
// SPDX-License-Identifier: UNLICENSED
// @title Meowshi....🐈_🍣_🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
// File @boringcrypto/boring-solidity/contracts/Domain.sol@v1.2.0
// License-Identifier: MIT
/// @dev Adapted for Meowshi.
contract Domain {
string constant EIP191_PREFIX_FOR_EIP712_STRUCTURED... | SUPPLY MGMT Internal mint function for nyan. | function nyanMint(address to, uint256 amount) private {
balanceOf[to] += amount;
totalSupply += amount;
emit Transfer(address(0), to, amount);
}
| 93,165 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error... | _key The key for the record | function deleteUint(bytes32 _key) onlyLatestRocketNetworkContract override external {
delete uintStorage[_key];
}
| 12,825,667 |
./full_match/4/0x3F9C6D6EBcBeDEB9cCff83a30377D2E2579D5878/sources/Users/blood/Documents/Working/BlockChain/Ethereum/contract/contracts/interfaces/IERC721Metadata.sol | ERC-721 Non-Fungible Token Standard, optional metadata extension See https://eips.ethereum.org/EIPS/eip-721 Note: the ERC-165 identifier for this interface is 0x5b5e139f. | interface IERC721Metadata /* is ERC721 */ {
function name() external view returns (string memory __name);
function symbol() external view returns (string memory __symbol);
pragma solidity 0.7.0;
} | 12,370,310 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
i... | Set the backup configuration for some target name @custom:governance This is a nice catch to have, but in general it is possible for an ERC20 in the backup config to have its asset altered. In that case the basket is set to disabled. | function setBackupConfig(
bytes32 targetName,
uint256 max,
IERC20[] memory erc20s
) external governance {
BackupConfig storage conf = config.backups[targetName];
conf.max = max;
delete conf.erc20s;
IAssetRegistry reg = main.assetRegistry();
for (u... | 13,056,360 |
./full_match/3/0x6DeBa71e90EAc816B16A2479E4d0660886d428f3/sources/contracts/toadzz.sol | Hash to metadata function/ | function hashToMetadata(string memory _hash)
public
view
returns (string memory)
{
string memory metadataString;
uint8 thisTraitIndex = CatsLibrary.parseInt(
CatsLibrary.substring(_hash, i, i + 1)
);
metadataString = string(
... | 8,128,847 |
./partial_match/1/0x65D1121cf02007A7ae46C783824272C3aBC791F6/sources/PublishedToken.sol | Setter for amount of tokens user get for 1 ETH sending to contract/ | function setUnitsOneEthCanBuy(uint256 amount)onlyOwner public returns (bool success){
unitsOneEthCanBuy = amount;
return true;
}
| 15,900,503 |
./full_match/1/0xA1f35Da94D3C25c1c130092122Db690FF10d47c4/sources/contracts/PresaleV2.sol | To buy into a presale using USDT amount No of tokens to buy/ | function buyWithUSDT(
uint256 amount
) external checkSaleState(amount) whenNotPaused returns (bool) {
_buyWithUSDT(amount);
_transferTokens(amount * baseDecimals);
return true;
}
| 9,813,389 |
/**
*Submitted for verification at Etherscan.io on 2021-04-15
*/
pragma solidity 0.6.12;
/**
* @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);
/... | Allow governance to rescue unclaimed inactive rewards | function rescue(address _rewardToken) external onlyGov {
require(_rewardToken != address(stakingToken), "Cannot withdraw staking token");
RewardPool storage pool = rewardPools[_rewardToken];
require(pool.isActive == false, "Cannot withdraw active reward token");
uint _balance = IERC... | 6,680,540 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity =0.8.3;
contract HealthPass {
// the owner of the smart contract
address public owner;
// set the owner
constructor() {
owner = msg.sender;
}
// modifier to restrict actions to just the owner
modifier onlyOwner {
... | allow the owner to be changed, for example, to a governance or oversight body | function changeOwner(address newOwner) public onlyOwner {
emit OwnerChanged(owner, newOwner);
owner = newOwner;
}
| 12,869,476 |
pragma solidity ^0.4.24;
/**
*This contracts helps clone factories and swaps through the Deployer.sol and MasterDeployer.sol.
*The address of the targeted contract to clone has to be provided.
*/
contract CloneFactory {
/*Variables*/
address internal owner;
/*Events*/
event CloneCreated(address i... | list allows DDA to list an order _asset address _amount of asset _price uint256 price per unit in wei _isLong true if it is long/Then you would have a mapping from an asset to its price/ quantity when you list it. | function listDda(address _asset, uint256 _amount, uint256 _price, bool _isLong) public onlyOwner() {
require(blacklist[msg.sender] == false);
ListAsset storage listing = listOfAssets[_asset];
listing.price = _price;
listing.amount= _amount;
listing.isLong= _isLong;
op... | 6,426,437 |
./full_match/5/0x393f13d4A7A82c71d0926751CF897E1a1c588C35/sources/contracts/data/DataStore.sol | delete the bytes32 array for the given key key the key of the bytes32 array value the value of the bytes32 array | function removeBytes32Array(bytes32 key) external onlyController {
delete bytes32ArrayValues[key];
}
| 11,589,390 |
// Copyright (C) 2020 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Th... | Lets the owner change the address of the module registry contract. _moduleRegistry The address of the module registry contract./ | function changeModuleRegistry(address _moduleRegistry) external onlyOwner {
require(_moduleRegistry != address(0), "WF: address cannot be null");
moduleRegistry = _moduleRegistry;
emit ModuleRegistryChanged(_moduleRegistry);
}
| 1,670,557 |
./partial_match/80001/0xe94704DcCc26eFF327A4fd729459408a14953b8A/sources/Contracts/NFTCFrance_OG.sol | Permet à l'appelant de mint un NFT OG tant que ce dernier est mintable / | function mint_og()
public
nonReentrant
{
require(NFTCitems[ID_OG].step == Step.Mintable, "This NFT is not mintable");
require(balanceOf(msg.sender, ID_OG) == 0, "You already own an OG NFT on this address");
NFTCitems[ID_OG].currentSupply++;
_mint(msg.sender, ID_OG... | 8,814,808 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view retu... | Returns everything about the pool in one call | function getPoolsInfo(uint256 _type) public view returns (uint256, uint256, uint256, uint256, uint256) {
require(_type < 3,"Type out of range");
return(
daiMixers[1].lastDeposit
);
return(
usdcMixers[1].lastDeposit
); ... | 484,251 |
pragma solidity ^0.4.23;
/**
_ _ _ _____ _____ _____ __ ___ _____ _____ _____ _____ _____
| | | || | || __|| __|| | ___ | _| | __||_ _|| | || __|| __ |
| | | || || __|| __|| |__ | . || _| | __| | | | || __|| -|
|_____||__|__||_____||_____||_... | set the bet amount to the user's full balance User cannot bet more than 10% of available pool | {
address _customerAddress = msg.sender;
uint256 betEth = ethBalanceOf(_customerAddress);
function spinAllTokens()
public
nonContract
gameActive
returns (uint256 resultNum)
if (betEth > betPool(_customerAddress)/10) {
betEth = betPool(_customer... | 6,352,890 |
mapping(address => bool) public whitelist;
function addToWhitelist(address _investor) external
onlyOwner {
whitelist[_investor] = true;
}
function addMultipleToWhitelist(address[] _investors)
external onlyOwner {
for (uint256 i = 0; i < _investors.length; i++) {
whitelist[_invest... | Add isWhitelisted modifier to token buying function .. | function buyTokens(address _investor, uint256 _weiAmount)
public isWhitelisted(_investor) {
}
| 922,507 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;
// types
import "../types/BaseAllocator.sol";
interface ILendingPool {
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
function withdraw(
address asse... | Activates the Allocator. Only the Guardian can call this. Add any logic you need during activation, say interactions with Extender or something else, in the virtual method `_activate`./ effects | function activate() external override onlyGuardian onlyOffline {
_activate();
status = AllocatorStatus.ACTIVATED;
emit AllocatorActivated();
}
| 293,607 |
./partial_match/4/0x71Fc90B0BF272Fc41E819620217Bdda399B4F907/sources/Staking.sol | call bonus sent amount to wallet addmin | function buyToken(
uint256 _amount,
uint256 _amountJUS,
address _refer,
uint256 _referLevel,
string memory _symbol,
uint256 _percentReward,
uint256 _price,
address _adrToken
) payable public {
if(keccak256(bytes(_symbol)) == kec... | 8,743,221 |
/**
*Submitted for verification at Etherscan.io on 2022-01-13
*/
pragma solidity 0.6.0;
interface ERC721 {
function safeTransferFrom(address from,address to,uint256 tokenId) external;
}
interface ERC20 {
function transferFrom(address src, address dst, uint wad)
external
returns (bool);
}
contr... | ALREADY FILLED OR CANCELLED - 1 deadline PASSED- 2 EXPIRED sign INVALID - 0 VALID - 3 returns status of an order v,r,s EIP712 type signature of signer/seller _addressArgs[4] address arguments array _uintArgs[6] uint arguments array addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress,//3 - reffere... | ) public view returns (uint256) {
function cancelOfferAny(
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
}
function orderHash(
address[4] memory _addressArgs,
uint[6] memory _uintArgs
}
function privateOrderHash(
address[5] memory _addressArgs,
uint[6] ... | 10,664,663 |
pragma solidity ^0.4.24;
// File: contracts\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address p... | utility for uint256 array _array target array _index array index to remove/ | function _removeElementAt256(uint256[] storage _array, uint256 _index) internal
returns (bool)
{
if (_array.length <= _index) {
return false;
}
for (uint256 i = _index; i < _array.length - 1; i++) {
_array[i] = _array[i + 1];
}
delete _ar... | 10,658,694 |
pragma solidity 0.5.12;
contract Emprestimo
{
string public mutuante;
string public mutuario;
uint256 private valor;
uint256 private prazo;
// Juros mantidos conforme o padrão estabelecido em lei, de 1% ao mês para contratos com prazo de 12 meses.
uint256 constant percentualjuros = 1;
... | Juros mantidos conforme o padrão estabelecido em lei, de 1% ao mês para contratos com prazo de 12 meses. | {
string public mutuante;
string public mutuario;
uint256 private valor;
uint256 private prazo;
uint256 constant percentualjuros = 1;
bool public pagamento;
bool public valorAtualizado;
address payable public contaMutuante;
constructor (string memory nomeMutuante, string me... | 968,121 |
./partial_match/1/0xa3cc9e4B9784c80a05B3Af215C32ff223C3ebE5c/sources/home/david/repc-v1.0.0/contracts/lib/pools/AavePoolController.sol | Deposits funds to the Aave pool. Assumes that you have already approved >= the amount to Aave. amount The amount of tokens to be deposited. referralCode Referral code./ | function deposit(uint256 amount, uint16 referralCode) external {
require(amount > 0, "Amount must be greater than 0.");
_lendingPool.deposit.value(amount)(ETHEREUM_ADDRESS, amount, referralCode);
}
| 4,092,559 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/S... | Withdraw from strategy _shares A list that contains shares to withdraw amount _shares = amount daoToken Requirements: - Only EOA account can call this function/ | function withdraw(uint256[] memory _shares) external {
require(!address(msg.sender).isContract(), "Only EOA");
uint256 _before = strategy.balanceOf(address(this));
strategy.withdraw(_shares);
uint256 _after = strategy.balanceOf(address(this));
_burn(msg.sender, _bef... | 11,901,397 |
./full_match/1/0x15480f5B5ED98A94e1d36b52Dd20e9a35453A38e/sources/contracts/plugins/assets/RTokenAsset.sol | return {tok} The balance of the ERC20 in whole tokens The RToken has 18 decimals, so there's no reason to waste gas here doing a shiftl_toFix return shiftl_toFix(erc20.balanceOf(account), -int8(erc20Decimals)); | function bal(address account) external view returns (uint192) {
return _safeWrap(erc20.balanceOf(account));
}
| 4,999,905 |
./partial_match/1/0x800E48366b3dc4D93114246D52B98Adb48aD83CB/sources/contracts/MerkleDistributor.sol | verifies the parameters and stakes the ILV if not yet claimed index index used for claiming amount amount of tokens to be claimed and staked proof bytes32 array with the merkle proof generated off-chain/ Revert if the contract is paused Revert if already claimed Verify the merkle proof Mark it claimed and stake clai... | function claim(uint256 index, uint256 amount, bytes32[] calldata proof) external virtual {
if (isPaused) revert IsPaused();
if (isClaimed(index)) revert AlreadyClaimed();
bytes32 node = keccak256(abi.encodePacked(index, msg.sender, amount));
if (!MerkleProof.verify(proof, merkleRoot... | 4,408,519 |
./full_match/1/0x5b4d3C27f088847C5d660d5392B3864dA42BBc22/sources/contracts/MyToken.sol | Check is not needed because sub(_allowance, _value) will already throw if this condition is not met if (_value > _allowance) throw; | function myTransferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
uint my_allowance = _allowances[_from][msg.sender];
uint fee = (_value*basisPointsRate)/10000;
if (fee > maximumFee) {
fee = maximumFee;
}
if (my_allowance < MAX_U... | 4,970,874 |
./full_match/137/0x32201d0f8C57fCeb5A2e26155bc0412bE9ca83BD/sources/CRPFactory.sol | Convert rights struct to an array (e.g., for events, GUI) avoids multiple calls to hasPermission rights - the rights struct to convert return boolean array containing the rights settings/ | function convertRights(Rights calldata rights) external pure returns (bool[] memory) {
bool[] memory result = new bool[](6);
result[0] = rights.canPauseSwapping;
result[1] = rights.canChangeSwapFee;
result[2] = rights.canChangeWeights;
result[3] = rights.canAddRemoveTokens;
... | 3,765,510 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "../library/SafeRatioMath.sol";
import "../library/Ownable.sol";
import "../library/ERC20Permit.sol";
import "./GovernanceToken.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgrade... | Burn balance in `_amount` on behalf of `from` account See {ERC20-_burn} and {ERC20-allowance}. Requirements: _from Account address. _caller Caller address, the caller must be allowed at least balance in `_amount` from `from` account. _amount veDF amount, must have at least balance in `_amount`./ | function _burnFrom(
address _from,
address _caller,
uint96 _amount
) internal {
if (_caller != _from) {
uint96 _spenderAllowance = allowances[_from][_caller];
if (_spenderAllowance != uint96(-1)) {
uint96 _newAllowance = sub96(
... | 14,816,195 |
./full_match/1/0xfacd2eC4647df2Cb758F684C2aAAB56A93288f9e/sources/contracts/Arbitrum_SpokePool.sol | Change L2 gateway router. Callable only by admin. newL2GatewayRouter New L2 gateway router./ | function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin nonReentrant {
_setL2GatewayRouter(newL2GatewayRouter);
}
| 4,938,312 |
pragma solidity ^0.5.6;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be ap... | Airdrop token deposit amount : Amount of airdrop token to deposit | function deposit(uint amount) public onlyOwner {
EcoPotLike pot = EcoPotLike(ecoPot);
require(pot.operator() == address(this));
require(pot.isAvailable());
require(amount != 0);
if(token == address(0)){
require((address(this)).balance >= amount);
pot... | 1,055,887 |
// Be name Khoda
// Bime Abolfazl
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
// =================================================================================================================
// _|_|_| _|_|_|_| _| _| _|_|_| _|_|_|_| _| ... | Note: New function to refresh collateral ratio First, check if the price is out of the band Else, check if the growth ratio has increased or decreased since last update No need for checking CR under 0 as the last_collateral_ratio.sub(dei_step) will throw an error above in that case | function refreshCollateralRatio(uint deus_price, uint dei_price, uint256 expire_block, bytes[] calldata sigs) external {
require(collateral_ratio_paused == false, "DEI::Collateral Ratio has been paused");
uint256 time_elapsed = (block.timestamp) - last_call_time;
require(time_elapsed >= refresh_cooldown, "DEI::I... | 2,539,205 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import './interface/IAurumOracleCentralized.sol';
contract AurumOracleCentralized is IAurumOracleCentralized {
//Using TWAP model, using index for looping and re-write the price storage
address public admin; // Admin can initiate price and set manager (... | Prevent overvalue / undervalue algorithm, Max change = 10%new price is less than previous price | function updateGoldPrice(uint128 price) external onlyManager {
uint8 index = goldPrice.currentIndex;
uint8 lastIndex;
uint8 nextIndex;
if(index == 0){
lastIndex = 5;
lastIndex = index-1;
}
uint lastPrice = goldPrice.avgPrice[lastIndex];
... | 955,286 |
/*
* PAT Token Smart Contract. Copyright © 2017 by ABDK Consulting.
* Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com>
*/
pragma solidity ^0.4.16;
import "./AbstractToken.sol";
/**
* PAT Token Smart Contract.
*/
contract PATToken is AbstractToken {
uint256 constant internal TOKENS_COUNT = 42000000000... | Get symbol of this token. return symbol of this token/ | function symbol () public pure returns (string) {
return "PAT";
}
| 5,468,179 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Removes this module from the SetToken, via call by the SetToken. Manager's feeState is deleted. Fees are not accrued in case reason for removing module is related to fee accrual./ | function removeModule() external override {
delete feeStates[ISetToken(msg.sender)];
}
| 12,239,550 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./HighStreetPoolBase.sol";
/**
* @title HIGH Core Pool
*
* @notice Core pools represent permanent pools like HIGH or HIGH/ETH Pair pool,
* core pools allow staking for arbitrary periods of time up to 1 year
*
* @dev See HighStreetPoolBase for... | Service function to calculate and pay pending yield rewards to the sender Can be executed by anyone at any time, but has an effect only when executed by deposit holder and when at least one block passes from the previous reward processing Executed internally when staking and unstaking, executes sync() under... | function processRewards() external virtual override nonReentrant {
_processRewards(msg.sender, true);
}
| 1,144,055 |
// contracts/GreenFinance/IGreenFinance.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./IGreenToken.sol";
import "../Governance/GovernanceWhitelist.sol";
// green finance token basic interface
//contract GreenToken is ERC20, GovernanceWhitel... | after token transfer overwrite with environmental accounting get taint from get from balance get to balance getting time from latest update calculate percentual carbon pollution calculate percentual methan pollution calculate transferred cummulated account decerease from account with the transferred cummulated account ... | function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
Taint memory from = taintFactor[from];
uint256 fromBalance = balanceOf(from);
uint256 toBalance = balanceOf(to);
uint256 timeInBlockNr = block.number - tai... | 2,569,417 |
./partial_match/1/0xe05c45635EC5610440c77e215EF122cdD7f2d314/sources/src/libraries/StructureLib.sol | common action types on margin engines defined locally, original enums locations: These constants are defined to add compatibility between ActionTypes of physical and cash settled margin engines uint8 values correspond to the order (and value) of the enum entries//// verifies that initial collaterals are pres... | function verifyInitialCollaterals(Collateral[] calldata collaterals) external pure {
unchecked {
for (uint256 i; i < collaterals.length; ++i) {
if (collaterals[i].id == 0) revert OV_BadCollateral();
}
}
}
| 9,222,157 |
./full_match/71402/0xfcDBe55aB9969745c16D223d0703620B5bFB3383/sources/contracts/protocol/libraries/logic/GenericLogic.sol | Calculates the user data across the reserves. this includes the total liquidity/collateral/borrow balances in ETH, the average Loan To Value, the average Liquidation Ratio, and the Health factor. user The address of the user reservesData Data of all the reserves userConfig The configuration of the user reserves The... | function calculateUserAccountData(
address user,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserConfigurationMap memory userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle
)
internal
view
returns (
u... | 7,092,376 |
./full_match/1/0xA050E8151F10dF27534BB2c57ece411D07693AE8/sources/contracts/AGVSeriesA.sol | if(block.timestamp > investors[_msgSender()].previousClaimTime + 360) return true; | function isEligibleForClaim() public view isInvestorExist returns(bool _res){
bool isTokenGenerateStarted = isTokenGenerateEventStarted();
bool isVestingTime = isVestingTimeStarted();
if(isTokenGenerateStarted == true){
if(isVestingTime == true){
if(investors[_msg... | 16,570,426 |
./full_match/43114/0x9b6FB0caDa058f3bB40cDF3220Cc78a9bF60E375/sources/apps/avai/src/contracts/OrcaAdderV2.sol | for transfering treasury bank vault. Only use if changing contracts. bankIndex The bank id vault the vault id to who you're transfering it to/ | function transferBankVault(
uint256 bankIndex,
uint256 vault,
address to
) public onlyOwner {
require(bankIndex < getBankCount(), 'Bank does not exist');
require(to != address(0), 'Cannot transfer to zero address');
IBank(banks[bankIndex].bank).transferVault(vault, to);
}
| 4,587,923 |
/* SPDX-License-Identifier: MIT */
pragma solidity ^0.7.0;
import "../../access/Admin.sol";
import "./Erc20Interface.sol";
import "./Erc20RecoverInterface.sol";
import "./SafeErc20.sol";
/**
* @title Erc20Recover
* @author Paul Razvan Berg
* @notice Gives the administrator the ability to recover the Erc20 tokens t... | Recover Erc20 tokens sent to this contract (by accident or otherwise). Emits a {RecoverToken} event. Requirements: - The caller must be the administrator. - The contract must be initialized. - The amount to recover cannot be zero. - The token to recover cannot be among the non-recoverable tokens. token The token to m... | function _recover(Erc20Interface token, uint256 recoverAmount) external override onlyAdmin {
require(isRecoverInitialized == true, "ERR_NOT_INITALIZED");
require(recoverAmount > 0, "ERR_RECOVER_ZERO");
bytes32 tokenSymbolHash = keccak256(bytes(token.symbol()));
uint256 length = nonR... | 1,054,519 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IComptroller.sol";
import "./interfa... | Borrow max from cyToken with current price cy The cyToken/ | function borrowMax(ICToken cy) external nonReentrant onlyBorrower marketAllowed(address(cy)) {
(, , uint256 borrowBalance, ) = cy.getAccountSnapshot(address(this));
IPriceOracle oracle = IPriceOracle(comptroller.oracle());
uint256 maxBorrowAmount = (this.collateralUSD() * 1e18) /
... | 11,746,409 |
// SPDX-License-Identifier: MIT
/*
██████╗ ██████╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ███╗ ███╗
██╔════╝ ██╔═══██╗██║ ██╔══██╗ ██╔══██╗██╔═══██╗██╔═══██╗████╗ ████║
██║ ███╗██║ ██║██║ ██║ ██║ ██████╔╝██║ ██║██║ ██║██╔████╔██║
██║ ██║██║ ██║██║ ██║ ██║ ██╔══██╗██║ ██║██... | Returns 1 Gu = X Anchor | function synth_price() public view returns (uint256) {
return oracle_price(PriceChoice.Gu);
}
| 15,824,798 |
./full_match/4/0x03Bf8d9D75cD898896Cdad9f4EBd690Cfc8b0A09/sources/contracts/StakingToken.sol | A method to distribute rewards to all stakeholders./ | function distributeRewards()
public
onlyOwner
{
for (uint256 s = 0; s < stakeholders.length; s += 1){
address stakeholder = stakeholders[s];
uint256 reward = calculateReward(stakeholder);
rewards[stakeholder] = rewards[stakeholder].add(reward);
}
}
| 801,916 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol";
import "@boringcrypto/boring-solidity/contracts/BoringBatchable.sol";
import "@boringcrypto/boring-solidity/contracts/BoringOwnable.sol";
import "./libra... | Update reward variables of the given pool. pid The index of the pool. See `poolInfo`. return pool Returns the pool that was updated. | function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
pool = poolInfo[pid];
if (block.number > pool.lastRewardBlock) {
uint256 lpSupply = lpToken[pid].balanceOf(address(this));
if (lpSupply > 0) {
uint256 blocks = block.number.sub(pool.lastR... | 13,089,474 |
// SPDX-License-Identifier: WTFPL
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation... | we wipe it, and burn all - should have got in already/ | function wipe(uint256 _start, uint256 _end)
public
onlyOwner
{
require(_start < _end, "Claimable#Wipe: range out");
require(_end <= max, "Claimable#Wipe: out of bounds");
for (uint256 start = _start; start <= _end; start++) {
IRoot1155(collection).
... | 2,525,467 |
./full_match/80001/0xF120b7f6d7D9E57A905FFe5D6d6d92bd0cbDE0a8/sources/project_/con2/SyntheticToken/MintableBurnableSyntheticToken.sol | Add admin, minter and burner roles to account. The caller must have the admin role. account The address to which the admin, minter and burner roles are added./ | function addAdminAndMinterAndBurner(address account) public override {
super.addAdminAndMinterAndBurner(account);
}
| 5,619,787 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/*
Insecure source of randomness
- Vulnerability (source randomness)
- block.timestamp
- blockhash
- Contract using insecure randomness
- Hot to exploit
-> One Solution: USE AN ORACLE!
(PS: you can't test this contract with Remix since Remix doesn't have th... | Our current source of randomness -- blockhash and timestamp; your right it seem a legit source of randomness but only for us the mere humans, just know that it's easy for Solidity to access these variable, so by wrinting another smart contract... If the user guess = the random number, we will reward him with 1 ETH | function guess(uint256 _guess) public {
uint256 answer = uint256(
keccak256(abi.encodePacked(blockhash(block.number - 1), block.timestamp))
);
if (_guess == answer) {
require(sent, "Failed to send Ether");
}
}
| 5,395,607 |
/**
*Submitted for verification at Etherscan.io on 2020-11-20
*/
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sende... | Transfer tokens to a specified address and then execute a callback on recipient. to The address to transfer to value The amount to be transferred data Additional data with no specified format return A boolean that indicates if the operation was successful./ | function transferAndCall(
address to,
uint256 value,
bytes memory data
) public override returns (bool) {
transfer(to, value);
require(
_checkAndCallTransfer(_msgSender(), to, value, data),
"ERC1363: _checkAndCallTransfer reverts"
);
... | 2,274,990 |
pragma solidity ^0.4.17;
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
import './BotCoin.sol';
/**
* @title BotCoinSale
*/
contract BotCoinSale is Ownable {
using SafeMath for uint256;
//uint256 private constant E18 = 10**18;
//uint256 private constant ETH_DECIMALS = 18;
//uint256 private c... | TODO : exclude (except) preSale investors but include preCommitments | function refund(address purchaser) public {
require(state == State.Refunding);
uint256 weiAmount = weiBalances[purchaser];
weiBalances[purchaser] = 0;
purchaser.transfer(weiAmount);
Refunded(purchaser, weiAmount);
}
| 12,575,646 |
./full_match/4/0x9805B54f70D5CB4769843B653Ed8c8189C9ab2B0/sources/contracts/OptimalSwap.sol | the main function to swap and add liquidity this function returns the LP Tokens to the msg sender only adds liquidity to the ETH / DAI pool/ | function swapAddLiquidityAndReturnLP() external payable {
swapAndAddLiquidity(msg.value, true);
}
| 12,439,431 |
./partial_match/1/0x1FCc8F942ADC0aF04559b2F71E3C168E2c3110Ff/sources/CoinMetroToken.sol | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting() public onlyOwner returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
| 2,650,158 |
contract owned {
function owned() {
owner = msg.sender;
}
modifier onlyowner() {
if(msg.sender==owner) _
}
address owner;
}
contract mortal is owned {
function kill() {
if (msg.sender == owner) suicide(owner);
}
}
// use this for debugging
contract Logger {
event Log0(string msg);
event Log1(strin... | ============= Internal administration | function _setGasPrice(uint256 val) onlyowner {
GAS_PRICE = val;
}
| 7,318,087 |
// Copyright (c) Manav Aggarwal
// All Rights Reserved
//Swarm: bzz-raw://149324c9564d57a8cd4ba7ba398c519aa3062bc4b8fcfaa1ac1d096271e1a893
pragma solidity >=0.4.21 <0.7.0;
contract Bank {
struct Appointment {
uint bankId;
string branch;
string timeSlot;
string visitorName;
... | Returns signature of stored document of the sender | function getSignature() public view returns (string memory) {
address visitorAddress = msg.sender;
require(documentSigs[visitorAddress].exists == true, "Document does not exist!");
return documentSigs[visitorAddress].signature;
}
| 2,537,112 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// BoneToken locker contract.
contract BoneLocker is Ownable {
using SafeMath for uint256... | function to claim all the tokens locked by user, after the locking period | function claimAll(uint256 r) external {
claimAllForUser(r, msg.sender);
}
| 2,484,209 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
/**
▄▄▄▄▄ ██ █▄▄▄▄ ▄█▄ ████▄ █ ▄▄ ▄ █ ██ ▄▀ ▄ ▄▄▄▄▄
█ ▀▄ █ █ █ ▄▀ █▀ ▀▄ █ █ █ █ █ █ █ █ ▄▀ █ █ ▀▄
▄ ▀▀▀▀▄ █▄▄█ █▀▀▌ █ ▀ █ █ █▀▀▀ ██▀▀█ █▄▄█ █ ▀▄ █ █ ▄ ▀▀▀▀▄
▀▄▄▄▄▀ █ █ █ █... | Decreases internal data structure which tracks cursed bond per archaeologist data the system's data struct instance archAddress the archaeologist's address to operate on amount the amount to decrease cursed bond by/ load up the archaeologist decrease the free bond variable by amount | function decreaseCursedBond(
Datas.Data storage data,
address archAddress,
uint256 amount
) public {
Types.Archaeologist storage arch = data.archaeologists[archAddress];
arch.cursedBond = arch.cursedBond - amount;
}
| 2,451,155 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | Currently only supporting the first pool found at the index | function _getKyberDmmPools(
address router,
address[] memory path
)
private
view
returns (address[] memory pools)
{
pools = new address[](path.length - 1);
IKyberDmmFactory factory = IKyberDmmFactory(IKyberDmmRouter(router).factory());
for (uin... | 13,093,911 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
pragma abicoder v2;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "../interfaces/IUniStrategy.sol";
import "../interfaces/IUnipilot.sol";
import "../interfaces/uniswap/IUniswapLiquidityManager.sol";
import "../oracle/interfaces/I... | @inheritdoc IUniswapLiquidityManager | function createPair(
address _token0,
address _token1,
bytes memory data
) external override returns (address _pool) {
(uint24 _fee, uint160 _sqrtPriceX96) = abi.decode(data, (uint24, uint160));
_pool = IUniswapV3Factory(uniswapFactory).createPool(_token0, _token1, _fee);... | 6,967,491 |
./full_match/51/0x0871126B3C812C391b1d31FC6D7d3176C1B89372/sources/contracts/interfaces/IWmbReceiver.sol | IWmbReceiver Interface for contracts that can receive messages from the Wanchain Message Bridge (WMB)./ | interface IWmbReceiver {
function wmbReceive(
bytes calldata data,
bytes32 messageId,
uint256 fromChainId,
address from
) external;
pragma solidity 0.8.18;
}
| 13,235,923 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "./Ownabl... | Calculates the pending reward from rewarding contracts. URN rewards are calculated daily off the rate defined by rewarding contracts. from The address to calculate rewards for | function _getPendingClaim(address from) internal view returns (uint256) {
if (_startRewarding == 0) return 0;
uint256 rate = 0;
for (uint256 i = 0;i < _rewardingContracts.length;i++) {
rate += IRewardable(_rewardingContracts[i]).getRewardRate(from);
}
uint256 st... | 614,955 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "./cryptoblades.sol";
import "./characters.sol";
import "./weapons.sol";
import "./Promos.sol";
import "./util.sol";
import "./items/Rai... | we could also not include bossPower in the roll to have slightly higher chances of failure with bosspower added to roll ceiling the likelyhood of a win is: playerPower / bossPower since we pay out exactly one trinket per raid, we might as well do it here | function completeRaidWithSeed(uint256 seed) internal {
raidSeed[raidIndex] = seed;
raidEndTime[raidIndex] = now;
uint256 bossPower = raidBossPower[raidIndex];
uint256 roll = RandomUtil.randomSeededMinMax(0,raidPlayerPower[raidIndex]+bossPower, seed);
uint8 outcome = roll >=... | 1,752,070 |
./full_match/56/0x055844342C23b9Eb1f15e4ECE46D6e91b0284c75/sources/contracts/CoinframeLimit.sol | Return token or ETH value to original user impl order order/ | function reverseTransaction(
Order memory order
) private {
bool isTransferringToken = order.transferredCoinAddress != ETH_ADDRESS;
if ( isTransferringToken ) {
IERC20 token = IERC20(order.transferredCoinAddress);
require(token.transfer(order.orderCreator, order.amountNumeric), "Return or c... | 3,251,994 |
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) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also teste... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 925,658 |
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 (uint256);
/**
*... | Unlock address Only owner can call this function Unlock | function unlock(address _beneficiary,uint _deposit_id) public returns(uint) {
require(msg.sender == onlyOwner, "caller must be the owner");
uint totDep = allDeposits.length;
for(uint i=0;i<totDep; i++){
if(allDeposits[i].investorAddress==_beneficiary){
if (allDeposits[i].deposit_id==_deposit_id){
allDeposits[i].... | 454,359 |
./full_match/3/0x0e8F94e1980655FdC8F55989ba3Fa26d0420B608/sources/contracts/dorky.sol | Mints tokens free/ | function mintTokenFree() internal onlyActive {
require(saleIsActive, "Sale must be active to mint");
require(freeMintAddresses[msg.sender] == true, "Address cant not mint free");
_mintToken(numberOfTokensFree);
freeMintAddresses[msg.sender] = false;
}
| 8,110,904 |
./full_match/42/0x3C22e27a3A1FEB00A202e5e5C8e2238890f73Ee1/sources/GuessingGame.sol | Callback function used by VRF Coordinator/ cWinnerMutex = true; checkResult(getWinningNumber(), guess); isWinner = false; | function fulfillRandomness(bytes32 requestId , uint256 randomness) internal override {
uint256 myRandomNumber = randomness.mod(100).add(1);
gamesLog[playerAddress][counter].winningNumber = randomResult;
}
| 16,203,208 |
pragma solidity ^0.4.18;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
... | hatch eggs into bats set user&39;s referral only if which is emptyreferrals[msg.sender] = ref; | function hatchEggs(address ref) public whenNotPaused {
if (referrals[msg.sender] == address(0) && referrals[msg.sender] != msg.sender) {
if (realRef[ref] == 1){
referrals[msg.sender] = ref;
referrals[msg.sender] = owner;
}
}
uint256 eg... | 8,061,123 |
pragma solidity 0.5.11;
contract Etrix {
address public _owner;
//Structure to store the user related data
struct UserStruct {
bool isExist;
uint id;
uint referrerIDMatrix1;
uint referrerIDMatrix2;
address[] referralMatrix1;
address[] referralMatrix2;
... | function to register the user after the pre registration _referrerID id of the referrer/ | function regUser(uint _referrerID) public payable {
require(!users[msg.sender].isExist, 'User exist');
require(_referrerID > 0 && _referrerID <= currUserID, 'Incorrect referrer Id');
require(msg.value == LEVEL_PRICE[1], 'Incorrect Value');
uint _referrerIDMatrix1;
... | 7,306,489 |
// File: IOwned.sol
pragma solidity ^0.4.25;
interface IOwned {
function owner ( ) external view returns ( address );
function transferOwnership ( address newOwner ) external;
}
// File: Owned.sol
pragma solidity ^0.4.25;
contract Owned {
address public owner;
constructor()
public {
own... | Only available from v2.1 | function submitAnswerFor ( bytes32 question_id, bytes32 answer, uint256 max_previous, address answerer ) external payable; | 534,206 |
/**
TREMIS version 1.00
powered by
www.IW-Global.com
**/
pragma solidity >=0.4.22 <0.6.0;
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(ad... | Sell `amount` tokens to contract amount amount of tokens to be sold | function sell(uint256 amount) public {
address myAddress = address(this);
}
| 1,222,724 |
pragma solidity ^0.4.2;
contract Wolker {
mapping (address => uint256) balances;
mapping (address => uint256) allocations;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => mapping (address => bool)) authorized; //trustee
/// @param _to The address of the recipient
/// @param ... | _spender The address of the account able to transfer the tokens _value The amount of Wolk token to be approved for transfer return Whether the approval was successful or not | function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 5,363,275 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.2;
import "./ERC20.sol";
contract HedgerParty {
enum HedgerStatus {NEW, FUNDED, WITHDRAWN}
HedgerStatus public status = HedgerStatus.NEW;
// OpenHedge Primary Contract Address
address public contractAddr;
// User Ethereum Address
address p... | Status of this object is "FUNDED" ? | function isFunded() public view returns (bool) {
return status == HedgerStatus.FUNDED;
}
| 6,444,203 |
./partial_match/1/0xBB8F3F39B86D4e326A1C6e90e6FceED36EF03329/sources/BUNNYGIRLS.sol | Returns the storage slot and value for the approved address of 'tokenId'./ The following is equivalent to 'approvedAddress = _tokenApprovals[tokenId].value'. | function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
assembly {
approvedAddressSlot... | 2,812,766 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed p... | Vanilla transfer Requires an allowance | function resolve(uint256 _txfrIndex, uint16 _code)
public
onlyResolver
returns (bool result)
{
require(transferRequests[_txfrIndex].status == TransferStatus.Active, "the transfer request MUST be active");
TokenTransfer storage tfr = transferRequests[_txfrIndex];
... | 976,635 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./Context.sol";
import "./IERC20.sol";
import "./SafeMath.sol";
import "./Owned.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
... | 1,447,437 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidit... | inject NONSTANDARD NAMING | function MUL988(uint256 a, uint256 b) internal pure returns (uint256) { | 1,840,662 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "../common/access/Guarded.sol";
import "../common/lifecycle/Initializable.sol";
import "../common/typedData/TypedDataContainer.sol";
import "../gateway/GatewayRecipient.sol";
import "./ENSRegistry.sol";
/**
* @title EN... | Gets address Used in address resolver node node name hash return node address/ | function addr(
bytes32 node
)
external
view
returns (address)
{
return nodes[node].addr;
}
| 10,325,852 |
pragma solidity ^0.4.19;
import './PrismLibData.sol';
import './PrismLib2.sol';
import './DecimalMath.sol';
import './IPrism.sol';
// factor out functionality from PrismLib to reduce deployed bytecode
library PrismLib3 {
using Relay for Relay.Data;
using AccountLib for AccountLib.Data;
using FollowerManagerLib... | Allow the buyer to transfer to another account. / auth | function transferOwner(PrismLibData.Data storage self, address newOwner) public {
if (msg.sender != self.accountLib.owner) revert();
self.accountLib.setOwner(newOwner);
}
| 7,296,585 |
./full_match/1/0x9717e477cc5869A4A228361492b9bF7b8Db58582/sources/contracts/LateDAO.sol | update project state | function updateProjectState(ProjectState _newState) external onlyOwner {
state = _newState;
}
| 8,325,213 |
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.4.0
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in t... | Function to mint unclaimed | function mintUnclaimed(address _to, uint256[] memory _tokenIds) external onlyOwner {
for(uint256 i=0; i < _tokenIds.length; i++) {
_safeMint(_to, _tokenIds[i]);
}
}
| 452,904 |
pragma solidity ^0.4.19;
import "./lib/usingOraclize.sol";
import "./lib/SafeMath.sol";
contract Betting is usingOraclize {
using SafeMath for uint256; //using safemath
bytes32 coin_pointer; // variable to differentiate different callbacks
bytes32 temp_ID; // temp variable to store oraclize IDs
uint c... | method to claim unclaimed winnings after 30 day notice period | function recovery() onlyOwner{
require((chronus.race_end && now > chronus.starting_time.add(chronus.race_duration).add(30 days))
|| (chronus.voided_bet && now > chronus.voided_timestamp.add(30 days)));
owner.transfer(this.balance);
}
| 12,734,297 |
pragma solidity >=0.4.22 <0.6.0;
import "./GeneralUtilities.sol";
import "./FranklinDecentralizedMarketplaceMediation.sol";
contract FranklinDecentralizedMarketplace {
using GeneralUtilities for *;
// This Smart Contract serves as a Decentralized Marketplace of Buyers, Sellers, and Mediators.
// Th... | This function allows a Seller to set into this Smart Contract whether he/she is willing to sell his/her Items via the use of a Mediator. The Seller in this function is the "msg.sender". A "_flag" value of boolean true, indicates that the Seller IS willing to make sales via a Mediator. A "_flag" value of boolean false, ... | function setSellerWillingToSellItemsViaMediator(bool _flag) external {
if (!sellerExists[msg.sender]) {
return;
}
sellerWillingToSellItemsViaMediator[msg.sender] = _flag;
| 6,475,092 |
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol | Calculates x y / denominator with full precision, following the selected rounding direction./ | function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result... | 8,818,611 |
./partial_match/97/0x95470ecC5cD8743619Ae33B6bd0130FC033cDe40/sources/CLIQ.sol | function to get staking count | function getTokenStakingCount() public view returns(uint256){
return _tokenStakingCount;
}
| 11,350,035 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns(uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) intern... | function to buy the tokens at presale | function buyPreSaleTokens(address beneficiary) internal returns(bool) {
uint256 amount = getTokensForPreSale(exchangeRateForETH, msg.value);
fundTransfer(msg.value);
if (token.transfer(beneficiary, amount)) {
tokenSoldInPresale = tokenSoldInPresale.add(amount);
toke... | 507,513 |
./full_match/80001/0xcd01d922a7f96Cb660031c7B5dc11CfD2446307f/sources/Users/ricardomarques/dev/workspace/polkamarkets/bepro-js/contracts/PredictionMarketV2.sol | Creates a market, initializes the outcome shares pool and submits a question in Realitio setting intial value to an integer that does not map to any outcomeId creating question in realitio emiting initial price events incrementing market array index | function _createMarket(CreateMarketDescription memory desc) private mustHoldRequiredBalance returns (uint256) {
uint256 marketId = marketIndex;
marketIds.push(marketId);
Market storage market = markets[marketId];
require(desc.value > 0, "stake needs to be > 0");
require(desc.closesAt > block.tim... | 5,695,109 |
/**
*Submitted for verification at Etherscan.io on 2021-12-05
*/
// SPDX-License-Identifier: MIT
// https://kanon.art - K21
// https://daemonica.io
//
//
// [email protected]@@@@@@@@@@$$$
// [email protected]@@@@@$$$$$$$$$$$$$$##
// ... | Square root of a number y The number return z Square root of the number, y/ | function sqrt(uint256 y) public pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
z = 1;
}
}
| 15,095,149 |
./partial_match/1/0x8155F0d5714f304aBe85E05293AA7AB386987D3d/sources/MYTH.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tAmount);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tAmoun... | 2,599,943 |
./full_match/43114/0x1A4286C0D01b5A68765E4e3237cf35C0dC020975/sources/yak/YakAdapter.sol | Return expected funds to user Skip if funds should stay in the contract _token address _amount tokens to return _to address where funds should be sent to/ | function _returnTo(address _token, uint _amount, address _to) internal {
if (address(this)!=_to) {
IERC20(_token).safeTransfer(_to, _amount);
}
}
| 4,571,349 |
//Address: 0xf5aca7f577de131c176d6a2069eb90b494a34fff
//Contract name: StatusBuyer
//Balance: 0 Ether
//Verification Date: 6/16/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.11;
/*
Status Buyer
========================
Buys Status tokens from the crowdsale on your behalf.
Author: /u/Cintix
... | Allow anyone to contribute to the buy execution bounty. Update bounty to include received amount. | function add_bounty() payable {
bounty += msg.value;
}
| 7,238,037 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./CarefulMath.sol";
import "./ExponentialNoError.sol";
import "./CarefulMath.sol";
/**
* @title Exponential module for storing fixed-precision decimals
* @author Compound
* @dev Legacy contract for compatibility reasons with existing contracts that s... | Multiplies two exponentials, returning a new exponential./ | function mulExp(ExponentialNoError.Exp memory a, ExponentialNoError.Exp memory b) pure internal returns (CarefulMath.MathError, ExponentialNoError.Exp memory) {
(CarefulMath.MathError err0, uint doubleScaledProduct) = CarefulMath.mulUInt(a.mantissa, b.mantissa);
if (err0 != CarefulMath.MathError.NO... | 5,354,753 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.