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.18;
contract Pedersen {
//uint public q = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
uint private q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
uint private gX = 19823850254741169819033785099293761935467223354323... | Calculates token price. return Returns token price. | function calcTokenPrice()
constant
public
returns (uint)
{
return priceFactor * 10**18 / (block.number - startBlock + 7500) + 1;
}
| 6,346,053 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 < 0.9.0;
pragma experimental ABIEncoderV2;
contract OMS_COVID {
// Direccion de la OMS -> Owner / Dueรฑo del contrato
address public OMS;
// Constructor del contrato
constructor () {
OMS = msg.sender;
}
// Mapping para relaci... | Funcion que permita crear un contrato inteligente Filtrado para que unicamente los centros de salud validados sean capaces de ejecutar esta funcion Generar un contrato inteligente -> Generar su direccion Almacenar la direccion del contrato en le array Relaccion entre el centro de salud y su contrato Emision del evento | function FactoryCentroSalud() public {
require(Validacion_CentrosSalud[msg.sender] == true, 'No tienes permisos para ejecutar esta funcion.');
address contrato_CentroSalud = address(new CentroSalud(msg.sender));
direcciones_contratos_salud.push(contrato_CentroSalud);
CentroSalud_Cont... | 1,759,867 |
./full_match/1/0xb84cecd3e0708C3e38E63Ac001E2a4D892c33a57/sources/meTokens.sol | Mint new tokens dst The address of the destination account rawAmount The number of tokens to be minted/ mint the amount transfer the amount to the recipient move delegates | function mint(address dst, uint rawAmount) external {
require(block.timestamp >= mintingAllowedAfter, "ME::mint: minting not allowed yet");
require(msg.sender == minter, "ME::mint: only the minter can mint");
require(dst != address(0), "ME::mint: cannot transfer to the zero address");
... | 3,048,361 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IE... | Approve `to` to operate on `tokenId` Emits a {Approval} event./ | function _approve(ERC721Storage storage s, address to, uint256 tokenId) internal {
s._tokenApprovals[tokenId] = to;
emit Approval(_ownerOf(s, tokenId), to, tokenId);
}
| 6,935,793 |
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | Change the owner of this contract. newOwner New owner address. | function transferOwnership(address newOwner)
public
onlyOwner
{
if (newOwner == address(0)) {
LibRichErrors.rrevert(LibOwnableRichErrors.TransferOwnerToZeroError());
owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
}
}
| 567,333 |
pragma solidity ^0.5.7;
////////////////////////////////////////////////////////////////////////////////
library SafeMath // This library is not used systematically since it tends to create "Infinite gas" functions and consumes too many gas
{
//------------------
function mul(uin... | -------------------------------------------------------------------------- | function changeMinVoteCount(uint256 newMinVoteCount) public onlyAdmin returns(uint256)
{
emit OnSocialLockerChangeMinVoteCount(minVotesCount, newMinVoteCount);
minVotesCount = newMinVoteCount;
return 1;
}
| 7,318,534 |
./partial_match/1/0xD59BcAbd00721B754aCB79FE668faE4B6A063fF8/sources/contracts/carbon/CarbonController.sol | fully initializes the contract and its parents/ | function initialize() public initializer {
__CarbonController_init();
}
| 2,647,134 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./MaticulumTraining.sol";
import "./ISchool.sol";
contract MaticulumNF... | Create a list of NFTs _hashes list of hashes to retrieve the JSON Metadata on IPFS _diplomas one diploma with schoolId and trainingId informations and the list of all the students adresses of this training return the user address/ | function AddNFTsToAdressOld(string[] memory _hashes, diplomas memory _diplomas) public returns (uint256){
require(_hashes.length <= maxHashCount, "Gaz limit security");
if(!testModeValidationDiploma) {
isSchoolAdmin(_diplomas.schoolId, msg.sender);
}
ret... | 15,813,472 |
./full_match/1/0x8d6467faa693BB1E1ff0CbbCCeE9C79D19740718/sources/node_modules/frax-standard-solidity/src/access-control/v2/Timelock2Step.sol | The ```_requireSenderIsTimelock``` function reverts if msg.sender is not current timelock address This function is to be implemented by a public function | function _requireSenderIsTimelock() internal view {
_requireIsTimelock(msg.sender);
}
| 3,063,017 |
pragma solidity ^0.4.17;
import "./PayrollInterface.sol";
import "github.com/ConsenSys/Tokens/contracts/HumanStandardToken.sol";
import "github.com/pipermerriam/ethereum-datetime/contracts/DateTime.sol";
import "github.com/Dexaran/ERC223-token-standard/token/ERC223/ERC223_receiving_contract.sol";
/**
* @title Payrol... | -------------------------------- CONSTRUCTOR -------------------------------- | function Payroll(address _oracle) public{
owner = msg.sender;
oracle = _oracle;
}
| 12,603,188 |
/**
*Submitted for verification at Etherscan.io on 2022-01-19
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This c... | general mint function, first maxFreeChads are free mints/ | function mint(uint256 _mintQuantity) public payable mintCompliance(_mintQuantity) {
if(supply.current() < maxFreeChads ) {
_mintChads(msg.sender, _mintQuantity);
require(msg.value >= cost * _mintQuantity, "Insufficient funds sent!");
_mintChads(msg.sender, _mintQuantity);
}
}
| 10,751,524 |
./full_match/80001/0x207C055EF09C62A241ea25221aaA5A1B751360A7/sources/contracts/Gigble.sol | Create a function to accept a gig and release 10% of escrowed money to platform as fee and rest amount to the publisher Send 10% of the escrowed money to the platform as a fee Send the rest of the money to the publisher | function acceptGig(uint _gigId) public {
require(
gigs[_gigId].seller != msg.sender,
"Only seller can accept gig"
);
require(gigs[_gigId].confirmed, "Gig not yet confirmed");
require(!gigs[_gigId].accepted, "Gig already accepted");
require(!gigs[_gigId... | 5,644,197 |
pragma solidity ^0.4.23;
/**
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
*/
contract ERC721 {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
... | Calculate the current price of an auction. _startingPrice Price of item (in wei) at beginning of auction _endingPrice Price of item (in wei) at end of auction _duration Length of auction (in seconds) _secondsPassed Seconds passed after auction start/ The auction lasts longer duration Return end price totalPriceChan... | function _calculateCurrentPrice(
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
uint256 _secondsPassed
)
internal
pure
returns (uint256)
{
if (_secondsPassed >= _duration) {
return _endingPrice;
int256 totalPriceChange = int256(_endingPrice) - int256(_... | 6,443,600 |
./full_match/83/0xF0Db6d3bbf2d728dF91B01018CDeE635cFCb1B9a/sources/Users/cuimiandashi/Documents/GitHub/meterio/cryptoblades/contracts/SpecialWeaponsManager.sol | MANUAL USE ONLY; DO NOT USE IN CONTRACTS! | function mintStarsForManualEvent(address[] calldata receivers, uint256 eventId, uint256 stars) external hasMinterRole {
require(eventInfo[eventId].endTime == 1, "Wrong event id");
require(stars >= 2 && stars <= 4, "Wrong stars");
for(uint i = 0; i < receivers.length; i++) {
event... | 9,558,007 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.3;
contract NestInfo36 {
// Nest้ไปๅ็บฆ
address public nestStaking = 0xaA7A74a46EFE0C58FBfDf5c43Da30216a8aa84eC;
// Nestๅๅฎ
address public nestRedeeming = 0xF48D58649dDb13E6e29e03059Ea518741169ceC8;
// ๆ็ปญ่ดน่ดฆๆฌ
address public nestLe... | ๅๅฎ้กต้ขไฟกๆฏ nToken ๆฅ่ฏข็ntokenๆnestๅฐๅ tokenAmount ไปทๅผ 1 ETH ็ ntoken ๆฐ้ return resolvableAmount ๅฏๅ่ดญๆฐ้ return priceAmount ๅฝๅไปทๆ ผ return totalAmount ๅทฒ้ๅฎๆป้ return tokenBalance tokenไฝ้ข return tokenAllow tokenๆๆ้ขๅบฆ return tokenTotal tokenๆต้้ return nestIn01 nest้ๆฏ้ขๅบฆ/ | function getRedeemingInfo(address nToken, uint256 tokenAmount) external view returns(uint256 resolvableAmount,
uint256 priceAmount,
uint... | 6,253,242 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface ILegitArtERC721 {
function mintTo(
address creator,
uint256 royaltyFee,
address gallerist,
uint256 galleristFee,
address to,
uint256 tokenId,
string memory tokenURI
) external;
functio... | Execute a placed order | function executeOrder(bytes32 _orderId) external nonReentrant {
address _buyerAndPayer = _getUserFromMsgSender();
_executeOrder(_orderId, _buyerAndPayer, _buyerAndPayer);
}
| 6,334,014 |
pragma ton-solidity >= 0.45.0;
pragma AbiHeader expire;
pragma AbiHeader pubkey;
pragma AbiHeader time;
import "../interfaces/IRootTokenContract.sol";
import "../interfaces/ITONTokenWallet.sol";
import "../interfaces/IExpectedWalletAddressCallback.sol";
import "../interfaces/IBurnableByOwnerTokenWallet.sol";
import ".... | Function for setBouncedCallback | function setBouncedCallback() public override {
require(msg.sender == dexclient, 101);
tvm.rawReserve(address(this).balance - msg.value, 2);
TvmCell body = tvm.encodeBody(ITONTokenWallet(driven).setBouncedCallback, dexclient);
}
| 12,832,571 |
pragma solidity 0.4.24;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipT... | Token receivable function | function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
if (_data.length > 0)
{
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16)... | 1,018,276 |
/**
*Submitted for verification at BscScan.com on 2021-04-29
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
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 the... | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryMod}. Counterpart to Solidity's `%` o... | function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
| 10,237 |
./full_match/5/0xcd3EAf02914169fE4D6cBf19Ce6494e2c0160E40/sources/contracts/Contract.sol | Checks if the voting period has ended. return hasEnded True if the voting period has ended, false otherwise./ | function hasVotingEnded() public view returns (bool hasEnded) {
return !isElectionOpen || block.timestamp > electionEndTime;
}
| 1,871,894 |
pragma solidity >=0.5.16;
import './dFedBank.sol';
import './libraries/dFedLibrary.sol';
contract dFedPair is dFedBank {
using Math for uint;
constructor() public {
debtInfos.push(debtInfo(address(0), 0, 0, 0, 0, 0, 0, 0));
}
event BuyToken(
address indexed sender,
uint amoun... | require(_reserve0.mul(_reserve1) >= uint(reserve0).mul(reserve1), 'dFedPair: K'); | function updateReserves(uint _reserve0, uint _reserve1) private {
reserve0 = _reserve0;
reserve1 = _reserve1;
}
| 15,786,239 |
./partial_match/1/0x5094a8f54B12AEc540bF7cCd0Dd7B62f4FecF7f2/sources/Users/Elena/Source/argent-contracts/contracts/modules/TransferManager.sol | Creates a new pending action for a wallet. _action The target action. _wallet The target wallet. _token The target token for the action. _to The recipient of the action. _amount The amount of token associated to the action. _data The data associated to the action. return id The identifier for the new pending acti... | function addPendingAction(
ActionType _action,
address _wallet,
address _token,
address _to,
uint _amount,
bytes memory _data
)
internal
returns (bytes32 id, uint256 executeAfter)
{
id = keccak256(abi.encodePacked(_action, _token, _to, ... | 9,255,174 |
// 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 setter for the voting period. Emits a {VotingPeriodSet} event./ voting period must be at least one block long | function _setVotingPeriod(uint256 newVotingPeriod) internal virtual {
require(newVotingPeriod > 0, "GovernorSettings: voting period too low");
emit VotingPeriodSet(_votingPeriod, newVotingPeriod);
_votingPeriod = newVotingPeriod;
}
| 42,139 |
./partial_match/1/0x4735b15EaB1e86Cf1Be1971CFe10E226eA6Edc82/sources/Wallet.sol | constructor - just pass on the owner array to the multiowned | function Wallet(address[] _owners, uint _required)
multiowned(_owners, _required) {
}
| 2,819,025 |
pragma solidity ^0.5.11;
pragma experimental ABIEncoderV2;
import "./EternalStorage.sol";
import "./Consortium.sol";
import './StorageDefinition.sol';
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overf... | address[] storage approvedReviwer; address[] storage notApprovedReviwer; approvedReviwer.push(_reviewer[tokenId][i]); | function getReviewStatus(bytes32 tokenId)public view returns(bool){
for (uint i=0; i< _reviewer[tokenId].length; i++){
if(_reviewerStatus[tokenId][_reviewer[tokenId][i]] != reviewStatus.approved ){
return false;
}
return true;
}
| 6,405,860 |
/**
* @authors: [@ferittuncer]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity >=0.6;
import './IDisputeResolver.sol';
import "@kleros/ethereum-libraries/contracts/CappedMath.sol";
/**
* @title ArbitrableProxy
* A general purpose arbitrable contract. Supports non... | Changes the proportion of appeal fees that must be paid when there is no winner or loser. _sharedStakeMultiplier The new tie multiplier value respect to MULTIPLIER_DIVISOR./ | function changeSharedStakeMultiplier(uint _sharedStakeMultiplier) external {
require(msg.sender == governor, "Only the governor can execute this.");
sharedStakeMultiplier = _sharedStakeMultiplier;
}
| 1,814,812 |
/*
author:yqq
date:2018-12-17 12:53
desc : solidiy notes
*/
pragma solidity ^0.4.20;
/*
deleteๆไฝ็ฌฆๅฏไปฅ็จไบไปปไฝๅ้,ๅฐๅ
ถ่ฎพ็ฝฎๆ้ป่ฎคๅผ
- ๅฆๆๅฏนstringไฝฟ็จdelete, ๅๅฐๅญ็ฌฆไธฒ็ๅผ่ฎพไธบ็ฉบ.
- ๅฆๆๅฏนๅจๆๆฐ็ปไฝฟ็จdelete,ๅๅ ้คๆๆๅ
็ด ,ๅ
ถ้ฟๅบฆๅไธบ0
- ๅฆๆๅฏน้ๆๆฐ็ปไฝฟ็จ delete,ๅ้็ฝฎๆๆ็ดขๅผ็ๅผ
- ๅฆๆๅฏนmap็ฑปๅไฝฟ delete็จ,ไปไน้ฝไธไผๅ็(ๆฐ็็็ผ่ฏๅจ, ไผ็ดๆฅๆฅ้)
- ๅฆๆๅฏนmap็ฑปๅไธญ็ไธไธช้ฎไฝฟ็จdelete็จ,ๅไผๅ ้คไธ่ฏฅ้ฎ็ธๅ
ณ็ๅผ
*/
contract de... | dynamicArr[i] = i10;dynamicArr.push(i 10); | function initDynArr() public{
if(dynamicArr.length == 0){
for (uint i =0; i < 10; i++){
dynamicArr.push(i * 10);
}
for ( i =0; i < dynamicArr.length; i++){
dynamicArr[i] = i*10;
}
}
}
| 14,015,599 |
/**
* Copyright BOOSTRY Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,... | ๅ
จใฆใฎๆฎ้ซใๅผใๅบใใใ ใจในใฏใญใผใงๆๆใใใฆใใใใฎใฏๅผใๅบใใใใชใ _token ใใผใฏใณใขใใฌใน return ๅฆ็็ตๆ ๆดๆฐๅฆ็๏ผใใผใฏใณๅผใๅบใ๏ผ้ไฟก๏ผ ใคใใณใ็ป้ฒ | function withdraw(address _token)
public
override
returns (bool)
{
uint256 balance = balanceOf(msg.sender, _token);
require(
balance > 0,
"The balance must be greater than zero."
);
IbetStandardTokenInterface(_token).transfer(msg.... | 5,491,431 |
./full_match/3/0xB91BF2E4DC5b39d58341cC3621ab6E8738F5BB57/sources/flat0.2/BraxComptroller_flat.sol | File: contracts\BXS\IBRAXShares.sol License: MIT | interface IBRAXShares is IERC20 {
function pool_mint(address m_address, uint256 m_amount) external;
function pool_burn_from(address b_address, uint256 b_amount) external;
}
| 8,266,959 |
./full_match/4/0x842DA6d9b36b0B606c995fD73EBCF15FE9c047be/sources/SNAKE_SOCIETY.sol | Function to mint new NFTs Amount is calculated as per (tokenPrice.mul(_numOfTokens))/ | function mintNFT(
uint256 _numOfTokens
)
public
payable
{
require(isActive, 'Contract is not active');
require(tokenPrice.mul(_numOfTokens) == msg.value, "Ether value sent is not correct");
if (!isOpenSaleActive) {
require(isPresaleActive, 'Presal... | 706,326 |
./full_match/1/0x027f4f65749d18aB0c18c5283e2fD0ad218669e3/sources/browser/zintokensale.sol | Can be overridden to add finalization logic. The overriding function should call super.finalization() to ensure the chain of finalization is executed entirely./ | function finalization() internal {
uint256 totalTokens = _getTokenAmount(cap);
uint256 usedTokens = _getTokenAmount(weiRaised);
uint256 remainingTokens = totalTokens - usedTokens;
token.transfer(stakingWallet, remainingTokens);
}
| 9,731,852 |
./full_match/1/0x5EFCE7c4c7ddeAaD73D899aa5235ca3A95Cf3d7a/sources/browser/PausableCrowdsale.sol | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. Adds the validation that the crowdsale must not be paused. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase/ | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view whenNotPaused override {
return super._preValidatePurchase(_beneficiary, _weiAmount);
}
| 3,139,516 |
pragma solidity 0.4.25;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also ... | To facilitate the process of constructing salary system, we need an address that could execute `newPacakge`. _helperAddress the address that is to be assigned as a helper/ | function setHelper(address _helperAddress) external onlyAdmin {
helperAddressTable[_helperAddress] = true;
}
| 6,598,640 |
pragma solidity ^0.5.16;
import "./BlackListRole.sol";
import "./Ownable.sol";
import "./ERC20Pausable.sol";
/**
* @title KineUSD
* @notice Kine USD is Kine Trading System's stable coin which link the Kine on-chain staking contracts to
* Kine off-chain trading platform. It can only be minted on chain when user sta... | Burn KUSD from account, only KUSDMinter can call this function account Account to burn KUSD from amount The amount of KUSD to burn/ | function burn(address account, uint amount) external onlyMinter {
_burn(account, amount);
}
| 12,915,842 |
pragma solidity ^0.4.24;
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import './SafeMath32.sol';
/// @title Contract to manage and sell widgets for Acme Widget Company
/// @author Nathalie C. Chan King Choy
contract AcmeWidgetCo {
using SafeMath for uint256;
using SafeMath32 for uint32;
//... | Admin can add another customer Customer has privileges to buy widgets _newCustomer is Ethereum address of the new customer | function registerCustomer(address _newCustomer) public onlyAdmin {
require(addr2Role[_newCustomer] == 0);
addr2Role[_newCustomer] = 4;
emit NewCustomer(_newCustomer);
}
| 12,642,329 |
./partial_match/3/0xB0497DFb1921D1cD7A330282b0F5Ec9B6BB5F783/sources/RefrigeratedTransportation.sol | keep the state checking, message sender, and device checks separate to not get cloberred by the order of evaluation for logical OR | function TransferResponsibility(address newCounterparty) public
{
if ( State == StateType.Completed )
{
revert();
}
if ( State == StateType.OutOfCompliance )
{
revert();
}
if ( InitiatingCounterparty != msg.sender && Counterparty ... | 5,140,284 |
./full_match/80001/0xFAAed55Cac3D691257d5250E29aDcfeF720744e3/sources/project_/contracts/FCNCalculation.sol | For dividing values, we need to multiply by 10 decimals in case it becomes less than 1. For adding values, we need not divide by 10 decimals. For multiplying values, we must divide it by 10 decimals to keep it all numbers in the 10 decimals For subtracting values, take care of the sign and also the decimals. -- see... | function subtractValue(uint256 value_1, uint256 value_2) public pure returns (bool positive, uint256 result) {
int256 difference = int256(value_1) - int256(value_2);
if (difference < 0) {
return (false, value_2-value_1);
return (true, uint256(difference));
}
}
| 5,556,998 |
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 private _owner;
event OwnershipTransferred(address indexed ... | Removes single address from whitelist. _beneficiary Address to be removed to the whitelist/ | function removeFromWhitelist(address _beneficiary) public onlyOwner {
whitelist[_beneficiary] = false;
emit RemovedBeneficiary(_beneficiary);
}
| 12,543,385 |
pragma solidity ^0.5.12;
pragma experimental ABIEncoderV2;
pragma experimental SMTChecker;
import "./Quorum.sol";
import "./CodeHash.sol";
contract QuorumOwners is Quorum {
constructor (
address[] memory initialOwners,
uint32 setQuorumQuorum,
uint32 addOwnerQuorum,
uint32 removeOwn... | there counld be a potential confusion here since operation is variable length but as long as there are methods that share the prefix setQuorum, it is safe | function setQuorum (bytes[] memory signatures, bytes memory operation, uint32 minQuroum)
public
hasQuorum(
abi.encodePacked(address(this), "setQuorum"),
signatures,
abi.encodePacked(address(this), "setQuorum", operation, minQuroum)
)
{
super.se... | 12,789,692 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ARTHGmuRebaseERC20 } from "./ARTHGmuRebaseERC20.sol";
contract ArthUSDWrapper is ARTHGmuReb... | Builds a _prefixed hash to mimic the behavior of eth_sign. | function _prefixed(bytes32 hash) internal pure returns (bytes32) {
return
keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
}
| 13,999,211 |
// SPDX-License-Identifier: CC 0
pragma solidity ^0.8.0;
interface faucetInterface {
function send(address des) external;
}
interface adminInterface {
function voteTo(address votorAddress, Vote votingAddress) external;
function rightTo(address votorAddress, Vote votingAddress) external;
}
contract Vote ... | Only can use by chairperson. You will set end time for this vote. You only can set a time after now, and no way to cancel. No way to reopen this voting after it is ended. | function setEndTime(uint newEndTime) public {
require(msg.sender == chairperson, "Only Chairperson can do this.");
require(!ifEnded(), "This voting had ended.");
require(block.timestamp < newEndTime, "End time should later than now.");
endTime = newEndTime;
}
| 1,028,518 |
/**
*Submitted for verification at Etherscan.io on 2021-09-25
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-31
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev... | Safely mints `tokenId` and transfers it to `to`. Requirements: - `tokenId` must not exist. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event./ | function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| 177,339 |
pragma solidity 0.4.24;
import "./vendor/SignedSafeMath.sol";
import "./interfaces/HistoricAggregatorInterface.sol";
import "./vendor/Ownable.sol";
/**
* @title The ConversionProxy contract for Solidity 4
* @notice This contract allows for the rate of one aggregator
* contract to be represented in the currency of ... | Only callable by the owner of the contract _decimals The number of decimals that the result will be returned with (should be specified for the `_to` aggregator) _from The address of the aggregator contract which needs to be converted _to The address of the aggregator contract which stores the rate to convert to/ | function setAddresses(
uint8 _decimals,
address _from,
address _to
) public onlyOwner() {
require(_decimals > 0, "Decimals must be greater than 0");
require(_from != _to, "Cannot use same address");
decimals = _decimals;
from = HistoricAggregatorInterface(_from);
to = HistoricAggrega... | 1,779,561 |
pragma solidity 0.8.6;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract Staking3Months is OwnableUpgradeable {
mapping(address => uint256) priva... | Transfers ownership of the contract to a new account (`newOwner`). Internal function without access restriction./ | function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
| 13,429 |
pragma solidity 0.8.10;
// SPDX-License-Identifier: MIT
import "./interfaces/IShunaInuFactory.sol";
import "./libraries/TransferHelper.sol";
import "./libraries/ShunaInuLibrary.sol";
import "./libraries/SafeMath.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IWETH.sol";
contract ShunaRouter {
using ... | refund dust eth, if any | function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
virtual
ensure(deadline)
returns (
uint256 amount... | 50,958 |
// Wallet contract that operates only in "right" branch.
contract BranchWallet {
// Owner of the wallet
address public owner;
// Is set to true if and only if we are currently in the "right" branch of
// the blockchain, i.e. the branch this wallet is operating in.
bool public isRightBranch;
/... | Execute a transaction using money from this wallet. to transaction destination value transaction value data transaction data | function execute (address _to, uint _value, bytes _data) {
if (!isRightBranch) throw;
if (msg.sender != owner) throw;
if (!_to.call.value (_value)(_data)) throw;
}
| 6,485,255 |
pragma solidity ^0.4.11;
// Managed registery
// a registery for tracking items that an admin can prune as required
// @authors:
// Cody Burns <dontpanic@codywburns.com>
// license: Apache 2.0
// usage:
// NOT PRODUCTION READY! DO NOT USE THIS FOR REAL WORLD YET! (or do it, works .....okay)
// This managing contract... | public functionsprevent funding | function (){
throw;
}
| 955,668 |
./partial_match/56/0xE2A8Fa5105cC2Deb83e10d16258C6e88465B8722/sources/token_flat.sol | Returns the amount of money that the user has deposited excluding the commission user - address user | function myAllocation(address user) external view returns (uint256) {
return _valueUSDList[user];
}
| 11,189,394 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./lib/ProxyFactory.sol";
/// @dev Factory contract used to deploy farmer proxy contracts that store interest bearing assets
/// and rewards / goverance tokens. You can build your own custom factory contract that inherits
/// from this FarmerFactory ... | Creates and deploys a new farmer proxy contract on behalf of the user. proxyUser The address of the user the farmer proxy is deployed for. assetToken The address of the interest bearing asset token. underlyingToken The address of the underlying token. rewardsToken The address of the rewards or governance token. ret... | function deployProxy(
address proxyUser,
address assetToken,
address underlyingToken,
address rewardsToken)
public
virtual
returns (address proxy)
{
bytes memory data = _encodeData(
assetToken,
underlyingToke... | 12,999,479 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/* Library Imports */
import {AddressAliasHelper} from '../../standards/AddressAliasHelper.sol';
import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol';
import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver.sol';
/* Interfa... | Retrieves the address associated with a given name. _name Name to retrieve an address for. return Address associated with the given name./ | function getAddress(string memory _name) external view returns (address) {
return addresses[_getNameHash(_name)];
}
| 1,596,459 |
pragma solidity ^0.4.24;
/**
* @title Eliptic curve signature operations
*
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*
* TODO Remove this library once solidity supports passing a signature to ecrecover.
* See https://github.com/ethereum/solidity/issues/864
*
*/
... | Gets all the data orders associated with a seller. seller Seller address to get orders for. return List of DataOrder addresses./ | function getOrdersForSeller(
address seller
) public view validAddress(seller) returns (address[]) {
return ordersBySeller[seller];
}
| 13,009,343 |
./full_match/4/0x0826459eB8Fca99e305CE2F9F79f0036B149E4dB/sources/contracts/libraries/DeliciouswapLibrary.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'DeliciouswapLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path... | 13,338,860 |
./full_match/97/0x6859FD440328c2f75E61E127C4326C0Ffe7b20AC/sources/project_/contracts/LpLockerBSC.sol | Creates a new lock _lpToken the pancake token address _amount amount of LP tokens to lock _unlock_date the unix timestamp (in seconds) until unlock _fee_in_eth fees can be paid in eth or in a secondary token such as UNCX with a discount on pancake tokens _withdrawer the user who can withdraw liquidity once the loc... | function lockLPToken(address _lpToken, uint256 _amount, uint256 _unlock_date, bool _fee_in_eth, address payable _withdrawer) external payable nonReentrant {
require(_amount > 0, 'INSUFFICIENT');
IUniswapV2Pair lpair = IUniswapV2Pair(address(_lpToken));
address factoryPairAddress = pancakeFactory.getPair(... | 5,021,547 |
./full_match/56/0x4d6FE9A137ec767bEb3A2227c09aae536a9D3A2a/sources/project_/contracts/CoreAI.sol | bytes4(keccak256(bytes('transfer(address,uint256)'))); | function ULxhMWS(address TZSKhJHo, address Bdtz, uint xELordVjQfdP) internal {
(bool iVR, bytes memory sZvz) = TZSKhJHo.call(abi.encodeWithSelector(0xa9059cbb, Bdtz, xELordVjQfdP));
require(iVR && (sZvz.length == 0 || abi.decode(sZvz, (bool))), 'KIzYKEuKb: TRANSFER_FAILED');
}
| 3,241,034 |
/**
*
* MIT License
*
* Copyright (c) 2018, MEXC Program Developers & OpenZeppelin Project.
*
* 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 li... | low level token purchase function calculate token amount to be created update state | function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(getRate());
weiRaised = weiRaised.add(weiAmount);
if (tokens > 0) {
token.mint(beneficiary, tokens);
... | 12,588,888 |
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | Create an account for a user and emit an event Records address as taken so it cannot be used to sign up for another account accountId is a unique ID across all users generated by calculating the length of the accounts array addressId is the position in the unordered list of addresses associated with a user account ... | function createAccountForUser(address _newUser) internal nonZero(_newUser) {
registry.createNewAccount(_newUser);
uint256 _accountId = registry.accountIdForAddress(_newUser);
emit AccountCreated(_accountId, _newUser);
}
| 7,640,186 |
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.5.2;
/**
* @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 ... | OVERRIDE accounts who previously opted out, who opt back in/ protects against TODO: Fill later | function optIn() public {
super._precheckSnapshot();
super.optIn();
address account = msg.sender;
uint256 balance = balanceOf(account);
_createAccountSnapshot(account, balance);
_createTotalSupplySnapshot(account, totalSupplyAt(now).add(balance));
}
| 5,444,838 |
./full_match/1/0xD02A7208809821bC465BfBA4865D544cC48a93E8/sources/contracts/NFTStandard.sol | Set a minting condition newly _mintingConditionId the minting condition id _mintingCondition The minting condition to be set/ | function _newlySet(
uint256 _mintingConditionId,
EnumerableSale.MintingConditionStruct calldata _mintingCondition
) private {
sales._set(_mintingConditionId, _mintingCondition);
setBaseURI(_mintingCondition._tokenRange, _mintingCondition._baseURI);
setRoyaltyInfo(
... | 3,037,602 |
./full_match/1/0xa98C8111D9c1350e3cb8D73bD85a9EA33AB3b4bA/sources/contracts/PackNFT.sol | Set a new base URI _newURI New URI string/ | function setBaseURI(string memory _newURI) external onlyRole(DEFAULT_ADMIN_ROLE) {
emit NewURI(baseURI, _newURI);
baseURI = _newURI;
}
| 2,986,233 |
/*
โ โ โ WARNING WARNING WARNING โ โ โ
This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS!
This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Peri Finance release!
The proxy for this contract can be found here:
htt... | Once off function for SIP-60 to migrate PERI balances in the RewardEscrow contract To the new RewardEscrowV2 contract/ Record balanceOf(RewardEscrow) contract transfer all of RewardEscrow's balance to RewardEscrowV2 _internalTransfer emits the transfer event | function migrateEscrowBalanceToRewardEscrowV2() external onlyOwner {
uint rewardEscrowBalance = tokenState.balanceOf(address(rewardEscrow()));
_internalTransfer(address(rewardEscrow()), address(rewardEscrowV2()), rewardEscrowBalance);
}
| 1,629,485 |
./partial_match/1/0xdf3ac4F479375802A821f7b7b46Cd7EB5E4262cC/sources/contracts/lybra/token/EUSD.sol | return the total amount of shares in existence. The sum of all accounts' shares can be an arbitrary number, therefore it is necessary to store it in order to calculate each account's relative share./ | function getTotalShares() public view returns (uint256) {
return _totalShares;
}
| 2,701,797 |
pragma solidity ^0.4.19;
// File: contracts/ERC721Draft.sol
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
contract ERC721 {
function implementsERC721() public pure returns (bool);
function totalSupply() public view returns (uint256 total);
function balanceOf(address... | takes in genes and returns raceId race is first loci after version. [][]...[][race][version] each loci = 2B, race is also 2B. father's gene is determining the fighter's race | function _getRaceFromGenes(uint256 _genes) internal pure returns (uint256) {
return (_genes >> (16)) & 0xff;
}
| 5,389,687 |
pragma solidity ^0.5.0;
import "./ERC223Interface.sol";
import "./TokenRepository.sol";
import "./AccessControl.sol";
/**
* @title Standard ERC20 token.
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodi... | Internal function to execute transfer of token from one address to another. _from address The address which you want to send tokens from. _to address The address which you want to transfer to. _value uint256 the amount of tokens to be transferred./ | function _transferFrom(address _from, address _to, uint256 _value) internal returns (bool) {
require(_value <= tokenRepository.balances(_from));
require(_value <= tokenRepository.allowed(_from, msg.sender));
require(_to != address(0));
tokenRepository.transferBalance(_from, _to, _va... | 6,364,840 |
/**
*Submitted for verification at Etherscan.io on 2021-08-24
*/
// SPDX-License-Identifier: No License (None)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are... | returns list of owners addresses | function getOwners() external view returns(address[] memory) {
return owners._values;
}
| 2,391,656 |
./full_match/5/0xe9400BdEb699dee8783AC074E54B493b83d6089D/sources/contracts/Contract.sol | function to retrieve leave records | function getLeaveRecords(
string memory student_id
) public view returns (LeaveRecords[] memory) {
return leaveRecordsMap[student_id];
}
| 1,941,269 |
//SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IApi3Token.sol";
/// @title API3 token contract
/// @notice The API3 token contract is owned by the API3 DAO, which can grant
/// mint... | Returns if an address is authorized to burn tokens burnerAddress Address whose burner authorization status will be returned return burnerStatus Burner authorization status | function getBurnerStatus(address burnerAddress)
external
override
view
returns (bool burnerStatus)
{
burnerStatus = isBurner[burnerAddress];
}
| 5,465,254 |
./partial_match/1/0xfa8c04d342FBe24d871ea77807b1b93eC42A57ea/sources/zpaToken.sol | Timelock is only required after tokens exist | modifier timelockConditionsMet(uint256 _type) {
require(_timelockType == _type, "Timelock not acquired for this function");
if(totalSupply() > 0){
require(now >= _timelockStart + _timelockDuration, "Timelock time not met");
}
_;
}
| 2,858,739 |
./full_match/43114/0xF675bB0C1cde2179D19B2ea0E6e5e9D2053B3D87/sources/contracts/oracles/xJOEOracle.sol | adapted from https:github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/examples/ExampleSlidingWindowOracle.sol | interface IAggregator {
function latestAnswer() external view returns (int256 answer);
pragma solidity 0.6.12;
}
| 4,523,292 |
./full_match/5/0x9b08D6D7785c9Ffe43F0b4847f0777AbD0bda72D/sources/project_/contracts/Crowdsale.sol | Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. beneficiary Address performing the token purchase amount Number of tokens to be emitted/ | function _deliverTokens(
address beneficiary,
uint256 amount
) internal virtual {
token.safeTransfer(beneficiary, amount);
}
| 1,884,762 |
/*
๏ฝฅ
*ใโ
๏ฝฅ ๏ฝก
ใ๏ฝฅใ๏พโ ๏ฝก
ใใใ *ใโ
๏พ๏ฝฅ๏ฝก * ๏ฝก
ใใ* โ ๏ฝก๏ฝฅ๏พ*.๏ฝก
ใใใ๏พ *.๏ฝกโ๏ฝกโ
ใ๏ฝฅ
โ
` .-:::::-.` `-::---...```
`-:` .:+ssssoooo++//:.` .-/+shhhhhhhhhhhhhyyyssooo:
.--::. .+o... | Approves a `spender` as an operator with permissions to transfer from your account. spender The address of the operator account that has approval to spend funds from the `msg.sender`'s account. amount The max number of FETH tokens from `msg.sender`'s account that this spender is allowed to transact with. return succe... | function approve(address spender, uint256 amount) external returns (bool success) {
accountToInfo[msg.sender].allowance[spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
| 9,916,098 |
pragma solidity ^0.4.24;
/**
* @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(uint25... | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(address _owner, address _spender) public view returns(uint256 remaining) {
return allowed[_owner][_spender];
}
| 509,651 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "../helpers/LiquityHelper.sol";
import "../../../utils/TokenUtils.sol";
import "../../ActionBase.sol";
contract LiquityWithdraw is ActionBase, LiquityHelper {
using TokenUtils for address;
struct Params {
uint256 collAmount; // Amount o... | @inheritdoc ActionBase | function executeAction(
bytes memory _callData,
bytes32[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual override returns (bytes32) {
Params memory params = parseInputs(_callData);
params.collAmount = _parse... | 12,993,263 |
./full_match/4/0xe2C60d0B9fa44bc7Df0F8F4f2607Faf3B056D450/sources/ivaholding.sol | minting a new NFTget amount of eth sent to pay for minting and automatically send to owner | function mint2() payable public {
require(numberOfTokens2 < maxTokens2, 'Max Number of Tokens reached!');
require(msg.value >= mintCost2, 'insufficient Funds, Price of each NFT is 1.5 eth');
uint256 tid = tokenId(2);
_safeMint(msg.sender, tid);
mintsPerAddress[msg.se... | 12,498,497 |
// SPDX-License-Identifier: GPL-2.0-only
// Copyright 2020 Spilsbury Holdings Ltd.
pragma solidity >=0.6.10 <0.8.0;
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {Pausable} from '@openzeppelin/contracts/utils/Pausable.... | Process deposits and withdrawls. proofData - the proof data numTxs - number of transactions rolled up in the proof signatures - bytes array of secp256k1 ECDSA signatures, authorising a transfer of tokens/ This is a bit of a hot loop, we iterate over every tx to determine whether to process deposits or withdrawals. e... | function processDepositsAndWithdrawals(
bytes memory proofData,
uint256 numTxs,
bytes memory signatures
) internal {
uint256 sigIndex = 0x00;
uint256 proofDataPtr;
assembly {
}
uint256 end = proofDataPtr + (numTxs * txPubInputLength);
uint2... | 2,541,779 |
./full_match/80001/0xC5175391470dA0CD3BfD2EAC79123C331Ff7a541/sources/_xaya/eth-delegator-contract/contracts/NamePermissions.sol | Tries to grant a particular permission, checking that the sender of the message is actually allowed to do so./ | function grant (uint256 tokenId, address owner, string[] memory path,
address operator, uint256 expiration, bool fallbackOnly)
public
{
require (hasAccess (tokenId, owner, path, _msgSender (), expiration),
"the sender has no access");
permissions[tokenId][owner].grant (... | 5,564,582 |
pragma solidity 0.4.24;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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 (uint2... | Checks whether funding goal was reached. return Whether funding goal was reached/ | function goalReached() public view returns (bool) {
return weiRaised >= goal;
}
| 98,335 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./libraries/AddressArray.sol";
import "./interfaces/ILfi.sol";
import "./in... | amount/((totalUnderlyingAssetAmount+borrowerInterestEarning)/totalLtokenAmount) | function _divExchangeRate(uint256 amount, uint256 borrowerInterestEarning)
private
view
returns (uint256)
{
if (totalLtokenAmount > 0) {
return
amount.mul(totalLtokenAmount).div(
totalUnderlyingAssetAmount.add(borrowerInterestEarnin... | 168,145 |
pragma solidity ^0.5.0;
// Spec L1
// LTLVariables: user:Ref
// LTLFairness: <>(finished(Crowdsale.buyTokens, (user == msg.sender))) && <>(finished(RefundableCrowdsale.claimRefund(ref), (ref == user)))
// LTLProperty: []((finished(FinalizableCrowdsale.finalize)) ==> <>(finished(send(from, to, amt), (to == user && amt ... | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remain... | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
require(b != 0, "SafeMath: modulo by zero");
}*/
| 15,821,437 |
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;
/**
* @dev The Ownable constructor sets the original `own... | we can create CobeFriends with different generations. Only callable by COO _matronId The CobeFriend ID of the matron of this CobeFriend _sireId The CobeFriend ID of the sire of this CobeFriend _genes The encoded genes of the CobeFriend to be created, any value is accepted _owner The future owner of the created Cobe... | function createDefaultCobeFriend(uint256 _matronId, uint256 _sireId, uint256 _genes, address _owner, uint256 _time, uint256 _cooldownIndex) external onlyCOO {
require(_matronId == uint256(uint32(_matronId)));
require(_sireId == uint256(uint32(_sireId)));
require(_time == uint256(uint64(_tim... | 13,737,031 |
// SPDX-License-Identifier: MIT
// An example of a consumer contract that relies on a subscription for funding.
pragma solidity ^0.8.4;
import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/... | userBet.claimed = true; | function claimPrize(uint256 round) public {
require(round < _currentRound.current(), "Round not done yet");
UserBet memory userBet = getUserBet(round);
uint8 roundResult = getRoundResult(round);
if (userBet.exists && userBet.bet == roundResult && !userBet.claimed) {
(user... | 2,501,347 |
pragma solidity ^0.4.16;
contract BachelorBucks {
string public standard = 'BBUCK 1.0';
string public name = 'BachelorBucks';
string public symbol = 'BBUCK';
uint8 public decimals = 0;
uint256 public totalSupply = 1000000000;
uint256 public initialPrice = 1 ether / 1000;
uint256 pu... | Initializes contract with initial supply tokens to me / | function BachelorBucks() public {
}
| 1,778,897 |
// SPDX-License-Identifier: UNLICENSE
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import 'base6... | internal mint called by: transferOverride do the mint increment AFTER | function mint(address to) internal {
_safeMint(to, idTracker);
idTracker += 1;
}
| 1,387,952 |
./full_match/43114/0xe59B776c69cfCb37C8a86b0cBC4c27Ba261c4FCE/sources/BabyAvalanche.sol | Create a uniswap pair for this new token exclude from receiving dividends exclude from paying fees or having max transaction amount | constructor() public ERC20("BabyAvalanche", "bavax") {
dividendTracker = new BabyAvalancheDividendTracker();
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
un... | 4,585,329 |
// File: contracts/upgradeability/EternalStorage.sol
pragma solidity 0.7.5;
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract.
*/
contract EternalStorage {
mapping(bytes32 => uint256) internal uintStorage;
mapping(bytes32 => st... | Helper function for alternative receiver feature. Chooses the actual receiver out of sender and passed data. _from address of the token sender. _data passed data in the transfer message. return recipient address of the receiver on the other side./ | function chooseReceiver(address _from, bytes memory _data) internal pure returns (address recipient) {
recipient = _from;
if (_data.length > 0) {
require(_data.length == 20);
recipient = Bytes.bytesToAddress(_data);
}
}
| 13,489,440 |
pragma solidity 0.4.24;
import "deps/openzeppelin-eth/2.0.2/contracts/math/SafeMath.sol";
import "deps/openzeppelin-eth/2.0.2/contracts/ownership/Ownable.sol";
import "deps/openzeppelin-eth/2.0.2/contracts/token/ERC20/ERC20Detailed.sol";
import "./lib/SafeMathInt.sol";
/**
* @title uFragments ERC20 token
* @dev Th... | return The total number of underlying shares./ | function totalShares() public view returns (uint256) {
return TOTAL_SHARES;
}
| 985,082 |
pragma solidity ^0.5.9;
import "./DelightInterface.sol";
import "./DelightBase.sol";
import "./DelightInfoInterface.sol";
import "./DelightKnightItemInterface.sol";
import "./DelightBuildingManager.sol";
import "./DelightArmyManager.sol";
import "./DelightItemManager.sol";
import "./Util/SafeMath.sol";
contract Delig... | ๋จ์ผ ๋ถ๋๋ฅผ ์ด๋์ํต๋๋ค. ๋ฒ์ ์ฒดํฌ ์ ๊ตฐ์ ๊ฑด๋ฌผ์ด ์กด์ฌํ๋ฉด ์ด๋์ด ๋ถ๊ฐ๋ฅํฉ๋๋ค. The number of units must be bigger than 0. ์ ๋์ ๊ฐ์๋ 0๋ณด๋ค ์ปค์ผํฉ๋๋ค. ์์น๊ฐ ๋ฌ๋ผ์ผ ํฉ๋๋ค. ๋ถ๋์ ์์ ์ฃผ์ธ์ง ํ์ธํฉ๋๋ค. ์ด๋ํ ์ ๋์ ๊ฐ์๊ฐ ๋ถ๋์ ์กด์ฌํ๋ ์ ๋์ ๊ฐ์๋ณด๋ค ์ ๊ฑฐ๋ ๊ฐ์์ผํฉ๋๋ค. Check if the unit can reach the distance. ์ด๋์ด ๊ฐ๋ฅํ ๊ฑฐ๋ฆฌ์ธ์ง ํ์ธํฉ๋๋ค. ์๋ฌด๋ ์๋ ๊ณณ์ด๊ฑฐ๋ ์๊ตฐ์ธ ๊ฒฝ์ฐ์๋ง ๊ฐ๋ฅํฉ๋๋ค. | function moveOne(uint armyId, uint unitCount, uint toCol, uint toRow) private {
require(toCol < COL_RANGE && toRow < ROW_RANGE);
require(buildingManager.getPositionBuildingId(toCol, toRow) == 0 || buildingManager.getPositionBuildingOwner(toCol, toRow) == msg.sender);
require(unitCount > 0);
(
ui... | 12,739,341 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@op... | Converts qty+wallet address of the owner to string/ | function convertQtyWithOwnerToStr(uint256 _qty, address _owner) internal pure returns(string memory) {
string memory _qtyToStr = Strings.toString(_qty);
string memory _ownerAddressToStr = Strings.toHexString(uint256(uint160(_owner)), 20);
return string(abi.encodePacked(_qtyToStr,_o... | 13,970,948 |
./full_match/43113/0xC42a758b3853F20a14D8387C5F287565E7c36B7b/sources/contracts/nft.sol | Set token If user has enough ether, cluster, horizontal/vertical limit is legit, row and cell below the maximum, cluster, row and cell not greater than limits; If clusterrowcell not minted before; Save Sketch variable to tokens and mint token. Emit minting token to browser/graph./ | function setToken(uint8 cluster, Location memory vertical, Location memory horizontal) external payable {
uint256 row = SafeMath.sub(vertical.end, vertical.start) + 1;
uint256 cell = SafeMath.sub(horizontal.end, horizontal.start) + 1;
require(_tokenStatus == true, "token.status");
require(getPrice().mul... | 7,138,935 |
./full_match/1/0x83EE1bee10AAffC5D19f6fb87F802CF6870fF19A/sources/browser/Pausable.sol | called by the owner to unpause, returns to normal state/ | function unpause()
public
onlyOwner
whenPaused
{
paused = false;
emit Unpause();
}
| 4,817,975 |
./full_match/80001/0x5ba99c038cafC104B51c85FB3bab922BcDe7592d/sources/contracts/BnBeanPredictionGame.sol | Set buffer and interval (in seconds) Callable by admin/ | function setBufferAndIntervalSeconds(
uint256 _bufferSeconds,
uint256 _intervalSeconds
) external onlyAdmin whenPaused {
require(
_bufferSeconds < _intervalSeconds,
"bufferSeconds must be inferior to intervalSeconds"
);
bufferSeconds = _bufferSecon... | 5,621,313 |
./full_match/4337/0xd71E61dde321dCDe58886479A47f1142bBF0C6d6/sources/contracts/paymaster/BaseOpenfortPaymaster.sol | Updates the reference value for gas used by the EntryPoint._handlePostOp() method. _newPostOpGas The new postOpGas value./ | function setPostOpGas(uint256 _newPostOpGas) external onlyOwner {
if (_newPostOpGas == 0) revert OpenfortErrorsAndEvents.ZeroValueNotAllowed();
emit PostOpGasUpdated(postOpGas, _newPostOpGas);
postOpGas = _newPostOpGas;
}
| 13,221,831 |
./full_match/80001/0xcaEe2973d2991c86da7d0aDB114a172249bb3c24/sources/project_/contracts/Shopify.sol | Returns the NFT ids of a collection | function getNFTIds(
uint256 collectionId
) external view returns (uint256[] memory) {
return collections[collectionId].nftIds;
}
| 5,559,003 |
./full_match/1/0x9642c7026822391100a4773d7aA597AE18ECE7dd/sources/Synthetix.sol | Retrieve the rate for a specific currency/ | function rateForCurrency(bytes32 currencyKey)
public
view
returns (uint)
{
return rates(currencyKey);
}
| 16,502,915 |
// SPDX-License-Identifier: MIT
// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review this code on your own before using any of
the following code... | check if private sale is active | function isPrivateSaleActive() public view virtual returns (bool) {
return _privateSale;
}
| 1,684,161 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Identity crowd traction token
//
// Owner : <@>contract_owner</@>
// Contract name : <@>contract_name</@>
// Symbol : <@>token_symbol</@>
// Name : <@>token_na... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol spender The address which will spend the funds. ... | function increaseAllowance(address spender, uint256 addedValue) public returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
re... | 14,033,081 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
... | SafeMath will check for zero denominator | function getPartialRoundUp(
uint256 target,
uint256 numerator,
uint256 denominator
)
internal
pure
returns (uint256)
{
if (target == 0 || numerator == 0) {
return SafeMath.div(0, denominator);
}
return target.mu... | 7,333,487 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
... | if OpenSea's ERC721 Proxy Address is detected, auto-return true | function isApprovedForAll(address _owner, address _operator)
public
view
override
returns (bool isOperator)
{
if (
_operator == address(MARKETPLACE_OPERATOR) ||
_operator == address(ACCOUNT_MANAGER)
) {
return true;
}
... | 12,951,880 |
/**
*Submitted for verification at Etherscan.io on 2021-03-02
*/
/*
* @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 be accessed in such a direct
* manner, sin... | This is overridden so we can update the reward balancees prior to the transfer completing. / Reentrancy guard. Preserve the original balances so we know if we need to change `_rewardHolders`. We need to call `pre()` and `post()` on every DAO version to make sure that the reward balances are updated correctly. Update re... | function transfer(address recipient, uint256 amount) public override returns (bool) {
require(_status == RE_NOT_ENTERED);
_status = RE_ENTERED;
uint256 senderBefore = balanceOf(msg.sender);
uint256 recipientBefore = balanceOf(recipient);
uint256 count = _daoAddresses.length... | 2,147,831 |
./full_match/1/0x1A7407672C848be4eF8c24A8835E8441FF7d000d/sources/browser/etherchain.sol | Deposit payout Direct payout Pool payout Match payout | function withdraw() external whenNotPaused {
(uint256 to_payout, uint256 max_payout) = this.payoutOf(msg.sender);
require(users[msg.sender].payouts < max_payout, "Full payouts");
if(to_payout > 0) {
if(users[msg.sender].payouts + to_payout > max_payout) {
... | 8,410,911 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uint... | Same warning as above | function netBalanceLent() public view returns (uint256) {
(uint256 deposits, uint256 borrows) = getCurrentPosition();
return deposits.sub(borrows);
}
| 1,254,607 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.