file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x02f28544C89b2D704Eb0d1F9f4fc60d688ad8959/sources/SPTToken.sol | If account is flagged to freeze return true | function frozen(address _account) public view returns (bool){ | 3,976,783 |
./full_match/1/0xBa5F7f5502BBA82460D29B1b9aeE967CAf2B4F5e/sources/FlattenPool.sol | Swap ETH to WETH for user | function addLiquidityWithEth(uint256 cookAmount)
internal
returns (uint256, uint256)
{
(uint256 wethAmount, address wethAddress) =
_calWethAmountToPairCook(cookAmount);
require(
msg.value == wethAmount,
"Please provide exact amount of eth need... | 16,591,838 |
./full_match/1/0xE7C2016f5344858f6A1874424d077aDD3ea81fa5/sources/@aragon/govern-core/contracts/pipelines/GovernQueue.sol | Apply arbitrator's ruling over a challenge once it has come to a final ruling _container A ERC3000Data.Container struct holding both the payload being scheduled for execution and the current configuration of the system _disputeId disputeId in the arbitrator in which the dispute over the container was created/ | function resolve(ERC3000Data.Container memory _container, uint256 _disputeId) override public returns (bytes32 failureMap, bytes[] memory) {
bytes32 containerHash = _container.hash();
IArbitrator arbitrator = IArbitrator(_container.config.resolver);
require(disputeItemCache[containerHash][a... | 4,907,043 |
/**
* MPSBoardSig.sol
* Governance smart contract including multi-signature capabilities.
* It uniquely represents the Board of Directors of Mt Pelerin Group SA on-chain
* until it is superseded by a resolution of the board referring to a new
* governance on-chain reference.
* The unflattened code is avai... | returns replayProtection/ | function replayProtection() public view returns (bytes32) {
return replayProtection;
}
| 1,773,316 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
interface cToken {
function underlying() external view returns (address);
}
interface comptroller {
function getAllMarkets() external view returns (address[] memory);
function markets(address _market) external view returns (bool isListed, uint256 coll... | For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed | function getReserveConfiguration(address _market) external view returns (uint, uint, uint, bool);
function getConfiguration(address _market) external view returns (ReserveConfigurationMap memory);
}
function getParamsMemory(aavecore.ReserveConfigurationMap memory self) internal pure returns (uint256) {
... | 5,794,064 |
pragma solidity ^0.4.18;
contract EthPyramid {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in t... | The polynomial R = 2 + c2x^2 + c4x^4 + ... approximates the function x(exp(x)+1)/(exp(x)-1) Hence exp(x) = (R(x)+x)/(R(x)-x) | function fixedExp(int256 a) internal pure returns (uint256 exp) {
int256 scale = (a + (ln2_64dot5)) / ln2 - 64;
a -= scale*ln2;
int256 z = (a*a) / one;
int256 R = ((int256)(2) * one) +
(z*(c2 + (z*(c4 + (z*(c6 + (z*c8/one))/one))/one))/one);
exp = (uint256) (((R + a) * one) / (R - a));
if (scale >= 0)
... | 424,955 |
pragma solidity ^0.5.3;
pragma experimental ABIEncoderV2;
import "../../node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721Metadata.sol";
import "../../node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721Enumerable.sol";
import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath... | Internal function for apply commission on purchase/ pirce in cents for fiat in wei for crypto | function _applyCommission(uint256 _tokenId, uint32 _commission) internal {
datasetInfo[_tokenId].commission = _commission;
}
| 5,501,623 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/ILido.sol";
contract WstKSM is ERC20 {
// LIDO contract
ILido public LIDO;
// vKSM precompile
IERC20 public VK... | Get amount of wstKSM for a given amount of stKSM _stKSMAmount amount of stKSM return Amount of wstKSM for a given stKSM amount/ | function getWstKSMByStKSM(uint256 _stKSMAmount) external view returns (uint256) {
return LIDO.getSharesByPooledKSM(_stKSMAmount);
}
| 14,088,077 |
/**
*Submitted for verification at Etherscan.io on 2021-01-05
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace... | Increase the amount of tokens that an owner has allowed to a spender. This method should be used instead of approve() to avoid the double approval vulnerability described above. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by./ | function increaseAllowance(address spender, uint256 addedValue)
public
override
returns (bool)
{
require(!transfersPaused || transferPauseExemptList[msg.sender], "paused");
_allowedXdef[msg.sender][spender] = _allowedXdef[msg.sender][spender].add(addedValue);
emi... | 7,821,817 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
interface ServiceInterface {
function readServicesLength() external view returns (uint);
function readService(uint _index) external view returns (address, string memory, string memory, string memory, string memory, string memory, uint);
func... | hires will be initialized with 0 | function writeService(
string memory _name,
string memory _image,
string memory _description,
string memory _location,
string memory _contact
) external {
services[servicesLength] = Service(
payable(tx.origin),
_name,
_image,
_description,
_location,
_con... | 1,085,803 |
pragma solidity ^0.7.0;
import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "../node_modules/@openzeppelin/contracts/access/AccessControl.sol";
contract OneVote is AccessControl{
using SafeMath for uint256;
//EVENTS
//emitted when citizen is created showing new citizen's name, inde... | all candidates must be citizensemit event when canidiate is created /need to find out if it is possible to use _getCitizen() and assign that data to a variable like in javascriptdateOfBirth: citizen.dateOfBirth,officeTitle: office.officeTitle,zipCode: office.zipCode, / | function createCandidate(
uint256 _citizenId,
uint256 _stateId,
uint256 _officeId,
uint256 _electionId
) public returns(uint256){
require(stateIdInUse[_stateId] == true, "State Id is not assigned to a citizen yet");
require(... | 12,768,738 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "./utils/Address.sol";
import "./utils/Context.sol";
import "./utils/introspection/ERC165... | 查询a账户对o账户授权tokenId代币的可用数量 | function howManyApproved(address account, address operator, uint256 tokenId) public view returns (uint256) {
return _approvalCounts[account][operator][tokenId];
}
| 5,425,114 |
pragma solidity ^0.4.25;
interface ERC20 {
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
//function transferFrom(address from, address t... | function transferFrom(address from, address to, uint256 value) public returns (bool); | interface ERC20 {
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
function approve(address spender, uint256 value) public returns (bool);
eve... | 15,796,935 |
./full_match/4/0xd126eDB030c82b0A5a1885C8219229E99F9D72AB/sources/contracts/Token.sol | function mintWithIndex(address _creator, string memory _tokenURI) public onlyMinter returns (uint256 _tokenId){ | function mintWithIndex(address _creator, string memory _tokenURI) public returns (uint256 _tokenId) {
_tokenIds.increment();
uint256 tokenId = _tokenIds.current();
tokenOwner[tokenId] = _creator;
uint256 length = balanceOf(_creator);
tokenCreator[tokenId] = _creator;
... | 12,396,372 |
pragma solidity 0.5.17;
/**
* @title Initializeable logic contract implementation - used for testing.
*/
contract InitializeableImplementation {
bool private _initialized;
function initialize() external { // function signature: 0x8129fc1c
_initialized = true;
}
function initialized() external view re... | function signature: 0x8129fc1c | function initialize() external { | 1,001,145 |
./full_match/80001/0xBB07C62Fc2748500106f37AA2fE7c6c859afEA95/sources/contracts/SonicaERC721DelayedReveal.sol | Runs before every `claim` function call. | function _beforeClaim(
address,
uint256 _quantity,
address,
uint256,
AllowlistProof calldata,
bytes memory
) internal view override {
require(_currentIndex + _quantity <= nextTokenIdToLazyMint, "!Tokens");
require(maxTotalSupply == 0 || _currentInd... | 848,969 |
/**
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity =0.6.10;
pragma experimental ABIEncoderV2;
// File: contracts/packages/oz/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily res... | is a less than or equal to b a FixedPointInt b FixedPointInt return True if a <= b, False if not/ | function isLessThanOrEqual(FixedPointInt memory a, FixedPointInt memory b) internal pure returns (bool) {
return a.value <= b.value;
}
| 1,551,666 |
./full_match/80001/0x4444572f8e6FB8b76f2943C1ba15f5aA9b38eC72/sources/gist-4c970e79d3a27a9edbbf04d6c737be27/UserConfiguration.sol | Validate a user has been using the reserve as collateral self The configuration object reserveIndex The index of the reserve in the bitmap return True if the user has been using a reserve as collateral, false otherwise/ | function isUsingAsCollateral(
DataTypes.UserConfigurationMap memory self,
uint256 reserveIndex
) internal pure returns (bool) {
unchecked {
require(reserveIndex < ReserveConfiguration.MAX_RESERVES_COUNT, Errors.INVALID_RESERVE_INDEX);
return (self.data >> ((reserveIndex << 1) + 1)) & 1 != 0;... | 5,657,776 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "../client/node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract PardnaConfig {
// ARRAYS
User[] public users;
Pardna[] public pardnas;
// MAPPINGS
mapping (address => uint256[]) public pardnasParticipati... | Lists all public Pardnas with open slots | function pardnaDirectory() public returns (Pardna[] memory){
for(uint i=0;i<=pardnas.length;i++){
if (!pardnas[i].inviteOnly && pardnas[i].openSlots > 0 && block.timestamp > pardnas[i].throwDates[1]){
publicPardnas.push(pardnas[i]);
}
... | 2,544,743 |
./full_match/1/0xBC9934df96EeACF5B86F7070E8A60CA5665cd2E9/sources/contracts/YukonToken.sol | View the amount of dividend in wei that an address can withdraw. _owner The address of a token holder. return The amount of dividend in wei that `_owner` can withdraw. | function withdrawableDividendOf(address _owner) public view override returns(uint256) {
return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);
}
| 3,047,282 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "../../../interfaces/IEscrowTicketer.sol";
import "../../../interfaces/ISeenHausNFT.sol";
import "../../../interfaces/ISaleEnder.sol";
import "../MarketHandlerBase.sol"... | Close out a successfully completed sale. Funds are disbursed as normal. See: {MarketHandlerBase.disburseFunds} Reverts if: - Sale doesn't exist or hasn't started - There is remaining inventory (remaining supply in case of digital, remaining tickets in the case of physical) Emits a SaleEnded event. _consignmentId - id ... | function closeSale(uint256 _consignmentId)
external
override
{
MarketHandlerLib.MarketHandlerStorage storage mhs = MarketHandlerLib.marketHandlerStorage();
Consignment memory consignment = getMarketController().getConsignment(_consignmentId);
Sale storage sale = mhs.sales[_cons... | 14,623,668 |
./full_match/5/0x3ba6B81F70aa8dF8BB40c42cF09215f116F9cCBA/sources/contracts/CrowdFunding.sol | Check is everything ok? | function createCampaign(
address _owner,
string memory _ownerName,
string memory _title,
string memory _category,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image
) public returns (uint256) {
Campaign storage campaign = campaigns[number... | 1,874,538 |
./partial_match/1/0x86f7bB1F9d605F957B82A8Ce77EAf5936c8b3653/sources/_keep-network/keep-core/contracts/Escrow.sol | Withdraws all tokens from escrow to the beneficiary. If the beneficiary is not set, caller is not the beneficiary, or there are no tokens in escrow, function fails. | function withdraw() public {
require(beneficiary != address(0), "Beneficiary not assigned");
require(msg.sender == beneficiary, "Caller is not the beneficiary");
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "No tokens to withdraw");
token.safeTransfe... | 3,651,735 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function tran... | Refund ether to the investors (invoke from only token) update states | function refund(address _to) public refundAllowed {
require(msg.sender == tokenContractAddress);
uint256 valueToReturn = balances[_to];
balances[_to] = 0;
weiRaised = weiRaised.sub(valueToReturn);
_to.transfer(valueToReturn);
}
| 111,693 |
./full_match/1/0x780a50e3b1c708BF94421C9fb96dBAEe09cd903E/sources/contracts/interface/ISFIRewarder.sol | Interface of the SFIRewarder contract for SaffronStakingV2 to implement and call./ | interface ISFIRewarder {
function rewardUser(address to, uint256 amount) external;
event UserRewarded(address indexed to, uint256 amount);
}
| 3,209,718 |
./partial_match/1/0xcc64fc3ac4aF7e5D8c3162C0E75247A0BbeE6077/sources/ERC20.sol | See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amodupnat`./ | function transfer(address to, uint256 amodupnat) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amodupnat);
return true;
}
| 11,011,184 |
./partial_match/1/0x73d6c8c6796B4a664d34Fd97103340C8469f8917/sources/MoonICO.sol | Check ICO Contract Investor Token Balance | function investorBalanceOf(address _investor) external view returns (uint) {
return token.balanceOf(_investor);
}
| 4,197,375 |
./partial_match/1/0x6923F9B683111DCc0e20124e9A031dEeAE5DaD93/sources/HUB.sol | Enable or disable anti bot Only callable by the owner _antiBotEnabled Enable or disable anti bot/ | function setAntiBotEnabled(bool _antiBotEnabled) external onlyOwner {
antiBotEnabled = _antiBotEnabled;
}
| 2,679,180 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the o... | Claim rewards Here we use cumulative reward to make claim process idempotent _rewardsRequest rewards request bytes coded in protobuf _sigs list of signatures sorted by signer addresses _signers sorted list of current signers _powers powers of current signers/ | function claimRewards(
bytes calldata _rewardsRequest,
bytes[] calldata _sigs,
address[] calldata _signers,
uint256[] calldata _powers
) external whenNotPaused {
bytes32 domain = keccak256(abi.encodePacked(block.chainid, address(this), "FarmingRewards"));
sigsVeri... | 12,752,306 |
./full_match/5/0x2FE97a791D03B193966F8E7c1F216C020fb6c45A/sources/contracts/ETH/PresaleV1.sol | To calculate the price in USD for given amount of tokens. _amount No of tokens/ | function calculatePrice(uint256 _amount) public view returns (uint256) {
uint256 USDTAmount;
uint256 total = checkPoint == 0 ? totalTokensSold : checkPoint;
require(_amount <= maxTokensToBuy, 'Amount exceeds max tokens to buy');
if (_amount + total > rounds[0][currentStep] || block.timestamp >= rounds... | 7,091,715 |
pragma solidity ^0.4.24;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "./Percent.sol";
import "./MintableBurnableERC20Token.sol";
/*
* Sensei Kevlar presents...
*
* ================... | Retrieve the tokens owned by the caller./ | function myTokens() public view returns(uint256) {
return balanceOf(msg.sender);
}
| 14,015,181 |
./full_match/43113/0x8f295cE62C14C13CBeE1c50f1eCE0DE6f0561dEd/sources/apps/avai/src/contracts/Bank.sol | For liquidation Chainlink price source Token used as collateral Token used as debt Address that corresponds to liquidater address that corresponds to gateway, if there is one Vault that corresponds to the treasury Vault information Events for general vault operations Buying out a vault event Events for collateral opera... | {
bytes32 public constant TREASURY_ROLE = keccak256('TREASURY_ROLE');
using SafeERC20 for IERC20;
using SafeERC20 for IStablecoin;
using CountersUpgradeable for CountersUpgradeable.Counter;
CountersUpgradeable.Counter private _userVaultIds;
uint256 public minimumCollateralPercentage;
uint256 public debtCe... | 7,123,389 |
./partial_match/1/0x20d3613ce72EA75dcB16C09b7e82002C090dC434/sources/CHUCKY.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(ROUTER), tokenAmount);
address(this),
tokenAmount,
lpAddress,
block.timestamp
);
ROUTER.addLiquidityETH{value: ethAmount}(
}
| 2,632,940 |
pragma solidity ^0.5.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./IFlightSuretyData.sol";
contract FlightSuretyDa... | set the funding status only app contract knows the logic/ | function setAirlineFundingStatus(address airline, bool status) external whenNotPaused fromAuthorized {
airlines[airline].isFunded = status;
}
| 13,113,890 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;
import "./ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@1001-digital/erc721-extensions/contracts/WithContractMetaData.sol";
contract MG is
ERC721Enumerable,
Ownable,
WithContractMetaData
{
string public baseURI;
... | See {IERC721-ownerOf}./ | function ownerOf(uint256 tokenId) public view virtual override returns (address) {
require(tokenId > 0 && tokenId <= _totalSupply, "ERC721: owner query for nonexistent token");
if (_initiator_levies[tokenId] == address(0)) {
return _initiator;
}
address owner = _owners[to... | 1,318,278 |
pragma solidity >=0.4.16 <0.9.0;
contract BasketGame {
// A enum type
enum Team { Home, Visitor }
// Event
event FinalResult(uint home, uint visitor);
// A struct/custom type
struct Game {
uint homePoints;
uint visitorPoints;
bool gameFinished;
}
// State/storage variables
Game gam... | Functions that DON'T MODIFY contract storage. They don´t use gas | function getResult() external view returns(uint, uint) {
return(game.homePoints, game.visitorPoints);
}
| 13,022,366 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
import "contracts/Allocations.sol";
import "contracts/ExactDollarPartition.sol";
import "contracts/Phases.sol";
import "contracts/Proposals.sol";
import "contracts/Zipper.sol";
import "contracts/Token.sol";
import "cont... | getter returning the current phase of the contract return a value from the Phases enumeration, representing current state of the contract | function getCurrentPhase() external view override returns (uint8){
return currentPhase;
}
| 1,792,838 |
./full_match/40/0x5B19bd330A84c049b62D5B0FC2bA120217a18C1C/sources/contracts/proof/utility/LayerZeroPacket.sol | The log consists of the destination chain id and then a bytes payload 0--------------------------------------------31 0 | total bytes size 32 | destination chain id 64 | bytes offset 96 | bytes array size 128 | payload | function getPacket(
bytes memory data,
uint16 srcChain,
uint sizeOfSrcAddress,
bytes32 ulnAddress
) internal pure returns (LayerZeroPacket.Packet memory) {
uint16 dstChainId;
address dstAddress;
uint size;
uint64 nonce;
assembly {
... | 9,547,518 |
// File: contracts/common/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amo... | ========== STATE VARIABLES ========== / ========== CONSTRUCTOR ========== / | function _deposit() internal virtual;
function _claimReward() internal virtual;
function _withdrawSome(uint _amount) internal virtual returns (uint);
function _withdrawAll() internal virtual;
function getName() external pure virtual returns (string memory);
function balanceOf() public view... | 634,423 |
./full_match/1/0xAF345c813CE17Cc5837BfD14a910D365223F3B95/sources/contracts/helpers/converter/GeneralTokenConverter.sol | Swap from one token to another token. _poolType The pool type. _encoding The customized encoding of the route. _amountIn The amount of input token. _recipient The address of output token receiver. return _amountOut The amount of output token. tokenIn is (W)ETH and we are going to use ETH. Uniswap V2 | function _swap(
uint256 _poolType,
uint256 _encoding,
uint256 _amountIn,
address _recipient
) internal returns (uint256 _amountOut) {
(address _tokenIn, address _tokenOut) = _getTokenPair(_poolType, 0, _encoding);
address _pool = address(_encoding & 146150163733090291820368483271628301965593... | 4,884,772 |
/**
*Submitted for verification at Etherscan.io on 2022-04-10
*/
// SPDX-License-Identifier: MIT
// Be Bold: BBGRADE
// >>> FREE NFT minting. <<<
// Be Bold is a free giveaway collection with people from markets who inspire.
// There are motivational tokens with our own, made up, motivational rhymes.
// Even thoug... | Max mint value per wallet is 27 NFTs. That is the total allowed NFT mints quantity in a wallet. NOTE: Actually, if the minting wallet has not reached the set 27 NFTs mint maximum yet, it can mint even over the set limit of 27 NFTs, when minting the "last" mint with the maximum mint sum allowed./ The question w... | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity >=0.7.0 <0.9.0;
constructor() ERC721("Be Bold", "BBGRADE") {
}
| 2,194,708 |
./partial_match/1/0x072CE703c4C3916C564A5D66C7fc91C3A817392f/sources/TokenOracleDemo.sol | 获取pair的两个token的兑换比例,10位小数位,按数组索引查找 | function getPairPriceByIndex(uint index) external override view returns (address pair, string memory token0Symbol, string memory token1Symbol, uint token0Price, uint token1Price, uint blockTimestamp) {
require(index < pairInfo.length, "TokenOracle: index is out of range");
return (address(pairInfo[i... | 9,422,249 |
pragma solidity 0.4.24;
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;
}
function div(uint256 a, uint256 b) internal pure returns (uint256... | require(auctions[_auctionId].winner == address(0)); | function setWinner(address _winner, uint _auctionId, uint _finalPrice, uint _executeTime) onlyAdmin external {
require(auctions[_auctionId].exists);
require(!auctions[_auctionId].executed);
require(now > auctions[_auctionId].stopTime);
require(_finalPrice >= auctions[_auctionId].star... | 7,877,203 |
// 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].
*
* Implementers can declare support of contract interfaces, which can then be
* ... | Update the base URI for all tokens | function setTokenBaseURI(string memory baseURI_) external onlyAuthorized {
_tokenBaseURI = baseURI_;
}
| 38,776 |
/*
Copyright 2021 Set Labs Inc.
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... | Function handles all interactions with exchange. All GeneralIndexModule adapters must allow for selling or buying a fixed quantity of a token in return for a non-fixed (floating) quantity of a token. If `isSendTokenFixed` is true then the adapter will choose the exchange interface associated with inputting a fixed amou... | function _executeTrade(TradeInfo memory _tradeInfo) internal virtual {
_tradeInfo.setToken.invokeApprove(
_tradeInfo.sendToken,
_tradeInfo.exchangeAdapter.getSpender(),
_tradeInfo.sendQuantity
);
(
address targetExchange,
uint256 c... | 6,960,902 |
./full_match/1/0x167860391dd8C6B11ce4Fb37458F65E87c2ec863/sources/browser/NIFITYWORLD.sol | Update the given pool's NIFITY allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
}
| 3,199,029 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
/*
* @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, since when d... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 2,277,278 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../contracts/security/Pausable.sol";
import "../contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "../contracts/utils/AccessControl.sol";
/// @title PussyCat ERC20 Token
/// @author James Garfield
/// @notice A ERC20 token for the PussyCat pro... | Destroys `amount` tokens from the caller. See {ERC20Burnable}. | function burn(uint256 amount) public override canRunWhilePaused {
super.burn(amount);
}
| 12,969,805 |
./full_match/1/0x930eD81ad809603baf727117385D01f04354612E/sources/browser/SOLARITE.sol | Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred./ decrease allowance get value in solarites sub from from | function transferFrom(address from, address to, uint256 value)
external
validRecipient(to)
returns (bool)
{
_allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value);
uint256 solariteValue = value.mul(internalDecimals).div(solaritesScalingFacto... | 3,153,884 |
./partial_match/1/0x690C46531f777501989E253b89Df86C4451ED818/sources/Staking.sol | RetreebInc Interface Staking Platform with fixed APY and lockup | interface IStaking {
function startStaking() external;
function deposit(uint amount) external;
function withdrawAll() external;
function withdraw(uint amount) external;
function amountStaked(address stakeHolder) external view returns (uint);
function totalDeposited() external view returns (... | 3,721,453 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./ActionGuards.sol";
import "../../internal/AccountContextHandler.sol";
import "../../internal/liquidation/LiquidateCurrency.sol";
import "../../internal/liquidation/LiquidationHelpers.sol";
import "../../math/SafeInt256.sol";... | Calculates local and collateral currency transfers for a liquidation. This is a stateful method because it may settle the liquidated account if required. However, it can be called using staticcall off chain to determine the net currency amounts required before liquidating. liquidateAccount account to liquidate localC... | function calculateCollateralCurrencyLiquidation(
address liquidateAccount,
uint16 localCurrency,
uint16 collateralCurrency,
uint128 maxCollateralLiquidation,
uint96 maxNTokenLiquidation
)
external nonReentrant
returns (
int256,
int2... | 12,056,179 |
./full_match/1/0x43949399D34f8B61a899581575b5259B36F418d0/sources/contracts/staking/VeBids.sol | reverts if usedVote[_user] < -_voteDelta | function vote(address _user, int256 _voteDelta) external override onlyVoter {
if (_voteDelta >= 0) {
usedVote[_user] += uint256(_voteDelta);
_verifyVoteIsEnough(_user);
usedVote[_user] -= uint256(-_voteDelta);
}
emit Vote(_user, _voteDelta);
}
| 16,446,127 |
./partial_match/3/0x87569D60333195badD2BcF9db8d7c43660AEe9Eb/sources/Treasury.sol | 20% swapped to eth for reserve system | function allocateSeigniorage()
external
onlyOneBlock
checkCondition
checkEpoch
checkOperator
{
_updateCashPrice();
uint256 cashPrice = getCashPrice();
require(
cashPrice > cashPriceCeiling,
'Treasury: there is no seigniorage... | 5,235,759 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/libraries/KnockoutLiq.sol | Resets all fields on a existing pivot struct. / | function deletePivot (KnockoutPivot storage pivot) internal {
pivot.lots_ = 0;
pivot.pivotTime_ = 0;
pivot.rangeTicks_ = 0;
}
| 4,651,734 |
// Verified using https://dapp.tools
// hevm: flattened sources of src/saviours/NativeUnderlyingUniswapV2SafeSaviour.sol
pragma solidity =0.6.7 >=0.6.0 <0.8.0 >=0.6.7 <0.7.0;
////// src/interfaces/CoinJoinLike.sol
/* pragma solidity 0.6.7; */
abstract contract CoinJoinLike {
function systemCoin() virtual public ... | Withdraw lpToken from the contract and provide less cover for a SAFE Only an address that controls the SAFE inside the SAFE Manager can call this safeID The ID of the SAFE to remove cover from. This ID should be registered inside the SAFE Manager lpTokenAmount The amount of lpToken to withdraw dst The address that ... | function withdraw(uint256 safeID, uint256 lpTokenAmount, address dst) external controlsSAFE(msg.sender, safeID) nonReentrant {
require(lpTokenAmount > 0, "NativeUnderlyingUniswapV2SafeSaviour/null-lp-amount");
address safeHandler = safeManager.safes(safeID);
require(lpTokenCover[safeHandler... | 8,056 |
pragma solidity 0.4.21;
/**
* @title SafeMath by OpenZeppelin (commit: 5daaf60)
* @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) {
... | Fundraiser address claims the raised funds after ICO deadline/ | function withdrawFunds() afterIcoDeadline public {
require(fundRaiser == msg.sender);
fundRaiser.transfer(address(this).balance);
emit FundTransfer(fundRaiser, address(this).balance);
}
| 5,433,477 |
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/utils/ExchangeRate.sol | Calculates the exchange rate between two currencies via ETH. Returns the rate./ | function _exchangeRate(Rate memory baseER, Rate memory quoteER, uint16 quote) internal view returns (uint256) {
uint256 rate = _fetchExchangeRate(baseER, false);
if (quote != 0) {
uint256 quoteRate = _fetchExchangeRate(quoteER, false);
rate = rate.mul(quoteER.rateDecimals).... | 16,064,778 |
./full_match/1/0x8894c5Ba4f854860E9971F126dC934B40b137D64/sources/src/MinterMultiplexer.sol | Removes an approved minter for a given project./ | function removeMinterForProject(uint256 projectId, address minter)
external
onlyAllowedByAdminACL(this.removeMinterForProject.selector)
{
_mintersByProject[projectId].remove(minter);
}
| 17,006,543 |
./partial_match/1/0x476Cb6D4C66698d3664fe11BdF6D44cee8480BF3/sources/Nothingereum.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256)
{
return a + b;
}
| 4,473,675 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "../common/BaseWithStorage/ImmutableERC721.sol";
import "../common/BaseWithStorage/WithMinter.sol";
import "../common/interfaces/IAssetToken.sol";
import "../common/interfaces/IGameToken.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializ... | Get the amount of each assetId in a GAME. gameId The game to query. assetIds The assets to get balances for. | function getAssetBalances(uint256 gameId, uint256[] calldata assetIds)
external
view
override
returns (uint256[] memory)
{
uint256 storageId = _storageId(gameId);
require(_ownerOf(gameId) != address(0), "NONEXISTANT_TOKEN");
uint256 length = assetIds.lengt... | 13,092,521 |
./full_match/44787/0x2eC23b9362939aF28f59cf8cbdb61c05934761CF/sources/contracts/StarFarm.sol | Withdraw Star NFT from STAKING. Withdraw Star NFT from STAKING. | function leaveStakingNFT(uint256 _tokenId) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][_msgSender()];
require(starNFT.ownerOf(_tokenId) == _msgSender(), "error NFT user");
updatePool(0);
(uint256 _selfGain, uint256 _parentGain) = starNode.node... | 13,286,135 |
./partial_match/1/0x94b2D91aa89BA30f2E080205C14E83fcdeE310DD/sources/WorldEarnPlayCommunity.sol | Returns the keccak256 digest of an EIP-191 signed data with version `0x45` (`personal_sign` messages). The digest is calculated by prefixing a bytes32 `messageHash` with `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the NOTE: The `messageHash` parameter is intended to be the result of... | function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
assembly {
}
}
| 2,893,188 |
./full_match/1/0x275b5daA1509Ab9a77690171A5edCf1a671A15f7/sources/contracts/NFTBMaskofGanymede.sol | Mint a new ticket by providing the token ID/ | function claim(uint256 goldenTicketId) public whenNotPaused {
require(_goldenTicket.balanceOf(_msgSender()) > 0, "Caller does not own a Golden Ticket");
require(!_usedGoldenTickets[goldenTicketId], "Relic already used");
_usedGoldenTickets[goldenTicketId] = true;
u... | 17,148,541 |
./full_match/11155111/0xc9241Cf4cD7d9569cA044d8202EF1080405Bc6C9/sources/src/Drips.sol | Current user drips state. userId The user ID assetId The used asset ID return dripsHash The current drips receivers list hash, see `_hashDrips` return dripsHistoryHash The current drips history hash, see `_hashDripsHistory`. return updateTime The time when drips have been configured for the last time return balance T... | function _dripsState(uint256 userId, uint256 assetId)
internal
view
returns (
bytes32 dripsHash,
bytes32 dripsHistoryHash,
uint32 updateTime,
uint128 balance,
uint32 maxEnd
)
{
DripsState storage state = _dripsSt... | 3,827,165 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(ad... | Withdraws the erc20 tokens or native coins from this contract. _token address of the claimed token or address(0) for native coins. _to address of the tokens/coins receiver./ Since bridged tokens are locked at this contract, it is not allowed to claim them with the use of claimTokens function | function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner {
address bridgedToken = address(daiToken());
require(_token != address(bridgedToken));
require(_token != address(cDaiToken()) || !isInterestEnabled(bridgedToken));
require(_token != address(compToke... | 1,093,463 |
./full_match/1/0xD3bA92039916ec90D0cdBB5eE8c752e9A3defDE0/sources/contracts/VitreusVoucher.sol | Returns the deposit info by tokenId and round tokenId the voucher tokenId round the round/ | function getDeposit(uint256 tokenId, uint256 round) external view returns (uint256) {
return _deposits[tokenId][round];
}
| 17,158,085 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/// Tokens Interface
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint tokens);
function balanceOf(address tokenOwner) external view returns (uint balance);
function transfer(address to, uint256 value) external returns (bool)... | Returns the wallet this receiver will flush to | function wallet() external view returns (address) {
return fetchWallet();
}
| 1,042,899 |
pragma solidity 0.5.8;
/**
* @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, which is the standard behavior in high le... | Deposit ERC20 tokens into the fund. Tokens will be converted into DAI. _tokenAddr the address of the token to be deposited _tokenAmount The amount of tokens to be deposited. May be different from actual deposited amount./ Convert token into DAI Give back leftover tokens | function depositToken(address _tokenAddr, uint256 _tokenAmount)
public
nonReentrant
during(CyclePhase.Intermission)
isValidToken(_tokenAddr)
notReadyForUpgrade
{
require(_tokenAddr != DAI_ADDR && _tokenAddr != address(ETH_TOKEN_ADDRESS));
ERC20Detailed token = ERC20Detailed(_tokenAddr... | 14,018,568 |
./full_match/1/0x50E7F7C779D6F351D457De8f1BDeDc3cd12d85c2/sources/contracts/BrightBundles.sol | Returns State Variables Of `BundleIndex` note: `0. Name` note: `1. Price BrightList` note: `2. Price Public` note: `3. StartingIndexes` note: `4. EndingIndexes` note: `5. PurchaseableAmount` note: `6. Purchaseable Amount BrightList` note: `7. Purchaseable Amount Public` note: `8. ContractAddresses` Of NFT note: `9. Ope... | function viewBundleStates(uint[] calldata BundleIndexes) public view returns(Bundle[] memory)
{
Bundle[] memory BundleStates = new Bundle[](BundleIndexes.length);
for (uint i; i < BundleIndexes.length; i++)
{
Bundle storage saleInstance = Bundles[BundleIndexes[i]];
... | 4,984,381 |
./full_match/5/0x25427ba3411054899A181b473e6a1584f9D23341/sources/project_/contracts/superfluid/Superfluid.sol | solhint-disable-next-line avoid-tx-origin solhint-disable-next-line no-inline-assembly | function _registerApp(uint256 configWord, ISuperApp app, bool checkIfInAppConstructor) private
{
if (msg.sender == tx.origin) {
revert APP_RULE(SuperAppDefinitions.APP_RULE_NO_REGISTRATION_FOR_EOA);
}
if (checkIfInAppConstructor) {
uint256 cs;
if (cs ... | 1,898,343 |
pragma solidity 0.6.12;
/**
* @dev Policy approvals code.
*/
interface IPolicyApprovalsFacet {
/**
* @dev Approve this policy.
*
* Caller must be a representative of given entity.
*
* @param _role Type of pending role the entity of the caller has.
*/
function approve (bytes32 _role) external;
... | Policy approvals code./ events | interface IPolicyApprovalsFacet {
function approve (bytes32 _role) external;
function getApprovalsInfo () external view returns (
bool approved_,
bool insuredPartyApproved_,
bool underwriterApproved_,
bool brokerApproved_,
bool claimsAdminApproved_
);
event Approved(address indexed calle... | 5,396,536 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply(... | Gets the total amount of tokens unclaimed from a pool that are not yet "realized" in the form of LP tokens _poolId the identifier of the pool. return the total amount of unclaimed and un-minted tokens from a pool that are not in LP tokens/ | function getPoolTotalUnclaimedNotInLP(uint256 _poolId)
external
view
returns (uint256)
{
MerklePool.Data storage pool = pools.get(_poolId);
return
pool.getUpdatedTotalUnclaimed(poolContext) -
pool.totalUnclaimedTICInLP;
}
| 7,877,664 |
pragma solidity ^0.5.2;
/**
* Copyright (c) 2018-present, Leap DAO (leapdao.org)
*
* This source code is licensed under the Mozilla Public License, version 2,
* found in the LICENSE file in the root directory of this source tree.
*/
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and p... | Fallback function. Implemented entirely in `_fallback`./ | function () external payable {
_fallback();
}
| 885,390 |
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol | Selector of `log(bool,bool,address,address)`. | function log(bool p0, bool p1, address p2, address p3) internal pure {
bytes32 m0;
bytes32 m1;
bytes32 m2;
bytes32 m3;
bytes32 m4;
assembly {
m0 := mload(0x00)
m1 := mload(0x20)
m2 := mload(0x40)
m3 := mload(0x60)
... | 16,053,073 |
pragma solidity >0.5.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract IUniswapExchange {
// Address of ERC20 token sold on this exchange
function tokenAddress() external view returns (address token);
// Address of Uniswap Fact... | check what relayer is currently allowed to execute the transaction NOTE: this function needs to return your address for you to be allowed as a relayer to execute the transaction and obtain the fee | function check_allowed_relayer(address payable _user) public view returns(address){
Stream storage s = streams[_user];
if (now < s.lastSwap + s.interval){
return 0x0000000000000000000000000000000000000000;
uint multiple = (now - s.startTime) / (240 * relayersCount);
... | 7,286,328 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a... | decrease allowance get value in gamers sub from from | function transferFrom(address from, address to, uint256 value)
external
validRecipient(to)
returns (bool)
{
_allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value);
uint256 gamerValue = value.mul(internalDecimals).div(gamersScalingFa... | 7,415,296 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "../TokenBase/Base.sol";
import "./MSDController.sol";
import "./MSD.sol";
/**
* @title dForce's Lending Protocol Contract.
* @notice dForce lending token for the Multi-currency Stable Debt Token.
* @author dForce Team.
*/
contract iMSD is Base {
... | Gets the newest exchange rate by accruing interest. iMSD returns the initial exchange rate 1.0/ | function exchangeRateCurrent() external pure returns (uint256) {
return initialExchangeRate;
}
| 5,431,983 |
pragma solidity ^0.4.24;
contract IStorage {
function processPreSaleBonus(uint minTotalUsdAmountInCents, uint bonusPercent, uint _start, uint _limit) external returns(uint);
function checkNeedProcessPreSaleBonus(uint minTotalUsdAmountInCents) external view returns(bool);
function getCountNeedProcessPreS... | Add payment by address/ | function addPayment(
address _addr,
string pType,
uint _value,
uint usdAmount,
uint currencyUSD,
uint tokenWithoutBonus,
uint tokenBonus,
uint bonusPercent,
uint payId
)
public
onlyMultiOwnersType(9)
returns(bool)
{
require(_value > 0);
require(usdAmount > 0);
... | 1,061,111 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract NotesContract {
constructor() {
createNote("First Note", "This is a note created by the constructor :)");
}
uint notesCount = 0;
uint notesNextID = 0;
struct Note {
uint id;
string title;
string content;
address owner;... | Returns the amount of created notes./ | function getNotesCount() public view returns (uint) {
return notesCount;
}
| 14,041,997 |
./full_match/42/0xc56Dc76e2f87d3BDb0CF1f2b1A993EC42A1EB247/sources/Users/225153/Projects/ram/contracts/RamVault.sol | Calculate and set user's new accounting balance Adjust total accounting supply accordingly | function adjustEffectiveStake(
PoolInfo storage pool,
UserInfo storage user,
bool withdraw
) internal {
uint256 prevBalancesAccounting = user.boostAmount;
uint256 accTotalMultiplier = getTotalMultiplier(user.boostLevel);
uint256 newBalancesAccounting = user.amount... | 9,578,719 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IMasterChef.sol";
import "./interfaces/IVault.sol";
import "./interfaces/ILockManager.sol";
import "./interfaces/IERC20Extended.sol";
import "./lib/SafeERC20.sol";
import "./lib/ReentrancyGuard.sol";
/**
* @title RewardsManager
* @dev Con... | SPDX-License-Identifier: MIT | interface IVault {
function deposit(uint256 _pid, uint256 _amount) external;
function withdraw(uint256 _pid, uint256 _amount) external;
function poolInfo(uint256 _pid) external view returns (PoolInfo memory);
function pendingSushi(uint256 _pid, address _user) external view returns (uint256);
fu... | 13,001,336 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/ICoverForge.sol";
import "./ERC20/IERC20Permit.sol";
import "./ERC20/ERC20.sol";
import "./ERC20/IERC20.sol";
import "./utils/Ownable.sol";
import "./ERC20/ERC20Permit.sol";
import "./ERC20/SafeERC20.sol";
contract CoverForge is ERC20("Cove... | See {IERC20-balanceOf}./ | function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
| 3,105 |
./full_match/1/0x5cF51E611B36E9b3Bf4e5b36da908Fa3b040961E/sources/contracts/CAKE721A/CAKE721A.sol | onlyAdmin setter for mutable timestamp variables. Combined to conserve byte-space./ | function setTimestamps(uint256 preSale, uint256 publicSale) external onlyRole(PROVISIONED_ACCESS) {
require(preSale >= 0 && publicSale >= 0, 'Invalid timestamp');
PRIVATE_SALE_TIMESTAMP = preSale;
PUBLIC_SALE_TIMESTAMP = publicSale;
}
| 8,403,007 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/.../Context.sol";
import "https://github.com/vigilance91/solidarity/contracts/accessControl/AccessControl.sol";
import "http... | return {uint} number of blocks to mine/validate until this license is considered expiredrequireInitalized(self);if(!isValidBlock(self, block.number)){}return self.terminationBlock.sub(block.number); | function blocksRemaining(
LicenseStorage storage self
)internal view returns(
uint
){
return 0;
}
| 12,953,619 |
pragma solidity ^0.4.18;
contract Owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
i... | Buy tokens from contract by sending ether | function buy() payable public {
require(isOpened);
}
| 11,741,083 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../upgrades/GraphUpgradeable.sol";
import "./RewardsManagerStorage.sol";
import "./IRewardsManager.sol";
contract RewardsManager is RewardsManagerV1Storage, GraphUpg... | Raises x to the power of n with scaling factor of base. x Base of the exponentiation n Exponent base Scaling factor return z Exponential of n with base x/ | function _pow(
uint256 x,
uint256 n,
uint256 base
) private pure returns (uint256 z) {
assembly {
switch x
case 0 {
switch n
case 0 {
z := base
}
... | 1,846,396 |
./full_match/5/0x26014a53456574d41C25C87FcF570003CBd3a988/sources/contracts/Vault.sol | the function is name differently to not cause inheritance clash in truffle and allows tests | function initializeVault(
address _storage,
address _underlying,
uint256 _toInvestNumerator,
uint256 _toInvestDenominator
) public initializer {
require(
_toInvestNumerator <= _toInvestDenominator,
"cannot invest more than 100%"
);
... | 1,909,668 |
./full_match/4/0x33633363139f53f96A8fFcFf42400F3e866121F4/sources/contracts/landContract_NEW.sol | 1. FIRST OPERATIONowner shall add lands via this function | function addLand(string _location, uint _cost) public isOwner
{
totalLandsCounter = totalLandsCounter + 1;
Land memory myLand = Land(
{
ownerAddress: msg.sender,
location: _location,
cost: _cost,
landID: totalLandsCounte... | 740,491 |
// Dependency file: contracts/zeppelin/upgradable/Initializable.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.7.0;
// pragma abicoder v2;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initialize... | Emitted when the pause is triggered by a pauser (`account`)./ Emitted when the pause is lifted by a pauser (`account`)./ Initializes the contract in unpaused state. Assigns the Pauser role to the deployer./ | function __Pausable_init(address sender) public initializer {
UpgradablePauserRole.__PauserRol_init(sender);
_paused = false;
}
| 11,909,139 |
/**
*Submitted for verification at Etherscan.io on 2019-07-05
*/
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 constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 ||... | low level token purchase function calculate token amount to be sent | function buyTokens(address beneficiary) payable public{
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = ((weiAmount) * price);
weiRaised = weiRaised.add(weiAmount);
tokenReward.transfer(beneficiary, tokens);
e... | 10,751,181 |
pragma solidity ^0.4.15;
import "./moneyflow/IMoneyflow.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title SplitterBase
* @dev Splitter has multiple outputs (allows to send money only to THESE addresses)
*/
contract IWeiReceiverSi... | require(_isOpen(msg.sender)); emit SplitterBase_ProcessFunds(msg.sender, msg.value, _currentFlow); require(amount>=_getTotalWeiNeeded(stor, _currentFlow)); | function processFunds(uint _currentFlow) external payable{
address[] memory children = getChildren(msg.sender);
uint amount = _currentFlow;
uint needed;
for(uint i=0; i<children.length; ++i){
if(IWeiReceiverSimple(children[i]).isSimpleWeiReceiverType()){
needed = _getTotalWeiNeeded(children[i], amoun... | 1,776,432 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/**
* CakeCrypt.io
*/
contract Token {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external retur... | lock tokens/update balance in address | function lockTokens(address _tokenAddress, uint256 _amount, uint256 _unlockTime) public returns (uint256 _id) {
require(_amount > 0, 'token amount is Zero');
require(_unlockTime < 10000000000, 'Enter an unix timestamp in seconds, not miliseconds');
require(Token(_tokenAddress).approve(addres... | 555,448 |
./full_match/100/0xC740046C8FdA017636FF155B8cFa4cF30f72907D/sources/project_/contracts/base/BaseController.sol | Enable or disable joins and exits. Note that this does not affect Recovery Mode exits. Emits the JoinExitEnabledSet event. This is a permissioned function. _poolAddress - Address of pool being worked on. _joinExitEnabled - The new value of the join/exit enabled flag./ | function setJoinExitEnabled(
address _poolAddress,
bool _joinExitEnabled) public restricted nonReentrant {
ManagedPool managedPool;
managedPool = ManagedPool(_poolAddress);
managedPool.setJoinExitEnabled(_joinExitEnabled);
}
| 14,270,456 |
/**
Copyright (c) 2018, ZSC Dev Team
2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../../common/delegate.sol";
import "./Logistics_database.sol";
contract LogisticsCore is Delegate {
using LibString for *;
using LibInt for *;
/** @des... | check param add num | function updateBriefEx(string _num, string _brief) public _onlyAdminOrHigher _checkDatabaseAddr {
require(0 != bytes(_num).length);
require(0 != bytes(_brief).length);
if (!numExists_[_num]) {
_addNum(_num);
}
}
| 12,787,439 |
./full_match/1/0xE0fC587E1F56b5968a7d5DC3667bA1f385fddb38/sources/contracts/TermRepoCollateralManager.sol | collateralToken The address of the collateral token to lock amount The amount of collateral token to lock | function externalLockCollateral(
address collateralToken,
uint256 amount
) external isCollateralTokenAccepted(collateralToken) {
address borrower = msg.sender;
if (block.timestamp > termRepoServicer.endOfRepurchaseWindow()) {
revert CollateralDepositClosed();
... | 9,687,077 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./WithLimitedSupply.sol";
import "./WithIPFSMetaData.sol";
/// @author 1001.digital
/// @title A token tracker that increments token IDs on each new mint.
abstract contract WithAdditionalMints is With... | _cid The new collection CID which holds the metadata for the updated collection. _count The number of tokens to mint. _to The owner of the new tokens. Add and mint new tokens | function mintAdditionalTokens(string memory _cid, uint256 _count, address _to) public onlyOwner {
addTokens(_cid, _count);
for (uint256 index = 0; index < _count; index++) {
_safeMint(_to, nextToken());
}
}
| 12,981,569 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '../../mock/MockERC20.sol';
import ... | deposit lp tokens and stakesend to proxy to stakeadd user balance directly | function deposit(
uint256 _pid,
uint256 _amount,
bool /*_stake*/
) public returns (bool) {
PoolInfo storage pool = poolInfo[_pid];
address lptoken = pool.lptoken;
IERC20(lptoken).safeTransferFrom(msg.sender, address(this), _amount);
address token = pool.t... | 1,802,841 |
./full_match/80001/0x281D1c6Ee5CCd86102A1369D9ED0921A84F44278/sources/Contracts/USTFeeder.sol | Let's start about 1 NBV for 0.5 UST | function getNVBamount (uint256 _amount) public pure returns(uint256) {
return _amount / 500000;
}
| 5,656,679 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
contract Administration is AccessControl {
bytes32 internal constant RENTER_ROLE = keccak256("RENTER");
bytes32 internal constant RENTEE_ROLE = keccak256("RENTEE");
/// @dev Add `root` to the admi... | Return `true` if the account belongs to the admin role. | function isAdmin(address account)
internal view returns (bool)
{
return hasRole(APP_DEV, account);
}
| 6,478,372 |
./partial_match/3/0xB55DDdeEda2F35E9EA89B6B6D3869b1a85353b5C/sources/SwAppBar.sol | Enter the bar. Pay some SWAPPs. Earn some shares. | function enter(uint256 _amount) public {
uint256 totalSwApp = swApp.balanceOf(address(this));
uint256 totalShares = totalSupply();
if (totalShares == 0 || totalSwApp == 0) {
_mint(msg.sender, _amount);
uint256 what = _amount.mul(totalShares).div(totalSwApp);
... | 5,069,245 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.