file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x7a4325cff79c28356A467b81b266C29F24fd1756/sources/LoanClosingsWithGasToken.sol | settle loan origination fee | function _payBorrowingFee(
address user,
bytes32 loanId,
address feeToken,
uint256 borrowingFee)
internal
{
if (borrowingFee != 0) {
borrowingFeeTokensHeld[feeToken] = borrowingFeeTokensHeld[feeToken]
.add(borrowingFee);
em... | 3,735,731 |
pragma solidity 0.4.24;
/**
*
* This contract is used to set admin to the contract which has some additional features such as minting , burning etc
*
*/
contract Owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifi... | This function is used to do bulk transfer token to contributor after successful audit | function batchTransferToken(address[] wallets) public onlyOwner {
for (uint256 i = 0; i < wallets.length; i++) {
uint256 amountOfTokens = tokensAllocated[wallets[i]];
require(amountOfTokens > 0);
tokensAllocated[wallets[i]]=0;
token.transfer(wallets[i], amountOfTokens);
emit TokensTran... | 882,343 |
pragma solidity 0.4.26;
import "./ETOTimedStateMachine.sol";
import "./ETOTerms.sol";
import "./ETOTermsConstraints.sol";
import "../Universe.sol";
import "../Company/IEquityToken.sol";
import "../ICBM/LockedAccount.sol";
import "../AccessControl/AccessControlled.sol";
import "../Agreement.sol";
import "../Math.sol";
... | does nothing - all hapens in state transition | function payout()
external
withStateTransition()
onlyState(ETOState.Payout)
{
}
| 12,712,345 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Nomad Contracts ============
import {BridgeMessage} from "./BridgeMessage.sol";
import {XAppConnectionClient} from "../XAppConnectionClient.sol";
import {Encoding} from "./Encoding.sol";
import {TypeCasts} from "@nomad-xyz/nomad-co... | Retrieves the EVM Recipient from a Transfer _transferAction The message return The EVM Recipient/ before = 1 byte identifier + 12 bytes empty to trim for address = 13 bytes | function evmRecipient(bytes29 _transferAction)
internal
pure
returns (address)
{
return _transferAction.indexAddress(13);
}
| 12,224,997 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./BondingCurveFunds.sol";
/**
* @title Proof of Concept contract for the Khana framework
* @author David Truong <david@truong.vc>
* @dev This is a min... | Check if a user is an admin. _account The address of the user to check. return A bool indicating if the specified account is an admin./ | function checkIfAdmin(address _account) public view returns (bool) {
return adminAccounts[_account];
}
| 2,498,882 |
pragma solidity ^0.4.18;
// File: zeppelin-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 public owner;
... | Utility function for calculate available tokens and cost ethers all conditions has checked in the caller functions | function costAndBuyTokens(uint availableToken, uint value) constant internal returns (uint costValue, uint getTokens) {
getTokens = exchangeRate * value;
if (availableToken >= getTokens) {
costValue = value;
costValue = availableToken / exchangeRate;
getTokens = ... | 10,531,864 |
pragma solidity ^0.4.24;
import "./PartMarketBase.sol";
import "./PartOwnership.sol";
import "./Util/SafeMath.sol";
// 부품 마켓
contract PartMarket is PartMarketBase, PartOwnership {
using SafeMath for uint256;
event StartPartSale(uint256 indexed partId, uint256 price);
event ChangePartSaleId(uint256 indexed o... | 부품 판매를 취소합니다. saleId를 찾습니다. 판매 정보 삭제 | function cancelPartSale(uint256 partId) whenPartMarketRunning whenNotBlockedPart(partId) public {
bool isFound = false;
uint256 saleId;
for (uint256 i = 0; i < partSales.length; i += 1) {
if (partSales[i].partId == partId) {
saleId = i;
isFound = true;
}
}
for (i = saleId; ... | 7,296,258 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | function fund () public payable {
}
| 2,511,953 |
// SPDX-License-Identifier: MIT
pragma solidity = 0.7.6;
pragma abicoder v2;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mu... | return Array of structure | function allItems() public view returns (AuctionItem[] memory){
AuctionItem[] memory items = new AuctionItem[](1);
for (uint i = 0; i < totalItems; i++) {
AuctionItem storage item = itemsForSale[i];
items[i] = item;
}
return items;
}
| 14,551,322 |
pragma solidity ^0.5.0;
/// @title Provides helper functions to determine the validity of passed signatures.
/// @author Noah Zinsmeister
/// @dev Supports both prefixed and un-prefixed signatures.
contract SignatureVerifier {
/// @notice Determines whether the passed signature of `messageHash` was made by the pri... | Checks prefixed signatures. | function _isSignedPrefixed(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s)
internal pure returns (bool)
{
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
return _isSigned(_address, keccak256(abi.encodePacked(prefix, messageHash)), v, r, s);
}
| 5,497,654 |
/*
* Crypto stamp Bridge: Bridged ERC-721 Token
* Prototype contract for all ERC-721 tokens deployed by bridging an original
* ERC-721 token from the other side of the bridge
*
* Developed by Capacity Blockchain Solutions GmbH <capacity.at>
* for Österreichische Post AG <post.at>
*
* Any usage of or interaction... | Outward-facing function for operator-driven signed transfer: assembles the expected data and then calls the internal function to do the rest. Can transfer to any target, but only be called by the trusted operator contained in the signature. The signed data contains the operator, the token ID, and a nonce. Note that we ... | function signedTransferWithOperator(uint256 _tokenId, address _to, bytes memory _signature)
public override
requireTransferEnabled
{
address currentOwner = ownerOf(_tokenId);
bytes32 data = keccak256(abi.encodePacked(address(this), this.signedTransferWithOperator.selector, msg.sender, cu... | 14,685,637 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interfaces/IERC20Minimal.sol";
import "./libraries/TransferHelper.sol";
import "./interfaces/IVault.sol";
import "./interfaces/IVaultManager.sol";
import "./interfaces/IERC721Minimal.sol";
import "./interfaces/IV1.sol";
import "./interfaces/IWET... | check the pair if it exists Distribute collaterals burn vault nft self destruct the contract, send remaining balance if collateral is native currency | function liquidate() external override {
require(
!IVaultManager(manager).isValidCDP(
collateral,
debt,
IERC20Minimal(collateral).balanceOf(address(this)),
IERC20Minimal(debt).balanceOf(address(this))
),
"Vault: Position is still safe"
);
address pair = IU... | 15,811,355 |
./full_match/84531/0xbb539f4827211e873868Eb4083e6dBf18c0c68c3/sources/libraries/SafeswapLibrary.sol | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'SafeswapLibrary: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'SafeswapLibrary: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
}
... | 11,508,999 |
./partial_match/56/0xd88ca08d8eec1E9E09562213Ae83A7853ebB5d28/sources/XWINToken.sol | Return `true` if the account belongs to the user role. | function isMintUser(address account)
public virtual view returns (bool)
{
return hasRole(MINT_ROLE, account);
}
| 11,332,741 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./SafeMath.sol";
import "./IERC20.sol";
import "./MagicLampERC721.sol";
interface SuperMagic {
function compose(address owner) external returns (bool);
function bet(address owner) external returns (bool);
}
/**
* @title MagicLamps NFT contract... | Finalize starting index/ Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) Prevent default sequence | function finalizeStartingIndex() public virtual {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint(blockhash(startingIndexBlock)) % MAX_MAGICLAMP_SUPPLY;
if (block.number.sub(star... | 6,846,899 |
./full_match/1313161554/0x98d45f7D4FcF992cb62fb439A889320400186AE0/sources/contracts/LiquidityPool.sol | The fee is splited in two: first, for the Liquidity Providers, and second, for Meta Pool, granted for TREASURY_ROLE. CONSIDER FORMULA: _discountedAmount + _collectedFee + _lpFeeCut == _amount return _discountedAmount stAUR to be taken from the pool to cover the swap. return _collectedFee stAUR to be granted for TREASU... | function _calculatePoolFees(
uint256 _amount
) private view returns (uint256, uint256, uint256) {
uint256 totalFee = (
_amount * swapFeeBasisPoints
) / ONE_HUNDRED_PERCENT;
uint256 _lpFeeCut = (
totalFee * liqProvFeeCutBasisPoints
) / ONE_HUNDRED_... | 13,235,124 |
./full_match/1/0x500a7eAB8ae0fC36Bf586A8F5149d2885A3b40a3/sources/browser/Pool.sol | Safe tiger transfer function, just in case if rounding error causes pool to not have enough TIGERs. | function safeTigerTransfer(address _to, uint256 _amount) internal {
uint256 tigerBal = tiger.balanceOf(address(this));
if (_amount > tigerBal) {
tiger.transfer(_to, tigerBal);
tiger.transfer(_to, _amount);
}
}
| 9,613,301 |
// SPDX-License-Identifier: MIT
/// @title RaidParty Party Contract
/**
* ___ _ _ ___ _
* | _ \__ _(_)__| | _ \__ _ _ _| |_ _ _
* | / _` | / _` | _/ _` | '_| _| || |
* |_|_\__,_|_\__,_|_| \__,_|_| \__|\_, |
* |__/
*/
pragma solidity ^0.8.0;
import... | Compute a damage update given an array of components | function _updateDamage(
address user,
Damage.DamageComponent[] memory prev,
Damage.DamageComponent[] memory curr
) internal {
_damage[user] = _damage[user].getDamageUpdate(prev, curr);
uint32 dmg = uint32(_getDamage(user));
_raid.updateDamage(user, dmg);
... | 237,804 |
./full_match/80001/0x2971Fa1aFdF653e85c824efb092F162eC52eF9A8/sources/79cf8c59f1fbf6e6a0327920c9a9c49a/Parametric-Crop-Insurance.sol | Create a new Influencer Agreement. Once it's created, all logic & flow is handled from within the InfluencerAgreement Contract/ Convert Brand's payment into eth(wei) uint256 ethPayPerView = convertFiatToEth(_payPerView, _brandCurrency); uint256 ethBudget = convertFiatToEth(_budget, _brandCurrency);require brand must be... | function newInfluencerAgreement(address payable _brand, address payable _influencer, uint256 _endDateTime, uint256 _payPerView, uint256 _budget) public payable returns(address) {
require(_brand != _influencer, 'Brand & Influencer/content creator must be different');
require(_budget... | 5,612,877 |
pragma solidity ^0.4.18;
/* ==================================================================== */
/* Copyright (c) 2018 The Priate Conquest Project. All rights reserved.
/*
/* https://www.pirateconquest.com One of the world's slg games of blockchain
/*
/* authors rainy@livestar.com/Jonny.Fu@livestar.com
/... | ERC-721 Non-Fungible Token Standard, optional metadata extension See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md Note: the ERC-165 identifier for this interface is 0x5b5e139f | interface ERC721Metadata /* is ERC721 */ {
function name() external view returns (string _name);
function symbol() external view returns (string _symbol);
function tokenURI(uint256 _tokenId) external view returns (string);
}
| 1,032,218 |
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either... | inject NONSTANDARD NAMING | function BASE98() external view returns (address); | 12,918,537 |
./full_match/5/0x7A0849F28f0113B7dfDEABE5b894032d37945340/sources/contracts/CrowdFunding.sol | Create new Campaign functioncheck to verify campaign structure requirements | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
requ... | 1,849,447 |
./full_match/80001/0xFeE3EeDf3CD8F841df64A9E789DD3AF88c16Fc63/sources/contracts/protocol/ForeProtocol.sol | Returns true if Address is ForeOperator ForeOperators: ForeMarkets(as factory), ForeMarket contracts and marketplace | function isForeOperator(address addr) public view returns (bool) {
return (addr != address(0) &&
(addr == address(this) ||
isForeMarket[addr] ||
config.isFactoryWhitelisted(addr) ||
addr == config.marketplace()));
}
| 5,579,554 |
./partial_match/1/0x22C91cDd1E00cD4d7D029f0dB94020Fce3C486e3/sources/TENSFeeApproverPermanent.sol | Will block all buys and liquidity removals This is how a legend dies | function calculateAmountsAfterFee(
address sender,
address recipient,
uint256 amount
) public returns (uint256 transferToAmount, uint256 transferToFeeDistributorAmount, uint256 burnAmt)
{
if(sender == tokenETHPair || recipient == tokenETHPair) {
... | 4,349,994 |
pragma solidity >=0.4.24 <0.6.0;
import "./LeasableCar.sol";
import "./LeaseAgreement.sol";
import "./TimeMachine.sol";
/** @title Lease Agreement Executor
* @author Adnan (adnan214@github)
*/
//
// TODO: Split this up into multiple files. It huge.
// TODO: Move external/physical interaction code
//
contract A... | Initiates the transfer of car posession from driver to owner It does one finalize process run and disables driver's access to the car Triggers AgreementOverDue or AgreementCompleted based on how much is owned/remaining/ run a quick final cycle | function driverReturn()
public
driver_only("Only the driver can do return!")
{
require(agreement_state == LeaseAgreementStates.InProgress,
"Driver cannot return the car until after the agreement is InProgress");
uint time_now = time_machine.time_now();
ui... | 7,295,963 |
pragma solidity ^0.4.0;
contract Recommendation {
address sender;
string ipfs_hash;
address recipient;
constructor() public {
sender = msg.sender;
}
function send_recommendation(string _ipfs_hash, address _recipient) public {
// FIXME: check who is sending the recommendation
... | FIXME: check who is sending the recommendation | function send_recommendation(string _ipfs_hash, address _recipient) public {
ipfs_hash = _ipfs_hash;
recipient = _recipient;
}
| 5,516,369 |
./full_match/1/0x9A1d5103Ef765a3EdE26d5757353DF2Af0dd3856/sources/all_main.sol | need ensure the item is in chain | function DeleteItem(ChainManager storage chainM,
ChainQueue storage chain,
ChainItem storage item)
internal{
if(chain.First == item.My){
PopPutFirst(chainM, chain);
return;
PopPutEnd(chainM, chain);
return;
}
ChainItem storage next ... | 8,351,200 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
contract GameLand is ERC721Holder {
address public testnft;
constructor(address _nftaddress) {
testnft = _nftaddress;
}
struct Nft {
//price represent in... | owner withdraw nft when nft is not borrowing | function withdrawnft(uint256 nft_id) public {
require(!borrow_or_not[nft_id], "The nft alrady been borrowed");
require(msg.sender == nft_owner[nft_id], "Only owner can withdraw NFT");
(bool success, ) = testnft.call(
abi.encodeWithSignature(
"safeTransferFrom(addr... | 7,212,170 |
pragma solidity ^0.5.1;
// v1.0
import "../../lib/lifecycle/Destructible.sol";
import "../../lib/ownership/Upgradable.sol";
import "../database/DatabaseInterface.sol";
import "./RegistryInterface.sol";
contract Registry is Destructible, RegistryInterface, Upgradable {
event NewProvider(
addres... | Clear an endpoint with no bonds | function clearEndpoint(bytes32 endpoint) public {
require(isProviderInitiated(msg.sender), "Error: Provider is not initiated");
uint256 bound = db.getNumber(keccak256(abi.encodePacked('totalBound', msg.sender, endpoint)));
require(bound == 0, "Error: Endpoint must have no bonds");
... | 1,017,010 |
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises a... | The contract never left the first checkpoint Starting from the second checkpoint because the first one is already computed | function _computeRewardRatesWeightedSum(StakeDeposit memory stakeDeposit)
private
view
returns (uint256, uint256)
{
uint256 stakingPeriod = (stakeDeposit.endDate - stakeDeposit.startDate) / 1 days;
uint256 weight;
uint256 rate;
if (stakeDeposit.startCheckpointIndex =... | 252,990 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.7.0;
// pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
contract TokenSure {
address public tokenA;
address public tokenB;
address public Strategy;
address public Margin;
address public outToken; //要收割的代币 sushi,uni等等
//tokenA,token... | 募资者退钱 募资不满以及最后结束时退保证金 | function refund(uint256 _id) external{}
| 12,816,842 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
... | Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./ | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
... | 126,507 |
./partial_match/1/0x3bbd0B701755130f14EbB81c8581e1be55eB6B15/sources/contracts/interfaces/ICallWhitelist.sol | ============= Events ============== ================ View Functions ================ ================ Update Operations ================ | interface ICallWhitelist {
event CallAdded(address operator, address callee, bytes4 selector);
event CallRemoved(address operator, address callee, bytes4 selector);
function isWhitelisted(address callee, bytes4 selector) external view returns (bool);
function isBlacklisted(bytes4 selector) external ... | 15,971,003 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without g... | exclude from paying fees or having max transaction amount | constructor() ERC20("DADDY SATOSHI", "DADDY") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUni... | 548,018 |
pragma solidity ^0.4.18;
import "./Ownable.sol";
/**
* @title Claimable
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
* This allows the new owner to accept the transfer.
*/
contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws... | check if a document has been notarized | function checkDocument(string document) returns (bool) {
var proof = calculateProof(document);
return hasProof(proof);
}
| 13,069,942 |
pragma solidity ^0.5.6;
import '../common/UsingExternalStorage.sol';
import './GroupI.sol';
contract GroupLogic is UsingExternalStorage, GroupI
{
// Constants for hashing storage keys
string constant GROUP_KEY = "COMMUNITY";
string constant MEMBER_KEY = "MEMBER";
string constant INVITATION... | ensure sender is an admin of the group only two roles at this point, admin and moderator if admin is the account to change, then decrement if moderator is the count to change, then increment | function changeMemberRole(
address _sender,
uint256 _groupId,
address _accountToChange,
uint8 _newRole
)
internal
returns (bool)
{
uint256 signerRole = storageContract.getUintValue(
keccak256(
abi.encodePacked(
... | 13,100,598 |
./full_match/1/0xf385BB1b74FEDD5BF572D41131D64B5C7826209C/sources/contracts/Miratashi.sol | Allows the owner to mint from treasury supply./ Once time mint only Remaining supply should more than mint amount | function mintTeamTreasury() external onlyOwner {
require(
isTeamTreasuryMinted == false,
"Miratashi: Team treasury minted."
);
require(
remainingSupply() >= TEAM_TREASURY_SUPPLY,
"Miratashi: Team treasury mint supply limit."
);
... | 16,400,578 |
/**
*Submitted for verification at Etherscan.io on 2022-04-
*/
/**
RETURN TO SPACE v2
SPACE
https://t.me/return_to_space_ETH
THE NEW NETLFIX DOCUMETARY
Return to Space is an upcoming American documentary film made for Netflix.
Its story follows Elon Musk's and SpaceX engineers' two-decade mission to send NASA... | get balance of liquidity pair calculate amount to burn pull tokens from pancakePair liquidity and move to dead address permanently | function manualBurnLiquidityPairTokens(uint256 percent) external onlyOwner returns (bool){
require(block.timestamp > lastManualLpBurnTime + manualBurnFrequency , "Must wait for cooldown to finish");
require(percent <= 1000, "May not nuke more than 10% of tokens in LP");
lastManualLpBurnTime ... | 83,394 |
//Address: 0x2072d16c15978a7050a93b62a315e1caa13c6c27
//Contract name: TaskManager
//Balance: 0.468635899121845162 Ether
//Verification Date: 5/11/2018
//Transacion Count: 26
// CODE STARTS HERE
pragma solidity ^0.4.23;
/******* USING Registry **************************
Gives the inherting contract access to:
... | Populate names and addresses | {
uint _size = size();
_addresses = new address[](_size);
_balances = new uint[](_size);
uint _i = 0;
Entry memory _curEntry = entries[0x0];
function balanceOf(address _address)
public
view
returns (uint _balance)
}
function balances()
... | 1,071,764 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "./ERC20Interface.sol";
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
*/
contract ERC20 is ERC20Interface {
... | Transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender], "Not enough tokens.");
require(_to != address(0));
balances[msg.sender] = balances[msg.sender] - _value;
balances[_to] = balances[_to] + _value;
emit Transfer(msg.s... | 12,986,829 |
./full_match/80001/0x14e39aDc79A7610c685143c4cd891F94dB3B40cD/sources/@aragon/osx/framework/plugin/setup/PluginSetupProcessor.sol | Upgrades a UUPS upgradeable proxy contract (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)). _proxy The address of the proxy. _implementation The address of the implementation contract. _initData The initialization data to be passed to the upgradeable plugin contract via `upgradeToAndCall`. | function _upgradeProxy(
address _proxy,
address _implementation,
bytes memory _initData
) private {
if (_initData.length > 0) {
try
PluginUUPSUpgradeable(_proxy).upgradeToAndCall(_implementation, _initData)
revert(reason);
... | 5,569,410 |
./full_match/44787/0x6b51A45447cFF1F4e373a3F526ae90F5b97a9194/sources/contracts/DefaultStrategy.sol | Set this contract's dependencies in the StakedCelo system. _account The address of the Account contract. _groupHealth The address of the GroupHealth contract. _specificGroupStrategy The address of the SpecificGroupStrategy contract./ | function setDependencies(
address _account,
address _groupHealth,
address _specificGroupStrategy
) external onlyOwner {
require(_account != address(0), "Account null");
require(_groupHealth != address(0), "GroupHealth null");
require(_specificGroupStrategy != addr... | 13,246,518 |
pragma solidity ^0.4.25;
contract DecentralizationSmartGames{
using SafeMath for uint256;
string public constant name = "Decentralization Smart Games";
string public constant symbol = "DSG";
uint8 public constant decimals = 18;
uint256 public constant tokenPrice = 0.00065 ether;
... | buy() - the function of buying DSG tokens. It is active only during the time interval specified in sellTime() Dividends upon Pool Dividends program are being paid Dividends upon the Gaming Dividends program are being paid address referrerAddress - The address of the referrer who invited to the program require - Minimum... | function buy(address referrerAddress) payDividends(msg.sender) sellTime public payable
{
require(msg.value >= 0.1 ether, "Minimum investment is 0.1 ETH");
uint256 forTokensPurchase = msg.value.mul(fee.buy).div(100); /* 65% */
uint256 forDevelopment = msg.value.mul(fee.development).div(10... | 5,399,445 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "./IStateRent.sol";
contract StateRent is IStateRent {
address constant private precompile = address(0x0000000000000000000000000000000000000402);
/**
* @dev Returns the const of NewContractExtraBytes.
*/
function newCo... | Returns the const of DeploymentFee./ | function deploymentFee() public view override returns (uint256) {
(bool success, bytes memory returnData) = precompile.staticcall(abi.encodeWithSignature("deploymentFee()"));
assembly {
if eq(success, 0) {
revert(add(returnData, 0x20), returndatasize())
}
... | 897,473 |
./full_match/97/0x67144C0Fa1100bC57b004b558A98c68a2feF97b3/sources/project_/contracts/diamond/facets/LimitBookFacet.sol | todo: 更新 LibPriceFacade 里的价格 | function executeLimitOrder(KeeperExecution[] memory executeOrders) external override {
LibAccessControlEnumerable.checkRole(Constants.KEEPER_ROLE);
require(executeOrders.length > 0, "LimitBook: Parameters are empty");
LibTrading.checkTradeSwitch(IBook.TradingSwitch.EXECUTE_LIMIT_ORDER);
... | 5,030,995 |
./partial_match/1/0x9d473eB351976bb6ddDeF4d54BC921AD79136C1c/sources/B4se.sol | Notifies Fragments contract about a new rebase cycle. supplyDelta The number of new fragment tokens to add into circulation via expansion. return The total number of fragments after the supply adjustment./ | function rebase(uint256 epoch, int256 supplyDelta)
external
onlyB4sePolicy
returns (uint256)
{
if (supplyDelta == 0) {
emit LogRebase(epoch, _totalSupply);
return _totalSupply;
}
if (supplyDelta < 0) {
_totalSupply = _totalSupp... | 4,248,593 |
./full_match/4/0x6133B3b6d3364E4d1c1f952FCA469687d847F8DE/sources/browser/test.sol | to use anyother token(coin) for payment in-out that must be allowed by superadmin (owner) in other words if that coin address contains > 0 value in ether will be allowed means if validStableCoin[address] > 0 then can be used here network tree information ( user, parent, child-count, ref-count etc) | {
mapping(address => uint256) public validStableCoin;
struct userInfo
{
address payable user;
uint32 parentId;
uint32 referrerId;
uint8 childCount;
uint8 lastBoughtLevel;
uint16 referralCount;
uint128 levelExpiry;
uint32[] childIds;
... | 707,867 |
/**
*Submitted for verification at Etherscan.io on 2022-02-04
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrug... | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
... | 6,308,777 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import {RLPReader} from "./lib/RLPReader.sol";
import {MerklePatriciaProof} from "./lib/MerklePatriciaProof.sol";
import {Merkle} from "./lib/Merkle.sol";
import "./lib/ExitPayloadReader.sol";
/**
* @title C... | return number of payload items inside an encoded list. | function numItems(RLPItem memory item) private pure returns (uint256) {
if (item.len == 0) return 0;
uint256 count = 0;
uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);
uint256 endPtr = item.memPtr + item.len;
while (currPtr < endPtr) {
count++;
}
return count;
}
| 6,199,952 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
/// @title Predicty McPredictionFace
/// @author knnlrts 2020
/// @notice Predicty McPredictionFace is a Solidity smart contract implementation of a prediction market that allows crypto and defi enthousiasts alike to predict the future USD value of ETH on an hour... | Gets the prediction market neutral maximum price value. The neutral maximum price value forms the upper bound of the Neutral betting option. _marketId The id of the prediction market instance on which this function is called. return maxValue Returns the neutral maximum price value of the prediction market./ | function getNeutralMaxValue(uint _marketId) public view returns(uint maxValue) {
Market storage m = markets[_marketId];
return m.neutralMaxValue;
}
| 7,290,445 |
./full_match/1/0xa2c798f6456E4928f1E029C971007A09416A3db0/sources/contracts/Soaps.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(
balanceOf(from) >= amoun... | 17,028,031 |
pragma solidity ^0.4.0;
//Def.ai distributed id and attestation contracts
contract Defid{
address private owner;
address private override;
uint constant ERROR_EVENT = 1;
uint constant WARNING_EVENT = 2;
uint constant SIG_CHANGE_EVENT = 3;
uint constant INFO_EVENT = 4;
uint constant DEBUG_EVENT = ... | Allows only the person who gave the endorsement the ability to remove it./ | function removeEndorsement(bytes32 _attributeHash, bytes32 _endorsementHash) returns(bool) {
var attribute = attributes[_attributeHash];
var endorsement = attribute.endorsements[_endorsementHash];
if (msg.sender == endorsement.endorser) {
delete attribute.endorsements[_endorsemen... | 13,032,834 |
./full_match/1/0x33A8d92B2BE84755441C2b6e39715c4b8938242c/sources/contracts/plugins/assets/FiatCollateral.sol | return {ref/tok} Quantity of whole reference units per whole collateral tokens | function refPerTok() public view virtual returns (uint192) {
return FIX_ONE;
}
| 3,864,786 |
pragma solidity ^0.4.15;
/*
https://cryptogs.io
--Austin Thomas Griffith for ETHDenver
( PS this gas guzzling beast is still unaudited )
*/
//adapted from https://github.com/ethereum/EIPs/issues/721
// thanks to Dieter Shirley && http://axiomzen.co
contract NFT {
function NFT() public { }
mapping (uint2... | tx 2: of a game, player two approves the SlammerTime contract to take their tokensthis triggers an event to broadcast to player one that this player wants to rumblemake sure slammerTime was set at deploythe sender must own the tokenthey approve the slammertime contract to take the token away from themstop playing with ... | function submitCounterStack(bytes32 _stack, uint256 _id, uint256 _id2, uint256 _id3, uint256 _id4, uint256 _id5) public returns (bool) {
require(slammerTime!=address(0));
require(tokenIndexToOwner[_id]==msg.sender);
require(tokenIndexToOwner[_id2]==msg.sender);
require(tokenIndexToOwner[_id3... | 1,127,110 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/Auction.sol | Flips The Manual Auction LowestValidBid Boolean Value/ | function ___FlipManualSwitch() external onlyOwner { AuctionParams.ManualSwitch = !AuctionParams.ManualSwitch; }
| 8,470,751 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/iface/Wallet.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Wallet
/// @dev Base contract for smart wallets.
/// Sub-contracts must NOT use non-default constructor to initialize
///... | Returns the address where a contract will be stored if deployed via {deploy}. Any change in the `bytecode` or `salt` will result in a new destination address./ | function computeAddress(bytes32 salt, bytes memory bytecode) internal view returns (address) {
return computeAddress(salt, bytecode, address(this));
}
| 136,380 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
abstract contract IImpishSpiral is IERC721 {
uint256 public _tokenIdCou... | Function that marks this contract can accept incoming NFT transfers Return this value to accept the NFT | function onERC721Received(
address,
address,
uint256,
bytes calldata
) public pure returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
| 2,484,485 |
/**
The Money Team - $TMT
8 8
ad88888ba 888888888888 88b d88 888888888888
d8" 8 8 "8b 88 888b d888 88
Y8, 8 8 88 88`8b d8'88 88
`Y8a8a8a, 88 88... | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requiremen... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| 5,645 |
./full_match/80001/0x5A8AcB68306CE2dBEE0904897DC88ea763cC34b3/sources/contracts/CoffeeFactory.sol | Create a new coffee contract BuyMeCoffee newCoffeeContract = new BuyMeCoffee(_handle, testAddress); Add the new coffee contract to the mapping Increment the number of coffee contracts Emit the event emit NewCoffeeContract(msg.sender, newCoffeeContract._coffeeIndex, newCoffeeContract._contract, newCoffeeContract._owner)... | function createCoffeeContract(string calldata _handle) public {
BuyMeCoffee newCoffeeContract = new BuyMeCoffee(_handle, msg.sender);
allCoffeeContracts[numCoffeeContracts] = (
CoffeeFactoryStruct(
numCoffeeContracts,
address(newCoffeeContract),
... | 9,481,744 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this ... | 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 != _owner);
_transferOwnership(newOwner);
}
| 12,946,246 |
./full_match/43114/0xD767c58bbF357e9A3287181393004eB33fe95Da5/sources/masterchef.sol | Deposit LP tokens to MasterChef for GIVE allocation. | function deposit(uint256 _pid, uint256 _amount, address _referrer) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (_amount > 0 && address(referral) != address(0) && _referrer != address(0) && _ref... | 4,586,959 |
./partial_match/1/0x8B4953DCCd3EE51DA1E146fd8FecA4C21458238C/sources/AdminBase.sol | Check if an account is admin. account Address to check. return `true` if account is an admin./ | function isAdmin(address account) public view override returns (bool) {
return _isAdmin(account);
}
| 4,338,992 |
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Tests equality of two byte arrays. lhs First byte array to compare. rhs Second byte array to compare. return True if arrays are the same. False otherwise. Get the number of words occupied by <lhs> Add 1 to the number of words, to account for the length field Test equality word-by-word. Terminates early if there is a ... | function areBytesEqual(
bytes memory lhs,
bytes memory rhs
)
internal
pure
returns (bool equal)
{
assembly {
let lenFullWords := div(add(mload(lhs), 0x1F), 0x20)
lenFullWords := add(lenFullWords, 0x1)
let lhsWord := ml... | 5,522,743 |
/**
*Submitted for verification at Etherscan.io on 2021-03-10
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
/**
* This code contains elements of ERC20BurnableUpgradeable.sol https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/token/ERC20/ERC20BurnableUpgradeable.sol
... | Decreases the `_spender` allowance by `_subtractedValue`. _spender The entity whose spending allocation will be reduced. _subtractedValue The reduction of spending allocation in base units./ | function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
uint256 newAllowance = allowance[msg.sender][_spender].sub(_subtractedValue, "ERC20: decreased allowance below zero");
allowance[msg.sender][_spender] = newAllowance;
emit Approval(msg.sender, _spender, newAllow... | 10,765,480 |
./full_match/5/0x402CF8456F05D111ABEe84F4209334Ba37729479/sources/contracts/RoboNounsToken.sol | Lock the seeder. This cannot be reversed and is only callable by the owner when not locked./ | function lockSeeder() external override onlyOwner whenSeederNotLocked {
isSeederLocked = true;
emit SeederLocked();
}
| 1,854,432 |
/**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
// SPDX-License-Identifier: MIT
/* TG: @DarkShadowETH */
/* Weak & docile in the light, powerful & unruly in the dark.
www.darkshadow.info */
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
////// lib/openzeppelin... | exclude from paying fees or having max transaction amount | constructor() ERC20("Dark Shadow", "$DarkShadow") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2P... | 6,638,781 |
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.13 >=0.8.0;
////// src/interfaces/IJob.sol
// Copyright (C) 2021 Dai Foundation
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the G... | Execution is not enough We need to be over the threshold amounts | function work(bytes32 network, bytes calldata args) external override {
if (!sequencer.isMaster(network)) revert NotMaster(network);
bytes32 ilk = abi.decode(args, (bytes32));
(,,, uint256 line,) = vat.ilks(ilk);
uint256 nextLine = autoline.exec(ilk);
(uint256 maxL... | 6,823,324 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../interfaces/CTokenInterface.sol";
import "../interfaces/IFlashloanReceiver.sol";
import "hardhat/console.sol";
contract CTokenMock is ERC20, CTokenInterface {
address private uToken;
addre... | Get a snapshot of the account's balances, and the cached exchange rate This is used by comptroller to more efficiently perform liquidity checks. account Address of the account to snapshot return (possible error, cToken balance, borrow balance, exchange rate mantissa)/ | function getAccountSnapshot(address account)
public
view
override
returns (
uint256,
uint256,
uint256,
uint256
)
{
return (0, balanceOf(account), borrowBalanceStored(account), _exchangeRate);
}
| 6,419,254 |
pragma solidity ^0.4.25;
/*
* CryptoMiningWar - Blockchain-based strategy game
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint... | MainContract used this function to verify game's contract/ | function isContractMiniGame() public pure returns( bool _isContractMiniGame )
{
_isContractMiniGame = true;
}
| 1,029,045 |
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/EIP712.sol | Returns the EIP-712 domain separator. @solidity memory-safe-assembly | function _buildDomainSeparator() private view returns (bytes32 separator) {
bytes32 nameHash = _cachedNameHash;
bytes32 versionHash = _cachedVersionHash;
assembly {
mstore(m, _DOMAIN_TYPEHASH)
mstore(add(m, 0x20), nameHash)
mstore(add(m, 0x40), versionHash... | 3,203,015 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "hardhat/console.sol";
import "../libraries/types/Types.sol";
import "../libraries... | repay partial interest first - if amount is less than the interest repay full interest first - if partial or full installment payment repay full interest + some interest in advance substract nextInstallment.total cuz it might be less than full installment amount calculates how much interest to repay in advance | function repay(uint256 _amount)
external
onlyPond
returns (uint256 _principal, uint256 _interest)
{
require(
repaidTotalAmount.add(_amount) <= totalAmount,
"Growr. - Loan cannot be overrepaid"
);
Types.NextInstallment memory nextInstallmen... | 12,646,663 |
./partial_match/1/0x21b9F852534Fb9DdC3A0A7B24f067B50d8AC9a99/sources/DODOFeeRouteProxy.sol | before the first pool swap, contract call _deposit to get ERC20 token through DODOApprove/transfer ETH to WETH | function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
require(msg.value == amount, "ETH_VALUE_WRONG");
if (to != address(this)) SafeERC20.safeT... | 9,410,018 |
pragma solidity ^0.4.21;
// File: contracts/ISimpleCrowdsale.sol
interface ISimpleCrowdsale {
function getSoftCap() external view returns(uint256);
function isContributorInLists(address contributorAddress) external view returns(bool);
function processReservationFundContribution(
address contributo... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From OpenZeppelin StandardToken.sol _spender The address which will spend th... | function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);... | 574,555 |
./full_match/5/0x97c71058250AC42fa74B1e961eb7b835C1055EE5/sources/project_/contracts/dao/DAOVault.sol | Transfers ERC20 token to specific address _to Address to receive _amount Transfer ERC20 token amount | function claimERC20(address _token, address _to, uint256 _amount) external override onlyOwner {
require(IERC20(_token).balanceOf(address(this)) >= _amount, "DAOVault: not enough balance");
IERC20(_token).safeTransfer(_to, _amount);
emit Claimed(address(wton), _to, _amount);
}
| 1,889,410 |
./full_match/5/0x3D22AbdD2416Fdaa485cd352920854Ab274c7dD2/sources/homework/work.sol | 借出物品物品必须存在物品必须是可用状态物品必须没被借出押金必要符合设置设置借用人EOA设置为已借出触发借出事件 | function borrowGoods(string memory stickName, uint inx) public payable {
require(isGoodExist(stickName, inx),
"goods not exist");
require(goodsData[stickName][inx].available,
"goods not available");
require(!goodsData[stickName][inx].isBorrow,
"goods already lend");
r... | 1,917,278 |
/**
*Submitted for verification at Etherscan.io on 2021-01-13
*/
// File: @openzeppelin/contracts-ethereum-package/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 ex... | Mint xINCH using INCH oneInchAmount: INCH tokens to contribute/ | function mintWithToken(uint256 oneInchAmount) external whenNotPaused {
require(oneInchAmount > 0, "Must send token");
oneInch.safeTransferFrom(msg.sender, address(this), oneInchAmount);
uint256 fee = _calculateFee(oneInchAmount, feeDivisors.mintFee);
_incrementWithdrawableOneInchFee... | 7,653,625 |
./full_match/80001/0x1B2A448018e1C16c0fd816AC677ae9C0f025a4a7/sources/project:/contracts/ThriveCoinVoterList.sol | Remove a voter. Only callable by accounts with DEFAULT_ADMIN_ROLE. voters - The address that will lose the voter status./ | function removeVoters(address[] calldata voters) public onlyRole(DEFAULT_ADMIN_ROLE) {
for (uint256 i = 0; i < voters.length; i++) {
_voters[voters[i]] = false;
}
}
| 9,464,732 |
pragma solidity ^0.7.0;
import "./ERC165/ERC165.sol";
import "./ERC165/ERC165.sol";
import "./utils/Address.sol";
import "./utils/EnumerableMap.sol";
import "./utils/EnumerableSet.sol";
import "./utils/SafeMath.sol";
import "./utils/Strings.sol";
import "./utils/Context.sol";
import "./utils/Ownable.sol";
import "./IE... | Check if the name string is valid (Alphanumeric and spaces without leading or trailing space)/ | function validateName(string memory str) public pure returns (bool){
bytes memory b = bytes(str);
if(b.length < 1) returncannot be the zero address.
* - `to` cannot be the zero address false;
bytes1 lastChar = b[0];
for(uint i; i<b.length; i++){
bytes1 char = b[i];... | 13,061,686 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | Helpers that returns the MintingOrder plus the message to sign to the address of the creator jsonPart the json to mint return mintingOrder and message to hash | function createMintingOrder(address to, string memory jsonPart)
external
view
returns (MintingOrder memory mintingOrder, bytes32 message)
{
mintingOrder = MintingOrder({
to: to,
expiration: block.timestamp + 15 * 60,
jsonPart: jsonPart
... | 1,583,357 |
pragma solidity ^0.8.0;
import "../../../contracts/DappLib.sol";
///(import
///)
contract access_control_contract_runstate {
using DappLib for uint256;
///(using
///)
///(state
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ACCESS CONTROL: CONTRACT ACCESS <<<<<<<<<<<<<<<<<<<<<<<<<<<*/
// Contracts authorized to call th... | Deauthorizes a previously authorized smart contract from calling this contract account Address of the calling smart contract/$access_control:contract_runstate requireContractRunStateActive | function deauthorizeContract
(
address account
)
external
requireContractAdmin
{
require(account != address(0), "Invalid address");
delete authorized... | 6,425,077 |
pragma solidity ^0.5.12;
library SafeMath {
function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
... | inject NONSTANDARD NAMING | function SETLENDINGPOOLCOREIMPL156(address _lendingPoolCore) public; | 5,544,551 |
./full_match/4/0xaFF6691104510AFF7716765aEE6c4605C71C3D2B/sources/browser/GovernorAlpha.sol | uint latestProposalId = latestProposalIds[msg.sender]; if (latestProposalId != 0) { ProposalState proposersLatestProposalState = state(latestProposalId); require(proposersLatestProposalState != ProposalState.Active, "GovernorAlpha::propose: one live proposal per proposer, found an already active proposal"); requi... | function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(gt_.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below propos... | 12,331,966 |
./full_match/97/0xb0b2dD90491Bc9091604793321b98aC863dE8C0C/sources/project_/contracts/CollectionFactory.sol | Sets the collection uri. _collectionId The id of the collection. _uri The uri to be set./ | function setCollectionURI(
uint256 _collectionId,
string calldata _uri
) public collectionOwner(_collectionId) {
if (
keccak256(abi.encodePacked(_uri)) !=
keccak256(abi.encodePacked(collections[_collectionId].URI))
) {
collections[_collectionId... | 3,282,866 |
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/Registry.sol | Trust an adaptor to be used by cellars adaptor address of the adaptor to trust assetRisk the asset risk level associated with this adaptor protocolRisk the protocol risk level associated with this adaptor/ | function trustAdaptor(
address adaptor,
uint128 assetRisk,
uint128 protocolRisk
) external onlyOwner {
bytes32 identifier = BaseAdaptor(adaptor).identifier();
if (isIdentifierUsed[identifier]) revert Registry__IdentifierNotUnique();
isAdaptorTrusted[adaptor] = tru... | 3,124,287 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '../utils/RetrieveTokensFeature.sol';
import '../interfaces/IERC20UpgradeableBurnable.sol';
import './SafeERC20.sol';
/**
* Contract to handle a seed sale of diversify
*/
contract SeedSaleRound is RetrieveTokensFeature {
// The State of the seed sa... | _weiAmount Value in wei to momos return Number of token (momo's) one receives for the _weiAmount/ | function _getMomoAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount * rate();
}
| 5,437,166 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// Struct to clean up proposal mapping
struct ProposalInfo {
uint _id;
address _signer;
string _title;
string _text;
}
contract Proposals is ERC721 {
// ID is based on supply
uint... | Increase supply and create new proposal id Mint new proposal and set id as new supply Create the proposal data Return ID of new proposal so user can look at it in the future | function mint(string memory proposal_title, string memory proposal_text) public returns(uint) {
supply++;
uint id = supply;
_mint(msg.sender, id);
proposals[id] = ProposalInfo(id, msg.sender, proposal_title, proposal_text);
return id;
}
| 5,451,842 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contract... | swap from tokenIn to tokenOut with fixed tokenIn amount. uint256 halfFeesInTokenIn = amountIn.mul(fees)/2e5; trading in all fees go to the other side trading out | function swapIn (address tokenIn, address tokenOut, address from, address to,
uint256 amountIn) internal lockToken(tokenIn) returns(uint256 amountOut) {
address monoXPoolLocal = address(monoXPool);
amountIn = transferAndCheck(from,monoXPoolLocal,tokenIn,amountIn);
uint256 tokenInPrice;
... | 12,003,029 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
interface IERC2612Permit {
/**
* @d... | Staking contract holds excess sOHM | function circulatingSupply() public view returns (uint) {
return _totalSupply - balanceOf(stakingContract);
}
| 12,936,529 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.0;
import "lib/ds-test/test.sol";
import "src/tokens/StakeNFT.sol";
import "lib/openzeppelin/token/ERC20/ERC20.sol";
import "lib/openzeppelin/token/ERC721/IERC721Receiver.sol";
uint256 constant ONE_MADTOKEN = 10**18;
contract MadTokenMock is ERC20 {
... | transferring money before the contract is created | function testFail_ReentrantNoAdmin() public {
payable(address(0xf5a2fE45F4f1308502b1C136b9EF8af136141382)).transfer(100 ether);
(StakeNFT stakeNFT, MadTokenMock madToken, AdminAccount admin , ) = getFixtureData();
UserAccount donator = newUserAccount(madToken, stakeNFT);
UserAccount ... | 6,424,667 |
/**
*Submitted for verification at Etherscan.io on 2019-07-02
*/
pragma solidity 0.5.7;
/**
* @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 payable pu... | Retrieve the number of decimals used for a given ERC20 token As decimals are an optional feature in ERC20, this contract uses `call` to ensure that an exception doesn't cause transaction failure token the token for which we should retrieve the decimals return decimals the number of decimals in the given token Using ... | {
assembly {
let ptr := mload(0x40)
mstore(ptr,functionSig)
let functionSigLength := 0x04
let wordLength := 0x20
let success := call(
)
switch success
case 0 {
}
cas... | 12,810,682 |
pragma ton-solidity >= 0.44.0;
pragma AbiHeader expire;
pragma AbiHeader time;
pragma AbiHeader pubkey;
//================================================================================
//
import "../interfaces/ILiquidFTRoot.sol";
import "../interfaces/ILiquidFTWallet.sol";
import "../interfaces/IOwnable.sol";
import... | ======================================== | function _walletCreationCallback(address walletAddress) public reserve
{
require(msg.sender == _symbol1RTW || msg.sender == _symbol2RTW, ERROR_WALLET_ADDRESS_INVALID);
_creatorAddress.transfer(0, true, 128);
}
| 888,102 |
pragma solidity 0.5.3;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address ... | Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer t... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
return true;
}
| 2,529,950 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ERC721 } from "../../lib/ERC721.sol";
import { Create2 } from "../../lib/Create2.sol";
import { FxBaseRootTunnel } from "../../tunnel/FxBaseRootTunnel.sol";
import { IERC721Receiver } from "../../lib/IERC721Receiver.sol";
/**
* @title FxERC721RootTunne... | map token if not mapped | function deposit(address rootToken, address user, uint256 tokenId, bytes memory data) public {
if (rootToChildTokens[rootToken] == address(0x0)) {
mapToken(rootToken);
}
tokenId,
data
);
_sendMessageToChild(message);
emit FxDepositERC721(... | 6,172,568 |
./full_match/1/0x25127685dC35d4dc96C7fEAC7370749d004C5040/sources/unibot_token.sol | Returns the integer division of two unsigned integers, reverting with custom message on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consumi... | function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
| 17,004,664 |
./partial_match/1/0x48F63Dcec1306bB2210B0D79bee7064050C18137/sources/RonazoStaking.sol | Calculate the current payout and maxpayout of a given addressThe max_payout is capped so that we can also cap available rewards dailyUsing 1e18 we capture all significant digits when calculating available divs payout remaining allowable divs if exceeds | function payoutOf(address _addr) public view returns(uint256 payout, uint256 max_payout, uint256 net_payout, uint256 sustainability_fee) {
max_payout = maxPayoutOf(users[_addr].deposits);
uint256 share;
if(users[_addr].payouts < max_payout) {
payout = share * block.timestamp.sub(users[... | 4,261,899 |
/**
*Submitted for verification at Etherscan.io on 2022-01-11
*/
//*********************************************************************//
//*********************************************************************//
//
//
// 8888888b. d8888 888b ... | Mints a token to an address with a tokenURI. This is owner only and allows a fee-free drop _to address of the future owner of the token/ | function mintToAdmin(address _to) public onlyOwner {
require(_getNextTokenId() <= SUPPLYCAP, 'Cannot mint over supply cap of 5000');
uint256 newTokenId = _getNextTokenId();
_mint(_to, newTokenId);
_incrementTokenId();
}
| 7,943,633 |
pragma solidity ^0.5.17;
import "./ERC20NonTransferrable.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/con... | In case there is an issue this fundraise can be stopped | function pause() public onlyAdmin {
require(currentState == State.ACTIVE, "Current state is not active");
currentState = State.INACTIVE;
}
| 6,427,337 |
// SPDX-License-Identifier: ISC
pragma solidity >=0.6.0 <0.9.0;
import './BinToken.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/utils/math/Math.sol';
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol';
import '@uniswap/lib/contracts/libraries... | / need to substract Ether amount to buy as it's already present on wallet when called from buy method, otherwise use amountToBuy = 0 Initial price | function getPrice(uint256 amountTobuy) public view returns (uint256) {
uint256 supply = token.totalSupply();
uint256 collateral = address(this).balance.sub(amountTobuy);
if(supply == 0 || collateral == 0) {
return 0.0001 ether;
}
}
@param amount The amount of BIN tokens to buy
| 12,770,770 |
pragma solidity ^ 0.5 .8;
import "./ITransferRules.sol";
import "./TransferRules.sol";
contract ERC1404 {
string public symbol;
string public name;
uint8 public decimals;
uint256 public totalSupply;
address public contractOwner;
ITransferRules public transferRules;
mapping(address => uint256) private _... | SAFE MATH / | function sub(uint256 a, uint256 b) internal pure returns(uint256 result) {
require(b <= a, "Underflow error");
uint256 c = a - b;
return c;
}
| 1,775,027 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.6;
import "./interfaces/ICampaign.sol";
import "./interfaces/ICampaignFactory.sol";
import "./interfaces/IProposal.sol";
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* @... | @inheritdoc ICampaign/ | function updateManager(address _newManager) external override onlyManager() {
manager = _newManager;
}
| 12,640,916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.