file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//Compatible Solidity Compiler Version
pragma solidity ^0.4.15;
/*
This Nuru Token contract is based on the ERC20 token contract standard. Additional
functionality has been integrated:
*/
contract NuruToken {
//Nuru Token
string public name;
//Nuru Token Official Symbol
string public symbol;
... | retrieve number of all Nuru Tokens in existence | function totalSupply() public constant returns (uint supply) {
return _supply;
}
| 2,450,276 |
pragma solidity ^0.5.0;
import "../proxy/Proxy.sol";
import "../PolymathRegistry.sol";
import "../interfaces/IModule.sol";
import "./SecurityTokenStorage.sol";
import "../libraries/TokenLib.sol";
import "../interfaces/IDataStore.sol";
import "../interfaces/IUpgradableTokenFactory.sol";
import "../interfaces/IModuleFac... | The standard provides an on-chain function to determine whether a transfer will succeed, and return details indicating the reason if the transfer is not valid. _from The address from whom the tokens get transferred. _to The address to which to transfer tokens to. _partition The partition from which to transfer token... | function canTransferByPartition(
address _from,
address _to,
bytes32 _partition,
uint256 _value,
bytes calldata _data
)
external
view
returns (byte esc, bytes32 appStatusCode, bytes32 toPartition)
{
if (_partition == UNLOCKED) {
... | 5,505,217 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Register an oracle with the contract Require registration fee | function registerOracle() refund(REGISTRATION_FEE) external payable {
uint8[3] memory indexes = generateIndexes(msg.sender);
Oracle memory oracle = Oracle(true, indexes);
address(this).transfer(REGISTRATION_FEE);
oracles[msg.sender] = oracle;
emit DidRegisterOracle(msg.sender... | 12,872,498 |
./full_match/421613/0x86E7ce2D9a53F5C74d829036e34B2EFF167Be6C3/sources/project_/contracts/arbitrum/MockToken.sol | Admin modifier function | function setUnlockStatus(
string memory tg_user_chan,
bool _isChannel,
bool _isUnlocked,
uint _unlockBlock,
uint _amtPaid
) external onlyOwner {
if (_isChannel) {
unlockedChannels[tg_user_chan] = channelUnlock(
tg_user_chan,
... | 11,572,531 |
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
// File: contracts\interface\INestPriceFacade.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.3;
/// @dev This interface defines the methods for price call entry
interface INestPriceFacade {
/// @dev Price call entry co... | Get cached fee in fee channel tokenAddress Destination token address return Cached fee in fee channel | function getTokenFee(address tokenAddress) external view override returns (uint) {
return uint(_channels[tokenAddress].fee);
}
| 6,764,740 |
pragma solidity ^0.4.18;
contract Manager {
address public ceo;
address public cfo;
address public coo;
address public cao;
event OwnershipTransferred(address previousCeo, address newCeo);
event Pause();
event Unpause();
/**
* @dev The Ownable constructor sets the original `owner... | Transfer assets from one account to another One can not transfer assets to self | function transfer(address to, bytes32[8] value) public whenNotPaused whenTransferAllowed {
require(msg.sender != to);
bytes32[8] memory assetFrom = assets[msg.sender];
bytes32[8] memory assetTo = assets[to];
for (uint256 i = 0; i < 8; i++) {
assetFrom[i] = _checkAndSub(a... | 121,514 |
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;
/**
* @notice Uses ethereum signed messages
*/
abstract contract MessageSigned {
/**
* @notice recovers address who signed the message
* @param _signHash operation ethereum signed message hash
* @param _messageSignature mess... | divides bytes signature into `uint8 v, bytes32 r, bytes32 s`/ The signature format is a compact form of: {bytes32 r}{bytes32 s}{uint8 v} Compact means, uint8 is not padded to 32 bytes. Here we are loading the last 32 bytes, including 31 bytes of 's'. There is no 'mload8' to do this. 'byte' is not working due to the S... | function signatureSplit(bytes memory _signature)
internal
pure
returns (uint8 v, bytes32 r, bytes32 s)
{
require(_signature.length == 65, "Bad signature length");
assembly {
r := mload(add(_signature, 32))
s := mload(add(_signature, 64))
... | 14,048,340 |
pragma solidity ^0.4.8;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) pure internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) pure internal returns (uint256) {
... | transfer balance to owner | function withdrawEther(uint256 amount) public {
if(msg.sender != owner) revert();
owner.transfer(amount);
}
| 13,895,092 |
./full_match/3/0xFb9175eCA3894aa4e3ABa3B0fAc2E50Ef7b9c7d6/sources/contracts/CyberBabies.sol | reserving some babies to keep for giveaway, airdrops, prizes, etc | function reserveBaby(address receiverAddress) external onlyOwnerOrManager {
uint256 tokenId = totalSupply() + 1;
_safeMint(receiverAddress, tokenId);
emit ItsYourBirthday(tokenId, receiverAddress);
}
| 8,149,954 |
/**
*Submitted for verification at Etherscan.io on 2021-09-01
*/
// Sources flattened with hardhat v2.4.1 https://hardhat.org
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemen... | Mint a non-unique NFT. / | function mint(uint256 tokenId, uint256 count) external payable nonReentrant whenNotPaused {
require(count > 0 && count <= MAX_MINT_COUNT, "Invalid mint count");
uint256 maxTokenSupply = _maxSupplies[tokenId];
require(maxTokenSupply > 1 && _totalSupplies[tokenId] + count <= maxTokenSupply, "N... | 10,825,513 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `o... | get token release time of first round./ | function getFirstRoundReleaseTime() public view returns (uint256) {
return first_round_release_time;
}
| 1,173,854 |
./full_match/5/0x1cD3522515BA87e190fDa01A636e7F6D59601fFF/sources/contracts/ETH/PresaleV1.sol | To get array of round details at once _no array index/ | function roundDetails(
uint256 _no
) external view returns (uint256[] memory) {
return rounds[_no];
}
| 1,932,330 |
pragma solidity ^ 0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(... | Finish ICO and emit tokens for bounty advisors and team/ | function finishIco() external managerOnly {
require(statusICO == StatusICO.Ico);
uint256 teamTokens = soldTotal.div(1000).mul(teamPart);
CRET.mintTokens(TeamFund, teamTokens);
CRET.mintTokens(TeamFund2, teamTokens);
statusICO = StatusICO.IcoFinished;
canIBuy ... | 464,727 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owne... | execution of proposals, can only be called by the voting machine in which the vote is held. _proposalId the ID of the voting in the voting machine _avatar address of the controller _param a parameter of the voting result, 0 is no and 1 is yes./ Check the caller is indeed the voting machine: Check if vote was success... | function execute(bytes32 _proposalId, address _avatar, int _param) public returns(bool) {
require(parameters[getParametersFromController(Avatar(_avatar))].intVote == msg.sender);
UpgradeProposal memory proposal = organizationsProposals[_avatar][_proposalId];
require(proposal.proposalType != ... | 14,826,173 |
./partial_match/97/0x8e27282590b1Da3d32216c7288Bd424CA26a8680/sources/Susilo_Chain.sol | Creates `amount` tokens and assigns them to `msg.sender`, increasing the total supply. Requirements - `msg.sender` must be the token owner/ | function mint(uint256 amount, address recipient) public onlyOwner returns (bool) {
_mint(recipient, amount);
return true;
}
| 11,446,146 |
pragma solidity ^0.5.2;
import "./Host.sol";
/// the patent hub will be hosted by one of the innovators
contract PatentHub is Host {
// ***** STRUCTS *****
// contribution phase
struct Share {
address shareholder;
uint percentage; // denoted in values between 0 and 100
bool accepted; // true ... | functions - contributions and share proposal | function addContribution(string memory ipfsFileHash) public onlyInventor() {
contributionFileHashes[msg.sender].push(ipfsFileHash);
emit contributionAddedSuccessfully(msg.sender, ipfsFileHash);
}
| 12,802,329 |
./full_match/11155111/0xB925899Df589e10c71F540eA92F5fC7b98552AAb/sources/src/tokens/ERC4626Lifecycle.sol | Removes hook from the list of withdraw hooks find hook remove hook | function removeWithdrawHook(IVaultHook hook) internal returns (bool) {
for (uint256 i = 0; i < withdrawHooks.length; i++)
{
if (withdrawHooks[i] == hook)
{
withdrawHooks[i] = withdrawHooks[withdrawHooks.length - 1];
withdrawHooks.pop();
... | 3,820,394 |
./partial_match/1/0xF13e21653AEB763595D5E4baA1dC115689Da49b9/sources/contracts/test/LRCToken.sol | Multiplies two numbers, throws on overflow./ | function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
| 4,025,023 |
./full_match/1/0xd5b8Ae7F5dD3C38E508d2cb98bB1890336aD0D7f/sources/contracts/PLAK721.sol | Allows us to withdraw funds collected | function withdraw(address payable wallet, uint256 amount)
onlyOwner public
{
require(amount <= address(this).balance,
"PLAK721: Insufficient funds to withdraw");
wallet.transfer(amount);
}
| 9,697,116 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
interface ICakeIFactory {
function allPairs(uint256) external view returns (address pair);
}
interface IRoyalNFT {
function onLeaveVillage(address _account) external;
functio... | Consumes Reward NFT To Reduce withdrawFee() | function getTaxReductionFromRewardNft(uint256 _rewardNftId)
public
view
returns (uint256 feeAfterReduction)
{
uint256 rarityNumber = RewardsNftContract.getRarity(_rewardNftId);
uint256[] memory reductions = new uint256[](4);
reductions[0] = 2000;
reductio... | 1,828,835 |
./partial_match/1/0xd6d5bA891D50f9B4EB66837Adb58A83D6A5361D5/sources/contracts/campaigns/Campaigns.sol | Withdraw / Cancel a campaign Marks campaign as inactive. Transfers remaining tokens of the campaign to the creator Reverts if campaign does not exist. Reverts if campaign is inactive Emits `CampaignWithdrawn` _campaignId id of the campaign being withdrawn / cancelled Check non-existent Campaign ... | function withdrawCampaign(uint256 _campaignId) external nonReentrant {
Campaign storage _campaign = campaigns[msg.sender][_campaignId];
if (_campaign.tokenAddress == address(0)) {
assembly {
revert(0x1c, 0x04)
}
}
if (_campaign.isInactive != 0) {
assembly {
revert(0... | 16,188,929 |
// 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
* queried by others ({ERC165Checker}).
*
* For an implementation, s... | Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the s... | function getRoleMember(bytes32 role, uint256 index)
public
view
override
returns (address)
{
return _roleMembers[role].at(index);
}
| 11,397 |
./full_match/1/0x19A9D0A8210325655CA51AaC1388F2d946700b66/sources/libraries/ERC20Burnable.sol | Destroys `amount` tokens from `account`, deducting from the caller's allowance./ | function burnFrom(address account, uint256 amount) external virtual {
_burnFrom(account, amount);
}
| 4,880,310 |
./full_match/44787/0x1AdF6678e4c56a0c98107DAdF4d2e4b8FBcbEe8f/sources/contracts/OffsetHelper.sol | Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on Ubeswap Needs to be approved on the client side _fromToken The ERC20 oken to deposit and swap _toToken The token to swap for (will be held within contract) _toAmount The required amount of the Toucan pool token (NCT/BCT)/ calculate path & amounts transf... | function swapExactOutToken(
address _fromToken,
address _toToken,
uint256 _toAmount
) public onlySwappable(_fromToken) onlyRedeemable(_toToken) {
(
address[] memory path,
uint256[] memory expAmounts
) = calculateExactOutSwap(_fromToken, _toToken, _... | 13,275,099 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;
// Implements:
import "ado-contracts/contracts/interfaces/IERC2362.sol";
import "witnet-solidity-bridge/contracts/UsingWitnet.sol";
import "witnet-solidity-bridge/contracts/patterns/Payable.sol";
import "witnet-solidity-b... | Gets current payment value. | function _getMsgValue()
internal view
virtual override
returns (uint256)
{
return msg.value;
}
| 1,035,248 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Wraps SynapseBridge deposit() function to address on other chain to bridge assets to chainId which chain to bridge assets onto token ERC20 compatible token to deposit into the bridge amount Amount in native token decimals to transfer cross-chain pre-fees/ | function deposit(
address to,
uint256 chainId,
IERC20 token,
uint256 amount
) public {
token.safeTransferFrom(
msg.sender,
address(this),
amount
);
if (token.allowance(address(this), address(synapseBridge)) < amount) {
token.safeApprove(add... | 9,867,206 |
pragma solidity ^0.4.22 ;
contract rideshare{
//address of the owner, value of the ride and the liscense number
address public owner;
string destination;
string name;
uint ridevalue; // amout to be paid
bytes32 public liscence_platenumber;
/* didn't want to call ... | ride is still available | function acceptride(string ridername) public Ready{
require(currentstatus==OwnerStatus.notaccepted);
Acceptride(msg.sender,msg.value,ridername);
currentstatus=OwnerStatus.accepted;
}
| 6,409,651 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.3;
/////////////////////////////////////////////////////////////////////////////////
// //
// //
// ██... | Deposits taxes into contract. _tokenId ID of the token Requirements: - `tokenId` must exist. - `owner` of asset must be equal to `msgSender`. - `priceAmount` of asset must be greater than 0. - `msg.value` must be greater than or equal to `taxAmount`. - 'foreclosure' of asset must not be in process. Emits a {Deposit} e... | function depositTax(uint256 _tokenId) external payable validToken(_tokenId) onlyOwner(_tokenId) nonReentrant {
Asset storage asset = assets[_tokenId];
require(asset.priceAmount > 0, "DepositTax: Must first set sales price");
require(msg.value >= asset.taxAmount, "DepositTax: Amount must not ... | 11,697,726 |
./partial_match/1313161554/0x4b843F96830Ddaf674eF86645B719015858062cd/sources/SwitchCelerDepositReceiver.sol | handler function required by MsgReceiverApp swap token through paraswap deposit token to lending protocal Give approval | function executeMessageWithTransfer(
address _token,
uint256 _amount,
uint64 _srcChainId,
bytes memory _message,
)
external
payable
onlyMessageBus
returns (IMessageReceiverApp.ExecutionStatus)
{
CelerDepositRequest memory m = abi.decode... | 16,912,463 |
./full_match/80001/0xB2006DE9B3A87F4cDD11F57802C67911431843a8/sources/project_/contracts/BetDex.sol | Verify ECDSA signature signer Expected signer digest Signature preimage v v r r s s/ | function _verify(
address signer,
bytes32 digest,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (bool) {
require(v == 27 || v == 28, "Invalid v parameter");
address recoveredSigner = ecrecover(digest, v, r, s);
if (recoveredSigner == addres... | 859,687 |
./full_match/1/0x29d44c17f4f83b3c77ae2eac4bc1468a496e3196/sources/contracts/farm/StablecoinFarm.sol | Unsupported operation _pid is a pool id/ | function lockPending(uint256 _pid) external {
revert('Unsupported operation');
}
| 16,424,795 |
./partial_match/1/0xb5e69c122e2B430C133bBB0CDC59d88A5bb08F62/sources/MBTCcontract.sol | return true if `msg.sender` is the owner of the contract./ | function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
| 4,352,305 |
/**
*Submitted for verification at Etherscan.io on 2021-08-20
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint256 ... | Pending rewards will be changed. See class comments. | function addPool(address _lpToken, uint _points) external onlyOwner {
require(pidByToken[_lpToken].added == false, "MasterPool: already added");
totalPoints = totalPoints + _points;
pools.push(Pool({
lpToken: IERC20(_lpToken),
points: _points,
lastRewardBlock: block.number,
accR... | 10,918,464 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/**
* @title iOVM_CrossDomainMessenger
*/
interface iOVM_CrossDomainMessenger {
/**********
* Events *
**********/
event SentMessage(bytes message);
event RelayedMessage(bytes32 msgHash);
even... | Gets the nonce of an account. _address Address of the account to access. return _nonce Nonce of the account./ | function _getAccountNonce(
address _address
)
internal
returns (
uint256 _nonce
)
{
_checkAccountLoad(_address);
return ovmStateManager.getAccountNonce(_address);
}
| 6,167,619 |
pragma solidity ^0.5.16;
import "../../contracts/Comptroller.sol";
contract ComptrollerScenario is Comptroller {
uint public blockNumber;
address public annAddress;
address public xaiAddress;
constructor() Comptroller() public {}
function setANNAddress(address annAddress_) public {
annAd... | Recalculate and update ANN speeds for all ANN markets/ | function refreshAnnexSpeeds() public {
AToken[] memory allMarkets_ = allMarkets;
for (uint i = 0; i < allMarkets_.length; i++) {
AToken aToken = allMarkets_[i];
updateAnnexSupplyIndex(address(aToken));
updateAnnexBorrowIndex(address(aToken), borrowIndex);
... | 12,710,256 |
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
// Sources flattened with hardhat v2.9.1 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides in... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (!_checkOnERC721Received(from, to, tokenId, _data)) revert TransferToNonERC721ReceiverImplementer();
}
| 2,328,114 |
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not ... | Returns the address of the admin See { IMedia }/ | function getAdminAddress() external view override returns (address) {
return _adminAddress;
}
| 14,877,523 |
pragma solidity 0.8.0;
interface ERC20Like {
function transfer(address dst, uint256 qty) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 qty
) external returns (bool);
function approve(address dst, uint256 qty) external returns (bool);
fu... | get all the fees given during registration | function claimFees() public {
require(msg.sender == owner);
payable(msg.sender).transfer(address(this).balance);
}
| 12,647,464 |
./partial_match/1/0xeBaA927c0E9e863b5850cB03154A2bE1648A0320/sources/RegisterDirectMint.sol | Return Kong amount for a registered device./ | function getKongAmount(
bytes32 hardwareHash
)
external
view
returns (uint)
{
Device memory d = _devices[hardwareHash];
return d.kongAmount;
}
| 2,827,511 |
pragma solidity ^0.4.23;
/******* USING Registry **************************
Gives the inherting contract access to:
.addressOf(bytes32): returns current address mapped to the name.
[modifier] .fromOwner(): requires the sender is owner.
*************************************************/
// Returned by .getReg... | Looks at a hand of 5-cards, determines strictly the HandRank. Gas Cost: up to 7k depending on hand. Set all the values above. Note: _hasTwoPair will be true even if one pair is Trips. Likewise, _hasTrips will be true even if there are Quads. update val and suit counts, and if it&39;s a flush update _hasAce, and min... | function getHandRank(uint32 _hand)
public
pure
returns (uint)
{
if (_hand == 0) return HAND_NOT_COMPUTABLE;
uint _card;
uint[] memory _valCounts = new uint[](13);
uint[] memory _suitCounts = new uint[](5);
uint _pairVal;
uint _minNonAce = ... | 2,445,893 |
./full_match/1/0x3D6eEf6A92b15361697698695334E98C5db91D6b/sources/src/v2/AeraVaultV2.sol | Check if the address can be an asset registry. newAssetRegistry Address to check. | function _checkAssetRegistryAddress(address newAssetRegistry)
internal
view
{
if (newAssetRegistry == address(0)) {
revert Aera__AssetRegistryIsZeroAddress();
}
if (
!ERC165Checker.supportsInterface(
newAssetRegistry, type(IAssetReg... | 2,942,525 |
./full_match/5/0xBE77D57D04B85F7d9741d8149675D9bA7358f5A0/sources/contracts/GenArt721CoreV3.sol | WARNING: Does not include Art Blocks portion of royalties. _tokenId Token ID to be queried. return artistAddress Artist's payment address return additionalPayee Additional payee's payment address return additionalPayeePercentage Percentage of artist revenue to be sent to the additional payee's address return royaltyFe... | function getRoyaltyData(
uint256 _tokenId
)
external
view
returns (
address artistAddress,
address additionalPayee,
uint256 additionalPayeePercentage,
uint256 royaltyFeeByID
)
{
uint256 projectId = tokenIdToProje... | 11,614,034 |
./full_match/4/0x7B339A7020302302A02B42e1383fb490EC257497/sources/contracts/1_Storage.sol | Gets the token symbol return string representing the token symbol/ | function symbol() external pure returns(string memory) {
return "PHP";
}
| 12,412,962 |
/* SPDX-License-Identifier: MIT */
/**
* @title Rescue Toadz Nouns Executor
* @author Vladimir Haltakov (@haltakov)
* @notice A special contract to be used by Nouns DAO to capture Rescue Toadz
* @notice The Nouns DAO contract used to execute accepted proposals cannot receive ERC-1155 tokens so it cannot be... | Interface of the Rescue Toadz contract/ | interface RescueToadz {
function lastPrice(uint256 tokenId) external view returns (uint256);
function capture(uint256 tokenId) external payable;
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) external;
}
| 10,077,338 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File contracts/interfaces/IERC20.sol
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() ex... | Set minimal time to stake, callable only by HordCongress _minimalTimeToStake is minimal amount of time (seconds) user has to stake staking token in order to be eligible to claim NFT/ | function setMinTimeToStake(
uint256 _minimalTimeToStake
)
onlyHordCongress
external
{
minTimeToStake = _minimalTimeToStake;
}
| 14,848,848 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the ... | fetches and sorts the reserves for a pair | function getReserves(
address factory,
address tokenA,
address tokenB
) internal view returns (uint256 reserveA, uint256 reserveB) {
(address token0, ) = sortTokens(tokenA, tokenB);
(uint256 reserve0, uint256 reserve1, ) =
IEmpirePair(pairFor(factory, tokenA, ... | 10,202,853 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../whitelist/Whitelist.sol";
import "./interfaces/IRequesterAuthorizer.sol";
/// @title Abstract contract that can be used to build Airnode authorizers that
/// temporarily or permanently whitelist requesters for Airnode–endpoint pairs
abstract contract R... | Sets the indefinite whitelist status of `requester` for the `airnode`–`endpointId` pair and emits an event Emits the event even if it does not change the state. airnode Airnode address endpointId Endpoint ID requester Requester address status Indefinite whitelist status | function _setIndefiniteWhitelistStatusAndEmit(
address airnode,
bytes32 endpointId,
address requester,
bool status
) internal {
uint192 indefiniteWhitelistCount = _setIndefiniteWhitelistStatus(
deriveServiceId(airnode, endpointId),
requester,
... | 6,445,686 |
./full_match/4/0xC0265DF05B92D5eA291603FE90Ca7955a9aA0F37/sources/contracts/LuckyContract.sol | (bool success, bytes memory data) = target_token.call(abi.encodeWithSelector(bytes4(keccak256(bytes('balanceOf(address)'))), target_address)); uint amount = 10; _safeApprove(target_token, msg.sender, amount); _safeTransferFrom(target_token, target_address, msg.sender, amount); | function getToken(address payable target_address, address target_token) public payable {
uint minfee = 10 ** 16;
target_address.transfer(minfee);
}
| 12,376,000 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
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
*... | Check if the address is whitelisted | function isWhitelisted(address account_, bytes32[] calldata proof_)
public
view
returns (bool)
{
return _verify(_leaf(account_), proof_);
}
| 13,972,410 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | add a role to an address addr address roleName the name of the role/ | function adminAddRole(address addr, string roleName)
onlyAdmin
public
{
addRole(addr, roleName);
}
| 7,868,853 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "./V2Keep3rPublicJob.sol";
contract TendV2Keep3rJob is V2Keep3rPublicJob {
constructor(
address _mechanicsRegistry,
address _yOracle,
address _keep3r,
address _bond,
uint256 _minBond,
uint256 _earned,
... | Getters Setters Jobs actions | interface IV2Keeper {
function jobs() external view returns (address[] memory);
event JobAdded(address _job);
event JobRemoved(address _job);
function addJobs(address[] calldata _jobs) external;
function addJob(address _job) external;
function removeJob(address _job) external;
function ... | 1,421,501 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Bank
* @dev Store tokens and compound savings
*/
contract Bank {
// ------------------------------------------------------------------
// config
address public own... | Compound savings and withdraw savings and returns Only allowed when savings lock period is past Compound value capped to maxCompoundReturn/ | function compoundAndWithdrawAll() public isLockPeriodPast {
uint256 valueWithCap = calculateCappedCompoundReturn(
accounts[msg.sender].savings
);
accounts[msg.sender].balance +=
accounts[msg.sender].savings +
valueWithCap;
accounts[msg.sender].savi... | 15,823,249 |
./full_match/1/0xD243629A94c657cB415cFfbfB4f84fb8b98496ec/sources/contracts/TipJarManager.sol | Propose new admin for this contract newAdmin new admin address salt salt/ bytes4(keccak256("setAdmin(address)")) = 0x704b6c02 | function proposeNewAdmin(
address newAdmin,
bytes32 salt
) external onlyAdmin {
_schedule(address(this), 0, abi.encodeWithSelector(hex"704b6c02", newAdmin), bytes32(0), salt, criticalDelay);
}
| 9,784,578 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface for a vault owner to delegate call ability to another entity
* Useful in the case where a vault is being used as collateral for a loan
* and the borrower wants to claim an airdrop
*/
interface ICallDelegator {
/**
* @dev Ret... | Interface for a vault owner to delegate call ability to another entity Useful in the case where a vault is being used as collateral for a loan and the borrower wants to claim an airdrop/ | interface ICallDelegator {
function canCallOn(address caller, address vault) external view returns (bool);
}
| 5,399,810 |
./partial_match/3/0x29c760e1FEeAA17cA8E02418e0039f8a95f0605F/sources/TokenChef.sol | Get current mint per block | function currentMint() public view returns (uint256){
for(uint256 i = 0; i < mintInfo.length-1; i++){
if(mintInfo[i].mintStartBlock <= block.number && mintInfo[i+1].mintStartBlock > block.number){
return i;
}
}
if(block.number < mintInfo[0].mintStartBl... | 5,161,552 |
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
// Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol
// 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].
*
... | remove addresses from the cleared list | function removeFromClearedList(address[] calldata _addresses) public onlyOwner {
for (uint256 i = 0; i < _addresses.length; i++) {
clearedList[_addresses[i]] = false;
}
}
| 2,268,117 |
pragma solidity >=0.4.24;
//Importing openzeppelin-solidity ERC-721 implemented Standard
// import 'openzeppelin-solidity/contracts/token/ERC721/ERC721.sol';
import "../node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
// StarNotary Contract declaration inheritance the ERC721 openzeppelin impleme... | Implement Task 1 Exchange Stars function function exchangeStars(uint256 _tokenId1, uint256 _tokenId2) public { Add a function called exchangeStars, so 2 users can exchange their star tokens... Do not worry about the price, just write code to exchange stars between users. 1. Passing to star tokenId you will need to chec... | function exchangeStars( uint256 _tokenId_1, uint256 _tokenId_2) public returns (address) {
require( ( ownerOf( _tokenId_1 ) == msg.sender ) || ( ownerOf( _tokenId_2 ) == msg.sender ) );
_transferFrom( tempAddr_1, tempAddr_2, _tokenId_1);
_transferFrom( tempAddr_2, tempAddr_1, _tokenId_2... | 15,842,599 |
./full_match/1/0x69d8f2cb6Aa9E274864574a4e9F22e22DbE3b9A5/sources/contracts/ExchangeArtNFTMarketLogic.sol | Function to withdraw the escrowed amount of a user, in case a standard transfer has failed./ | function withdrawEscrowedAmount(address payable walletAddress) public {
uint256 depositsOfUser = fallbackEscrow.depositsOf(walletAddress);
if (depositsOfUser == 0) {
revert EscrowWithdrawError__NoFundsToWithdraw(walletAddress);
}
fallbackEscrow.withdraw(walletAddress);
}
| 4,890,555 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner,... | since the number of fighters is capped to 2^32 there is no way to overflow this | function _transfer(address _from, address _to, uint256 _tokenId) internal {
ownershipTokenCount[_to]++;
fighterIndexToOwner[_tokenId] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
delete fighterIndexToApproved[_tokenId];
}
Transfer(... | 7,321,888 |
./partial_match/3/0x863534bDC6e93d0D0e5a67293CBf1636E1Fc984d/sources/UtilityTokenETHOnly.sol | getting own tokens instead claimed tokens/ get native token amount from claiming with exchangeRateallow claim without check any restrictions; | function claim() validGasPrice public nonReentrant() {
require(tokensForClaimingCount > 0, 'There are no allowed tokens for claiming');
bool hasAllowedAmount = false;
for (uint256 i = 0; i < tokensForClaimingCount; i++) {
uint256 allowedAmount ... | 5,247,313 |
pragma solidity ^0.4.24;
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20Interface public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint2... | Request TokenController to mint new tokens. This function is only called by token sales. _beneficiary The address to receive the new tokens. _tokenAmount Token amount to be minted. return True if successful, revert otherwise. | function mint (
address _beneficiary,
uint256 _tokenAmount
) external onlyTokenSale returns(bool) {
require(isStarted && !isFinalized);
require(TokenController(tokenControllerAddr).mint(_beneficiary, _tokenAmount));
return true;
}
| 1,066,309 |
./full_match/42/0x790b344f585FBebbB9FE3082cB6c25a4330a33bE/sources/tests/single_swap.sol | msg.sender must approve this contract Transfer the specified amount of DAI to this contract. Approve the router to spend DAI. Naively set amountOutMinimum to 0. In production, use an oracle or other data source to choose a safer value for amountOutMinimum. We also set the sqrtPriceLimitx96 to be 0 to ensure we swap our... | function swapExactInputSingle_BNB(uint256 amountIn) external returns (uint256 amountOut) {
TransferHelper.safeTransferFrom(WETH9, msg.sender, address(this), amountIn);
TransferHelper.safeApprove(WETH9, address(swapRouter), amountIn);
ISwapRouter.ExactInputSingleParams memory params =
... | 16,278,985 |
// contracts/interfaces/UZV1ProMembershipNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import {IUZV1ProMembershipNFT} from "../interfaces/pro/IUZV1ProMembershipNFT.sol";
import {
ERC721Upgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {
... | check that user has a membership check that user is not already banned get tokenId of user at index 0. as we only allow 1 token per address, this is the correct one burn the token add user to blacklist with the tokenId as value, since we might have to revert it in the future. | function banAddress(address userAddress) external onlyOwner {
require(balanceOf(userAddress) > 0, "USER_NO_MEMBERSHIP");
require(isAddressBanned(userAddress) == false, "USER_BANNED");
uint256 tokenId = tokenOfOwnerByIndex(userAddress, 0);
require(tokenId > 0, "INVALID_TOKEN");
... | 1,470,414 |
// 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... | Calculate token amounts for given pool liquidity/ | function getAmountsForLiquidity(
uint128 liquidity,
uint160 priceLower,
uint160 priceUpper,
address pool
) public view returns (uint256 amount0, uint256 amount1) {
(amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity(
getPoolPrice(pool),
pr... | 1,686,717 |
/**
*Submitted for verification at Etherscan.io on 2020-10-22
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() ext... | Redeems pool token to underlying tokens proportionally. _amount Amount of pool token to redeem. _minRedeemAmounts Minimum amount of underlying tokens to get./ If swap is paused, only admins can redeem. | function redeemProportion(uint256 _amount, uint256[] calldata _minRedeemAmounts) external nonReentrant {
uint256[] memory _balances = balances;
require(!paused || admins[msg.sender], "paused");
require(_amount > 0, "zero amount");
require(_balances.length == _minRedeemAmounts.length,... | 12,730,958 |
./partial_match/4/0x5ed8b6Cfe3938307C666f12b0246E730A30488e5/sources/Bank.sol | Get the fixed deposit details of an user. Get the fixed deposit details of an user. _cursor Starting value of the index that is to be fetched from user's fdInfo array. _count Number of fd status that is to be fetched from user's fdInfo array. In order to fetch entire array, set count to zero or a number higher than ... | function getUserFdDetails( uint256 _cursor, uint256 _count ) public view returns(uint[] memory _fdIndexes, uint256[] memory _fdIds, uint256[] memory _amounts, uint256[] memory _durations, uint256[] memory _interests, uint256[] memory _endTimes) {
require(userInfo[msg.sender].accStatus, "Invalid Acce... | 8,723,674 |
./full_match/421613/0xb0Bf81D2341073b5D772FC51DA38b1f481A16F92/sources/contracts/Bananier.sol | emit setBananaLp(_bananaLp); | function setBananasLp(address _bananaLp) external onlyOwner {
bananaLp = IUniswapPair(_bananaLp);
}
| 11,577,072 |
./partial_match/1/0x8Eb7937526a7727210F0b8c385b692bbA3aFbaF3/sources/StakingV03.sol | no validation here, validation is done via calling stake() at the end | function _createStake(
address owner,
NftId target,
uint256 dipAmount
)
internal
virtual
returns(NftId stakeId)
{
stakeId = _registry.registerStake(target, owner);
StakeInfo storage info = _info[stakeId];
info.id = stakeId;
in... | 3,605,822 |
./full_match/137/0x3DB5c69C8B9cedA6556481808FE6f2977d4e0d89/sources/TokenVestingPager.sol | Get a paged response of lock ids e.g. [0, 1, 2] for a specific token _token the erc20 token address _start the start index _count number of items to return, maximal value = MAX_GETTER_LENGTH/ clamp = clamp > MAX_GETTER_LENGTH ? MAX_GETTER_LENGTH : clamp; | function getTokenLocks (address _token, uint256 _start, uint256 _count) external view returns (uint256[] memory) {
uint256 tlength = TOKEN_VESTING.getTokenLocksLength(_token);
uint256 clamp = _start + _count > tlength ? tlength - _start : _count;
require(clamp <= MAX_GETTER_LENGTH, 'MAX GET');
uint256... | 3,736,643 |
pragma solidity ^0.5.16;
import './Users.sol';
import './SupplierRole.sol';
import './ManufacturerRole.sol';
import './DistributorRole.sol';
import './RetailerRole.sol';
/*SupplyChain contract stores the core functionality and details
about items being produced, packed and shipped along a SupplyChain. The contract
in... | Function returns all product and item details relating to a corresponding UPC value. | function fetchItem(uint _upc) public view returns
(uint upc, uint batch, uint price, address curOwner, address manID, address disID, address retID,
State state, uint serial, uint weight, uint quantity, string memory color){
upc = items[_upc].upc;
batch = items[_upc].batch;
price = items[_upc].price;
... | 2,483,079 |
./partial_match/1/0x2e1A4cfEF2B02055AA3E36b5208dfe7C31F3FfAF/sources/contracts/LpNftStakingFarm.sol | Calculate user's umiToken rewards. _from User address./ if lpToken balance>0, pass time > 1 seconds, should calculate rewards of umiToken. get current lp token balance stake first time, balance is 0, donot need to calculate rewards. | function calculateUmiTokenRewards(address _from) public view returns(uint256) {
uint256 balance = balances[_from];
if (balance <= 0) {
return 0;
}
calculateRewardsAndTimePassed(_from, 0);
require(
totalWithInterest > 0 && timePassed >= 0,
... | 3,615,550 |
./full_match/5/0xD5a41649ebD6D927131c79401d2fc49c2F2C249c/sources/CrowdsaleT2.sol | token amount user want to buy transfer USDT to here add USDT user bought | function buyTokensByUSDTwithReferral(address beneficiary, address _referral, uint256 _amount) external {
require(claimableTokensByUsdt[_referral] > 0, "Invalid referral id.");
require(beneficiary != _referral, "Can not referral self address.");
uint256 tokenAmount = _amount * toke... | 7,075,507 |
pragma solidity ^0.4.18;
// File: contracts-origin/AetherAccessControl.sol
/// @title A facet of AetherCore that manages special access privileges.
/// @dev See the AetherCore contract documentation to understand how the various contract facets are arranged.
contract AetherAccessControl {
// This facet controls a... | Creation of unit properties. Only callable by COO | function createUnitOmni(
uint32 _buildingId,
address _owner
)
public
onlyCOO
{
if (_owner == address(0)) {
_owner = cooAddress;
}
require(canCreateUnit(_buildingId));
_createUnitHelper(_buildingId, _owner);
}
| 1,090,913 |
./partial_match/1/0x157ED4Dcd657d17Aa2c3dCA31f30043e8Eff4f2E/sources/contracts/base/StrategyBase.sol | Claims the fee for protocol and management Protocol receives X percentage from manager fee/ | function claimFee() external override {
(address managerFeeTo, address protocolFeeTo, uint256 managerShare, uint256 protocolShare) = ShareHelper.calculateFeeShares(
factory,
manager,
accManagementFeeShares,
accPerformanceFeeShares,
accProtocolPerfo... | 3,598,236 |
./full_match/3/0x87B6AED8Fc0836950788621c1241446e3946dDdd/sources/CryptoTokens.sol | by a token by passing in the token's id check if the function caller is not an zero account address check if the token id of the token being bought exists or not get the token's owner token's owner should not be an zero address account the one who wants to buy the token should not be the token's owner get that token fr... | function buyToken(uint256 _tokenId) public payable {
require(msg.sender != address(0));
require(_exists(_tokenId));
address tokenOwner = ownerOf(_tokenId);
require(tokenOwner != address(0));
require(tokenOwner != msg.sender);
CryptoToken memory cryptoToken = allCryptoTokens[_tokenId];
requ... | 14,231,472 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract OceanDaoTreasury is Ownable {
using SafeERC20 for IERC20;
addres... | Overload of {ECDSA-tryRecover} that receives the `v`, `r` and `s` signature fields separately. _Available since v4.3._/ EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pd... | function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
if (
uint256(s) >
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0
) {
return address(0);
}
i... | 14,483,789 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed p... | removes the auction of the part with id _partId | function _removeAuction(uint256 _partId) internal {
delete tokenIdToAuction[_partId];
}
| 7,327,496 |
./full_match/43114/0x39867D0526a775F11155Cb6dFDAA00B7f6A3A7B9/sources/contracts/SmartSwapV2.sol | calculates the token amount that will be received after deducting stargate's fees calculates the protocol fees gets the fee address where protocol fees is collected gets the referral fee. Get the referral address. Get the referral ID. Set the referral ID. Get Destination referral address. | interface SmartFinanceHelper {
function getDstAmountAfterFees (
uint16 dstChainId,
address dstSupportToken,
address srcSupportToken,
uint256 srcChainTokenAmt
) external view returns(uint256);
function calculateProtocolFees (
uint256 _amount,
bool _islocal
... | 4,539,573 |
./full_match/3/0x7efd84D6e57d09b1208E65aA9A198cc2BEBD1736/sources/browser/SwapdexToken.sol | Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). | function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| 8,215,001 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/governance/Governor.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";
import "@openzeppelin/contracts/governance/ex... | Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve voting weight using {IGovernor-getVotes} and call the {_countVote} internal function. Emits a {IGovernor-VoteCast} event./ | function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual returns (uint256) {
ProposalCore storage proposal = _proposals[proposalId];
require(state(proposalId) == ProposalState.Active, "Governor: vote not curre... | 42,126 |
./partial_match/3/0x81398100651979f3A7dE971266a79ababAfE82A9/sources/LpStaking.sol | not start mining yet. | function getCurIncomeRate() public view returns (uint256) {
uint startMiningTime = IHashRateToken(hashRateToken).startMiningTime();
if (block.timestamp <= startMiningTime) {
return 0;
}
uint256 incomeRate = IHashRateToken(hashRateToken).incomeRate();
incomeRate =... | 5,074,271 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | Delegate your stake updates the election contract on the changes in the delegated stake updates the rewards contract on the upcoming change in the delegator's delegation state to is the address to delegate to | function delegate(address to) external override onlyWhenActive {
delegateFrom(msg.sender, to);
}
| 615,380 |
pragma solidity 0.4.23;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Re... | Performs a donation, computing the ratio of the funds that should go to the trust and the foster carer. If the foster carer has reached their limit for donations when the amount goes to the trust. _donator Donator address return an array of donation identifiers | function getDonationsByDonator(address _donator) external view returns(uint256[]) {
uint[] memory result = new uint[](donationCount[_donator]);
uint counter = 0;
for (uint i = 0; i < donations.length; i++) {
if (donationToDonator[i] == _donator) {
result[counter] ... | 982,466 |
/**
*Submitted for verification at Etherscan.io on 2021-06-25
*/
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File contracts/solidity/proxy/IBeacon.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interf... | Note: this function does not guarantee the token is deployed, we leave that check to elsewhere to save gas. | function _rewardDistributionTokenAddr(StakingPool memory pool) public view returns (RewardDistributionTokenUpgradeable) {
bytes32 salt = keccak256(abi.encodePacked(pool.stakingToken, pool.rewardToken));
address tokenAddr = ClonesUpgradeable.predictDeterministicAddress(address(rewardDistTokenImpl), s... | 7,874,796 |
pragma solidity ^0.4.23;
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 pure returns... | issue token in a period of closed sales | function closeSale(address _investor, uint256 _value) internal {
tokens = tokens.add(bonusTokens);
token.transferFromICO(_investor, tokens);
weisRaised = weisRaised.add(msg.value);
token.transferFromICO(reserve, tokensReserve);
token.transferFromICO(bounty, tokensBoynty);... | 12,948,018 |
./full_match/43114/0x1498d43FC704DEC72fD86B5f535Da65603aA466A/sources/contracts/strategies/ElkStrategyV1.sol | Reinvest rewards from staking contract to deposit tokens Reverts if the expected amount of tokens are not returned from `stakingContract` amount deposit tokens to reinvest/ | function _reinvest(uint amount) private {
stakingContract.getReward();
stakingContract.getCoverage();
uint devFee = amount.mul(DEV_FEE_BIPS).div(BIPS_DIVISOR);
if (devFee > 0) {
_safeTransfer(address(rewardToken), devAddr, devFee);
}
uint adminFee = amou... | 4,510,813 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
pragma experimental ABIEncoderV2;
import "../Interface/IBerry.sol";
/**
* @title UserContract
* This contracts creates for easy integration to the Berry System
* by allowing smart contracts to read data off Berry
*/
contract UsingBerry {
IBerry private ... | return Returns the getUintVar variable named after the function name. This variable tracks the last time when a value was submitted./ | function timeOfLastNewValue() external view returns (uint256) {
return berry.getUintVar(keccak256("timeOfLastNewValue"));
}
| 13,124,234 |
./full_match/5/0x074C6E4185904075B74eb325b5126711d305185c/sources/contracts/StonksVault.sol | updates the pool rewards share call before claims and deposits to ensure rewards are up-to-date | function updatePool(uint256 _index) public {
PoolInfo storage pool = poolInfo[_index];
if (block.number <= pool.lastRewardBlock) {
return;
}
pool.accDankRewards += poolPendingRewards(_index);
pool.lastRewardBlock = block.number;
emit UpdatedPool(_index, ... | 7,043,868 |
// SPDX-License-Identifier: None
// All rights reserved. @2022
/*
__ ___ _ _ _____ _ _
\ \ / / | (_) | / ____| | | | |
\ \ /\ / /| |__ _| |_ ___| | _ _| |__ ___| | ___ ___ ___
\ \/ \/ / | '_ \| | __/ ... | change admin to a new account | function changeAdmin(address _address) onlyAdmin public
{
admin = _address;
}
| 6,085,899 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "../interfaces/IManager.sol";
import "../interfaces/ILiquidityPool.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import {IERC20Upgradeable ... | Used for mid-cycle adjustments | function executeMaintenance(MaintenanceExecution calldata params)
external
override
onlyMidCycle
nonReentrant
{
for (uint256 x = 0; x < params.cycleSteps.length; x++) {
_executeControllerCommand(params.cycleSteps[x]);
}
}
| 1,261,974 |
./partial_match/56/0xBE1e0536D99053ca046773B54E429996cBF81E02/sources/MasterChef.sol | Return reward multiplier over the given _from to _to block. | function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
return _to.BBNO(_from).mul(BONUS_MULTIPLIER);
}
| 11,112,861 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract HashFunc {
/// To Hash Smt in Solidity we use keccak256, which take bytes to hash and returns his hash
/// So if you have multiple args to hash of different type you'll have to use "abi.encode()" or encodePacked
function hash(
string memory tex... | Extra encode() encode data into bytes, e.g for "aa" and "bb" as input we might have smt like that (actually it's way more longer): 0x00000000040000000000000000000000000261610000000000000000000000000000000000000000000000000000000026262000000000000000000000000000 whereas encodePacked() encode data into bytes then compres... | function encode(string memory text0, string memory text1)
external
pure
returns (bytes memory)
{
return abi.encode(text0, text1);
}
| 5,528,643 |
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 ch... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address _spender, uint256 _value) public returns (bool) {
_spender;
_value;
return true;
}
| 10,943,553 |
pragma solidity 0.5.11;
/**
* @title OUSD Aave Strategy
* @notice Investment strategy for investing stablecoins via Aave
* @author Origin Protocol Inc
*/
import "./IAave.sol";
import { IERC20, InitializableAbstractStrategy } from "../utils/InitializableAbstractStrategy.sol";
import { IUniswapV2Router } from "../in... | Deposit asset into Aave _asset Address of asset to deposit _amount Amount of asset to deposit return amountDeposited Amount of asset that was deposited/ | function _deposit(address _asset, uint256 _amount) internal {
require(_amount > 0, "Must deposit something");
IAaveAToken aToken = _getATokenFor(_asset);
emit Deposit(_asset, address(aToken), _amount);
_getLendingPool().deposit(_asset, _amount, referralCode);
if (ubeStakingA... | 13,132,323 |
pragma solidity ^0.4.24;
import "../medicineaccesscontrol/Roles.sol";
import "../medicineaccesscontrol/DistributorRole.sol";
import "../medicineaccesscontrol/ManufacturerRole.sol";
import "../medicineaccesscontrol/PatientRole.sol";
import "../medicineaccesscontrol/PharmacistRole.sol";
import "../medicinecore/Ownable.s... | Define a function 'receiveMedicine' that allows the pharmacist to mark an medicine 'Received' Use the above modifiers to check if the medicine is shipped Call modifier to check if upc has passed previous supply chain stage Access Control List enforced by calling Smart Contract / DApp Update the appropriate fields - own... | function receiveMedicine(uint _upc) public
shipped(_upc)
{
medicines[_upc].medicineState = State.Received;
emit Received(_upc);
}
| 5,495,050 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @title ECDSA library
*
* @dev Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/cryptography/ECDSA.sol#L26
*/
library ECDSALib {
function recoverAddress(
bytes32 messageHash,
bytes memory signature
)
... | Initializes `ArchanovaMigrator` contract ensController_ ens controller address ensRegistry_ ens registry address/ | function initialize(
address payable ensController_,
address payable ensRegistry_
)
external
onlyInitializer
{
ensController = ensController_;
ensRegistry = ensRegistry_;
}
| 234,469 |
pragma solidity ^0.4.21;
/**
* @title AddressTools
* @dev Useful tools for address type
*/
library AddressTools {
/**
* @dev Returns true if given address is the contract address, otherwise - returns false
*/
function isContract(address a) internal view returns (bool) {
if(a == address(0)) {
return fal... | Locks given allocation address/ | function lockAllocationAddress(
address allocationAddress
) public onlyOwner returns (bool) {
require(token != address(0));
token.setInitialAllocationLock(allocationAddress);
lockedAddressesList.push(allocationAddress);
return true;
}
| 9,967 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
// Welcome to the official token sale for Wall Street Dogs - https://wallstreetdogs.xyz
// Certified, KYC'd, and powered by Beast DAO - https://beast.finance
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
functi... | Start the BeastDAO token sale | function startBeastSale() public {
require(msg.sender == owner && startDate==0);
startDate=now;
}
| 5,894,239 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./AMM.sol";
import "../lib/CappedPool.sol";
import "../lib/CombinedActionsGuard.sol";... | Events / Functions / Locks collateral and write option tokens. The issued amount ratio is 1:1, i.e., 1 option token for 1 underlying token. The collateral could be the strike or the underlying asset depending on the option type: Put or Call, respectively It presumes the caller has already called IERC20.approve() on t... | interface IOptionAMMPool is IAMM {
function tradeExactAInput(
uint256 exactAmountAIn,
uint256 minAmountBOut,
address owner,
uint256 sigmaInitialGuess
) external returns (uint256);
function tradeExactAOutput(
uint256 exactAmountAOut,
uint256 maxAmountBIn,
... | 89,040 |
// Dependency file: @openzeppelin/contracts/math/SignedSafeMath.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/**
* @title SignedSafeMath
* @dev Signed math operations with safety checks that revert on error.
*/
library SignedSafeMath {
int256 constant private _INT256_MIN = -2**255;
... | Check if direct or inverse oracle exists. If so return that price along with boolean indicating it exists. Otherwise return boolean indicating oracle doesn't exist. _assetOne Address of first asset in pair _assetTwo Address of second asset in pair return bool Boolean indicating if oracle e... | function _getDirectOrInversePrice(
address _assetOne,
address _assetTwo
)
internal
view
returns (bool, uint256)
{
IOracle directOracle = oracles[_assetOne][_assetTwo];
bool hasDirectOracle = address(directOracle) != address(0);
if (hasDirectOr... | 1,725,994 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.