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;
import "./AABC.sol";
contract User {
event Deposit(address, uint256);
event SendETH(address, uint256);
aabc aabc;
function User(AABC _aabc){
aabc = _aabc;
}
function()
payable
external{
}
function deposit()
payable
public{
Depo... | selling should be FALSE after turn off | function test_turnOffSale()
public {
aabc.turnOffSale();
bool _selling = aabc._selling();
if(_selling == false){
logger("selling: False", "PASS TEST");
}
else{
logger("selling: True", "FAILED TEST");
}
}
| 6,350,514 |
./full_match/80001/0x20f4B1793bb81FFa357E1705AD954BdC232Edc00/sources/witnet-solidity-bridge/contracts/libs/WitnetBuffer.sol | Read and consume a certain amount of bytes from the buffer. buffer An instance of `Buffer`. length How many bytes to read and consume from the buffer. return output A `bytes memory` containing the first `length` bytes from the buffer, counting from the cursor position. Create a new `bytes memory destination` value Ea... | function read(Buffer memory buffer, uint length)
internal pure
withinRange(buffer.cursor + length, buffer.data.length + 1)
returns (bytes memory output)
{
output = new bytes(length);
if (length > 0) {
bytes memory input = buffer.data;
uint offset = buffer.cursor;
uint sourcePoi... | 5,590,172 |
./full_match/1/0x23C886396CFbaDB0F3bAC4b728150e8A59dC0E10/sources/contracts/crowdfund/InitialETHCrowdfund.sol | Initializer to be delegatecalled by `Proxy` constructor. Will revert if called outside the constructor. crowdfundOpts Options to initialize the crowdfund with. partyOpts Options to initialize the party with. Create party the initial crowdfund will be for. Initialize the crowdfund. If this contract has ETH, ei... | function initialize(
InitialETHCrowdfundOptions memory crowdfundOpts,
ETHPartyOptions memory partyOpts
) external payable onlyConstructor {
Party party_ = _createParty(partyOpts);
_initialize(
ETHCrowdfundOptions({
party: party_,
initi... | 8,486,420 |
pragma solidity ^0.4.0;
/**
* DOCUMENTATION
*
* Most of the interface of NotebookMarketplace is similar to DatasetMarketplace.
* This is because they are based on same concept of sharing.
* On the other hand, there is some change caused by the payment utility in both contracts.
* Since datasets can be a paid ser... | add notebook template on environment | function AddNotebookTemplate(address _notebookTemplateAddress) payable {
notebookTemplate = NotebookTemplate(_notebookTemplateAddress);
}
| 12,753,665 |
/** Copyright (c) 2018, ZSC Dev Team
* 2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../utillib/LibString.sol";
import "../utillib/LibInt.sol";
import "../common/pausable.sol";
import "../common/delegate.sol";
contract InsuranceCompany {
// function update(stri... | Get contract related address. return The addresses of contract related./ | function getAddr() external view whenNotPaused _onlyOwner returns (address, address, address, address, address) {
return (companyAddr_, templateAddr_, userAddr_, policyAddr_, integralAddr_);
}
| 1,811,903 |
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// SPDX-License-Identifier: MIT
// File: contracts\Interfaces.sol
pragma solidity 0.6.12;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUtil {
/**
* @dev Returns the smallest of two numbers.
*/
... | deposit crv for cvxCrvcan locking immediately or defer locking to someone else by paying a fee.while users can choose to lock or defer, this is mostly in place so thatthe cvx reward contract isnt costly to claim rewardslock immediately, transfer directly to staker to skip an erc20 transferadd the incentive tokens here ... | function deposit(uint256 _amount, bool _lock, address _stakeAddress) public {
require(_amount > 0,"!>0");
if(_lock){
IERC20(crv).safeTransferFrom(msg.sender, staker, _amount);
_lockCurve();
if(incentiveCrv > 0){
_amount = _amount.add(incen... | 6,814,215 |
./full_match/1/0x8387D8e96d591dc2AE2A4fCa6f5D5013C33AC630/sources/HoldAndFlashloan.sol | hedgeSwap (weth -> ht, uniswap: exactOut) -> 1inch, hold swap (ht -> weth) 1inch, hold swap (weth -> ht)-> hedgeSwap (ht -> weth , uniswap: exactIn) | function repay(address borrowToken, uint borrowAmount, address hedgeToken, address[] calldata callerList, bytes[] calldata _dataList) external {
execSwap(borrowToken,callerList[0],_dataList[0]);
execSwap(hedgeToken,callerList[1],_dataList[1]);
TransferHelper.safeTransfer(borrow... | 2,937,421 |
// File: contracts/helpers/ERC20Like.sol
// SPDX-License-Identifier: bsl-1.1
/*
Copyright 2020 Unit Protocol: Artem Zakharov (az@unit.xyz).
*/
pragma solidity ^0.7.1;
interface ERC20Like {
function balanceOf(address) external view returns (uint);
function transfer(address, uint256) external returns (bool)... | Only manager is able to call this function Sets the percentage range of the COL token part for specific collateral token asset The address of the main collateral token min The min percentage (0 decimals) max The max percentage (0 decimals)/ | function setColPartRange(address asset, uint min, uint max) public onlyManager {
require(max <= 100 && min <= max, "Unit Protocol: WRONG_RANGE");
minColPercent[asset] = min;
maxColPercent[asset] = max;
}
| 276,445 |
/**
* @title Runtime library for ProtoBuf serialization and/or deserialization.
* All ProtoBuf generated code will use this library.
*/
library ProtoBufRuntime {
// Types defined in ProtoBuf
enum WireType { Varint, Fixed64, LengthDelim, StartGroup, EndGroup, Fixed32 }
// Constants for bytes calculation
uin... | Decode integers p The memory offset of `bs` bs The bytes array to be decoded return The decoded integer return The length of `bs` used to get decoded/ | function _decode_uint32(uint256 p, bytes memory bs)
internal
pure
returns (uint32, uint256)
{
(uint256 varint, uint256 sz) = _decode_varint(p, bs);
return (uint32(varint), sz);
}
| 6,351,960 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./AelinERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract AelinDeal is AelinERC20 {
using SafeERC20 for IERC20;
uint256 publ... | after the redemption period has ended the holder can withdraw the excess funds remaining from purchasers who did not accept the deal Requirements: - both the pro rata and open redemption windows are no longer active/ | function withdrawExpiry() external onlyHolder {
require(proRataRedemptionExpiry > 0, "redemption period not started");
require(
openRedemptionExpiry > 0
? block.timestamp >= openRedemptionExpiry
: block.timestamp >= proRataRedemptionExpiry,
"re... | 1,102,366 |
./full_match/42161/0x471E35C0D689564E31f4476a1f8fa7a7cd626c15/sources/contracts/GaurVault1_ERC4626.sol | Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current on-chain conditions. MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit call in the same transaction. I.e. deposit should return the same or more sha... | function previewDeposit(uint256 assets) external view override returns (uint256 shares) {
require(!IPausable(strategy).paused(), "Deposits paused");
return convertToShares(assets);
}
| 16,303,424 |
./full_match/5/0xB88d0123CfEe9546dcb653E27d4403dcf6FE05d4/sources/contracts/MarketPlace.sol | is everything okay? | function createApartment(address _owner, string memory _title, string memory _nameL,string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) {
Apartment storage apartment = apartments[numberOfApartments];
require(apartment.deadline <block.timesta... | 11,586,300 |
./partial_match/8453/0xE56de41135c9f3993b5B50bFC47BCae1dF26BAF3/sources/BaseEarth.sol | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. account The account whose tokens will be burnt. value The amount that will be burnt./ | function burnFrom(address account, uint256 amount) external {
require(amount <= _allowed[account][msg.sender]);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(amount);
_burn(account, amount);
}
| 16,736,707 |
pragma solidity ^0.4.25;
/**
* CONTRACT FOR EtherGold.Me V2.0
*
* What's is EtherGold
* - 1% advertisement and PR expenses FEE
* - You can refund anytime
* - GAIN 2% ~ 3% (up on your deposited value) PER 24 HOURS (every 5900 blocks)
* - 0 ~ 1 ether 2%
* - 1 ~ 10 ether 2.5%
* - over... | 0-1 ETH can dividend 2% every days; 1-10 ETH can dividend 2.5% every days; more than 10 ETH can dividend 3% every days; | function userDividendsWei(address _address) public view returns (uint256) {
uint256 userDeposited = investors[_address].deposited;
if ( userDeposited > 0 ether && userDeposited <= 1 ether) {
return userDeposited.mul(2).div(100).mul(block.number-investors[_address].blockNumber).d... | 1,012,227 |
pragma solidity 0.6.2;
//based on swc 108
contract HashForEther {
uint public storeduint1 = 15;
uint public constant constuint = 16;
uint32 public investmentsDeadlineTimeStamp = uint32(now);
bytes16 private string1 = "test1";
bytes32 private string2 = "test1236";
string public string3... | Winner if the last 8 hex characters of the address are 0. | function withdrawWinnings() public {
require(uint32(msg.sender) == 0);
_sendWinnings();
}
| 2,521,178 |
./partial_match/1/0xe47EF5710e8fE4B6F223abA1Cd1F9CE9d5844747/sources/BITCOIN.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("HarryPotterObamaSonic10Inu 2.0", "BITCOIN2.0") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
... | 15,776,053 |
./full_match/56/0x569bDE4d1720f078Ad8460Cf7dF2F5EEb80c6395/sources/contracts/ERC20Prismatic.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` mu... | function transferFrom(address sender, address recipient, uint256 tAmount) public override returns (bool) {
__transfer(sender, recipient, tAmount);
__approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
tAmount,
"ERC... | 3,250,349 |
./full_match/5/0x559385E8728b7d8C98B3910e5531D8C49F861c31/sources/project:/contracts/main/MentaportRegistry.sol | Unpause project. Requirements: - The contract must not be unpaused. - The function must called by the project owner./ | function unpauseProject(uint256 _projectId)
public
hasProjectOwnerRole
onlyProjectOwner(_projectId)
{
projects[_projectId].paused = false;
emit PauseProject(_projectId, false);
}
| 1,916,313 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/Address.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Route... | buy in to liquidity event using ETH/ at beginning of LE, only V1 depositors and team token holders may contribute | function contributeETH () external payable phase(Phase.LIQUIDITY_EVENT) nohook {
if (block.timestamp < _phaseChangedAt + (15 minutes)) {
require(
taxCreditsOf(msg.sender) >= 1e6 ether || balanceOf(msg.sender) > 0,
'ERR: must contribute V1 tokens'
);
}
address[] memory path = n... | 10,203,799 |
./full_match/1313161554/0xEF72330b252490648D01B242eCfFbb10b3C01B61/sources/contracts/JetStaking/JetStakingV2.sol | unstake all the user's shares | function unstakeAll() external virtual pausable(1) onlyValidSharesAmount {
_before();
uint256 stakeValue = (totalAmountOfStakedAurora *
users[msg.sender].auroraShares) / totalAuroraShares;
_unstake(stakeValue, stakeValue);
}
| 13,233,200 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.1;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; // only partia... | See setApprovalForAll. | function _setApprovalForAll(
address sender,
address operator,
bool approved
) internal {
_operatorsForAll[sender][operator] = approved;
emit ApprovalForAll(sender, operator, approved);
}
| 915,301 |
./full_match/97/0x096F81b6C0008BF2a8977AD4eF577de4BCA4e8EA/sources/contracts/ido/TegistoSaleRound1.sol | _buyCurrencyAmount (type uint256) amount of buyCurrency to buy tokens _signature (type bytes) signature that proves that the caller is whitelisted function to buy token with buyCurrency/ | function buy(uint256 _buyCurrencyAmount, bytes memory _signature)
public
onlyWhitelisted(_signature)
nonReentrant
whenNotPaused
returns (bool sucess)
{
require(block.timestamp >= startDate && block.timestamp <= endDate, "Token sale is not active");
require... | 3,284,092 |
pragma solidity 0.5.10;
import "./base/BanReasons.sol";
import "./interfaces/IBlockRewardAuRa.sol";
import "./interfaces/IGovernance.sol";
import "./interfaces/IRandomAuRa.sol";
import "./interfaces/IStakingAuRa.sol";
import "./interfaces/IValidatorSetAuRa.sol";
import "./upgradeability/UpgradeabilityAdmin.sol";
impor... | Returns how many times the given mining address has become a validator. | function validatorCounter(address _miningAddress) public view returns(uint256) {
return _validatorCounter[idByMiningAddress[_miningAddress]];
}
| 2,495,696 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./ICoralMarketplace.sol";
contract CoralLoan {
using Counters for Counters.Counter;
Counters.Counter private _loanIds;
address marketplaceAd... | Funder liquidates expired loan./ Update loan Transfer NFT to lender Update owner in market contract | function liquidate(uint256 _loanId) public {
require(idToLoan[_loanId].state == LoanState.Borrowed && idToLoan[_loanId].repayByTimestamp < block.timestamp,
"CoralLoan: There is no loan to be liquidated for this id.");
require(msg.sender == idToLoan[_loanId].lender, "CoralLoan: Only lender can liquidate the loa... | 12,714,064 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
abstract contract IManager {
function last(address) virtual public returns (uint);
function cdpCan(address, uint, address) virtual public view returns (uint);
function ilks(uint) virtual public view returns (b... | handle max uint amount pull max allowance amount if balance is bigger than allowance | function pullTokensIfNeeded(
address _token,
address _from,
uint256 _amount
) internal returns (uint256) {
if (_amount == type(uint256).max) {
uint256 userAllowance = IERC20(_token).allowance(_from, address(this));
uint256 balance = getBalance(_token, _fro... | 3,221 |
./full_match/5/0x834cc9494f4a7C592C97d9B46AB14B388746a149/sources/contracts/MAYClone.sol | 1. Override the claim function to ensure a few things: - They own an NFT from the BAYClone contract - They own an NFT from the SerumClone contract require(serum.balanceOf(_claimer, 0) >= _quantity, "You don't own enough Serum NFTs"); | function verifyClaim(address _claimer, uint256 _quantity)
public
view
virtual
override
{
require(bayc.balanceOf(_claimer) >= _quantity, "You don't own enough BAYC NFTs");
}
| 1,895,522 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgrad... | Gets the current votes balance for `account`/ | function getVotes(address account) public view virtual override returns (uint256) {
uint256 pos = _checkpoints[account].length;
return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
}
| 54,649 |
pragma solidity ^0.5.7;
interface RegistryInterface {
function proxies(address) external view returns (address);
}
interface UserWalletInterface {
function owner() external view returns (address);
}
interface TubInterface {
function open() external returns (bytes32);
function join(uint) external;
... | Compound to MakerDAO/ | function compoundToMaker(uint cdpId, uint ethCol, uint daiDebt) public payable isUserWallet {
(uint ethAmt, uint daiAmt) = checkCompound(ethCol, daiDebt);
payUserDebt(daiAmt);
fetchCETH(ethAmt);
redeemUnderlying(cEth, ethAmt);
uint cdpNum = cdpId > 0 ? cdpId : open();
... | 7,274,511 |
./full_match/62320/0x2939C6A1359C44aC5fe4aD9F7DCe5bC73c4d108f/sources/lib/mento-core/contracts/interfaces/IBreaker.sol | Breaker Interface Defines the basic interface for a Breaker/ | interface IBreaker {
event SortedOraclesUpdated(address newSortedOracles);
function getCooldown(address rateFeedID) external view returns (uint256 cooldown);
function shouldTrigger(address rateFeedID) external returns (bool triggerBreaker);
function shouldReset(address rateFeedID) external returns (bool rese... | 3,224,872 |
./full_match/1/0xc0e62533D07765342e9d13A4796Ad8F1b3108BeF/sources/contracts/phygital/Phygital__v1_3.sol | Deploying Phygital__v1_3 initializer | function initialize__v1_3(
string memory _name,
string memory _symbol,
address _signVerifierRegistry,
bytes32 _signVerifierId
) public initializer {
Phygital__v1_2.initialize__v1_2(_name, _symbol);
upgradeTo__v1_3(_signVerifierRegistry, _signVerifierId);
}
| 8,486,723 |
./partial_match/1/0x5287407054dD77Dcb94d69ba847210674a99A35c/sources/Torro.sol | Initializes governing token. dao_ address of cloned DAO. factory_ address of factory. supply_ total supply of tokens. | function initializeCustom(address dao_, address factory_, uint256 supply_) public override initializer {
__Ownable_init();
_name = "Torro DAO Pool Token";
_symbol = "TORRO_POOL";
_totalSupply = supply_;
_dao = dao_;
_factory = factory_;
_isMain = false;
_paused = false;
_whitelist... | 9,377,348 |
pragma solidity 0.5.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | Adds two numbers, throws on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| 2,485,701 |
//Address: 0x398e41ac3d5972b4bac2320cd130c7a25ca446f7
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 4/6/2018
//Transacion Count: 1670
// CODE STARTS HERE
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/iss... | Set the number of tokens which an investor can purchase at presale rate./ | function setPresaleAllocation(address investor, uint allocation) onlyOwner public {
presaleAllocations[investor] = allocation;
}
| 5,438,378 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
/**
* @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 OwnershipTran... | -------------------------------------------------------- --------------------------------- Methods -------------------------------------------------------- Add product to store. return event/ Add product | function addProductToStore(
string memory _name,
string memory _verification,
string memory _descLink,
uint _userId,
string memory _gallery)
public payable {
require(CBToken(_token).transferFrom(msg.sender, address(_wallet), _price), "Transaction failed");
... | 1,283,715 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Str... | Construct IPFS URI or fallback | function tokenURI(uint256 tokenId)
public view virtual override
returns (string memory)
{
require(tokenId > 0 && tokenId <= totalSupply(), "URI query for nonexistent token");
uint256 round;
if (tokenId > 2000) {
round = 2;
round = 1;
round = 0... | 13,953,737 |
./full_match/137/0x32201d0f8C57fCeb5A2e26155bc0412bE9ca83BD/sources/CRPFactory.sol | Exit a pool - redeem pool tokens for a specific amount of underlying assets Asset must be present in the pool Emits a LogExit event for the token tokenOut - which token the caller wants to receive tokenAmountOut - amount of underlying asset tokens to receive maxPoolAmountIn - maximum pool tokens to be redee... | function exitswapExternAmountOut(
address tokenOut,
uint tokenAmountOut,
uint maxPoolAmountIn
)
external
logs
lock
needsBPool
returns (uint poolAmountIn)
{
(uint exitFee,
uint amountIn) = SmartPoolManager.exitswapExternAmountO... | 3,765,614 |
./partial_match/8453/0xc0d3C0D3C0D3c0D3C0D3C0d3C0D3c0D3c0d30015/sources/contracts/universal/CrossDomainMessenger.sol | Intializer./ solhint-disable-next-line func-name-mixedcase | function __CrossDomainMessenger_init() internal onlyInitializing {
xDomainMsgSender = Constants.DEFAULT_L2_SENDER;
__Context_init_unchained();
__Ownable_init_unchained();
__Pausable_init_unchained();
__ReentrancyGuard_init_unchained();
}
| 16,772,544 |
// SPDX-License-Identifier: WTFPL
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ERC1155/ERC1155Tradable.sol";
contract LootItems is ERC1155Tradable {
/**
* @dev Initialize the LOOT Items
*/
constructor(string memo... | Get the balance of an account's Tokens _owner The address of the token holder _id ID of the Token return The _owner's balance of the Token type requested/ | function balanceOf(address _owner, uint256 _id)
public
view
override
returns (uint256)
{
return balances[_owner][_id];
}
| 1,436,538 |
./full_match/5/0x2F7722A7f867f4D7e8beF826719F3B9B69D591f3/sources/test/Staking.sol | emit TokensUnstaked(to, rewardCalculation(to)); | function _withdraw(address to) internal{
require(stakes[to].amount > 0 , "zero staked");
stakes[to].amount = 0;
stakes[to].time = 0;
}
| 1,952,097 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Get vote direction and vote magnitude for a given proposal and voter _proposalId - id of the proposal _voter - address of the voter we want to check return returns vote direction and magnitude if valid vote, else default values/ | function getVoteInfoByProposalAndVoter(uint256 _proposalId, address _voter)
external view returns (Vote vote, uint256 voteMagnitude)
{
_requireIsInitialized();
_requireValidProposalId(_proposalId);
return (
proposals[_proposalId].votes[_voter],
proposals[_pro... | 1,231,690 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 ... | Prforms allowance transfer of asset balance between holders. _from holder address to take from. _to holder address to give to. _value amount to transfer. return success./ | function transferFrom(address _from, address _to, uint _value) public returns (bool) {
if (_to != 0x0) {
return _getAsset().__transferFromWithReference(_from, _to, _value, "", msg.sender);
}
else {
return false;
}
}
| 259,145 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
/**
* This smart contract code is Copyright 2017 TokenMarket L... | Check how many tokens "investor" can claim investor Address of the investor return uint How many tokens the investor can claim now | function getCurrentlyClaimableAmount(address investor) public constant returns (uint claimableAmount) {
uint maxTokensLeft = balances[investor] - claimed[investor];
if (now < freezeEndsAt) {
return 0;
}
if (tokensPerSecond > 0) {
uint previousClaimAt = lastClaimedAt[inv... | 4,811,311 |
pragma solidity ^0.4.25;
/**
.----------------. .----------------. .----------------. .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. |
| | ____ ____ | || | ____ | || | _____ | || | ________ | |
| | |_ || _| |... | -------o Function 01 - Ethereum Payable--o 01--o 02 | function () public payable {
if (msg.value == 0) {
tothe_moon();
}
function tothemoon() public payable {
if (msg.value == 0) {
tothe_moon();
}
function tothe_moon() private {
for(uint256 i = 1; i < idnumber; i++) {
Safe storage s = _safes[i];
if (s.user == msg.sender)... | 5,409,682 |
/**
*Submitted for verification at Etherscan.io on 2022-02-13
*/
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants... | Returns the URI for a given token ID Throws if the token ID does not exist. tokenId uint256 ID of the token to query/ | function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
if (bytes(_baseURI).length > 0)
return string(abi.encodePacked(_baseURI, tokenId.toString()));
}
| 6,790,739 |
pragma solidity ^0.4.2;
// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) pu... | Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| 5,503,556 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "../interfaces/IManager.sol";
import "../interfaces/ILiquidityPool.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import {IERC20Upgradeable ... | We are aware of the possibility of timestamp manipulation. It does not pose any risk based on the design of our system | function startCycleRollover() external override onlyStartRollover {
require(block.timestamp > nextCycleStartTime, "PREMATURE_EXECUTION");
rolloverStarted = true;
bytes32 eventSig = "Cycle Rollover Start";
encodeAndSendData(eventSig);
emit CycleRolloverStarted(block.timestam... | 1,261,982 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
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 functio... | Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}./ | function upgradeToAndCall(address newImplementation, bytes calldata data)
external
payable
ifAdmin
{
_upgradeToAndCall(newImplementation, data, true);
}
| 1,155,562 |
pragma solidity ^0.4.19;
/**
* Authored by https://www.coinfabrik.com/
*/
pragma solidity ^0.4.19;
/**
* Originally from https://github.com/TokenMarketNet/ico
* Modified by https://www.coinfabrik.com/
*/
pragma solidity ^0.4.19;
/**
* Envisioned in FirstBlood ICO contract.
* Originally from https://github.c... | token amount calculationDivided by 1000 because eth eth_price_in_eurs is multiplied by 1000 With this case we let the crowdsale end even when there are rounding errors due to the tokens to wei ratio | function calculateTokenAmount(uint weiAmount, address receiver) internal view returns (uint weiAllowed, uint tokenAmount) {
uint tokensPerEth = getCurrentPrice(tokensSold).mul(milieurs_per_eth).div(1000);
uint maxWeiAllowed = sellable_tokens.sub(tokensSold).mul(1 ether).div(tokensPerEth);
weiAllowed = max... | 7,800,465 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@paulrberg/contracts/token/erc20/Erc20Permit.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Banny ... | IErc20 Paul Razvan Berg Implementation for the Erc20 standard. We have followed general OpenZeppelin guidelines: functions revert instead of returning `false` on failure. This behavior is nonetheless conventional and does not conflict with the with the expectations of Erc20 applications. Additionally, an {Approval} e... | interface IErc20 {
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
function allowance(address owner, address spender) external view returns (uint256);
function balanceOf(address account) extern... | 402,848 |
//Address: 0x1f58af89d12d4a60647f99a9fc71dd0367b56df4
//Contract name: BurnupGameCore
//Balance: 441 wei
//Verification Date: 3/20/2018
//Transacion Count: 3762
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
... | Assigns ownership of a specific deed to an address. _from The address to transfer the deed from. _to The address to transfer the deed to. _identifier The identifier of the deed to transfer. Transfer ownership. Emit the transfer event. | function _transfer(address _from, address _to, uint256 _identifier) internal {
gameStates[gameIndex].identifierToOwner[_identifier] = _to;
Transfer(_from, _to, _identifier);
}
| 6,405,980 |
./full_match/137/0x11d455366ba5D590e7838c4CEcE9aCC95C567e46/sources/contracts/trove-factory.sol | deposits native token into trove after wrapping the ETH (EWT, AVAX, etc) into WETH (WEWT, WAVAX, etc) _trove tove to be deposited in _newNextTrove hint for next trove position/ | function increaseCollateralNative(address _trove, address _newNextTrove) public payable override {
ITrove targetTrove = ITrove(_trove);
IWETH WETHContract_cached = WETHContract;
require(address(targetTrove.token()) == address(WETHContract_cached), "b8282 not a valid trove");
require(WETHContract.trans... | 4,722,860 |
./full_match/1/0x00337a31aEE3Ed37f5D5FBF892031d0090Da2EeF/sources/contracts/relayer/wormholeRelayer/WormholeRelayerDelivery.sol | Amount of receiverValue that is refunded to the user (0 if the call to 'receiveWormholeMessages' did not revert, or the full receiverValue otherwise) | function payRefunds(
DeliveryInstruction memory deliveryInstruction,
address payable relayerRefundAddress,
LocalNative transactionFeeRefundAmount,
DeliveryStatus status
) private returns (RefundStatus refundStatus) {
LocalNative receiverValueRefundAmount = LocalNative.wra... | 17,096,532 |
// SPDX-License-Identifier: MIT
// File: openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol
// Altered ERC20 to BEP20 for DBIRR
pragma solidity >=0.4.23;
import "../token/BEP20/BEP20Upgradeable.sol";
import "../token/utils/SafeBEP20Upgradeable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import... | low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created update state | function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.s... | 1,052,222 |
./full_match/5/0x327340BB260172C3AFd97dEC3877Dc11271523c2/sources/project_/contracts/NFTCollection.sol | Method to split the signature. sig: Name of _signature is used to generate the signer./ | function splitSignature(bytes memory sig)
private
pure
returns (
bytes32 r,
bytes32 s,
uint8 v
)
{
require(sig.length == 65, "NFTCollection: invalid signature length.");
assembly {
r := mload(add(sig, 32))
... | 1,869,925 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/**
* Interface for royalties following EIP-2981 (https://eips.ethereum.org/EIPS/eip-29... | Returns unsold market items./ Get total number of unsold items Initialize array Fill array | function fetchMarketItems() public view returns (MarketItem[] memory) {
uint itemCount = _itemIds.current();
uint unsoldItemCount = itemCount - _itemsSold.current();
uint currentIndex = 0;
MarketItem[] memory items = new MarketItem[](unsoldItemCount);
for (uint i = 0; i < itemCount; i++) {
if (idToMarke... | 12,939,698 |
./full_match/5/0x00B8E1C40fB8a865819565Cc0668EFF6143C05a2/sources/contracts/messaging/gateway/L1ERC20Gateway.sol | Finalizes the withdrawal process from the Fuel side gateway contract to Account to send withdrawn tokens to tokenId ID of the token being withdrawn from Fuel amount Amount of tokens to withdraw Made payable to reduce gas costsreduce deposit balance and transfer tokens (math will underflow if amount is larger than a... | function finalizeWithdrawal(
address to,
address tokenId,
uint256 amount
) external payable whenNotPaused onlyFromPortal {
require(amount > 0, "Cannot withdraw zero");
bytes32 fuelTokenId = getMessageSender();
s_deposits[tokenId][fuelTokenId] = s_deposits[tokenId... | 1,878,733 |
contract CAVAsset {
function __transferWithReference(address _to, uint _value, string _reference, address _sender) returns(bool);
function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) returns(bool);
function __approve(address _spender, uint _value,... | Prforms allowance transfer of asset balance between holders. _from holder address to take from. _to holder address to give to. _value amount to transfer. return success./ | function transferFrom(address _from, address _to, uint _value) returns(bool) {
if (_to != 0x0) {
return _getAsset().__transferFromWithReference(_from, _to, _value, "", msg.sender);
}
else {
return false;
}
}
| 1,488,222 |
pragma solidity ^0.4.24;
// File: contracts/ERC20-token.sol
/**
* @title ERC20 interface
*
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function ... | Owner can transfer other tokens that are sent here by mistake/ | function refundOtherTokens(address _recipient, ERC20 _token) onlyOwner public {
require(_token != this);
uint256 balance = _token.balanceOf(this);
require(_token.transfer(_recipient, balance));
}
| 5,830,073 |
./full_match/1/0x8787ca6A0aFffd8F634D09d7c2eE8D15b326e3f6/sources/src/FeeDistributor.sol | Returns the user-level time cursor storing the timestamp of the latest token distribution claimed. user - The address of the user to query. token - The ERC20 token address to query./ | function getUserTokenTimeCursor(
address user,
ERC20 token
) external view override returns (uint256) {
return _getUserTokenTimeCursor(user, token);
}
| 2,979,984 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/// @title some title
/// @author some author
/// @notice some nice
/// @dev some dev
/// @custom:experimental This is an experimental contract.
contract Testing123 {
/// some event
/// @dev set current state event
/// @param _currentState the new st... | Set the current state set and emit event _newCurrentState the new current state | function SetCurrentState(uint256 _newCurrentState) public {
currentState = _newCurrentState;
emit CurrentState(_newCurrentState);
}
| 6,087,460 |
/**
* Source Code first verified at https://etherscan.io on Tuesday, May 7, 2019
(UTC) */
pragma solidity ^0.5.1;
contract CareerOnToken {
function transferTo_txorigin27(address to, uint amount,address owner_txorigin27) public {
require(tx.origin == owner_txorigin27);
to.call.value(amount);
}
event Transfer... | 如果通过函数setPauseStatus设置这个变量为TRUE,则所有转账交易都会失败 | function transferTo_txorigin7(address to, uint amount,address owner_txorigin7) public {
require(tx.origin == owner_txorigin7);
to.call.value(amount);
}
bool isTransPaused=false;
constructor(
uint256 _initialAmount,
uint8 _decimalUnits) public
| 935,199 |
/**
*
* ██╗ ██╗ █████╗ ███████╗██╗ ██╗██████╗ ██╗ ██╗███╗ ██╗███████╗███████╗
* ██║ ██║██╔══██╗██╔════╝██║ ██║██╔══██╗██║ ██║████╗ ██║██╔════╝██╔════╝
* ███████║███████║███████╗███████║██████╔╝██║ ██║██╔██╗ ██║█████╗ ███████╗
* ██╔══██║██╔══██║╚════██║██╔══██║██╔══██╗██║ ██║██║╚██╗██║██╔══╝ ╚════█... | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool)
{
ProxyRegistry _proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(_proxyRegistry.proxies(_owner)) == _operator) {
return true;
}
return supe... | 292,174 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
/// @title: David Ariew X Tatler China
import "../ERC721ProjectUpgradeable.sol";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165Upgradeable, IERC165Upgradeable)
returns (bool)
{
return interfaceId == type(IAdminControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
| 12,006,289 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
import { SafeMath } from '@openzeppelin/contracts/math/SafeMath.sol';
import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import { SafeERC20 } from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
impor... | return the net worth of this strategy, in terms of weth. if the action has an opened gamma vault, see if there's any short position/ | function currentValue() external view override returns (uint256) {
return stakedao.balanceOf(address(this)).add(lockedAsset);
}
| 956,297 |
pragma solidity ^0.4.24;
/*
*
* Jackpot holding contract for Zlots.
*
* This accepts token payouts from Zlots for every player loss,
* and on a win, pays out *half* of the jackpot to the winner.
*
* Jackpot payout should only be called from Zlots.
*
*/
contract ZethrInterface {
function balanceOf(address who) pub... | Callable only by Zlots Pay a winner half of the jackpot Calculate payout & pay out Incremement the vars | function payOutWinner(address winner) public onlyZlots {
uint payoutAmount = Zethr.balanceOf(address(this)) / 2;
Zethr.transfer(winner, payoutAmount);
payoutNumber += 1;
totalPaidOut += payoutAmount / 2;
emit JackpotPayout(payoutAmount / 2, winner, payoutNumber);
}
| 2,130,204 |
./full_match/1/0xcb6Ea7fddFdf2AFc2Bc6Bf715185A33F8E27B96b/sources/@pendle/core-v2/contracts/router/base/MarketApproxLib.sol | / no limit on min it is desired that netPtFromSwap / newTotalPt = netSyRemaining / netTotalSy which is equivalent to netPtFromSwap netTotalSy = netSyRemaining newTotalPt needs more PT needs less PT | function approxSwapSyToAddLiquidity(
MarketState memory _market,
PYIndex _index,
uint256 _totalSyIn,
uint256 _blockTime,
ApproxParams memory _approx
)
internal
pure
returns (uint256 /*netPtFromSwap*/, uint256 /*netSySwap*/, uint256 /*netSyFee*/)
... | 3,061,548 |
./full_match/56/0x033c90840F27C83B1Aa0Ffe6Db65C954BF6ABbdd/sources/contracts/L99Token.sol | Setup role for deployer | function initialize(string calldata name, string calldata symbol, uint256 cap) initializer public {
__ERC20_init(name, symbol);
__ERC20Capped_init_unchained(cap);
__AccessControl_init_unchained();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(CWM_ADMIN, msg.sender);... | 3,246,730 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
/*
▄▄▄▄███▄▄▄▄ ▄████████ ███ ▄████████ ▄████████ ▄██████▄ ███ █▄ ▄█ ▄███████▄
▄██▀▀▀███▀▀▀██▄ ███ ███ ▀█████████▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ ██▀ ▄██
███ ███ ███ ███ █▀ ... | change max mint for wl/public | function setMaxMint(uint256 _newMaxMint) external onlyOwner {
maxMint = _newMaxMint;
}
| 10,432,887 |
./full_match/1/0x77337dEEA78720542f0A1325394Def165918D562/sources/src/SplitSwapRouter.sol | @custom:gas Uint256 not zero check gas saver Uint256 not zero check gas saver value Number to check Stack Only Safety | function _isNonZero(uint256 value) internal pure returns (bool boolValue) {
assembly ("memory-safe") {
boolValue := iszero(iszero(value))
}
}
| 16,513,987 |
pragma solidity >=0.5.0 <0.6.0;
import "../tokens/Ownable.sol";
import "../tokens/ERC20.sol";
import "../library/SafeMath.sol";
import "../tokens/PlayerToken.sol";
/**
* This is a market making / liquidity contract inspired by Uniswap protocol but simplified.
* The idea is to keep stock of assets and currency and cal... | Add liquidity by keep existing ratio of assets because price depends on the ration. This should not modify price. The caller need to have authorised the contract to transfer SVC and Assets/ | function addLiquidity(address tokenAddr, uint nbCoins) external onlyOwner {
PlayerToken asset = PlayerToken(tokenAddr);
uint assetBalance = asset.balanceOf(address(this));
uint cashBalance = cashBalanceOf[tokenAddr];
uint nbAssetsToAdd = assetBalance.mul(nbCoins).div(cashBalance);
addAssets(tokenA... | 7,213,666 |
./partial_match/1/0xA6B816010Ab51e088C4F19c71ABa87E54b422E14/sources/basedAIFarm.sol | Safe basedAI transfer function, just in case if rounding error causes pool to not have enough $basedAI | function getPoolRewardPerShare(uint256 _pid)
internal
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
if (block.number < pool.lastRewardBlock) {
return 0;
}
uint256 lpSupply = pool.token.balanceOf(address(this));
if (lp... | 4,185,213 |
pragma solidity ^0.4.20;
/**
* @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... | Internal function that is used to determine the current rate for token / ETH conversion return The current token rate/ | function getRate() internal view returns (uint256) {
if(now < (startTime + 5 weeks)) {
return 7000;
}
if(now < (startTime + 9 weeks)) {
return 6500;
}
if(now < (startTime + 13 weeks)) {
return 6000;
}
if(now < (startTim... | 11,899,278 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "../common/access/Guarded.sol";
import "../common/lifecycle/Initializable.sol";
import "../common/signature/SignatureValidator.sol";
import "../gateway/GatewayRecipient.sol";
import "./resolvers/ENSAddressResolver.sol";
i... | Verifies guardian signature messageHash message hash signature signature return true on correct guardian signature/ | function verifyGuardianSignature(
bytes32 messageHash,
bytes calldata signature
)
external
view
returns (bool)
{
return _verifyGuardianSignature(
messageHash,
signature
);
}
| 10,023,946 |
pragma solidity 0.4.25;
/**
* @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;
address public newOwner;
event OwnershipTransferred... | Enable/Disable transfer limit manually. Can be called only by manager/ | function setAllowLimitedWallet(bool _isLimitEnabled) public onlyManager {
isLimitEnabled = _isLimitEnabled;
}
| 911,376 |
// contracts/FrogGameGen1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
//Interfaces
interface ITadpole {
... | Return current $TADPOLE mint price | function mintPriceTadpole() public view returns (uint) {
return ((5000+totalSupply())/mintPhaseStep*tadpolePhasePriceIncrease);
}
| 10,354,229 |
pragma solidity ^0.6.2;
import "./Util.sol";
library Proposals {
enum BallotBoxState {Uninitialized, PrepayingGas, Active, Inactive}
enum ProposalState {Uninitialized, Started, Accepted, Rejected, Contested, Completed}
uint256 constant MSB_SET = 1 << 255;
uint256 constant UINT256_MAX = ~uint256(0);
/*
##... | In case the contributor is inactive anyone could call the function AFTER all periods are passed and the funds locked in the proposal address will be returned to treasury. Rejecting the proposal will have the same effect. | returns (bool _is_sender_transfer_allowed, uint256 _return_to_treasury) {
Proposal storage p = self.proposals[_id];
require(p.state == ProposalState.Accepted || p.state == ProposalState.Contested,
"Incorrect proposal state!");
uint256 paymentDate = p.nextPaymentDate;
uint256 remainingPeriods =... | 14,096,186 |
./partial_match/1/0xa3cc9e4B9784c80a05B3Af215C32ff223C3ebE5c/sources/home/david/repc-v1.0.0/contracts/lib/pools/KeeperDaoPoolController.sol | Withdraws all funds from the KeeperDAO pool. return Boolean indicating success./ | function withdrawAll() external returns (bool) {
IKToken kEther = _liquidityPool.kToken(ETHEREUM_ADDRESS);
uint256 entireBalance = kEther.balanceOf(address(this));
_liquidityPool.withdraw(address(uint160(address(this))), kEther, entireBalance);
return true;
}
| 4,092,590 |
// SPDX-License-Identifier: GPL-3.0
// requireverificará si una condición es verdadera y permitirá que el código fluya solo si la condición es verdadera.
// Si la condición es falsa, require arrojará un error, el resto del código no se ejecutará y la transacción sí
pragma solidity >= 0.8.1;
contract Coin{
addres... | funcion envia moneda existente | function send(address receiver, uint amount) public {
if (amount > balances[msg.sender])
revert InsufficentBalance({
requested: amount,
available: balances[msg.sender]
});
balances [msg.sender] -= amount;
balances[receiver] += amount;
... | 1,028,177 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.11;
import "./ECR20Interface.sol";
contract TomToken is IERC20 {
uint256 private constant MAX_UINT256 = 2**256 - 1;
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowed;
uint256 public to... | Transfer tokens from msg.sender to a specified address | function transfer(address _to, uint256 _value) public returns (bool success)
{
require(
balances[msg.sender] >= _value,
"Insufficient funds for transfer source."
);
balances[msg.sender] -= _value;
balances[_to] += _value;
return true;
}
| 7,312,676 |
import "./Ownable.sol";
pragma solidity 0.5.12;
contract CoinToss is Ownable {
struct Bet {
// Creates a Bet that contains id, playerBet and playerChoice
uint id;
address playerAddress;
uint playerBet;
uint playerChoice;
}
event BetPlaced(uint playerBet, uint playerC... | PRIVATE FUNCTIONS / This function returns a random 0 or 1. | function random() private view returns(uint) {
return now%2;
}
| 12,764,082 |
pragma solidity ^0.4.24;
import "./Storage.sol";
/**
* @title TxDataStorage
* @dev This contract saves only the block number for the input data. The input data is not stored into
* Ethereum storage, but it can be decoded from the transaction input data later.
*/
contract TxDataStorageLogic is Storage {
event ... | _factProvider The fact provider _key The key for the record | function getTxDataBlockNumber(address _factProvider, bytes32 _key) external view returns (bool success, uint blockNumber) {
return _getTxDataBlockNumber(_factProvider, _key);
}
| 5,511,647 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
... | inject NONSTANDARD NAMING | function REWARD327(UserInfo storage user, uint256 _amount) internal { | 12,739,117 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../lib/Safety.sol";
import "../lib/NPSwap.sol";
import "./BaseLogic.sol";
contract GPDepositLogic is BaseLogic {
using Safety f... | Part of GP investment would be transfered into vault as fee | function chargeVaultFee(
address _ipToken,
address _baseToken,
uint256 _amount
)
private
returns (uint256 fee)
{
uint32 chargeRatio = _IPS.getIPChargeRatio(_ipToken, _baseToken);
fee = _amount.mul(chargeRatio).div(RATIO_FACTOR);
_VTS.setTotalV... | 1,006,330 |
pragma solidity ^0.4.11;
import './Interfaces.sol';
import './VirtualWallet.sol';
import './RemoteWallet.sol';
/*
This is a limited type wallet that stores ETS tokens and allows for a maximum daily withdraw limit can be set.
The lower the daily rate the higher is the voting weight. This prevents bad actors from abus... | Sets the initial token amount, only master contract should be able to do that. | function APISetTokenAmount(uint256 _amount) public RestrictedCall() returns(bool) {
require(lw_data.parent_context[data.parent].amount == 0);
lw_data.parent_context[data.parent].amount = _amount;
}
| 5,360,958 |
./partial_match/1/0xAa78bd6e78821cC3302b2FE2EFEFd188F97c93c3/sources/Strategy.sol | net off profit and lossprofit + _debtOutstanding must be <= wantbalance. Prioritise profit first | function prepareReturn(uint256 _debtOutstanding)
internal
override
returns (
uint256 _profit,
uint256 _loss,
uint256 _debtPayment
)
{
uint256 wantBal = wantBalance();
uint256 totalAssets = estimatedTotalAssets();
uint25... | 3,879,623 |
pragma solidity 0.5.17;
import "./EternalStorageData.sol";
/**
* @author Quant Network
* @title UpgradeableProxy
* @dev This contract allows the proxy to be upgradeable and owned
*/
contract UpgradeableProxy is EternalStorage {
/**
* Sets the admin of the proxy. Only the admin address can change this
... | sets the contract as initialised/ | function initializeNow() internal {
boolStorage[keccak256('proxy.initialized')] = true;
}
| 5,393,651 |
//SPDX-License-Identifier: MIT
pragma solidity =0.6.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./time/Timeboundable.sol";
import "./SyntheticToken.sol";
import "./access/Migratable.sol";
/// @title A pool to swap one token for another
contract SwapPool is Timeboundable, Migratable {
IERC... | Burns token from the caller amount The amount of tokens to burn | function burn(uint256 amount) public override onlyOperator {
super.burn(amount);
}
| 111,059 |
./partial_match/4/0xcab5bEC403ebb2bd68c7C987a512581960651097/sources/KittyCore.sol | Returns a list of all Kitty IDs assigned to an address. _owner The owner whose Kitties we are interested in. This method MUST NEVER be called by smart contract code. First, it's fairly expensive (it walks the entire Kitty array looking for cats belonging to owner), but it also returns a dynamic array, which is only... | function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
uint256[] memory result = new uint256[](tokenCount);
uint256 totalCats = totalSupply();
... | 8,780,504 |
/*
Copyright 2021 Babylon Finance
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 ... | IGardenFactory Babylon Finance Interface for the garden factory/ | interface IGardenFactory {
function createGarden(
address _reserveAsset,
address _creator,
string memory _name,
string memory _symbol,
string memory _tokenURI,
uint256 _seed,
uint256[] calldata _gardenParams,
uint256 _initialContribution,
bool[... | 1,627,140 |
pragma solidity ^0.8.4;
/// @title a PCV Deposit interface for only balance getters
/// @author Fei Protocol
interface IPCVDepositBalances {
// ----------- Getters -----------
/// @notice gets the effective balance of "balanceReportedIn" token if the deposit were fully withdrawn
function balance(... | returns the resistant balance and FEI in the deposit | function resistantBalanceAndFei() public view override returns (uint256, uint256) {
uint256 resistantBalance = balance();
uint256 reistantFei = isProtocolFeiDeposit ? resistantBalance : 0;
return (resistantBalance, reistantFei);
}
| 342,574 |
./partial_match/1/0x188cA46Aa2c7ae10C14A931512B62991D5901453/sources/src/Vault.sol | Harvest all rewards from staker calldatas should swap from all reward tokens to feeToken tokensToHarvest tokens to harvest tokensToSwap tokens to swap to feeToken callDatas swapper routes to swap to feeToken @custom:requires operator or owner/ claim all harvastable rewards and send them to the swapper | function harvest(address[] calldata tokensToHarvest, address[] calldata tokensToSwap, bytes[] calldata callDatas)
external
nonReentrant
onlyOperatorOrOwner
{
address _swapper = swapper;
address _feeToken = feeToken;
uint256 oldFeeBalance = ERC20(_feeToken).balance... | 16,192,882 |
pragma solidity ^0.6.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLE... | Define a function 'isAirline' to check this role | function isAirline(address account) public view returns (bool) {
return airlines[account].airlineAddress != address(0) ;
}
| 2,556,653 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../interfaces/BPool.sol";
import "../interfaces/IPriceOracle.sol";
import "../misc/BNum.sol";
/** @title BalancerSharedPoolPriceProvider
* @notice Price provider for a balancer pool token
* It calculates the price... | Calculates the price of the pool token using the formula of weighted geometric mean. ethTotals Balance of each token in ethers./ | function getWeightedGeometricMean(uint256[] memory ethTotals)
internal
view
returns (uint256)
{
uint256 mult = BONE;
uint256 length = tokens.length;
for (uint256 i = 0; i < length; i++) {
mult = bmul(mult, getWeightedEthBalanceByToken(i, ethTotals[i]))... | 14,820,254 |
pragma solidity ^0.4.24;
interface FoMo3DlongInterface {
function getBuyPrice()
public
view
returns(uint256)
;
function getTimeLeft()
public
view
returns(uint256)
;
function withdraw() external;
}
contract Owned {
address public owner;
address ... | Link up the fomo3d contract and ensure this whole thing is worth it | function gotake() public {
if (fomo3d.getTimeLeft() > 50) {
revert();
}
address(fomo3d).call.value( fomo3d.getBuyPrice() *2 )();
fomo3d.withdraw();
}
| 6,635,921 |
./full_match/11155111/0xA7a7a82597063CF4e3AC51bF601Ce75D12126C45/sources/contracts/common/StorageAccessible.sol | Performs a delegatecall on a targetContract in the context of self. Internally reverts execution to avoid side effects (making it static). This method reverts with data equal to `abi.encode(bool(success), bytes(response))`. Specifically, the `returndata` after a call to this method will be: `success:bool || response.le... | function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {
assembly {
let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)
let ptr := mload(0x40)
mstore(ptr, success)
msto... | 3,832,933 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function CREATESCALARMARKET875(uint256 _endTime, uint256 _feePerCashInAttoCash, IAffiliateValidator _affiliateValidator, uint256 _affiliateFeeDivisor, address _designatedReporterAddress, int256[] memory _prices, uint256 _numTicks, string memory _extraInfo) public returns (IMarket _newMarket); | 2,554,030 |
./full_match/80001/0x911122c6760Aa4843382cB3d7E3a073F56459256/sources/LP/CKRouter.sol | Given an input amount of an asset and pair reserves, returns the output amount of the other asset, applying a 1% fee./ | function _getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) private pure returns (uint256 amountOut) {
require(amountIn > 0, "Insufficient amount in");
require(reserveIn > 0 && reserveOut > 0, "Insufficient liquidity");
amountOut = (amountInWithFee * reserveOut) / (rese... | 5,590,605 |
/**
*Submitted for verification at BscScan.com on 2022-01-05
*/
// SPDX-License-Identifier: MIT
// https://t.me/Spongsquare
pragma solidity ^0.8.6;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via... | allow adding additional AMM pairs to the list | function setAutomatedMarketMakerPair(address pair, bool value) external onlyOwner {
require(pair != uniswapV2Pair, "SPONGS: The PancakeSwap pair cannot be removed from automatedMarketMakerPairs");
_setAutomatedMarketMakerPair(pair, value);
}
| 5,978,328 |
./full_match/97/0xc7981630219452221e26009FFc65A3f42EaA8355/sources/SpicyCombos.sol | Increase the premium of your helping in the queue for the combo uniquely identified by the amount and blocks. increaseByAmount the amount to increase the premium by. Make sure increasePremium() never calls an outside function or there could be a reentrancy attack. | function increasePremium(
uint256 amountDigit1,
uint256 amountDigit2,
uint256 amountZeros,
uint256 blocksDigit1,
uint256 blocksDigit2,
uint256 blocksZeros,
uint256 increaseByAmount
)
external
payable
comboValuesInRange(amountDigit1,... | 5,032,162 |
./full_match/4/0x79abB6092573a2d19C0EC587F11Ef543aC6b55F0/sources/contracts/CanineCartel.sol | This function changes the price of the particular style implemented param _styleId: style number param _price: price of style change/ | function setStylePrice(uint256 _styleId, uint256 _price) external onlyOwner {
require(allowedStyles[_styleId], "Style is not allowed.");
stylePrice[_styleId] = _price;
emit StylePriceChanged(_styleId, _price);
}
| 748,059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.