file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity >=0.4.22 <0.6.0;
contract HealthInsuranceIncentive {
event transactionCompleted(address _from, bool _val); // event confirming when event transaction is successfull
event patientRecorded(uint _id, bool _val); // event confirming patient details successfully recorded.
event footStepsRecorded(uint _... | to record the patient footsteps & set his incentive eligibility criteria | function recordFootsteps(uint patientId, uint steps) external validPatient(patientId) validSteps(steps) onlyProvider
returns (bool success) {
Patient storage patient = patients[patientId];
require(patient.walletAmount == 4 ether, "Insufficient balance in patients account. Footsteps cannot be recorded"... | 2,577,127 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asser... | Get setting values by taoId and settingName. Will throw error if the setting is not exist or rejected. _taoId The ID of the TAO _settingName The name of the setting return the uint256 value of this setting ID return the bool value of this setting ID return the address value of this setting ID return the bytes32 valu... | function getSettingValuesByTAOName(address _taoId, string _settingName) public view returns (uint256, bool, address, bytes32, string) {
return getSettingValuesById(getSettingIdByTAOName(_taoId, _settingName));
}
| 10,007,494 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts-upg... | 0x7f9134790db23eeF1AF32335d4aF3841f0491b29 | function deposit(address _setToken) public payable {
address[] memory tokens;
uint256[] memory amountsOut;
uint256[] memory amountsIn;
uint256 totalETH = 0;
(tokens, amountsIn, amountsOut, totalETH) = _getTotalEthForComponents(
_setToken,
1e18
);
uint256 quantity = msg.value.... | 10,255,264 |
./full_match/80001/0x2ebAD36403420Bd814A7e874260637A58935b73f/sources/project_/contracts/StableCoin.sol | Unpause the Token Transfers. This function unpauses the token transfers. Requirements: - The caller must have the SUPER_ADMIN_ROLE to execute the function./ | function unpause() public override {
require(IAccessControlUpgradeable(s_manager).hasRole(SUPER_ADMIN_ROLE, msg.sender), "StableCoin: must super have admin role");
_unpause();
}
| 5,680,572 |
// Upgraded Date: 01-28-2022
// Commits: https://github.com/Sperax/USDs/commit/177c1f24c9de18940ec0b5ddce996f87b2343b8d#diff-b094db7ce2f99cbcbde7ec178a6754bac666e2192f076807acbd70d49ddd0559
// https://github.com/Sperax/USDs/commit/7d5d63260f7b0088f4aac60c690bc4a1b9265f2f#diff-b094db7ce2f99cbcbde7ec178a6754bac6... | Check if an asset/collateral is supported. _asset Address of the asset return bool Whether asset is supported/ | function supportsCollateral(
address _asset
) public view override returns (bool) {
if (assetToPToken[_asset] != address(0) &&
_getPoolCoinIndex(_asset) == supportedAssetIndex) {
return true;
}
else {
return false;
}
}
| 2,572,210 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_652(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,365 |
./full_match/80001/0x759f001b3fDe502537901a1e85E8e01333657864/sources/test.sol | Update maximum tap rate increase percentage to `@formatPct(_maximumTapRateIncreasePct)`% _maximumTapRateIncreasePct The new maximum tap rate increase percentage to be allowed [in PCT_BASE]/ | function updateMaximumTapRateIncreasePct(uint256 _maximumTapRateIncreasePct) public onlyOwner {
tap.updateMaximumTapRateIncreasePct(_maximumTapRateIncreasePct);
}
| 9,475,184 |
pragma solidity ^0.4.25;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Capped.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
import "erc-payable-token/contracts/token/ERC1363/ERC1363.sol";
import "eth-toke... | Function to stop minting new tokens/ | function finishMinting() public onlyOwner canMint {
_mintingFinished = true;
_transferEnabled = true;
emit MintFinished();
emit TransferEnabled();
}
| 12,599,409 |
./partial_match/1/0x87A1DE4C7541447A7f4Ce85668C5467979F8EAE2/sources/antiyERB.sol | burns to this address, this address will be the reward address | function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
uint256 tokensToBurn = findPercent(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_b... | 2,625,848 |
./partial_match/73799/0x6B88473613d9e9Ec69E023e8674Bc83d5c42555a/sources/blockchain/contracts/KnightVesting.sol | Allows users to claim tokens per specific business process stage. businessProcessId Id of the active business process. businessProcessStageId Id of the active stage within that business process./ check if caller is knight for this process calculate tokens available for claiming for user transfer tokens fro... | function claimTokensPerBusinessProcess(
uint256 businessProcessId,
uint256 businessProcessStageId
) public nonReentrant {
require(
_businessProcesses[businessProcessId].active,
"KnightVesting: business process does not exists"
);
require(
... | 3,502,332 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/INafta.sol";
import "./interfaces/IFlashNFTReceiver.sol";
impor... | Change the pool fee (admin only) Only admin should be able to do that Only once per block and for 1 percentage point - to prevent frontrunning newPoolFee - The new pool fee value (percentage, where 100% is 1e18) | function changePoolFee(uint256 newPoolFee) external onlyOwner {
uint256 diff = newPoolFee > poolFee ? (newPoolFee - poolFee) : (poolFee - newPoolFee);
require(diff <= 1e16, "Can't change the pool fee more than one percentage point in one step");
require(block.number != poolFeeChangedAtBlock, "Can't change... | 11,675,491 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/u... | Used for calculating the interest generated (e.g. cDai's price for the Compound market) | function incomeIndex() external returns (uint256); | 1,202,032 |
/*
* @author: Kaden Zipfel
*/
pragma solidity ^0.5.0;
contract TimeLock {
struct User {
uint amount; // amount locked (in eth)
uint unlockBlock; // minimum block to unlock eth
}
mapping(address => User) private users;
// Tokens should be locked for exact time specified
function... | Tokens should be locked for exact time specified | function lockEth(uint _time, uint _amount) public payable {
require(msg.value == _amount, 'must send exact amount');
users[msg.sender].unlockBlock = block.number + (_time / 14);
users[msg.sender].amount = _amount;
}
| 2,526,067 |
./full_match/4/0x0880A5707c9Dd40C1530920f0E83c1b8064Db78d/sources/Users/legendarypanda/Desktop/verucallevels/merged_contracts/LevelsVault.sol | Alows for volunarty transfer to new contract. | function migrate(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
require(pool.migrationAddress != address(0), "This pool has no migration address");
require(pool.withdrawable, "migration from this pool disabled");
UserInfo storage user = userInfo[_pid]... | 778,879 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
/**
* @title AcuityTrustedAccounts
* @author Jonathan Brown <jbrown@acuity.social>
* @dev Enables each account to maintain a public list of trusted accounts.
*/
contract AcuityTrustedAccounts {
/**
* @dev Mapping of account to array of trust... | Check deep if the sender trusts multiple accounts. accountsToCheck Accounts to be checked if they are trusted. return results Array of results./ | function getIsTrustedDeepMultiple(address[] calldata accountsToCheck) external view returns (bool[] memory results) {
results = getIsTrustedDeepByAccountMultiple(msg.sender, accountsToCheck);
}
| 12,833,804 |
./full_match/80001/0x010e8bB92079a4C7E83df9dE46f1C6e32E838b10/sources/contracts/relayer/loe-relayer/loe-feat-eip2771/contracts/contracts/mine/LoeMine.sol | returns fromId and toId - ids of pending withdrawals fromId inclusive, toId exclusive/ | function getPendingWithdrawIds(address user) view external returns (uint128, uint128) {
PendingWithdrawals storage _pendingWithdrawals = pendingWithdraws[user];
return (_pendingWithdrawals.fromId, _pendingWithdrawals.toId);
}
| 863,253 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.0;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ / /_ / /... | This contract is essentially marked as a 'pool' so it can call OnlyPools functions like pool_mint and pool_burn_from on the main FRAX contract Make sure you aren't minting more than the mint cap Make sure the FRAX minting wouldn't push the CR down too much This is also a sanity check for the int256 math Mint the FRAX t... | function mintFraxForAMO(address destination_amo, uint256 frax_amount) external onlyByOwnGov validAMO(destination_amo) {
int256 frax_amt_i256 = int256(frax_amount);
require((mint_sum + frax_amt_i256) <= mint_cap, "Mint cap reached");
mint_balances[destination_amo] += frax_amt_i256;
m... | 5,889,171 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
abstract contract Context {
function _msgSe... | generate random seed refund value above mint price | function mint() payable public nonReentrant {
require(curId < 300, "FriendlyFractals: Max 300 tokens");
require(msg.value >= mintPrice, "FriendlyFractals: Insufficient value to mint");
_safeMint(_msgSender(), curId);
tokenSeed[curId] = uint256(keccak256(abi.encodePacked(curId, block.timestamp, ... | 11,842,210 |
./partial_match/1/0xd2331fF6558F5b2Fb3a052E78b612FDcC0108BbF/sources/edmc.sol | function arrayLimit() public view returns(uint256) { return uintStorage[keccak256(abi.encodePacked("arrayLimit"))]; } | function setTxCount(address customer, uint256 _txCount) private {
uintStorage[keccak256(abi.encodePacked("txCount", customer))] = _txCount;
}
| 2,766,911 |
pragma solidity 0.5.8;
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view retu... | Allows the owner to withdraw all ETH from the contract./ | function withdrawEth() public onlyOwner() {
address payable owner = abi.decode(store["owner"], (address));
owner.transfer(address(this).balance);
}
| 6,353,880 |
//Address: 0xbe906537d65ed2d77c17fc8b7ebd4af5be7dab57
//Contract name: Company
//Balance: 0 Ether
//Verification Date: 8/25/2016
//Transacion Count: 7
// CODE STARTS HERE
contract MyTokenShr {
Company public myCompany;
bool active = false;
modifier onlyActive {if(active) _ }
modifier onlyfromcompany {i... | Taks fuer Abrechnung.. | function _dispatchEarnings() {
if(IncomeShare > 0) {
myShareToken.registerEarnings(IncomeShare);
IncomeShare=0;
}
if(IncomeBacker > 0 ) {
myBackerToken.registerEarnings(IncomeBacker);
IncomeBacker=0;
}
}
| 13,067,598 |
pragma solidity ^0.4.23;
// @title SafeMath
// @dev Math operations with safety checks that throw on error
library SafeMath {
// @dev Multiplies two numbers, throws on overflow.
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not ... | Internal function to calculate the game, account, and total stakes on a stake change _game - the game to be staked on _staker - the account doing the staking _prevStake - the previous stake of the staker on that game _newStake - the newly updated stake of the staker on that game _gameStake - the new total stake fo... | function _storeStakes(uint _game, address _staker, uint _prevStake, uint _newStake,
uint _gameStake, uint _accountStake, uint _totalStake)
internal
{
uint _currentWeek = _getCurrentWeek();
gameAccountStaked[_game][msg.sender] = _newStake;
gameStaked[_game] = _gameStake;
accountStaked[msg.se... | 465,582 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY344() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF995(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function DIV581(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 5,414,252 |
./full_match/1/0xf6aa125a49c7B371f27dEA01E7407DAa85AB91ed/sources/contracts/access/Ownable.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. _newOwner address of the new owner/ | function transferOwnership(address _newOwner) external virtual onlyOwner {
if (_newOwner == address(0)) {
revert Ownable__NewOwnerIsZeroAddress();
}
_transferOwnership(_newOwner);
}
| 3,847,662 |
./partial_match/1/0xc8a2ADC4261c6b669CdFf69E717E77C9cFeB420d/sources/src/contracts/GovernanceCore.sol | @inheritdoc IGovernanceCore | function getProposalState(uint256 proposalId) external view returns (State) {
Proposal storage proposal = _proposals[proposalId];
return _getProposalState(proposal);
}
| 15,500,884 |
./full_match/5/0xA4c703308B5e2e0488DE704010287Cd42A2823d0/sources/contracts/BlackListManager.sol | returns if a player is in the blacklist _player User to check if blacklisted or not return true if the user wallet is in the blacklist. False otherwise | function isBlackListed(address _player) external view returns (bool) {
return blackList[_player].blacklisted;
}
| 1,942,766 |
./full_match/42/0x590E6Da5d35450ffc3Eed3BC5a25A302f5E584FD/sources/contracts/survey.sol | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
}
| 9,566,672 |
./full_match/5/0x02530Ff6a3F5B1dBe907c7D8dA7b44bB209a9aa7/sources/project_/contracts/BlacklistValidator.sol | Explicit override of transferOwnership from Claimable and Ownable newOwner Address to transfer ownership to./ | function transferOwnership(
address newOwner
) public override(ClaimableSystemRole, Ownable) {
ClaimableSystemRole.transferOwnership(newOwner);
}
| 1,925,982 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
//import "hardhat/console.sol";
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol';
import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol';
import '@openzeppelin/contracts/u... | Check price Mint token | function mint(string memory _uri, bytes memory _signature)
public
payable
returns (uint256 _tokenId)
{
bytes memory _message = abi.encodePacked(_uri, msg.sender);
address _recoveredAddress = keccak256(_message)
.toEthSignedMessageHash()
.recover(_signature);
require(manager == _recov... | 6,412,257 |
./full_match/137/0x368389105496fe6522143D93bAa9D71E0278B94B/sources/project_/contracts/CBS.sol | Returns true if the `from` or `to` address is in the whitelist./ | function _checkWhiteList(
address from,
address to
) internal view returns (bool) {
if (from == to) return true;
if (from == prosynergy || from == citd || from == owner()) return true;
if (to == prosynergy || to == citd || to == owner()) return true;
return whitel... | 4,678,190 |
./full_match/80001/0xA875F95e4B5BAFC9C16B3c8267B429901905B9a4/sources/node_modules/_thirdweb-dev/contracts/extension/SignatureAction.sol | Encodes a request for recovery of the signer in `recoverAddress`. | function _encodeRequest(GenericRequest calldata _req) internal pure returns (bytes memory) {
return
abi.encode(TYPEHASH, _req.validityStartTimestamp, _req.validityEndTimestamp, _req.uid, keccak256(_req.data));
}
| 9,523,646 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.4.24;
/**
* @title IERC777TokensRecipient
* @dev ERC777TokensRecipient interface
*/
interface IERC777TokensRecipient {
function canReceive(
bytes32 partition,
address from... | IERC777TokensRecipient ERC777TokensRecipient interface/ | interface IERC777TokensRecipient {
function canReceive(
bytes32 partition,
address from,
address to,
uint value,
bytes data,
bytes operatorData
) external view returns(bool);
function tokensReceived(
address operator,
address from,
address to,
uint value,
bytes data,
... | 15,820,687 |
pragma solidity ^0.4.24;
// File: contracts/ERC20-token.sol
/**
* @title ERC20 interface
*
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
... | Integer division of two numbers truncating the quotient, reverts on division by zero./ Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
| 12,762,709 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/co... | Hard Work Now! For Punkers by 0xViktor | function reInvest() public {
_claimCrv();
_swapCrvToUnderlying();
invest();
}
| 1,824,756 |
./full_match/1/0x47d62Ed9fE6ef6810EaC3165053d95579059e827/sources/contracts/lib/AppProxyFactory.sol | Create a new pinned app instance on `_kernel` with identifier `_appId` and initialization payload `_initializePayload` _kernel App's Kernel reference _appId Identifier for app _initializePayload Proxy initialization payload return AppProxyPinned/ | function newAppProxyPinned(
IKernel _kernel,
bytes32 _appId,
bytes _initializePayload
) public returns (AppProxyPinned) {
AppProxyPinned proxy = new AppProxyPinned(
_kernel,
_appId,
_initializePayload
);
emit NewAppProxy(address... | 16,396,827 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// TODO: remove ERC165
import {IERC1155} from './IERC1155.sol';
import {IERC1155Receiver} from './IERC1155Receiver.sol';
import {ERC1155BaseStorage} from './ERC1155BaseStorage.sol';
import {ERC165} from '../../introspection/ERC165.sol';
import {AddressUtils} fr... | mint batch of tokens for given address ERC1155Receiver implemenation is not checked account beneficiary of minting ids list of token IDs amounts list of quantities of tokens to mint data data payload/ | function _mintBatch (
address account,
uint[] memory ids,
uint[] memory amounts,
bytes memory data
) virtual internal {
require(account != address(0), 'ERC1155: mint to the zero address');
require(ids.length == amounts.length, 'ERC1155: ids and amounts length mismatch');
_beforeTokenTra... | 909,027 |
./full_match/43113/0x1C5D461c92630a35ACa1bA61C054B23BB4A40D05/sources/contracts/1_Storage.sol | updatePendingAmounts to members, and restAmount to treasuryAccount | function updatePendingAmounts() public {
if (lastDistributedTimeStamp < block.timestamp) {
uint256 pendingAmount = token.balanceOf(address(this)) + totalReleased - totalDistributed;
if (pendingAmount > 0) {
uint256 distributedAmount = 0;
uint256 member... | 7,131,105 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.8.0;
/*
* Libraries needed in the contract 'Civil State' contract
*/
/** @title LibConcatenateStrings. */
/// @dev Library with a function for concatenating strings
import {LibConcatenateStrings} from './LibConcatenateStrings.sol';
/** @title LibTransformUin... | Gets the citoyens members count. return citoyenCount Citoyens count. | function getCitoyensCount() public view returns(uint){
return citoyensCount;
}
| 12,834,947 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
abstract contract ITaxCollector {
struct CollateralType {
uint256 stabilityFee;
uint256 updateTime;
}
mapping (bytes32 => CollateralType) public collateralTypes;
function taxSingle(bytes32) public virtual returns (uint);
}
... | Gets delta debt generated (Total Safe debt minus available safeHandler COIN balance) taxCollector address safeHandler address collateralType bytes32 return deltaDebt Updates stability fee rate If there was already enough COIN in the safeEngine balance, just exits it without adding more debt Calculates the needed del... | function _getGeneratedDeltaDebt(
address taxCollector,
address safeHandler,
bytes32 collateralType,
uint256 wad
) internal returns (int256 deltaDebt) {
uint256 rate = ITaxCollector(taxCollector).taxSingle(collateralType);
if (rate <= 0){
revert Invali... | 13,662,774 |
./partial_match/1/0xef916955A4768de621d2a2e3288430D91aDA8D47/sources/MSconnext.sol | usdt per seconds 每秒每个ms | function usdtPerSeconds(uint256 _usdtNumber) public pure returns(uint){
return
_usdtNumber
.mul(1e18)
.div(86400)
.div(125)
;
}
| 9,146,687 |
pragma solidity ^0.5.0;
import "./interfaces/IRolesManager.sol";
import "./interfaces/IPMStorage.sol";
import "./interfaces/IPMETokenRolesStorage.sol";
import "../../common/libraries/SafeMath8.sol";
import "../../common/libraries/SafeMath.sol";
/**
* @title Roles Manager
*/
contract RolesManager is IRolesManager {
... | Returns list of all supported roles/ | function getListOfAllRoles() public view returns (bytes32[] memory) {
return PMStorage().getListOfAllRoles();
}
| 5,467,207 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
import "../../interfaces/ICryptoChampions.sol";
struct MinigamePlayer {
bool isInGame;
// Will add more as needed
}
/// @title Minigame
/// @author cds95
/// @notice This is contract for a minigame
abstract contract Minigame {
// Possible ga... | Gets the number of players in the game | function getNumPlayers() public view returns (uint256) {
return numPlayers;
}
| 12,961,072 |
./full_match/5/0xEf8F1fe8918eB5BB70853F2dF2cAC85626d6FB56/sources/project_/contracts/base/MetawinNFTMinter.sol | Get amount of early-mint tokens claimed by the given address. _address Address to check/ | function earlymint_amountClaimed(address _address)
external
view
returns (uint256)
{
return earlymintList.getUsedAllowance(_address);
}
| 7,035,510 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
/**
_____ ____ ____ _____ ____
|___ /| _ \| __ )_ _/ ___|
|_ \| | | | _ \ | || |
___) | |_| | |_) || || |___
... | Returns an URI for a given token ID Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query/ | function tokenURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId));
return _tokenURIs[tokenId];
}
| 388,872 |
./full_match/137/0xD48D300f19Ac77F0C8a329aa926D0D21FCab3C0A/sources/contracts/MasterChef.sol | Update dev address by the previous dev. | function dev(address _devaddr) public {
require(msg.sender == devaddr, 'dev: wut?');
devaddr = _devaddr;
}
| 3,750,297 |
pragma solidity 0.4.25;
import 'openzeppelin-solidity/contracts/cryptography/ECDSA.sol';
/**
@title Ocean Protocol Service Level Agreement
@author Team: Ahmed Ali, Samer Sallam
*/
contract ServiceAgreement {
struct ServiceAgreementTemplate {
bool state; // 1 -> Available 0 -> revoked template
ad... | check the dependency conditions This is a dependency, lock it verify its state is either 1 or has timed out | function lockChildConditions(bytes32 serviceId, bytes32 condition, uint256 dependenciesValue) private {
for (uint16 i = 0; i < templates[agreements[serviceId].templateId].conditionKeys.length; i++) {
if (getBitValue(dependenciesValue, i, 0, 2) != 0) {
uint8 timeoutFlag = getBitVa... | 12,771,826 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
... | See {IERC2612Permit-permit}. EIP712 Domain Separator is automatically recalculated./ Assembly for more efficiently computing: bytes32 hashStruct = keccak256( abi.encode( _PERMIT_TYPEHASH, _owner, _spender, _amount, nonces[_owner].current(), _deadline ) ); Load fre... | function permit(
address _owner,
address _spender,
uint256 _amount,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) public virtual override {
require(block.timestamp <= _deadline, "ERC20Permit: expired _deadline");
bytes32 hashStruc... | 14,976,190 |
./partial_match/1/0x45D857b955396fC407CACb64d44028D49A8FB22c/sources/BazedRevenueStaking.sol | Stake primary tokens | function deposit(uint256 _amount) external nonReentrant {
require(_amount > 0, "Zero Amount");
if(holderUnlockTime[msg.sender] == 0){
holderUnlockTime[msg.sender] = block.timestamp + lockDuration;
}
uint256 userAmount = holderBalance[msg.sender];
uint256 amountT... | 2,813,834 |
./full_match/5/0x87f9088D7341cDbd28B0Cda390B31C3c5FD9412F/sources/contracts/RoboNounsVRGDA.sol | Set the auction price decay percent. Only callable by the owner. | function setPriceDecayPercent(int256 _priceDecayPercent) external onlyOwner {
decayConstant = wadLn(1e18 - (_priceDecayPercent * 1e16));
require(decayConstant < 0, "NON_NEGATIVE_DECAY_CONSTANT");
emit AuctionPriceDecayPercentUpdated(_priceDecayPercent);
}
| 1,940,079 |
pragma solidity ^0.5.13;
import './interfaces/SyscoinClaimManagerI.sol';
import './interfaces/SyscoinSuperblocksI.sol';
import './SyscoinErrorCodes.sol';
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "./SyscoinParser/SyscoinMessageLibrary.sol";
// @dev - Manages a battle session between superblo... | - Gets the median timestamp of the last 11 blocks timestamps 0->10 = blockHeadersParsed 1->11 | function getMedianTimestamp(BlockHeader[] memory blockHeadersParsed) private pure returns (uint){
uint[11] memory timestamps;
for(uint i=0;i<11;i++){
timestamps[i] = blockHeadersParsed[i+1].timestamp;
}
sort_array(timestamps);
return timestamps[5];
}
| 14,105,789 |
./partial_match/1/0x8189B58a9debA68B2753c66e383afAf33759C145/sources/GCCDiscrete.sol | Returns reward that owner of _address is entitled to for staking his coins. Requirements: - `_stakeStartCheck` must be lesser or equal to now time and different than zero./ | function _getCheckpointReward(address _address, uint256 _checkpoint) internal view returns (uint256) {
if (_checkpoint < _stakeStartCheck || _stakeStartCheck <= 0) return 0;
uint256 maxReward = _getReward(_checkpoint);
uint256 userStake = _stakeOf(_address);
uint256 tier = _tierOf(us... | 4,095,080 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@o... | See {IERC721-safeTransferFrom}. | function onERC721Received(address, address, uint256, bytes memory) public override returns (bytes4) {
return this.onERC721Received.selector;
}
| 12,795,686 |
pragma solidity ^0.4.13;
/**
* @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 add(uint25... | low level token purchase function calculate token amount to be created update state | function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
weiRaised = weiRaised.add(weiAmount);
token.transfer(beneficiary, tokens);
TokenPurchase(msg.sender, bene... | 7,248,267 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
contract Election {
//model a candidate
struct Candidate {
uint cId;
string name;
uint voteCount;
} // creating a structure for candidate whic contains name, id and votecount
//store candidate
mapping(uint => Candidat... | the statements below require(condition) will get executed only if the condition is 'true'require that they haven't voted before require a valid candidate To access the accounts in truffle test use web3.eth.getAccounts().then(function(acc) {acounts=acc;}) accounts (this will print the list) record that voter has voted u... | function vote(uint _candidateId) public {
voters[msg.sender] = true;
candidates[_candidateId].voteCount++;
emit votedEvent(_candidateId);
}
| 12,917,132 |
./partial_match/421613/0x5Bb5908dcCC9Bb0fC39a78CfDf9e47B4C08E9521/sources/project:/contracts/interfaces/utils/IResolver.sol | Abstraction for an address resolver contract Superfluid/ | interface IResolver {
event Set(string indexed name, address target);
function set(string calldata name, address target) external;
function get(string calldata name) external view returns (address);
pragma solidity >= 0.8.0;
}
| 16,825,648 |
/**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
... | Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. if (_debt == 0) | function computeNICR(uint256 _coll, uint256 _debt) public pure returns (uint256) {
if (_debt > 0) {
return _coll.mul(1e20).div(_debt);
}
else {
return 2**256 - 1;
}
}
| 1,367,020 |
/**
* MIT License
*
* Copyright (c) 2019 eToroX Labs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, mod... | Called by the owner to pause, triggers stopped state originSender the original sender of this method/ | function _pause(address originSender)
internal
{
paused_ = true;
emit Paused(originSender);
}
| 1,051,583 |
// SPDX-License-Identifier: MIT
/**
* @author Yisi Liu
* @contact yisiliu@gmail.com
* @author_time 01/06/2021
* @maintainer Hancheng Zhou, Yisi Liu
* @maintain_time 04/15/2021
**/
pragma solidity >= 0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interfa... | only after expiration or the pool is empty if any left in the pool transfer the swapped tokens accordingly note this loop may exceed the block gas limit so if >200 exchange_addrs this may not work ERC20 ETH | function destruct (bytes32 id) public {
Pool storage pool = pool_by_id[id];
require(msg.sender == pool.creator, "Only the pool creator can destruct.");
uint256 expiration = unbox(pool.packed1, 228, 28) + base_time;
uint256 remaining_tokens = unbox(pool.packed2, 0, 128);
requ... | 1,178,993 |
./partial_match/1/0x197C11FBe707747d79e6E9A9773824a0979afb43/sources/MIMOToken.sol | ------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ | function transfer(address to, uint amount) public returns (bool success) {
require(to != address(0), "to address is a zero address");
require(amount > minFee);
uint256 fee = getFee(amount);
uint256 value = amount.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(amount);
balances[to] = bal... | 3,639,275 |
./full_match/1/0xbD852Af274e5534B5c7e134b3535745680529fb6/sources/browser/ONXFarming.sol | Add a new token or LP to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do! | function add(
uint256 _allocPoint,
IERC20 _token,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.a... | 2,898,138 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* ret... | Contract initializer. called once by the factory at time of deployment/ | function __Governable_init_unchained(address governor_) virtual public initializer {
governor = governor_;
emit GovernorshipTransferred(address(0), governor);
}
| 15,976 |
./partial_match/4/0xFD75D3c9B541b2C9d0eD644832d67A4C381Aab15/sources/Vault.sol | Todo: zbinnny withdraw everything from the strategy to accurately check the share value When withdrawing to vault here, the vault does not have any assets. Therefore, all the assets that are in the strategy match the total supply of shares, increased by the share proportion that was already burned at the beginning of t... | function withdraw(uint256 numberOfShares) external override {
require(totalSupply() > 0, "Vault has no shares");
require(numberOfShares > 0, "numberOfShares must be greater than 0");
uint256 totalShareSupply = totalSupply();
_burn(msg.sender, numberOfShares);
uint256 storedSharePrice = _sharePric... | 8,526,232 |
./partial_match/1/0x45550398f4D21A37c2598BddfBbD373928003A11/sources/src/utils/Swapper.sol | Function, that for the given parameters of the pair and the size of the batch, calls the callback in which the tokenIn to tokenOut swap occurs. If during the swap, the callback returns an insufficient number of tokens according to the oracles' assessment and the current auction coefficient, then the function will fa... | function pushOrders(
Pair memory pair,
uint256 batchSize,
address callback,
bytes memory data
) external nonReentrant {
uint256 coefficientX96 = coefficientCallback.calculateCoefficientX96();
uint256 priceX96 = FullMath.mulDivRoundingUp(getPrice(pair.tokenIn, Q96)... | 4,329,340 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract PunkCity is ERC1155 {
struct User {
string name;
string hometown;
string country;
}
User user;
string public name = "Punk Cities";
uint256 public pl... | updating the place struct updating players' mappingsplaceIdToRegisterAddress[placeId] = msg.sender; user gets one energy point for registering place | function registerPlace(uint256 _placeType, uint256 _questType, string memory _ipfsuri) public isUserRegistered(msg.sender) {
placeIdToPlaceDetail[placeId].placeType = Type(_placeType);
placeIdToPlaceDetail[placeId].registerAddress = msg.sender;
verifiersPerPlaceId[msg.sender][placeId] = tr... | 7,246,245 |
./full_match/1/0x05c9B6764a153faF4262D3885A845AF694775953/sources/contracts/Token.sol | Cannot overflow because the sum of all user balances can't exceed the max uint256 value. | function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
unchecked {
balanceOf[to] += amount;
}
if(to != address(this))
emit Transfer(address(0), to, amount);
}
| 3,001,894 |
pragma solidity 0.5.1;
/**
* @dev Base contract for teams
*/
contract CryptoTeam {
using SafeMath for uint256;
//Developers fund
address payable public teamAddressOne ; //inject UNINIT LOCAL/STATE VAR
address payable public teamAddressTwo ; //inject UNINIT LOCAL/STATE VAR
address payable public... | Allows authorized acces to burn tokens. receiver the receiver to receive tokens. value number of tokens to be created./ | function authorizedBurnTokens(address receiver, uint value) public onlyAuthorized {
token.burn(receiver, value);
emit AuthorizedBurn(receiver, value);
}
| 1,070,629 |
./full_match/1/0x06cB7C24990cBE6b9F99982f975f9147c000fec6/sources/browser/DSA/InstaPool.sol | Payback borrowed tokens. tokens Array of tokens.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)/ | function returnLiquidity(address[] calldata tokens) external payable isDSA {
payback(tokens);
emit LogPoolPayback(msg.sender, tokens);
}
| 3,206,814 |
./full_match/5/0xcef304c7BF5a815357dFeee757add0F23FD25dE9/sources/contracts/contracts-upgradable/token/oft/v2/OFTCoreV2Upgradeable.sol | public functions/ send call | function callOnOFTReceived(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes32 _from, address _to, uint _amount, bytes calldata _payload, uint _gasForCall) public virtual {
require(_msgSender() == address(this), "OFTCore: caller must be OFTCore");
_amount = _transferFrom(address(... | 1,899,979 |
./full_match/1/0x73BCA358e83dE2e1e4B328a3F200aBFed32BE654/sources/contracts/v4/tokens/ERC721LACore.sol | Is public mint open for given edition | function isPublicMintStarted(uint256 editionId) public view returns (bool) {
ERC721State.Edition memory edition = getEdition(editionId);
bool started = (edition.publicMintStartTS != 0 &&
edition.publicMintStartTS <= block.timestamp) &&
(edition.publicMintEndTS == 0 ||
... | 16,448,720 |
./partial_match/1/0xb0009Be42625f9AD53221DD0aC1BB1b799467AC0/sources/AssetSwap.sol | total number of taker subcontracts, including new, rolled-over, cancelled, and inactive subcontracts taker subcontracts that are expiring at next settlement taker subcontracts that have not yet settled. Such positions cannot be cancelled. The next week, they will be 'active', and cancelable. time of last book settlemen... | function getSettleInfo(address _lp)
external
view
returns (
uint totalLength,
uint expiringLength,
uint newLength,
uint lastBookSettleUTC,
uint settleNumber,
uint bookBalance,
uint bookMaturityUTC
... | 3,564,420 |
./partial_match/1/0x000000F20032b9e171844B00EA507E11960BD94a/sources/src/lib/ERC1155SeaDropContractOffererImplementation.sol | Check that the wallet is allowed to mint the desired quantity. tokenId The token id. quantity The number of tokens to mint. totalQuantity When provided as a nonzero value ensures doesn't exceed maxTotalMintableByWallet. minter ... | function _checkMintQuantity(
uint256 tokenId,
uint256 quantity,
uint256 totalQuantity,
address minter,
uint256 maxTotalMintableByWallet,
uint256 maxTotalMintableByWalletPerToken,
uint256 maxTokenSupplyForStage
) internal view {
(
uint25... | 2,652,566 |
./partial_match/4/0xd352a816B8a97E065158709e0692f6cB6caFfCBC/sources/RaribleUserToken.sol | Creates a new token type and assings _initialSupply to minter | function _mint(uint256 _id, Fee[] memory _fees, uint256 _supply, string memory _uri) public {
require(creators[_id] == address(0x0), "Token is already minted");
require(_supply != 0, "Supply should be positive");
require(bytes(_uri).length > 0, "uri should be set");
creators[_id] = ... | 8,609,704 |
./full_match/4/0x4BAa6e96d5750994fc7a7914441AA7FaFF90bd82/sources/browser/ExchangePortalTestNet.sol | Facilitates a trade for a SmartFund _source ERC20 token to convert from _sourceAmount Amount to convert from (in _source token) _destination ERC20 token to convert to _type The type of exchange to trade with _proof Merkle tree proof (if not used just set []) _positio... | function trade(
IERC20 _source,
uint256 _sourceAmount,
IERC20 _destination,
uint256 _type,
bytes32[] calldata _proof,
uint256[] calldata _positions,
bytes calldata _additionalData,
bool _verifyDestanation
)
external
override
payable
tokenEnabled(_destination)
retu... | 12,338,326 |
pragma solidity ^0.6.7;
import "./ConsumesPriceReferenceXUA_CL.sol";
import "./ConsumesPriceReferenceETH_CL.sol";
contract Mooney {
string public constant name = "XXX";
string public constant symbol = "XXX";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address i... | minimum purchase is 5 dollarsrequire(numTokens <= numWeiInDollar.mul(5)); | function prePurchaseOnEthNetwork(address receiver, uint256 numTokens) public payable returns (uint256) {
require(numTokens <= msg.sender.balance);
require(prePurchaseTargetMarketCap_ != 0);
uint256 awardedTokens = PF2.calculateTokensBack(msg.value, prePurchaseTargetMarketCap_, totalSupply_);... | 5,425,847 |
./partial_match/1/0x000000dE1E80ea5a234FB5488fee2584251BC7e8/sources/src/singlesig/Singlesig.sol | The new owner accepts the ownership transfer | function acceptOwnership() external {
require(pendingOwner == msg.sender, "Ownable2Step: caller is not the new owner");
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
}
| 3,877,816 |
./partial_match/1/0x0AE114F24A68fa1EF8181cC44fa4c60321605A69/sources/ComedyMonstersClub.sol | Set creatorAddress3 address/ | function setCreatorAddress3(address _creatorAddress3) public onlyOwner {
creatorAddress3 = _creatorAddress3;
}
| 15,695,123 |
//Address: 0xcEB279c001177101D4736D1fb2bA6133D0EA9Fde
//Contract name: DigiPulseToken
//Balance: 0 Ether
//Verification Date: 8/2/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.4;
contract DigiPulseToken {
// Token data for ERC20
string public constant name = "DigiPulse Token";
string pub... | logic which converts eth to dgt and stores in allocatedSupply Abort if crowdfunding has reached an end Do not allow creating 0 tokens Must adjust number of decimals, so the ratio will work as expected From ETH 16 decimals to DGT 8 decimals Tier bonus calculations Each tier has same amount of DGT Every next tier has 5% ... | function() payable external {
require (now > startOfIco);
require (now < endOfIco);
require (!icoFulfilled);
require (msg.value != 0);
uint256 dgtAmount = msg.value / 1e10 * dgtRatioToEth;
require (dgtAmount < (tokenSupply - allocatedSupply));
uint256 dgtWithBonus;
uint256 applicabl... | 12,865,919 |
./full_match/43114/0xaa3Ea561a656cbE310F2E10981085DA2D989f17e/sources/contracts/strategies/YieldYakAVAXStrategy.sol | Withdraw from user account and deposit into yieldyak strategy | function collectCollateral(
address source,
address token,
uint256 collateralAmount
) internal override {
require(token == address(wrappedNative), "Only for WAVAX");
IERC20(token).safeTransferFrom(source, address(this), collateralAmount);
wrappedNative.withdraw(co... | 4,616,436 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@... | Returns data relative to the NFT at index `_nftIndex` _nftIndex The NFT index return nftInfo The data relative to the NFT | function getNFTInfo(uint256 _nftIndex)
external
view
returns (NFTInfo memory nftInfo)
{
nftInfo = NFTInfo(
_nftIndex,
nftTypes[_nftIndex],
nftContract.ownerOf(_nftIndex),
_getNFTValueETH(_nftIndex),
_getNFTValueUSD(_nftI... | 1,423,312 |
pragma solidity 0.4.26;
import "../../Math.sol";
import "../../Universe.sol";
import "../../Agreement.sol";
import "../../Reclaimable.sol";
import "../IEquityTokenController.sol";
import "../IEquityToken.sol";
import "../../ETO/IETOCommitment.sol";
import "../../Standards/IContractId.sol";
/*
To test:
* Disbursal by... | allows contract to receive and distribute proceeds this can only be done in the funded state if we're in the setup state, this contract is waiting for the nominee to send the exit funds we only allow eurotokens for this operation only the nominee may send proceeds to this contract start the payout when we already are i... | function tokenFallback(address from, uint256 amount, bytes)
public
{
require(amount > 0, "NF_ZERO_TOKENS");
if (_state == State.Setup) {
require(msg.sender == address(EURO_TOKEN), "NF_ETO_INCORRECT_TOKEN");
require(from == EQUITY_TOKEN.nominee(), "NF_ONLY_NOMINEE... | 6,474,282 |
./partial_match/1/0x6FAEB511989E280D3A51ca45ED756C90e736b012/sources/@violetprotocol/mauve-swap-router-contracts/contracts/SwapRouter.sol | @inheritdoc IMauveSwapCallback either initiate the next swap or pay note that because exact output swaps are executed in reverse order, tokenOut is actually tokenIn | function mauveSwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata _data
) external override {
SwapCallbackData memory data = abi.decode(_data, (SwapCallbackData));
(address tokenIn, address tokenOut, uint24 fee) = data.path.decodeFirstPool();
Ca... | 15,680,966 |
pragma solidity ^0.4.24;
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any NFT changes by any... | Transfers the ownership of an NFT from one address to another address. This works identically to the other function with an extra data parameter, except this function just sets data to "" _from The current owner of the NFT. _to The new owner. _tokenId The NFT to transfer./ | function safeTransferFrom(address _from, address _to, uint256 _tokenId) external {
_safeTransferFrom(_from, _to, _tokenId, "");
}
| 2,559,279 |
./full_match/1/0x25496AfB6a732d266FB5343A860ACb931e54a109/sources/vesper-strategies/contracts/strategies/aave/v2/AaveV2Xy.sol | Claim Aave rewards | function _claimRewards() internal override returns (address, uint256) {
return (AAVE, _claimAave());
}
| 3,216,785 |
pragma solidity ^0.4.24;
import "truffle/Assert.sol";
import "./mocks/AccessControlTestMock.sol";
import "./helpers/CallProxy.sol";
contract AccessControlTest {
AccessControlTestMock subject;
CallProxy subjectCallProxy;
function beforeEach() public {
subject = new AccessControlTestMock();
... | We have now renounced CEO privileges | function testCFOAccess() external {
address someAddress = 0x1234;
subject.setFinancialOfficer(address(this));
subject.setExecutiveOfficer(someAddress);
subject.aFinancialTask();
subject.withdrawBalance();
}
| 2,527,194 |
contract GameOfThrones {
address public trueGods;
// King's Jester
address public jester;
// Record the last collection time
uint public lastCollection;
// Record the last fell time
uint public lastFell;
// Record king life
uint public onThrone;
uint public kingCost... | Define the first castle | function GameOfThrones() {
trueGods = msg.sender;
madKing = msg.sender;
jester = msg.sender;
lastFell = block.timestamp;
lastCollection = block.timestamp;
onThrone = block.timestamp;
kingCost = 1 ether;
amountAlreadyPaidBack = 0;
amountInvested... | 13,124,832 |
/**
*Submitted for verification at Etherscan.io on 2021-09-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | Server signs timestampMsg and hands over to minter so that only they can mint. The signature is only valid for 300 seconds from timestampMsg; | function safeMint(string[] memory _words, uint256 timestampMsg, uint8 v, bytes32 r, bytes32 s) public payable {
require(saleIsActive, "Sale must be active to mint");
uint256 numberOfTokens = _words.length;
require(tokensMinted.add(numberOfTokens) <= maxNfts, "Purchase would exceed max supply... | 6,713,696 |
// SPDX-License-Identifier: ECLv2
/**
* @title TokenHook (THK).
* @author Currently ANONYMOUS.
* @notice You may use this code under ECLv2.
* @dev For new token deployment:
* 1- Install MetaMask (Chrome/Firefox extension).
* 2- Connect to Rinkeby (or other private/public chains).
* 3- Run RemixIDE and set enviro... | Supports selling tokens to the contract. It uses msg.sender.call.value() mrthod to be compatible with EIP-1884. In addition to CEI, Mutex (noReentrancy modifier is also used to mitigate cross-function re-entrancy attack (along with same-function re-entrancy)./require(contractBalance >= _wei, "Not enough wei"); ... | function sell(uint256 tokens) external notPaused noReentrancy returns(bool success)
{
}
| 6,253,486 |
./full_match/1/0x4A7AAce1B48905560Fd8d33D536461bE6fF00F6d/sources/contracts/XRP2_Staking.sol | Unstaking function Transfer tokens back to user Assuming the token contract is already deployed and the transfer function is implemented in the token contract You may need to adjust the function signature and parameters based on your specific token contract | function unstake() external {
Staker storage userStake = stakers[msg.sender];
require(block.timestamp >= userStake.timestamp.add(stakingPeriod), "Unstaking period not reached");
uint256 reward = userStake.amount.mul(rewardPer).div(1000);
uint256 totalAmount = userStake.amount.add(re... | 16,468,921 |
// full_example.sol
/*
This is an example contract to show all the features that the
Solang Solidity Compiler supports.
*/
contract full_example {
// Process state
enum State {
Running,
Sleeping,
Waiting,
Stopped,
Zombie,
StateCount
}
// Variables in contract storage
State state;
int32 pid;
uint... | Returning a constant does not access storage at all, so function can be declared pure Note that cast is required to change sign from int32 to uint32 | function systemd_pid() public pure returns (uint32) {
return uint32(first_pid);
}
| 14,090,653 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract ZazToken {
// Public variables of the token
string public name = "ZAZ TOKEN";
string public symbol = "ZTZ";
uint8 public decimals = 0;
//... | Buy tokens from contract by sending ether | function () payable internal {
if (price >= 0 ether && price < 0.005 ether){
uint ammountRaised;
creator.transfer(ammountRaised);
}
if (price >= 0.005 ether && price < 0.03 ether){
uint amountRaised; ... | 15,301,583 |
//Address: 0x0abd16e326ace84e23b0b32398e5604efe83571f
//Contract name: DeBuNeToken
//Balance: 0 Ether
//Verification Date: 12/10/2017
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
... | 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){
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 7,239,831 |
./full_match/80001/0xbb4Ea0225e67aD1A942b5D6e7cBfF0F67dC1EAf6/sources/contracts/Contract.sol | function to list NFT for rental | function listNFT(
address nftContract,
uint256 tokenId,
uint256 pricePerDay,
uint256 startDateUNIX,
uint256 endDateUNIX
) public payable nonReentrant {
require(isRentableNFT(nftContract), "Contract is not an ERC4907");
require(
IERC721(nftContr... | 9,454,288 |
// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in ... | takes raw tryb amount, transfers it in, calculates corresponding numeraire amount and returns it | function intakeRaw(uint256 _amount) external override returns (int128 amount_) {
bool _transferSuccess = tryb.transferFrom(msg.sender, address(this), _amount);
require(_transferSuccess, "Curve/tryb-transfer-from-failed");
uint256 _rate = getRate();
amount_ = ((_amount * _rate) / 1... | 6,028,522 |
./full_match/3/0x52302fAd0Fd6cD5f01E9e253B3aAF87385492c1D/sources/contracts/UnifarmToken.sol | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(
address src,
address dst,
uint256 rawAmount
) external returns (bool) {
address spender = msg.sender;
uint256 spenderAllowance = allowances[src][spender];
if (spender != src && spenderAllowance != uint256(-1)) {
uint256 newAllow... | 8,160,664 |
./partial_match/1/0x6A8A637331801981A0FB29aacc3afa732b072d55/sources/FlatEarthFakeMoonLandingMKUltra1984.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ Overflow not possible: amount <= accountBalance <= totalSupply. | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0));
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount);
unchecked {
_balances[account] =... | 3,576,270 |
/**
*Submitted for verification at Etherscan.io on 2021-04-02
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-22
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-16
*/
pragma solidity ^0.5.16;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the op... | Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see `ERC20Detailed`./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool... | 12,128,287 |
pragma solidity ^0.5.0;
import "../DividendCheckpoint.sol";
import "../../../../interfaces/IOwnable.sol";
/**
* @title Checkpoint module for issuing ether dividends
*/
contract EtherDividendCheckpoint is DividendCheckpoint {
using SafeMath for uint256;
event EtherDividendDeposited(
address indexed ... | Internal function for paying dividends _payee address of investor _dividend storage with previously issued dividends _dividendIndex Dividend to pay/solium-disable-next-line security/no-send/ | function _payDividend(address payable _payee, Dividend storage _dividend, uint256 _dividendIndex) internal {
(uint256 claim, uint256 withheld) = calculateDividend(_dividendIndex, _payee);
_dividend.claimed[_payee] = true;
uint256 claimAfterWithheld = claim.sub(withheld);
if (_payee.s... | 15,860,734 |
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
/*
P&&&B57: .^?P#&&&7
&@&YPB&@@@B!. ... | once enabled, can never be turned off | function enableTrading2() external onlyOwner {
tradingActive = true;
_launchTime = block.timestamp.add(1);
}
| 15,050,877 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
/// @title LibMath
/// @author Connext <support@connext.network>
/// @notice This library allows functions that would otherwise overflow and
/// revert if SafeMath was used to instead return the UINT_MAX. In the
//... | Returns the maximum uint256 for an addition that would overflow (saturation arithmetic) | function satAdd(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 sum = x + y;
return sum >= x ? sum : type(uint256).max;
}
| 1,807,196 |
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 is ch... | This function returns the amount in weis for withdraw Minimum percent is 3%, maximum percent is 6.5% per 24 hours 1000 instead of 100, because in case of 3% 'percent' equals to 30 and so on | function payoutAmount() public view returns(uint256) {
uint256 percent = percentRate();
uint256 different = now.sub(time[rounds_counter][msg.sender]).div(stepTime);
uint256 rate = balance[rounds_counter][msg.sender].mul(percent).div(1000);
uint256 withdrawalAmount = rate.mul(diffe... | 12,944,400 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.