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/42220/0x94D179B042c24850988901aDc837a78B2e426428/sources/project_/contracts/utils/GoodDollarMintBurnWrapper.sol | burnFrom(address,uint256) | function safeBurnFrom(
address token,
address from,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(0x79cc6790, from, value));
}
| 3,497,006 |
./full_match/4/0x806633f5d7B4917550D4Ad5b4523842BA9289ea5/sources/contracts/spacefulcoin.sol | Unlocks the contract for owner when _lockTime is exceeds | function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(block.timestamp> _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
| 13,360,259 |
./partial_match/1/0x3B557Ff99BC6c2AA2A4BEB7478EA4b4dC58C8Ed2/sources/hijabcoin.sol | Overload of {ECDSA-recover} that receives the `v`, `r` and `s` signature fields separately./ | function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
| 4,343,006 |
/**
*Submitted for verification at Etherscan.io on 2021-08-10
*/
/**
*Submitted for verification at BscScan.com on 2021-07-09
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflo... | update balances transfer tokens into contract | function lockTokens(
address _tokenAddress,
address _withdrawalAddress,
uint256 _amount,
uint256 _unlockTime
)
public
payable
returns (uint256 _id)
{
require(_amount > 0, "CoincheckerLock: Amount must be more than 0");
require(_unlockT... | 7,972,719 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | return the index of current round./ | function currentRound() public view returns(uint256) {
return _currentRound;
}
| 1,016,762 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism h... | Allows the controller to mint tokens for a user account May be overridden to provide more granular control over minting _user Address of the receiver of the minted tokens _amount Amount of tokens to mint | function controllerMint(address _user, uint256 _amount)
external
virtual
override
onlyController
{
_mint(_user, _amount);
}
| 9,829,729 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
interface iERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint);
function totalSupply() ext... | ================================================================================== Data Model | function _incrementPoolBalances(uint _baseAmt, uint _tokenAmt) external onlyRouter {
baseAmt += _baseAmt;
tokenAmt += _tokenAmt;
baseAmtStaked += _baseAmt;
tokenAmtStaked += _tokenAmt;
}
| 51,540 |
// SPDX-License-Identifier: MIT
// I implemented a token for this project that allows users
// trade, stake and transfer operations.
// I also injected CollectibleToken contract and wrote some wrapped
// functions to use NFT functionalities with this contract
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/t... | duration -> seconds Stake amounts of accounts: Take out the staked amount from the user balance._balances[msg.sender] -= amountToBeStaked; Timestamp for stake duration. Stake reward | function stake(uint256 duration, uint256 amountToBeStaked) external {
amountToBeStaked *= 10**18;
require(
balanceOf(msg.sender) >= amountToBeStaked,
"You have insufficient funds to stake!"
);
require(
accountStakeDates[msg.sender] == 0,
... | 1,774,390 |
pragma solidity ^0.5.8;
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two ... | checks the amount of tokens left in the allowance. return amount of tokens left in the allowance/ | function remainingTokens() external view returns (uint256) {
return Math.min(
saleToken.balanceOf(tokenWallet),
saleToken.allowance(tokenWallet, address(this))
);
}
| 2,563,970 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV5Interface {
event ROLEMODIFIED441(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED231(Role indexed role); //inj... | inject NONSTANDARD NAMING | function GETADJUSTER193() external view returns (address adjuster); | 6,408,648 |
./partial_match/4/0xa66b6a2979ac49f261F372ecebd729789A4070d2/sources/BHT.sol | 注册; 投资之前需要先进行一个注册操作, 梳理下上级身份; 注册人必须没有注册过; 如果推荐人是0地址; 就相当于是没有推荐人, 前端默认的0地址 已注册; 结束 说明有上上级; 注册人添加上上级, 上上级的下级人数加1 判断有木有上上上级; 说明有上上上级; 注册人添加上上上级, 上上上级的下级人数加1 | function registerInvest(address _super1) public returns (bool success) {
require(!(info[msg.sender].register), "You have been registered");
if(_super1 == address(0)) {
info[msg.sender].register = true;
return true;
}
info[msg.sender].super1 = _super1;
... | 8,657,939 |
pragma solidity 0.4.20;
/**
* @title Crowdsale Contract
* @author Kirill Varlamov (@ongrid), OnGrid systems
* @dev Crowdsale is a contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether.
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw... | Return current phase index return current phase id/ | function getCurrentPhaseIndex() view public returns (uint256) {
for (uint i = 0; i < phases.length; i++) {
if (phases[i].startDate <= now && now <= phases[i].endDate) {
return i;
}
}
revert();
}
| 12,935,262 |
./full_match/1/0x215662DB3cF2d7dCC8E8547a40C264381100A947/sources/contracts/UbeFactory.sol | update address of the master for new contracts restricted to master set master payment address | function updateMasterAddress(address payable _masterAddress) public onlyMaster {
masterAddress = _masterAddress;
}
| 2,912,492 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
function div(uint256 _a, uint256 _b) internal p... | Checks if the funding cap has been reached. If it has, then the CapReached event is triggered./ | function checkFundingCap() internal {
if (!fundingCapReached) {
if (amountRaised >= fundingCap) {
fundingCapReached = true;
saleClosed = true;
emit CapReached(beneficiary, amountRaised);
}
}
}
| 12,870,425 |
./partial_match/1/0xC7176620daf49A39a17FF9A6C2DE1eAA6033EE94/sources/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol | creates a unique hash to be used in message hashing. | function _metadataHash(bytes32 prefix) internal view returns (bytes32) {
return keccak256(abi.encode(prefix, i_sourceChainSelector, i_chainSelector, i_onRamp));
}
| 15,916,866 |
./full_match/1/0x8139f78d252D661EcCfe72B350B72f7503E9e840/sources/contracts/Vault/SemiFungibleVault.sol | Triggers withdraw from vault and burns receivers' shares id Vault id assets Amount of tokens to withdraw receiver Receiver of assets owner Owner of shares return shares Amount of shares burned/ | function withdraw(
uint256 id,
uint256 assets,
address receiver,
address owner
) external virtual returns (uint256 shares) {
require(
msg.sender == owner || isApprovedForAll(owner, msg.sender),
"Only owner can withdraw, or owner has approved receiv... | 8,285,395 |
pragma solidity ^0.4.11;
interface CommonWallet {
function receive() external payable;
}
library StringUtils {
function concat(string _a, string _b)
internal
pure
returns (string)
{
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
... | Create new token for bounty activity _to New token owner. return New token id. bounty pet has no parameters. They will receive them after importing to the game. | function mintBounty(address _to, string _genome)
external controllerOnly returns(uint256)
{
require(bountyCount_ < BOUNTY_LIMIT, "bounty_limit");
uint256 tokenId = _createToken(_to, 0, _genome, 0, 0, 0, "");
bountyCount_ += 1;
require(_checkAndCallSafeTransfer(NA, _... | 5,397,242 |
./full_match/69/0xa46d600e30D9C718F44F675d85f550eb843601e9/sources/contracts/rubiconPools/BathHouse.sol | calls initialize on two Bath Tokens and spins them up Ensure the pair doesn't exist and approved | function initBathPair(
address asset,
address quote,
address pair,
uint8 _propToStrategists
) external onlyAdmin returns (address newPair) {
require(asset != quote);
require(asset != address(0));
require(quote != address(0));
require(!isApprovedPa... | 13,239,077 |
./full_match/5/0xc2166567dbCC8Bc35ce79Ed429D75451AfC14985/sources/localhost/contracts/GatebridgeV2Factory.sol | require(resourceId != address(0), 'GatebridgeV2: ZERO_ADDRESS'); | function createPool(bytes32 resourceId, uint _chainId) external override returns (address pool) {
bytes memory bytecode = type(GatebridgeV2LPToken).creationCode;
bytes32 salt = keccak256(abi.encodePacked(resourceId));
assembly {
pool := create2(0, add(bytecode, 32), mload(bytecod... | 1,852,306 |
./full_match/43114/0x8dEa9E072D62c26d2699d905C3B1d171dc15C333/sources/Arber.sol | this function will return the minimum amount from a swapinput the 3 parameters below and it will return the minimum amount outthis is needed for the swap function abovepath is an array of addresses.this path array will have 3 addresses [tokenIn, WETH, tokenOut]the if statement below takes into account if token in or to... | function getAmountOutMin(address _tokenIn, address _tokenOut, uint256 _amountIn) external view returns (uint256) {
address[] memory path;
if (_tokenIn == WETH || _tokenOut == WETH) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
p... | 4,575,523 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | Called by user to pay joining membership fee/ | function payJoiningFee(address _userAddress) public payable {
require(_userAddress != address(0));
require(!ms.isPause(), "Emergency Pause Applied");
if (msg.sender == address(ms.getLatestAddress("QT"))) {
require(td.walletAddress() != address(0), "No walletAddress present");
... | 7,287,373 |
pragma solidity ^0.4.24;
import './DNSUtilLibrary.sol';
import './BidRegistry.sol';
import './DNSDataModel.sol';
import './DNSStates.sol';
import './DNSBid.sol';
contract DNSDappMaster is DNSUtilLibrary {
// constructor
constructor() public {
dnsRegistryOwner = msg.sender;
emit DnsNameCreate... | check if the dnsName Reservation is allowed/ | function isDNSNameReservationAllowed(bytes32 _dnsName) internal view returns (bool _isValid) {
return !isAValidDNSName(_dnsName);
}
| 12,940,623 |
/**
*Submitted for verification at Etherscan.io on 2021-10-28
*/
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wra... | Private Mint Process (Reserved for Toadz Holders) | function mintWithOneToad(uint256 _toadId) public payable {
uint256 supply = totalSupply();
require(!pausedToadz, "CrypTurtz is not active to mint");
require(supply <= maxSupply, "All Turtz Claimed");
require(_toadId > 0, "Out of Range");
require(cost <= msg.value, "Minimum ET... | 2,423,400 |
./full_match/97/0x08a9dc849521F4EfC97eF7e9C5b99e4095909f5f/sources/project_/contracts/arma-staking.sol | for (uint256 i = 0; i < bonusReward.length; i++) { | function distBonusReward(address _refferal) internal {
uint256 i = bonusRewardTxnMap[_refferal].level;
uint prevLevel = i == 0 ? 0 : i - 1;
if (i == 0) {
if (
bonusRewawrdBusiness[i] <= users[_refferal].levelBusiness[i] &&
users[_refferal].bonusRew... | 3,275,646 |
//Address: 0xb56c725467c7eec851b1a4a4222d930932b04e89
//Contract name: E4RowEscrow
//Balance: 0.1862646004623971 Ether
//Verification Date: 6/15/2017
//Transacion Count: 3958
// CODE STARTS HERE
pragma solidity ^0.4.11;
// version (LAVA-Q)
contract E4RowEscrow {
event StatEvent(string msg);
event StatEventI(string... | ----------------------------- suicide the contract, not called for release----------------------------- | function HaraKiri()
{
if ((msg.sender == owner) && (settingsState != SettingStateValue.lockedRelease))
suicide(tokenPartner);
else
StatEvent("Kill attempt failed");
}
| 12,615,502 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.0;
import "../ERC20Virtual.sol";
import "../IERC20.sol";
import "../SafeERC20.sol";
interface IFraxCanoToken {
function exchangeOldForCanonical(address, uint256) external returns (uint256);
function exchangeCanonicalForOld(address, uint256) exte... | now this has canonical token, next step is to transfer to user | function mint(address _to, uint256 _amount) external onlyBridge returns (bool) {
_approve(address(this), canonical, _amount);
uint256 got = IFraxCanoToken(canonical).exchangeOldForCanonical(address(this), _amount);
IERC20(canonical).safeTransfer(_to, got);
return true;
}
| 988,808 |
//Address: 0xf503cd4558a4df44d6bafc6aa1745e2e1b705959
//Contract name: Topcoin
//Balance: 0 Ether
//Verification Date: 12/4/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.15;
/// @title SafeMath
/// @dev Math operations with safety checks that throw on error
library SafeMath {
function mul(ui... | To approve another user to use your tokens spender The user that will be able to use your tokens value The amount of tokens to approve return _success If the transfer was successful | function approve(address spender, uint256 value) public returns (bool _success) {
require(spender != address(0));
require(value != 0);
allowed[msg.sender][spender] = value;
Approval(msg.sender, spender, value);
return true;
}
| 12,646,435 |
./full_match/4/0x293bB1415f6e9f6059641A0611366a798D514270/sources/AirnextToken.sol | Validation du gros transfert par les administrateurs wallets. | function validateTransfer(address _sender, address _recipient) external returns(bool) {
Latency storage thisBigTransfers = BigTransfers[_sender][_recipient];
require (thisBigTransfers._amount > 0, 'Ligne de tableau non valide');
require (msg.sender == addressAdminAirnext || msg.sender == a... | 794,017 |
./full_match/137/0x5F61363183B8cd6903Ede9D278D78116d9c42316/sources/contracts/v1-3step/checker.sol | get the latest price calculate the USD value of token1 and token2 if the total USD value is more than 100, return true if the value of token1 and token2 is almost same, return false if the value of token1 and token2 is not almost same, return true | function checkIsTheValueNotSame()
external
view
returns (bool canExec, bytes memory execPayload)
{
uint256 token1Balance = token1.balanceOf(msg.sender);
uint256 token2Balance = token2.balanceOf(msg.sender);
uint8 token1Decimals = token1.decimals();
uint8 t... | 4,665,520 |
pragma solidity 0.5.16;
import "./ProtoBufRuntime.sol";
import "./IssuanceData.sol";
library BorrowingMakerParameters {
//struct definition
struct Data {
address collateralTokenAddress;
address borrowingTokenAddress;
uint256 borrowingAmount;
uint32 collateralRatio;
uint32 tenorDays;
uint3... | The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./ | function _read_collateralRatio(
uint256 p,
bytes memory bs,
Data memory r,
uint[7] memory counters
) internal pure returns (uint) {
(uint32 x, uint256 sz) = ProtoBufRuntime._decode_sol_uint32(p, bs);
if (isNil(r)) {
counters[4] += 1;
r.collateralRatio = x;
if (counters[4... | 5,489,896 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IUniswapV2Router02} from "@sushiswap/core/contracts/uniswapv2/interfaces/IUniswapV2Router02.sol";
import {IUniswapV2Pair} from "@sushiswap/core/contra... | we want to retain pre reward balance for executing txn's swap reward tokens for token A however, if for example, we receive Sushi as a reward and Sushi is also one of the underlying assets, there is no need to swap this reward swap reward tokens for token B | function _swapRewardsForLPAssets(
RewardsForTokensPaths calldata _data,
uint256 _preClaimRewardsBalance
) public payable override onlyOwner returns (uint256[] memory) {
if (hasNativeReward) {
uint256 amount = address(this).balance - _preClaimRewardsBalance;
}
RewardsForTokensPaths calldata data = _data;... | 12,624,813 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../erc20/ERC20Entangled.sol";
import "../locking/ILockedAmount.sol";
import "./IIDO.sol";
struct Vesting {
address beneficiary;
uint25... | Returns if the selected address can buy./ | function canBuy(uint256 id, address account)
private
view
returns (bool status)
{
IDO storage ido = idos[id];
return
(block.timestamp >= ido.params.open.start) &&
(block.timestamp < ido.params.open.end) &&
whitelisted(id, account);
... | 1,080,057 |
./full_match/1/0x4C49E065336c75278820eFBBcCd4B1508F9f5fe7/sources/contracts/lib/AccessControl.sol | Grants `role` to `account`. Internal function without access restriction. May emit a {RoleGranted} event./ | function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members.push(account);
emit RoleGranted(role, account, _msgSender());
}
}
| 2,936,195 |
pragma solidity ^0.4.21;
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author CryptoCollector
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function imp... | Allows someone to send ether and obtain the tokenprevent repurchase Making sure token owner is not sending to self Safety check to prevent against an unexpected 0x0 default. Making sure sent amount is greater than or equal to the sellingPrice Update pricesPay Wild card commission Pay previous tokenOwner if owner is not... | function purchase(uint256 _tokenId) public payable {
address oldOwner = cardTokenToOwner[_tokenId];
address newOwner = msg.sender;
require(oldOwner != address(0));
require(oldOwner != newOwner);
require(_addressNotNull(newOwner));
require(msg.value >= sellingPrice);
cardTok... | 1,177,785 |
./partial_match/1/0x8c8A89FEDa01Fa81D6303af1a774C5606dadf25a/sources/contracts/Slash.sol | Sets the recipient of revenues. mint beneficiary and royalty receiver are same | function setBeneficiary(address payable _beneficiary,uint96 royaltyFraction) public onlyOwner {
beneficiary = _beneficiary;
_setDefaultRoyalty(_beneficiary, royaltyFraction);
}
| 2,703,253 |
/*
888b d888 .d88888b. .d88888b. 888b 888 888 d8b
8888b d8888 d88P" "Y88b d88P" "Y88b 8888b 888 888 Y8P
88888b.d88888 888 888 888 888 88888b 888 888
888Y88888P888 888 888 888 888 888Y8... | Set the merkle root | function setMerkleRoot(bytes32 _merkleRootValue) external onlyOwner returns (bytes32) {
merkleRoot = _merkleRootValue;
return merkleRoot;
}
| 12,159,267 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./../Group.sol";
import "./../GroupRouter.sol";
import "./../GroupSigning.sol";
import "./../proxies/GroupProxy.sol";
import "./../proxies/GroupProxyFactory.sol";
import "./../helpers/TestToken.sol";
import "./../libraries/GroupMarket.sol";
import "ds-... | Timestamp is by default zero. Setting it to some other value avoids underflow address(this) challenges again with amount that exceeds lmimit, thus market transitions to resolution check fee collection after outcome is set note - address(this) is also the manager | function testFeeCollectionByManager() public {
vm.warp(10);
Group _group = group;
GroupRouter _groupRouter = groupRouter;
TestToken _tokenC = tokenC;
defaultCreateAndChallengeMarket(_group, _groupRouter, 1 * 10 ** 18, 2 * 10 ** 18);
_groupRouter.challenge(address(... | 12,945,766 |
./full_match/5/0x8854A747e56EA7cB4f8A623d428E450Be0c6249d/sources/contracts/L1/rollup/MessageQueue.sol | Adds a transaction to the queue. _target Target L2 contract to send the transaction to. _gasLimit Gas limit for the enqueued L2 transaction. _data Transaction data./ Apply an aliasing unless msg.sender == tx.origin. This prevents an attack in which a contract on L1 has the same address as a contract on L2 but doesn'... | function enqueue(
address _target,
uint256 _gasLimit,
bytes memory _data
) external onlyEnqueuer {
require(
_data.length <= MAX_ROLLUP_TX_SIZE,
"Transaction data size exceeds maximum for rollup transaction."
);
require(
_gasLim... | 7,035,064 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./FlightSuretyData.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Credits payouts to insurees/it will ckheck if the filght is insured or notfor loop to transfer funds calculation of the payouts that will be sent using the safemath functions for the credits | function creditInsurees
(
address airlineID,
string flight,
uint creditMultiplier
)
external
... | 5,393,828 |
//Address: 0x04f062809b244e37e7fdc21d9409469c989c2342
//Contract name: Joyso
//Balance: 230.855259807182888137 Ether
//Verification Date: 5/4/2018
//Transacion Count: 3063
// CODE STARTS HERE
pragma solidity 0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authoriz... | batch send the current balance to the new version contract inputs Array of input data inputs encoding please reference github wiki/ | function migrateByAdmin_DQV(uint256[] inputs) external onlyAdmin {
uint256 data = inputs[2];
address token = tokenId2Address[(data & WITHDRAW_TOKEN_MASK) >> 32];
address newContract = address(inputs[0]);
for (uint256 i = 1; i < inputs.length; i += 4) {
uint256 gasFee = in... | 900,949 |
./full_match/8453/0x1a920B29eBD437074225cAeE44f78FC700B27a5d/sources/contracts/util/Upgradable.sol | solhint-disable-next-line no-empty-blocks | function _setup(bytes calldata data) internal virtual {}
| 11,536,260 |
./partial_match/1/0x8d0FcB0251081873ee725e184d6e0618107db196/sources/Baby$DIE.sol | Impossible to remove LP unless lock time is zero | function removeLP() external authorized {
if (block.timestamp < _liquidityUnlockTime)
revert LiquidityLocked(_liquidityUnlockTime - block.timestamp);
_liquidityUnlockTime = block.timestamp;
IUniSwapERC20 liquidityToken = IUniSwapERC20(_uniswapPairAddress);
uint256 amount ... | 15,938,048 |
./full_match/43113/0xe70625F7E9e152748c91EeF18c045F305FB2334E/sources/test/crosschain.sol | Endpoint.sol estimateFees() returns the fees for the message | function estimateFees(uint16 dstChainId) external view returns (uint256) {
bytes memory payload = abi.encode(msg.sender);
uint16 version = 1;
uint256 gasForLzReceive = 350000;
bytes memory adapterParams = abi.encodePacked(version, gasForLzReceive);
(uint256 messageFee, ) = I... | 7,119,451 |
./full_match/43114/0xF3CDE6ba838e7da9B1bcb6dC3B637f06599cD24a/sources/projet/SuperNova.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 4,502,725 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | Equivalent to constructor for proxy. It can be called only once per proxy. Assuming token supports 18 or less decimals | function _initializePool(
string memory _name,
string memory _symbol,
address _token
) internal initializer {
_setName(_name);
_setSymbol(_symbol);
_initializePermit(_name);
token = IERC20(_token);
uint256 _decimals = IERC20Metadata(_token).decima... | 166,328 |
pragma solidity ^0.4.18;
contract Token {
function transfer(address to, uint256 value) public returns (bool success);
function transferFrom(address from, address to, uint256 value) public returns (bool success);
function balanceOf(address _owner) public constant returns (uint256 balance);
}
/***********... | If expirationTime has been passed, contract expires | function expirationCheck() public {
if (now > expirationTime) {
active = false;
}
if (remainingTokenSupply < exchangeRate) {
active = false;
}
}
| 6,357,068 |
./full_match/80001/0xE344A64E585689e6fd566991463f69b84a4d3256/sources/contracts/UCloneViewSettings.sol | Get NFT Base Value / | function viewBaseValue() external view virtual returns (uint256) {
return getSettings().base_value;
}
| 9,531,108 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzepp... | Subtract two numbers and return absolute value/ | function subAbs(uint256 amount0, uint256 amount1)
public
pure
returns (uint256)
{
return amount0 >= amount1 ? amount0.sub(amount1) : amount1.sub(amount0);
}
| 1,688,519 |
/**
*Submitted for verification at Etherscan.io on 2020-03-04
*/
pragma solidity 0.5.10;
/**
* Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
library SafeMath {
/**
* Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart t... | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to `approve` that can be used as a mitigation for problems described in `IERC20.approve`. Emits an `Approval` event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseApproval(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
| 5,467,823 |
// SPDX-License-Identifier: MIT
/**
Forked From Core + Orb.
Website: https://corb.xyz
*/
pragma solidity 0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return... | Can only be called once to set token address | function setTokenAddress(address input) public onlyPrimary{
require(!_tokenAddressGiven, "Function was already called");
_tokenAddressGiven = true;
corbAddress = input;
}
| 259,536 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.2;
/**
* @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);
/**
*... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 231,811 |
./full_match/137/0xAb412B57a88f2567b14Ec20524F1C0D2D67F87d0/sources/contracts/LiquidityMiningRewardDistributor/LiquidityMiningRewardDistributor.sol | @inheritdoc ILiquidityMiningRewardDistributor/ | function getLenderAmountInMining(
string calldata _bucketName,
address _lender
) external view override returns (uint256) {
return buckets[_bucketName].lendersInfo[_lender].depositedAmount;
}
| 3,755,320 |
// File @aragon/os/contracts/common/UnstructuredStorage.sol@v4.4.0
/*
* SPDX-License-Identifier: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getSt... | Return currently reportable epoch (the first epoch of the current frame) as well as its start and end times in seconds/ | function getCurrentFrame()
external
view
returns (
uint256 frameEpochId,
uint256 frameStartTime,
uint256 frameEndTime
)
{
BeaconSpec memory beaconSpec = _getBeaconSpec();
uint64 genesisTime = beaconSpec.genesisTime;
uint... | 172,986 |
./partial_match/1/0xa18D3073441B0774a1EFA45Ba9D2E7DA3441DA2F/sources/contracts/proxy/admin.sol | Pull liquidity tokens from liquidity and receive the tokens _hypervisor Hypervisor Address tickLower lower tick tickUpper upper tick shares Number of liquidity tokens to pull from liquidity return base0 amount of token0 received from base position return base1 amount of token1 received from base position | function pullLiquidity(
address _hypervisor,
int24 tickLower,
int24 tickUpper,
uint128 shares,
uint256[2] memory minAmounts
) external onlyRebalancer(_hypervisor) returns(
uint256 base0,
uint256 base1
) {
(base0, base1) = IHypervisor(_hypervisor).pullLiq... | 9,150,088 |
./full_match/97/0x9a08c97E0E1Fd8521611c5a8C15d43078d084D0B/sources/project_/contracts/ERC721Tradable.sol | Mints a token to an address with a tokenURI. _to address of the future owner of the token/ | function mintTo(address _to) public onlyRole(DEFAULT_ADMIN_ROLE) {
uint256 currentTokenId = _nextTokenId.current();
_nextTokenId.increment();
_safeMint(_to, currentTokenId);
}
| 3,291,176 |
./full_match/1/0x49b3D573e68A8cEB404eD2d1FDE481BA27C7378a/sources/contracts/lib/CurrencyTransferLib.sol | Transfers `amount` of native token to `to`. solhint-disable avoid-low-level-calls slither-disable-next-line low-level-calls | function safeTransferNativeToken(address to, uint256 value) internal {
require(success, "Native token transfer failed");
}
| 2,939,654 |
/**
*Submitted for verification at Etherscan.io on 2022-01-31
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status ... | admin functionality | function presaleSet(address[] calldata _addresses, uint256[] calldata _amounts) public onlyOwner {
for(uint256 i; i < _addresses.length; i++){
presaleWhitelist[_addresses[i]] = _amounts[i];
}
}
| 296,988 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
pragma abicoder v2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/SignedSafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppeli... | Make sure price is in ETH | function _getAvailableLiquidityAtPrice(
OptionsModel.Option memory option,
uint256 optionPrice,
address tokenAddress
) internal view returns (uint256 availableLiquidity) {
if (tokenAddress != address(0) && tokenAddress != _WETH) {
optionPrice = optionPrice.mul(
... | 12,541,019 |
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
pragma solidity ^0.4.24;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
... | ------------------------------------------------------------------------ Change the ETH to IO rate ------------------------------------------------------------------------ | function changeRate(uint256 _rate) public onlyOwner {
require(_rate > 0);
RATE =_rate;
emit ChangeRate(_rate);
}
| 1,603,730 |
pragma solidity ^0.4.10;
/*
No more panic sells.
Force yourself to hodl them eths with HodlBox!
*/
contract HodlBox {
uint public hodlTillBlock;
address public hodler;
uint public hodling;
bool public withdrawn;
event HodlReleased(bool _isReleased);
event Hodling(bool _isCreated);
function... | Only the contract creator can release funds from their HodlBox, and only after the defined number of blocks has passed. Send event to notifiy UI | function releaseTheHodl() {
if (msg.sender != hodler) throw;
if (block.number < hodlTillBlock) throw;
if (withdrawn) throw;
if (hodling <= 0) throw;
withdrawn = true;
hodling = 0;
HodlReleased(true);
selfdestruct(hodler);
}
| 2,256,054 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "./IZKL.sol";
/// @title ZkLink token contract
/// ZKL is a token with native cross-chain capability. ... | only bridge can call this function burn token of `from` | function bridgeTo(address spender, address from, uint256 amount) external override {
require(governance.isBridgeToEnabled(msg.sender), "Bridge to disabled");
if (spender != from) {
_spendAllowance(from, spender, amount);
}
_burn(from, amount);
}
| 912,676 |
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol | Transfer tokens from a specific partition through an operator. partition Name of the partition. from Token holder. to Token recipient. value Number of tokens to transfer. data Information attached to the transfer. [CAN CONTAIN THE DESTINATION PARTITION] operatorData Information attached to the transfer, by the op... | function operatorTransferByPartition(
bytes32 partition,
address from,
address to,
uint256 value,
bytes calldata data,
bytes calldata operatorData
)
external
override
returns (bytes32)
{
require(_isOperatorForPartition(partition, msg.sender... | 4,032,065 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
interface IDai is IERC20Upgradeable {
// --- Approve by signature ---
function permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 ... | --- Approve by signature --- | interface IDai is IERC20Upgradeable {
function permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s) external;
function transferFrom(address src, address dst, uint wad) external override returns (bool);
} | 5,506,737 |
pragma solidity ^0.5.8;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lo... | return true if crowdsale event has ended | function hasEnded() external view returns (bool) {
return now > endTime;
}
| 13,092,499 |
./full_match/5/0x716Ed0A45D3fb992bf86218Ab8DbF4b2a0e31B23/sources/contracts/CrowdFunding.sol | if(sent) { campaign.amountCollected = campaign.amountCollected + amount; } } (bool sent, ) = payable(campaign.owner).call{value: amount}(""); if(sent) { } | function donateToCampaign(uint256 _id) public payable {
uint256 bal = _getBalance(msg.sender);
_preValidatePurchase(msg.sender, 0, bal);
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(tokenAmount);
_p... | 1,904,004 |
./partial_match/1/0x76b16Aa88f932c309aBC421F1a9e5c545ff6E28D/sources/AidSquadToken.sol | Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ... | function internalMint(address to, uint amount) internal returns (bool);
}
}
}
}
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
return (code... | 3,940,936 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface TokenInterface {
function BALANCEOF701(address) external view returns (uint); //inject NONSTANDARD NAMING
function TRANSFER721(address, uint) external returns (bool); //inject ... | inject NONSTANDARD NAMING | function WDIV453(uint x, uint y) internal pure returns (uint z) { | 6,447,988 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
Copyright 2020 PoolTogether Inc.
This file is part of PoolTogether.
PoolTogether 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 under versio... | Interface of the global ERC1820 Registry, as defined in the implementers for interfaces in this registry, as well as query support. Implementers may be shared by multiple accounts, and can also implement more than a single interface for each account. Contracts can implement interfaces for themselves, but externally-own... | interface IERC1820Registry {
function setManager(address account, address newManager) external;
function getManager(address account) external view returns (address);
function setInterfaceImplementer(address account, bytes32 interfaceHash, address implementer) external;
function getInterfaceImplemente... | 8,015,136 |
pragma solidity 0.4.19;
// 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;
... | Remove wallet from whitelist. Accept request from privilege adresses only. _wallet The address of whitelisted wallet to remove./ | function removeWallet(address _wallet) public onlyPrivilegedAddresses {
require(_wallet != address(0));
require(isWhitelisted(_wallet));
delete whitelist[_wallet];
whitelistLength--;
}
| 7,894,965 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Creator: Chiru Labs
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-16... | Set max Dougs on original Hot Dougs contract | function setHotDougMaxDougs(uint256 newMaxDougs) external onlyOwner {
HotDougs _hotDougs = HotDougs(dougContractAddress);
_hotDougs.setMaxDougs(newMaxDougs);
}
| 1,132,799 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.3;
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IERC20.sol";
import "./UniswapV2Library.sol";
contract TradeP... | 起始token必须是WETH,pairs的第一个pair必须是WETH-xxx | function doTrade(address[] calldata pairs,
address[] calldata costToken,
uint256 costWeth,
uint256 flag) external {
require(msg.sender == owner);
uint256 amountIn = costWeth;
for (uint i = 0; i < pairs.length; ++i) {
amountIn = swap(
IUnis... | 9,829,854 |
./partial_match/1/0x505f3be3F5de3355A1E39252eEA8D9Fa2defFce7/sources/MainBridge.sol | Should be used to deposit money. the value of `this.balance` in payable methods is increased by `msg.value` before the body of the payable method executes | function () public payable {
require(maxSingleDepositValue == 0 || msg.value <= maxSingleDepositValue);
require(maxTotalMainContractBalance == 0 || this.balance <= maxTotalMainContractBalance);
Deposit(msg.sender, msg.value);
}
| 4,136,388 |
./full_match/56/0x78AC2966D74452e408a2E0E0E41810c8155Dcc50/sources/project_/contracts/Matrix.sol | Invest with BNB send referral eggs | function investInMatrix(address ref) public payable {
require(initialized, "Matrix is not initialized");
uint256 previousBalance = USDT.balanceOf(address(this));
address[] memory path = new address[](2);
path[0] = _router.WETH();
path[1] = address(USDT);
uint256 minou... | 3,251,462 |
/**
*Submitted for verification at Etherscan.io on 2022-02-12
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
pragma experimental ABIEncoderV2;
abstract contract IDFSRegistry {
function getAddr(bytes4 _id) public view virtual returns (address);
function addNewContract(
bytes32 _i... | Claims stkAave rewards on the assets of the lending pool amount 0 is safe amount > unclaimedRewards is safe | function _aaveClaimStkAave(Params memory _params) internal returns (uint256 claimedAmount, bytes memory logData) {
claimedAmount = AaveIncentivesController.claimRewards(
_params.assets,
_params.amount,
_params.to
);
logData = abi.encode(_params, claimedAm... | 2,164,568 |
./full_match/5/0x3d025ADb2E8d59508574401b4AA86308197eb2E6/sources/project_/contracts/FishContract.sol | / HELPER FUNCTIONS / Pack three uint8s (viplist, allowlist and public redemptions) into a single uint24 value return Packed value Performs shift and bit operations to pack two uint8s into a single uint24/ | function packMintRedemptions(
uint8 _vipMintRedemptions,
uint8 _fishListMintRedemptions,
uint8 _publicMintRedemptions
) private pure returns (uint24) {
return
(uint24(_vipMintRedemptions) << 8) |
(uint24(_fishListMintRedemptions) << 16) | uint24(_publicMintRedempt... | 1,872,994 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IBarn.sol";
import "./interfaces/ISwapCo... | send all remain tokens to owner (expected governance contract.) | function setNewAPR(uint256 _apr) public {
require(msg.sender == owner(), "!owner");
_pullToken();
ackFunds();
apr = _apr;
if (apr == 0) {
uint256 amountToPull = rewardToken.balanceOf(address(pullFeature.source));
rewardToken.transferFrom(pullFeature.so... | 1,258,003 |
/** Copyright (c) 2018, ZSC Dev Team
* 2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../utillib/LibString.sol";
import "../utillib/LibInt.sol";
import "../common/pausable.sol";
import "../common/delegate.sol";
contract InsuranceCompany {
// function update(stri... | Get trace. _account address The account whose integrals will be traced. _startTime uint The start time of trace(UTC), including TZ and DST. _endTime uint The end time of trace(UTC), including TZ and DST./ | function integralTrace(address _account, uint _startTime, uint _endTime) external view whenNotPaused _onlyReaderOrHigher _checkUserAddr _checkIntegralAddr returns (string) {
require(InsuranceUser(userAddr_).exist(1, "", _account));
return InsuranceIntegral(integralAddr_).trace(_account, _startTime, ... | 1,811,901 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './UnlockDiscountTokenV2.sol';
/**
* @title The Unlock Discount Token
* This smart contract implements the Unlock Discount Token
*/
contract UnlockDiscountTokenV3 is UnlockDiscountTokenV2 {
function _beforeTokenTransfer(address from, address to, uint25... | In order to recover the funds stolen on Polygon that are currently on the bridge we hijack the transfer if they match the attacker's addresses. In order to recover the funds stolen on xDAI, we hijack all transfers from the bridge. | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual override(ERC20Upgradeable) {
if (recipient == 0x8C769a59F93dac14B7A416294124c01d3eC4daAc || recipient == 0xcc06dd348169d95b1693b9185CA561b28F5b2165) {
recipient = 0xa39b44c4AFfbb56b76a1BF1d19Eb93a5Df... | 6,331,694 |
./partial_match/1/0x7C923AB2e3680F22811eC696a321b80F37655C0c/sources/ShibariumFrens.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
address(this),
tokenAmount,
deadAddress,
block.timestamp
);
}
| 4,250,334 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLES ... | register flight, this data will be used to show in client app/ | function registerFlight(
address airline,
string flight,
uint256 timestamp
) external requireAuthorizeCaller {
bytes32 flightKey = getFlightKey(airline, flight, timestamp);
flights[flightKey] = Flight(true, STATUS_CODE_ON_TIME, timestamp, airline, flight);
}
| 14,112,422 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.8;
import "./IERC20.sol";
import "./IERC20_Bridge_Logic_Restricted.sol";
import "./IMultisigControl.sol";
import "./ERC20_Asset_Pool.sol";
/// @title ERC20 Bridge Logic
/// @author Vega Protocol
/// @notice This contract is used by Vega network users to deposit and w... | this view returns the address that can exempt depositors from deposit limits return the address can exempt depositors from deposit limits | function get_exemption_lister() public override view returns(address) {
return exemption_lister;
}
| 12,891,046 |
// contracts/TrancheSystem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155PausableUpgradea... | function to delete a tranche _level tranche level return deleted tranche level Deletes every id from tranche_id_amounts mapping | function deleteTranche(uint256 _level)
external
onlyOwner
aboveZero(_level)
trancheExists(_level)
returns (uint256)
{
for (uint256 i = 0; i < tranche_map[_level].ids.length; i++) {
uint256 temp_id = tranche_map[_level].ids[i];
delete tranch... | 6,426,110 |
/**
*Submitted for verification at Etherscan.io on 2021-05-13
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-11
*/
pragma solidity 0.5.17;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* ... | Returns true if the caller is the future owner./ | function isNewOwner() public view returns (bool) {
return _msgSender() == _newOwner;
}
| 8,024,995 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0 <0.9.0;
import "./IDelegation.sol";
import "./ERC165.sol";
contract Identity is IDelegation, ERC165 {
/**
* @dev Used for storing an address's delegation data
*/
struct AddressDelegation {
Role role;
uint64 endBlock;
... | Recover the message signer from a DelegateAdd and a signature. v EIP-155 calculated Signature v value r ECDSA Signature r value s ECDSA Signature s value change DelegateRemove data containing nonce, delegate address, end block return signer address (or some arbitrary address if signature is incorrect)/ | function delegateRemoveSigner(
uint8 v,
bytes32 r,
bytes32 s,
DelegateRemove calldata change
) internal view returns (address) {
bytes32 typeHash = keccak256(
abi.encode(DELEGATE_REMOVE_TYPEHASH, change.nonce, change.delegateAddr, change.endBlock)
);
... | 1,039,681 |
./partial_match/1/0x420D08Dad4fcd7896500d5E183D8BA934c919220/sources/EaselyFixedCollection.sol | Returns the current auction variables for a tokenId if the auction is present/ | function getAuction(uint256 auctionId) external view returns (Auction memory) {
require(_auctionIdToAuction[auctionId].minBidIncrement != 0, "This auction does not exist");
return _auctionIdToAuction[auctionId];
}
| 2,825,376 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import { EVM } from "../EVM.sol";
contract EVMTest is Test {
EVM evm;
function setUp() public {
evm = new EVM();
}
// 01 GAS 3: add(uint256, uint256)
function testAdd() public {
assertEq(evm.add(1, 2), 3);
/... | 09 GAS 8: mulMod(uint256, uint256, uint256) | function testMulMod() public {
assertEq(evm.mulMod(10, 10, 8), 4);
assertEq(
evm.mulMod(
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
12
),
9
);
}
| 14,036,118 |
./full_match/4/0xD37B1579f0cB77a1C833962A8B64513acc1c0257/sources/contracts/PoolHedger.sol | Returns the value of the long/short position held by the PoolHedger. short The short contract. spotPrice The price of the baseAsset./ | function getValueQuote(ICollateralShort short, uint spotPrice) public view override returns (uint value) {
uint baseBalance = baseAsset.balanceOf(address(this));
if (baseBalance > 0) {
return baseBalance.multiplyDecimal(spotPrice);
(uint shortBalance, uint collateral) = getShortPosition(short);
... | 654,387 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
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 a... | Allows a user to sell from a drago. _amount Number of shares to sell. return Bool the function executed correctly. | function sellDrago(uint256 _amount)
external
nonReentrant
hasEnough(_amount)
positiveAmount(_amount)
minimumPeriodPast
returns (bool success)
{
uint256 feeDrago;
uint256 feeDragoDao;
uint256 netAmount;
uint256 netRevenue;
(f... | 5,350,106 |
// File contracts/general/Ownable.sol
pragma solidity ^0.6.6;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*
* @dev We've added a second owner to share control of the timeloc... | Owner may change how much of the AUM should be saved in reserve each period. _reserveAmount The amount of wNXM (in token Wei) to reserve each period./ | function changeReserveAmount(uint256 _reserveAmount)
external
onlyOwner
{
reserveAmount = _reserveAmount;
}
| 6,135,516 |
./full_match/5/0xAd2580AaD69F1E09A50c2f84393F2c69412CF6E2/sources/contracts/Contract.sol | Set MAX WALLET Amount Set MAX WALLET Amount in Token | function setMaxWalletAmount(uint256 newValue) external onlyOwner {
require(newValue != maxWalletAmount, "Ares Token: Cannot update maxWalletAmount to same value");
emit MaxWalletAmountChange(newValue, maxWalletAmount);
maxWalletAmount = newValue;
}
| 1,878,887 |
./full_match/97/0xEb4a5eaF8B27EA6b7E282d706Db90e536d9558DC/sources/BDdbtest.sol | uint256 feeApplicable = pair == recipient ? totalFeeIfSelling.add(progTaxFee) : totalFee; mainnet | function takeFee(address sender, address recipient, uint256 amount) internal returns (uint256) {
uint256 progTaxFee = brokeSec.applyTax(sender);
uint256 feeAmount = amount.mul(feeApplicable).div(100);
gfCounter = gfCounter + amount.mul(growthFee).div(100);
_balances[address... | 3,262,667 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.2;
//import "hardhat/console.sol";
abstract contract ERC20 {
function balanceOf(address a) public view virtual returns (uint256);
}
contract Vinyl {
address admin_address;
uint256 public totalEarned; //amount due to store owner
uint256 public nu... | change an order to in progress, taking paymentadd amount paid plus differential boost amount to earned stack | function setShipped(uint32[] memory oids) public requireAdmin {
for (uint i=0;i<oids.length;i++) {
uint32 oid = oids[i];
if (oid >= numOrders) continue;
if(orders[oid].state != 0) continue;
totalEarned += orders[oid].paidAmount;
totalEarned += orders[oid].boostAmount;
emit eS... | 12,730,651 |
pragma solidity 0.4.24;
// @title SafeMath
// @dev Math operations with safety checks that throw on error
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function sub(uint256 a, uint256 b) inter... | Treat 2^256-1 means unlimited allowance | function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3 * 32) returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
uint256 _allowance = allowed[_from][msg.sender];
require(_value <= _allowance);
if (_allo... | 1,210,995 |
//Address: 0xe7cbf5437d084067f64fed612b9ac025c9e962b0
//Contract name: RICHToken
//Balance: 0 Ether
//Verification Date: 9/15/2017
//Transacion Count: 5
// CODE STARTS HERE
pragma solidity ^0.4.6;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function... | Transfer ownership to `_newOwner` _newOwner The address of the account that will become the new owner/ | function transferOwnership(address _newOwner) onlyOwner {
owner = _newOwner;
}
| 1,019,737 |
/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./Whitelist.sol";
// AliumToken - deflationary, upgradeable token.
contract AliumToken is ERC20, Whitelist {
uint256 public constant SYSTEM_DECIMAL = 10_000;
address public devFeeTo;
... | _percent depended on SYSTEM_DECIMAL | function setBurnFee(uint256 _percent) external onlyOwner {
require(_percent + devFee <= SYSTEM_DECIMAL / 2, "SYSTEM_DECIMAL overset");
burnFee = _percent;
emit BurnFeeChanged(_percent);
}
| 13,017,393 |
./full_match/137/0x95AA4a5081D12d33010DA0dd3fCa0281e53efb34/sources/contracts/FakeERC20.sol | See {IERC20-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
) public virtual returns (bool) {
return false;
}
| 4,682,393 |
./full_match/421613/0xB64ADf55Cdd9Bf0b3a3A8B7cfD9a124295A2e339/sources/contracts/Arcade.sol | I should probably emit an event when game result is submitted... that will allow for front-end to wait for the event, and update data (like total pool value, leaderboard) when this happensUPDATE THIS TO: token.balanceOf(_userAddress) > 0 && token.allowance(_userAddress,address(this))arcadeTokensAvailable[_userAddress] ... | function submitGameResult(
string memory _game,
address _userAddress,
uint256 _score
) public isWhitelisted(_userAddress) isGameSubmittooor(msg.sender) {
require(
playToken.balanceOf(_userAddress) >= costOfPlaying,
"You need to buy Arcade tokens!"
... | 11,574,073 |
pragma solidity ^0.4.6;
/**
* @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... | Sends an mail to the specific list of recipients with amount of MAIL tokens to spend on them, hash message, time unti when is message available and tokens _to List of recipients _weight Tokens to be spent on messages _hashedMessage Hashed content of mail _validUntil Mail is available until this specific time when w... | function sendMail(address[] _to, uint256 _weight, bytes32 _hashedMessage, uint256 _validUntil, bytes32 _attachmentToken, uint256 _attachmentAmount) {
bool useFreeTokens = false;
if (_weight == 0 && freeToUseTokens > 0) {
_weight = _to.length;
useFreeTokens = true;
}
... | 13,006,035 |
pragma solidity ^0.8.9;
// SPDX-License-Identifier: Unlicensed
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol";
import "@openzeppelin/contracts/t... | Required override for _beforeTokenTransfer because both ERC20Pausable and ERC20 have the same function, so the derived contract must override it from Address of the sender to Address of the recipient amount Amount of Cosmic to transfer/ | function _beforeTokenTransfer(address from, address to, uint256 amount)
internal whenNotPaused override(ERC20, ERC20Pausable) {
super._beforeTokenTransfer(from, to, amount);
}
| 13,093,839 |
pragma solidity ^0.5.16;
import {IERC20} from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
library TransferHelper {
function safeApprove(IERC20 token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = address... | bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); | function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
(bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAI... | 2,526,456 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.