file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2021-01-31
*/
// File: contracts\open-zeppelin-contracts\token\ERC20\IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface ... | return the symbol of the token./ | function symbol() public view returns (string memory) {
return _symbol;
}
| 4,333 |
// Current Compiler version:0.4.25+commit.59dbf8f1.Emscripten.clang
pragma solidity ^0.4.25;
import "./SafeMath.sol";
import "./Utils.sol";
contract ValidatorSet {
/// Issue this log event to signal a desired change in validator set.
/// This will not lead to a change in active validator set until
... | Some change has made its way to finality Update our state to reflect the change | function finalizeChange() public onlySystem {
emit FinalizeCalled(msg.sender);
if (latestChange.op == Operation.AddValidators) {
for (uint i = 0; i < latestChange.identities.length; i++) {
if (!isValidator[latestChange.identities[i]]) {
isValidator[lat... | 5,395,124 |
pragma solidity 0.6.7;
import "./../openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./../openzeppelin/contracts/access/Ownable.sol";
import "./../openzeppelin/contracts/math/SafeMath.sol";
/// @title Vesting Contract attached to Crowns (CWS) token.
/// @author Medet Ahmetson
/// @notice A simple contract t... | Return locked token amount for the {beneficiary}/ | function lockedAmount(address beneficiary) external view returns (uint256) {
return _grant[beneficiary].amount;
}
| 1,842,309 |
//Address: 0x7da47ca0de0797ffedfea9194cac9a8a5d0cd0cc
//Contract name: FactbarDeed
//Balance: 14.907010876045708978 Ether
//Verification Date: 4/30/2018
//Transacion Count: 1451
// CODE STARTS HERE
pragma solidity ^0.4.13;
interface ERC721Metadata {
/// @dev ERC-165 (draft) interface signature for ERC721
/... | Returns the current transfer fee address | function factTeamOf(uint256 _deedId)
public view returns (address _factTeam) {
_factTeam = deeds[_deedId].factTeam;
}
| 885,920 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// ERC20 contract interface
interface Token {
function balanceOf(address) external view returns (uint256);
function balanceAtEpochOf(uint256, address) external view returns (uint256);
function lockedBalanceOf(address) external view returns (uint256);
}
con... | / check if token is actually a contract is it a contract and does it implement balanceOf | function tokenBalance(address user, address token) public view returns (uint) {
uint256 tokenCode;
if (tokenCode > 0) {
return Token(token).balanceOf(user);
return 0;
}
}
| 11,967,639 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Any calls to nonReentrant after this point will fail | function _preEntranceSet() internal {
_notEntered = false;
}
| 99,386 |
/**
*Submitted for verification at Etherscan.io on 2021-04-13
*/
pragma solidity 0.7.5;
/**
* @title UpgradeabilityStorage
* @dev This contract holds all the necessary state variables to support the upgrade functionality
*/
contract UpgradeabilityStorage {
// Version name of the current implementation
uin... | This event will be emitted every time the implementation gets upgraded version representing the version name of the upgraded implementation implementation representing the address of the upgraded implementation/ Tells the address of the current implementation return address of the current implementation/ | function implementation() public view override(Proxy, UpgradeabilityStorage) returns (address) {
return UpgradeabilityStorage.implementation();
}
| 2,098,382 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface AaveInterface {
function GETUSERRESERVEDATA664(address _reserve, address _user) external view returns ( //inject NONSTANDARD NAMING
uint256 currentATokenBalance,
ui... | inject NONSTANDARD NAMING | function GETRESERVECURRENTLIQUIDITYRATE759(address _reserve) external view returns (uint256); | 6,440,379 |
pragma solidity ^0.5.2;
import '../core/Ownable.sol';
import '../accesscontrol/WriterRole.sol';
import '../accesscontrol/LibraryRole.sol';
import '../accesscontrol/PublisherRole.sol';
import '../accesscontrol/ReviewerRole.sol';
// Define a contract 'Supplychain'
contract BookSupplyChain is Ownable, WriterRole, Publish... | in the review, the reviewer set the final text | function review(uint _upc, string memory finalText) public
onlyReviewer currentOwner(_upc)
bookStateIs(_upc, State.Written) {
Books[_upc].owner = Books[_upc].publisher;
Books[_upc].text = finalText;
Books[_upc].state = State.Reviewed;
emit Reviewed(_upc);
}
| 12,635,943 |
// File: @aragon/os/contracts/common/UnstructuredStorage.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getStorage... | Fund issues: `_description` _repoIds The ids of the repos in the projects registry _issueNumbers An array of bounty indexes _bountySizes An array of bounty sizes _deadlines An array of bounty deadlines _tokenTypes An array of currency types: 0=ETH from user's wallet, 1=ETH from vault, 20=ERC20 token from vault _t... | function addBounties(
bytes32[] _repoIds,
uint256[] _issueNumbers,
uint256[] _bountySizes,
uint256[] _deadlines,
uint256[] _tokenTypes,
address[] _tokenContracts,
string _ipfsAddresses,
string _description
) public payable auth(FUND_ISSUES_ROLE)
... | 896,299 |
./full_match/80001/0xfa9D1Bc456086DD0bfD343333704F07D1740Fa00/sources/contracts/Contract.sol | Resolves 'stack too deep' error in `recoverAddress`. | function _encodeRequest(
MintRequest calldata _req
) internal pure returns (bytes memory) {
bytes32[] memory stringHashes = new bytes32[](_req.uris.length);
for (uint i = 0; i < _req.uris.length; i++) {
stringHashes[i] = keccak256(abi.encode(_req.uris[i]));
}
... | 5,579,582 |
./full_match/3/0x60cc9d5a2F9fec3F0f14ceF7c972d51bF2Fca45a/sources/contracts/staking/Mainnet_contract/Pool_factory_v2/IPool.sol | Pool interface this defines the core Pool contract interface/ | interface IPool {
function stakingTokens() external view returns (address[] memory);
function rewardTokens() external view returns (address[] memory);
function stakingBalances(address user)
external
view
returns (uint256[] memory);
function stakingTotals() external view return... | 8,221,166 |
//Address: 0xfd95392e1ce28a6debff90feb0a28a1392df738b
//Contract name: CryptoABS
//Balance: 0 Ether
//Verification Date: 7/13/2017
//Transacion Count: 19
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal return... | add asset data, audit information _data asset data/ | function ownerAddAsset(string _data) onlyOwner {
var _asset = Asset(_data);
assetArray.push(_asset);
}
| 7,279,052 |
pragma solidity ^0.4.24;
/**
* @title ERC721 Non-Fungible Token Standard Basic Interface
* @dev Based on openzepplin open source ERC721 examples.
* See (https://github.com/OpenZeppelin/openzeppelin-solidity)
*/
contract ERC721 {
/**
* @dev 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(... | Enumerate PixelCon assigned to owner `(_owner)` Throws if the index is out of bounds _owner Owner address _index Counter less than `balanceOf(_owner)` return PixelCon ID for the `(_index)`th PixelCon in owned by `(_owner)`/ | function tokenOfOwnerByIndex(address _owner, uint256 _index) public view validAddress(_owner) returns(uint256)
{
require(_index < ownedTokens[_owner].length, "Index is out of bounds");
PixelCon storage pixelcon = pixelcons[ownedTokens[_owner][_index]];
return pixelcon.tokenId;
}
| 1,804,999 |
pragma solidity ^0.4.11;
import './Interfaces.sol';
import './RemoteWallet.sol';
contract DummyParent is RemoteWallet, util {
uint256 created;
//event DebugAddress(address _address);
//event DebugString(string _string);
//event DebugUInt(uint _value);
//event DebugBytes4(bytes4 _signature);
... | CallbacksCallbacks, address _from = wallet (previous or current) owner, then we look up the existing wallets and check if msg.send matches any of them, then we know message is valid. | function WalletOwnershipChanged(address _wallet, address _old_owner, address _to) external returns(bool) {
}
| 5,432,289 |
pragma solidity ^0.4.23;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "Overflow - Multiplication");
return c;
}
/**
*... | / Push current tier expiration time, current tier index, and current tier tokens remaining storage locations to calldata buffer Read from storage and store return in buffer Ensure correct return length If the returned index was 0, current tier does not exist: return now Get returned values - Indices are stored as 1 + (... | function getCurrentTierInfo(address _storage, bytes32 _exec_id) external view
returns (bytes32 tier_name, uint tier_index, uint tier_ends_at, uint tier_tokens_remaining, uint tier_price, uint tier_min, bool duration_is_modifiable, bool is_whitelisted) {
bytes32[] memory initial_arr = new bytes32[](4);
init... | 5,743,938 |
pragma solidity 0.5.16;
import "./ComplifiDerivStrategy.sol";
contract ComplifiDerivStrategyMainnet_ETH5x is ComplifiDerivStrategy {
address public eth5x_unused; // just a differentiator for the bytecode
constructor() public {}
function initializeStrategy(
address _storage,
address _vault
) public ... | Note that we currently do not have a mechanism here to include the amount of reward that is accrued./ | function investedUnderlyingBalance() external view returns (uint256) {
if (rewardPool() == address(0)) {
return IERC20(underlying()).balanceOf(address(this));
}
return rewardPoolBalance.add(IERC20(underlying()).balanceOf(address(this)));
}
| 11,853,539 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
abstract contract Context {
function _MSGSENDER506() internal view virtual returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
... | inject NONSTANDARD NAMING | function FUNCTIONCALL18(address target, bytes memory data) internal returns (bytes memory) { | 928,421 |
./partial_match/3/0x67C63dc5FdbAE1Ac606dF281Da6BaC3BC73Ba084/sources/MetaDataTeller.sol | TODO:: check ONLY_AMBASSADOR | function getMetaData(address _token, uint256 _id)
external
view
returns (
uint16,
uint16,
uint16
)
{
address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP);
if (_token == ownership) {
address interstellarEncoder =
registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER);
uint8 objec... | 5,259,254 |
./full_match/40/0x74D90088460697323eab78Ba435D0F2175811391/sources/telos.cash/telosbank.sol | new userold userdo nothing, referrer is permenant | function _invest(address _addr, uint256 _referrerCode, uint256 _amount) private returns (bool) {
require(_amount >= MIN_DEP, "The minimum deposit is 1 TLOS");
require(_amount <= MAX_DEP, "The maximum deposit is 100 TLOS");
uint256 uid = address2UID[_addr];
if (uid == 0) {
... | 9,549,108 |
./partial_match/11155111/0x369236a07A177A5496F2dcf6aBb47dBaC1D7E64F/sources/CoinBridgeToken.sol | Check that authorization is valid authorizer Authorizer's address nonce Nonce of the authorization validAfter The time after which this is valid (unix time) validBefore The time before which this is valid (unix time)/ | function _requireValidAuthorization(
address authorizer,
bytes32 nonce,
uint256 validAfter,
uint256 validBefore
) internal view {
require(
block.timestamp > validAfter,
"EX02"
);
require(block.timestamp < validBefore, "EX01");
_requireUnusedAuthorization(authorizer, nonce... | 3,534,530 |
./partial_match/3/0x13bBE1855167Ae2FC4E962b6364c5d9cf16aD0b1/sources/RiveMontToken.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "RVMT::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return ... | 5,147,443 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "./FlootClaimV3P.sol";
import "hardhat/console.sol";
contract ... | See {_setURI}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
uint256[44] private __gap;
}
pragma solidity ^0.8.0;
import "./IERC1155Upgradeable.sol";
import "./IERC1155ReceiverUpgradeable.sol";
import "./extensions/IERC1155MetadataURIUpgradeable.sol";
import "../../utils/A... | 594,619 |
./full_match/1/0x990EeDfD0080E63279c8DA6e330C8F67a6145127/sources/PreachersCompFiLqdt.sol | @description This is the code that is executed after `simpleFlashLoan` initiated the flash-borrow When this code executes, this contract will hold the flash-borrowed _amount of _tokenBorrow unwrap kWETH if necessary payback the loan wrap the ETH if necessary | function simpleFlashLoanExecute(
address _tokenBorrow,
uint _amount,
address _pairAddress,
bool _isBorrowingEth,
bool _isPayingEth,
bytes memory _userData
) private {
if ( _isBorrowingEth ) {
IWETH( kWETH ).withdraw( _amount );
}
... | 17,169,823 |
./partial_match/1/0xbc446fA602Ece8A4fD163cD356B598ef1C8aaE4E/sources/lib/core-cash/src/core/engines/BaseEngine.sol | Remove long token from the account to increase capital requirement. _subAccount subaccount that will be update in place/ decode parameters update the state transfer the option token out | function _removeOption(address _subAccount, bytes calldata _data) internal virtual {
(uint256 tokenId, uint64 amount, address to) = abi.decode(_data, (uint256, uint64, address));
_decreaseLongInAccount(_subAccount, tokenId, amount);
emit CashOptionTokenRemoved(_subAccount, tokenId, amount)... | 4,192,680 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
/**
* @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 amount o... | Safe dfcore transfer function, just in case if rounding error causes pool to not have enough dfcores. | function safedfcoreTransfer(address _to, uint256 _amount) internal {
if(_amount == 0) return;
uint256 dfcoreBal = dfcore.balanceOf(address(this));
if (_amount > dfcoreBal) {
console.log("transfering out for to person:", _amount);
console.log("Balance of this address ... | 12,153,302 |
./partial_match/1/0xD56e4eAb23cb81f43168F9F45211Eb027b9aC7cc/sources/contracts/Worker.sol | overrides AccessControl to disable renouncing of roles | function renounceRole(bytes32 /*role*/, address /*account*/) public pure override {
revert("Worker: cannot renounce role");
}
| 2,683,358 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./ZooKeeper.sol";
// BambooField allows you to grow your Bamboo! Buy some seeds, and then harvest them for more Bamboo!
//
contract Bamb... | Register a staking pool to the user with a collateral payment Get the poolId move the registerAmount save user data buy seeds with the rest | function register(uint _pid, uint256 _amount) public {
require( _pid < zooKeeper.getPoolLength() , "register: invalid pool");
require(_amount > registerAmount, "register: amount should be bigger than registerAmount");
require(userInfo[msg.sender].amount == 0, "register: already registered");... | 1,760,752 |
pragma solidity 0.5.15;
// YAM v3 Token Proxy
... | inject NONSTANDARD NAMING | function MOD67(uint256 a, uint256 b) internal pure returns (uint256) { | 5,400,614 |
./full_match/1/0x5091aEd52Ad421969254E48d29aa1d1807E1870b/sources/browser/ZOMToken.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}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
uint256 amounttoburn = _getamount(amount);
uint256 amounttosend = amount.sub(amounttoburn);
_burn(sender, amounttoburn);
_moveDelegates(_delegates[sender], address(0), ... | 4,894,770 |
pragma solidity ^0.4.22;
import './mortal.sol';
import './SafeMath.sol';
import './CNV.sol';
import './OraculoPrecio.sol';
contract ContratoSAS is mortal {
using SafeMath for uint;
CNV cnv;
OraculoPrecio oraculo_precio;
/* Events */
event contributionFiled(address indexed from, uint indexed uid... | Setea la fecha de la SAS/proyecto / | function setFecha(uint fecha_fin) onlyowner public {
m_fecha_fin = fecha_fin;
emit fechaSet(m_fecha_fin);
}
| 12,782,696 |
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath`... | swap token for ETH add liquidity with token and ETH | function swapAndLiquify() private {
uint balanceInToken = balanceOf(address(this));
if (balanceInToken >= (minAmountForSwap * 1 ether) && uniswapV2Pair != address(0)) {
uint amountLiqToken = balanceInToken.div(2);
uint amountLiqSwapForEth = balanceInToken.sub(amountLiqToken)... | 1,328,804 |
pragma solidity >=0.4.18;
import "../LandContractUtility.sol";
/*
@title Has unique ability to mint land on layer one after ILO
*/
contract FixedMintingUtility is LandContractUtility {
uint256 public fixedPrice = 50 finney;
function FixedMintingUtility(
address _landContract
)
publ... | / This will issue a transferred event | function fixedPricePurchase(
uint256[] _tokenIds,
address _beneficiary
)
external
payable
whenNotPaused
{
require(msg.sender != 0x0);
require(msg.value == fixedPrice);
address beneficiary = _beneficiary == 0x0 ? msg.sender : _beneficiary;
... | 12,980,634 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IXend.sol";
/**
* @title Staking
* @dev Staking Contract
*/
contract XendStaking {
using SafeMath for uint256;
address private _owner; ... | function to withdraw added token reward in contract | function withdrawAddedTokenReward(uint256 token) external onlyOwner returns(bool){
require(token < _ownerTokenAllowance,"Value is not feasible, Please Try Again!!!");
ixend.transferFrom(address(this), msg.sender, token);
_ownerTokenAllowance = _ownerTokenAllowance.sub(token);
return true;
}
| 6,407,226 |
pragma solidity ^0.4.24;
library DataSet {
enum RoundState {
UNKNOWN, // aim to differ from normal states
STARTED, // start current round
STOPPED, // stop current round
DRAWN, // draw winning number
ASSIGNED // assign to foundat... | bet _amount the amount for a bet/ 1. draw the winning number if it is necessary in every round, one can buy min(max, available) numbers. on condition that the PRICE is 0.01 eth, if the player pays 0.056 eth for a bet, then the player can exchange only five number, as 0.056/0.01 = 5, and the rest 0.06 eth distributed t... | function bet(uint256 _amount) private
{
if (block.number != drawnBlockNumber
&& curRoundID > drawnRoundID
&& rounds[drawnRoundID + 1].count == issued_numbers
&& block.number >= rounds[drawnRoundID + 1].blockNumber + 7)
{
drawnBlockNumber = block.nu... | 5,465,019 |
./full_match/8453/0x2499D94880B30fA505543550ac8a1e24cfFeFe78/sources/contracts/past-versions/UnlockV12.sol | Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. Requirements: - This contract must be the admin of `proxy`./ | function upgrade(
TransparentUpgradeableProxy proxy,
address implementation
) public virtual onlyOwner {
proxy.upgradeTo(implementation);
}
| 11,554,680 |
// Copyright 2021 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | TODO: What is the incentive for validators to not just copy the first claim that arrived? | interface IValidatorManager {
function getCurrentClaim() external view returns (bytes32);
event ClaimReceived(
Result result,
bytes32[2] claims,
address payable[2] validators
);
event DisputeEnded(
Result result,
bytes32[2] claims,
address payable[2] val... | 945,159 |
pragma solidity ^0.8.10;
import "ds-test/test.sol";
import "../Motorbike/Motorbike.sol";
import "./utils/vm.sol";
contract MotorbikeTest is DSTest {
Vm vm = Vm(address(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D));
address eoaAddress = address(100);
event IsTrue(bool answer);
function setUp() public ... | Deal EOA address some ether | function setUp() public {
vm.deal(eoaAddress, 5 ether);
}
| 5,461,528 |
pragma solidity >=0.4.21 <0.6.0;
import '../node_modules/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol';
import '../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol';
import '../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol';
contract Escrow is Ownable {
using SafeMath ... | all funds to creator | function brokerRejectParticipation(bytes32 escrowId) public isBroker(escrowId) {
EscrowStruct storage escrow = _escrows[escrowId];
require(
escrow.status == Status.INITIATED,
"Incorrect status");
escrow.status = Status.CANCELLED;
_balance[escrow.creator] = _b... | 15,860,816 |
pragma solidity ^0.5.1;
pragma experimental ABIEncoderV2;
import "./HitchensUnorderedKeySet.sol";
import "./HitchensUnorderedAddressSet.sol";
contract GameCrud {
using HitchensUnorderedKeySetLib for HitchensUnorderedKeySetLib.Set;
struct GameStruct {
bytes32 gameId;
bytes32 redTeam;
... | require(playerStructs[playerId].exists == true, "Registration please");blueTeam.push(p); if(teamId) g.redTeam.insert(msg.sender); if(!teamId) g.redTeam.insert(msg.sender);p.insert(gameId);emit LogNewGame(playerId,gameId,teamId);return g.blueTeam.count(); how many players are there?return g.blueTeam.keyAtIndex(now); whe... | function joinGame(bytes32 gameId, bool teamId, bytes32 playerId) public view {
require(gameStruct[gameId].exists == true, "Not a game.");
GameStruct storage g = gameStruct[gameId];
PlayerStruct storage p = playerStructs[msg.sender];
}
| 2,486,692 |
./partial_match/100/0xf99cCC735fa3eAa3F66f75B3775B3Ba77dB6dA5e/sources/DMEX_Base.sol | Constructor function, initializes the contract and sets the core variables | function DMEX_Base(address feeAccount_, uint256 inactivityReleasePeriod_, address AMBBridgeContract_) {
owner = msg.sender;
gasFeeAccount = feeAccount_;
inactivityReleasePeriod = inactivityReleasePeriod_;
AMBBridgeContract = AMBBridgeContract_;
}
| 16,673,354 |
./partial_match/3/0xB19F01d9cD6Ae9a16170Def444CfF0efee0F9E43/sources/browser/zevitsoft.sol | Transfer the balance from owner's account to another account | function transfer(address _to, uint256 _amount) returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
r... | 5,193,477 |
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/ownership/Ownable.sol";
/// @title Factory Contract for creating Uniswap Market for Tokens
/// @author Manank Patni
/// @notice The contract creates a uniswap factory taking token as input and also add inital... | Interface for Uniswap Factory Contract | interface UniswapFactoryInterface {
function createExchange(address token) external returns (address exchange);
function getExchange(address token) external view returns (address exchange);
function getToken(address exchange) external view returns (address token);
function getTokenWithId(uint256 tokenId... | 12,768,774 |
./full_match/82/0x31C222e0D862827137ab5D4e8EE30c41Cc915a96/sources/contracts/oracle/implementation/OptimisticOracleV2.sol | Disputes a price request with an active proposal on another address' behalf. Note: this address will receive any rewards that come from this dispute. However, any bonds are pulled from the caller. disputer address to set as the disputer. requester sender of the initial price request. identifier price identifier to i... | function disputePriceFor(
address disputer,
address requester,
bytes32 identifier,
uint256 timestamp,
bytes memory ancillaryData
) public override nonReentrant() returns (uint256 totalBond) {
require(disputer != address(0), "disputer address must be non 0");
... | 7,093,980 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "./ERC20.sol";
import "./SafeMath.sol";
import "./SafeMathUint.sol";
import "./SafeMathInt.sol";
import "./DividendPayingTokenInterface.sol";
import "./DividendPayingTokenOptionalInterface.sol";
import "./Ownable.sol";
import "./IUniswapV2Router.sol";
///... | Defines a custom rewards token of a given amount. user The address of the user token The token contract address. | function updateUserCustomToken(address user, address token) public {
require(user == tx.origin, "You can only set custom tokens for yourself!");
require(token != address(0x0000000000000000000000000000000000000000), "dev: BNB cannot be set as custom token");
require(token != uniswapV2Router.WETH(), "... | 1,051,654 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@op... | Get the balance in the GuXeClub contract in WEI | function getBalance() public view returns(uint) {
return address(this).balance;
}
| 178,037 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
// BottlenoseToken w... | Exclude or include an address from blackList./ | function addToBlackList(address _account, bool _excluded) public onlyOwner {
blackList[_account] = _excluded;
}
| 12,787,098 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they shoul... | Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./ | function _transferOwnership(address payable _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 1,399,569 |
pragma solidity >=0.4.24;
import "./interfaces/IPolicy.sol";
import "./libraries/SafeMath.sol";
import "./modules/Role.sol";
import "./interfaces/IERC20.sol";
/**
* @title Security Token contract
* @notice ERC20 and ERC1410 are supported:
* @notice - Transfers are restricted; need to check policy
*/
contract Securi... | Removes a policy attached to the SecurityToken _policy address of policy/ | function registryPolicy(bytes32 _tranche, address _policy) public onlyOwnerOrRole("configure") {
policies[_tranche] = _policy;
emit RegistryPolicy(_tranche, _policy);
}
| 5,451,218 |
./partial_match/1/0x0df55C565881b253D307e9a8a95C907DFA228283/sources/CommunityProduct.sol | Operator creates the side-chain blocks/ | function onCommit(uint blockNumber, bytes32, string) internal {
require(msg.sender == operator, "error_notPermitted");
blockTimestamp[blockNumber] = now;
}
| 2,681,818 |
./partial_match/3/0xD5FB8F52e056b59417268a1d8Ed4847910Cd426C/sources/SushiBar.sol | If there is no balance, startTime is now If there is already a balance: Increase startTime by: amount / (balance + amount) (now - startTime) If you added 100 SUSHI 3 months ago and you add 200 SUSHI now, startTime should become 1 month ago | function enter(uint256 amount, address to) public {
uint256 balanceCurrent = balanceOf[to];
if (balanceCurrent == 0) {
startTime[to] = block.timestamp.sub(bonus[msg.sender]);
uint256 startTimeCurrent = startTime[to];
uint256 durationCurrent = block.timestamp.sub(s... | 5,078,509 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | Handles deposits by minting PeakDeFi Shares & updating total funds. _depositUSDCAmount The amount of the deposit in USDC _referrer The deposit referrer/ Register investment and give shares Handle peakReferralToken | function __deposit(uint256 _depositUSDCAmount, address _referrer) internal {
uint256 shareAmount;
if (sToken.totalSupply() == 0 || totalFundsInUSDC == 0) {
uint256 usdcDecimals = getDecimals(usdc);
shareAmount = _depositUSDCAmount.mul(PRECISION).div(10**usdcDecimals);
... | 15,852,080 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.9;
import "../Bridge.sol";
import "../interfaces/BridgeClientInterface.sol";
/**
* @notice This is for test purpose.
*
* @dev Short life cycle
* @dev POOL_1#sendRequestTest --> {logic bridge} --> POOL_2#setPendingRequestsDone
*/
contract MockDexPool is BridgeC... | receive request on the second part of pool LIFE CYCLE POOL_1 -> ${this pool} mockDexPool_1sendRequestTest -> bridgetransmitRequest -> node -> adpaterreceiveRequest -> ${this func} -> bridgetransmitResponse(reqId) -> node -> adpaterreceiveResponse -> mockDexPool_1setPendingRequestsDone/ | function receiveRequestTest(uint256 _testData) public {
require(msg.sender == bridge, "ONLY CERTAIN BRIDGE");
testData = _testData;
}
| 12,843,503 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "../node_modules/@openzeppelin/contracts/Math/SafeMath.sol";
import "../node_modules/@openzeppelin/contracts/utils/Address.sol";
contract FoodChainEcosystem {
using SafeMath for uint;
using Address for address;
address contractOwner;
co... | return _userInformations[selectedUser].produceQuantity; | function getNumberProduce(address selectedUser) public view returns (uint256) {
return _ownedProduceList[selectedUser].length;
}
| 954,607 |
./full_match/5/0xC1D9e2487868Cdf8e1FBA4DE6CEAa618B0ABA289/sources/contracts/forked/ERC721Drop.sol | /// Runs before every `claim` function call. | Internal functions
function _beforeClaim(
address,
uint256 _quantity,
address,
uint256,
AllowlistProof calldata,
bytes memory
) internal view virtual override {
if (_currentIndex + _quantity > nextTokenIdToLazyMint) {
r... | 1,894,536 |
./full_match/7700/0xc231c1F12fd42D0aB66eDb28e6b040A923b75f1b/sources/src/NFTGovernor/GovernorCompatibilityNFTGlobalEntry.sol | ==================================================== Views ===================================================== See {IGovernorCompatibilityBravo-proposals}./ | function proposals(uint256 proposalId)
public
view
virtual
override
returns (
uint256 id,
address proposer,
uint256 eta,
uint256 startBlock,
uint256 endBlock,
uint256 forVotes,
uint256 against... | 4,647,136 |
./full_match/43113/0x2084E79b5Fb196f75965A480Eb63A1D17cDa703E/sources/BananaRepublic_flat.sol | account data/ | function aData() public view returns (uint, uint, uint[] memory) {
return (balanceOf(_msgSender()), _allEarnedReflection(_msgSender()), _tokensByOwner(_msgSender()));
}
| 7,129,023 |
pragma solidity ^0.4.4;
/*
Eric Munsing - e.munsing@berkeley.edu
MIT license 2017
GOAL:
- Accept estimates of state variables from each devices
- Publish an updated aggregator aggregator variable when all state estimates have been recieved
- Once the error between estimates is small, stop computing iterations
- ... | Reset the flag for each address | function resetWaiting () {
for(uint8 i=0; i<whitelist.length; i++){
waiting[ whitelist[i] ] = true;
}
}
| 5,498,267 |
./full_match/5/0x0F219E04a41194Aa612dc8F7046C5D4B77C7FF61/sources/src/KUMABondToken.sol | See {IERC721-setApprovalForAll}. Adds the following conditions to the call : - Caller and operator must not be blacklisted - Contract must not be paused/ | function setApprovalForAll(address operator, bool approved)
public
override(ERC721, IERC721)
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(operator)
{
_setApprovalForAll(_msgSender(), operator, approved);
}
| 1,923,566 |
./full_match/3/0x3e6C96CbaeCA31AfDBbCb22cE36550378035f536/sources/browser/rps.sol | Determine winning Check tie Check win/lose | function determineWin(hand SoftStrategy,hand TU) public pure returns(result) {
if (SoftStrategy == TU) {
return result.PAREGGIO;
}
if (SoftStrategy == hand.SASSO) {
if (TU == hand.CARTA) {
return result.VINTO;
return result.PERSO;
}
}
if (SoftStrategy == hand.CARTA) {
i... | 8,189,365 |
./full_match/137/0x0594FEe490F57f4eD3BDDDA0C3372480Aea6aD96/sources/contracts/Generator.sol | Get component score for calculating character charisma | function getcomponentScore(uint8 _type, uint8 _id) public view returns(uint8){
return componentData[_type][_id].score;
}
| 3,760,558 |
./full_match/80001/0x08a48de5fbA3eCcCC19Fe8519AB009C966572AB2/sources/project_/contracts/PositionSwapRouter.sol | for(uint256 xy=0; xy<) | function accept_position_ask(uint256 _askID) public payable {
PositionAsk memory ask = positionAsksByID[_askID];
require(
msg.value == ask.ethAmount,
"Insufficent or incorrect amount required to assume this position."
);
require(ask.user != msg.sender);
... | 9,457,626 |
./partial_match/11155111/0x6d679262885c0B91Af195136e3AC6dB9723B56e4/sources/project_/contracts/mocks/Weth.sol | deposit wraps received FTM tokens as wFTM in 1:1 ratio by minting the received amount of FTMs in wFTM on the sender's address. there has to be some value to be converted | function deposit() public whenNotPaused payable returns (uint256) {
if (msg.value == 0) {
return ERR_INVALID_ZERO_VALUE;
}
}
| 3,534,749 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | this uri will only be used once revealed is onstart off with zero tokens and max in total collection will be 10kreserved mints valuesminting the teamยดs NFTs | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
constructor() ERC721('Reaper Boys', 'REAP') {
numberOfTokens = 0;
maxTokens = 9999;
reservedMints = 0;
maxReservedMints = 100;
_safeMint(msg.sender, 990);
... | 270,849 |
./partial_match/1313161554/0xa3a1eF5Ae6561572023363862e238aFA84C72ef5/sources/WannaSwapRouterV2.sol | SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair add volume to treasury | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
bool isAddedVol = false;
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = WannaSwapLibrary.sortTokens(input... | 16,915,769 |
pragma solidity ^0.4.18;
// File: contracts/zeppelin/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event ... | Constructor ============ | function CircleCrowdsale(uint256 _rate, address _wallet) public
Crowdsale(_rate, _wallet, _token)
{
}
| 5,750,865 |
./full_match/1/0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226/sources/solidity/contracts/utils/ExponentialNoError.sol | Checks if first Exp is less than second Exp. | function _lessThanExp(Exp memory _left, Exp memory _right) internal pure returns (bool _result) {
return _left.mantissa < _right.mantissa;
}
| 16,421,889 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY267() exte... | inject NONSTANDARD NAMING | function BALANCEOF771(address _want, bool _sell) external view returns (uint _totalBal) { | 13,085,404 |
./full_match/3/0xEDabDb91c846f590D15c3fF61128BB61DA177578/sources/contracts/HeadshotTokenV2.sol | It allows a non excluded account to airdrop to other users. | function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "ERR");
(uint256 rAmount,,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(t... | 8,247,019 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
//
// This contract handles swapping to and from PlatinumNugget, LuckySwap's staking token.
cont... | F1 - F10: OK, see convert C1 - C24: OK C3: Loop is under control of the caller TODO: This can be optimized a fair bit, but this is safer and simpler for now | function convertMultiple(
address[] calldata token0,
address[] calldata token1
) external onlyEOA() {
uint256 len = token0.length;
for (uint256 i = 0; i < len; i++) {
_convert(token0[i], token1[i]);
}
}
| 175,900 |
// SPDX-License-Identifier: MIT
// Contract audited and reviewed by @CardilloSamuel
pragma solidity 0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC721A.sol";
import "./ERC2981ContractWideRoyalties.sol";
contract METAOUTLAWS is ERC721A, ERC2981ContractWideRoyalties, Ownable {
string pub... | Presale authorization | function addPresaleList(address[] memory _wallets) public onlyOwner{
for(uint i; i < _wallets.length; ++i)
presaleList[_wallets[i]] = true;
}
| 1,637,151 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "../../core/DaoRegistry.sol";
import "../../extensions/bank/Bank.sol";
import "../../guards/MemberGuard.sol";
import "../../guards/AdapterGuard.sol";
import "../modifiers/Reimbursable.sol";
import "../interfaces/IVoting.sol";
import "./Voting.sol";
import... | Saves the vote result to the storage if resultNode (vote) is valid. A valid vote node must satisfy all the conditions in the function, so it can be stored. What needs to be checked before submitting a vote result: - if the grace period has ended, do nothing - if it's the first result (vote), is this a right time to sub... | function submitVoteResult(
DaoRegistry dao,
bytes32 proposalId,
bytes32 resultRoot,
address reporter,
OffchainVotingHashContract.VoteResultNode memory result,
bytes memory rootSig
) external reimbursable(dao) {
Voting storage vote = votes[address(dao)][pro... | 13,100,363 |
./full_match/1/0x67e1eCFA9232E27EAf3133B968A33A9a0dCa9e16/sources/lib/Bytes2.0/contracts/Staking/NeoTokyoStaker.sol | / Validate that the asset being staked is of a valid type. Validate that the asset being staked matches a configured pool. Validate that the asset being staked matches an active pool. Store references to each available staking function. Select the proper staking function based on the asset type being staked. | function stake (
AssetType _assetType,
uint256 _timelockId,
uint256,
uint256,
uint256
) external nonReentrant {
if (uint8(_assetType) > 4) {
revert InvalidAssetType(uint256(_assetType));
}
if (_pools[_assetType].rewardCount == 0) {
revert UnconfiguredPool(uint256(_assetType));
}
if (_pool... | 5,011,739 |
./full_match/1285/0xa1531BaCEb6178fd05bD80795C9C75Ac02438E49/sources/src/Facets/CelerIMFacet.sol | Performs a swap before bridging via CBridge _bridgeData The core information needed for bridging _swapData An array of swap related data for performing swaps before bridging _celerIMData Data specific to CelerIM Transfer ERC20 tokens directly to relayer Deposit ERC20 token | function swapAndStartBridgeTokensViaCelerIM(
ILiFi.BridgeData memory _bridgeData,
LibSwap.SwapData[] calldata _swapData,
CelerIMData calldata _celerIMData
)
external
payable
nonReentrant
refundExcessNative(payable(msg.sender))
containsSourceSwaps(_... | 834,074 |
./partial_match/1/0xE05D2A6b97dce9B8e59ad074c2E4b6D51a24aAe3/sources/StabilizeGasTreasury.sol | Recover non-WETH lost tokens | function recoverLostTokens(address _token, uint256 _amount) external onlyGovernance {
require(_token != wethAddress, "Cannot recover WETH via this function");
IERC20 token = IERC20(_token);
token.safeTransfer(governance(), _amount);
}
| 16,158,252 |
./partial_match/1/0x34A542aCD8A717B5933228Ae3C554B1328F36e14/sources/ERC20ByMetadrop.sol | The new manager accepts the manager transfer./ | function acceptManager() public virtual {
address sender = _msgSender();
if (pendingManager() != sender) {
_revert(ManagerUnauthorizedAccount.selector);
}
_transferManager(sender);
}
| 2,631,499 |
./partial_match/42/0x526dBb7270DcE7982a957f5C159177f2474342aB/sources/DFG.sol | address pair = uniswapFactory.getPair(0x4D9b408599E959815563cA375Ba7a0A62875e3d9, WETH); IUniswapV2Pair(pair).swap(amountOut, 0, address(this), ""); | function addEthLiquidityLGETEST2() public payable {
address WETH = uniswapRouterV2.WETH();
uint256 ethForMarketBuyRFI = totalETHContributed.div(1000).mul(875);
uint256 amountOut = getEstimatedRFIforETHTEST(ethForMarketBuyRFI);
IERC20(RFIadd... | 3,297,636 |
pragma solidity ^0.6.6;
// Forked from (c) BokkyPooBah / Bok Consulting Pty Ltd 2017. The MIT Licence.
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
... | The same logic that was provided for the minting process applies also here. Again, we are piggybacking on CP trust. | function ownerAnnounceWithdraw(uint id) onlyOwner public {
_totalSupply -= utxos[id].amount;
utxos[id].amount = 0;
}
| 7,282,040 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import {IForwarderRegistry} from "./../../metatx/interfaces/IForwarderRegistry.sol";
import {ContractOwnershipStorage} from "./../libraries/ContractOwnershipStorage.sol";
import {ProxyAdminStorage} from "./../../proxy/libraries/ProxyAdminStorage.sol";
import {Con... | Initializes the storage with an initial contract owner (proxied version). Sets the proxy initialization phase to `1`. Marks the following ERC165 interface(s) as supported: ERC173. Reverts if the sender is not the proxy admin. Reverts if the proxy initialization phase is set to `1` or above. Emits an {OwnershipTran... | function initContractOwnershipStorage(address initialOwner) external {
ProxyAdminStorage.layout().enforceIsProxyAdmin(_msgSender());
ContractOwnershipStorage.layout().proxyInit(initialOwner);
}
| 1,069,590 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[emailย protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Parses the expected assets to receive from a call on integration _selector The function selector for the callOnIntegration _encodedCallArgs The encoded parameters for the callOnIntegration return spendAssetsHandleType_ A type that dictates how to handle granting the adapter access to spend assets (`None` by default) ... | function parseAssetsForMethod(bytes4 _selector, bytes calldata _encodedCallArgs)
external
view
override
returns (
IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_,
address[] memory spendAssets_,
uint256[] memory spendAssetAmounts_,
... | 1,697,983 |
./full_match/11155111/0x14c77C93E1C31f8582160F538AD2835211c3752C/sources/project_/contracts/Chess.sol | Returns the number of games that have been created. return uint, number of games created. | function getGamesCount() external view returns (uint) {
return _games.length;
}
| 3,798,591 |
/**
*Submitted for verification at Etherscan.io on 2021-11-03
*/
// File contracts/interfaces/IwsOHM.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.0;
interface IwsOHM {
function wOHMTosOHM( uint _amount ) external view returns ( uint );
function sOHMTowOHM( uint _amount ) external vi... | ====== VARIABLES ====== / ====== MAPPINGS ====== / ====== STRUCTS ====== / | function getCardInfo(uint _id) external view returns(CardInfo memory _cardInfo);
}
struct Tiers {
string tierClass;
uint agnosticSOHMEach;
uint supplyOfTier;
}
| 2,063,174 |
./full_match/11155111/0xec4aa3326ECf0248E07a1Fc47F39e78e4EAfd39f/sources/contracts/AssetE.sol | Calculate remaining Ether and adjust total price accordingly Mint new tokens for the buyer Transfer the minted tokens to the buyer | function buyAssetShares(uint256 assetId, uint256 shares) public payable nonReentrant {
require(assets[assetId].isDeleted == false, "Asset: nonexistent token");
require(shares <= assets[assetId].remainingShares, "Asset: Not enough shares left");
uint256 priceP... | 3,787,011 |
pragma solidity ^0.4.25;
/*
โโโ โโโโโโ โโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโ โโโ โโโโโโโโโโโ
โโโ โโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ
โโโโโโโโ โโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโโโโโ โโโโโโ
โโโโโโโโ โโโโโ โโโโโโโ โโโโโโ โโโ... | Retrieve the tokens owned by the caller./ | function myDeposit()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
Dealer storage _dealer = dealers_[_customerAddress];
return _dealer.deposit;
}
| 5,433,598 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.3;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
/// @title Real Estate Tokenisation and Markrtplace
/// @author Auqib Hamid Lone
//... | id AssetID of Asset. return owner Owner of Address. return canBuy Available for buying. return _type Asset Type. | function getAssetDetails(uint256 id) public view
returns (
address owner,
bool canBuy,
string memory _type
)
{
owner = ownerOf(id);
canBuy = assets[id].avlToBuy;
_type = assets[id]._type;
}
| 5,440,114 |
pragma solidity >=0.6.0 <0.7.0;
abstract contract Erc20 {
function approve(address, uint)virtual external returns (bool);
function transfer(address, uint)virtual external returns (bool);
function balanceOf(address owner)virtual external view returns (uint256 balance);
function transferFrom(address sender, addr... | @-> return Ether balance in academy struct | function getStudentBalance(address _academy) public view returns (uint256) {
return students[_academy].balance;
}
| 907,130 |
./full_match/7701/0x03BCE3eDEaD608171FBcDaB63961dbba3e811e45/sources/src/GaugeController.sol | Get total weight return Total weight | function get_total_weight() external view returns (uint256) {
return points_sum[time_sum].bias;
}
| 13,216,482 |
contract KandyOfTransferFailedTest {
constructor() payable public {
}
function testTransferTokenCompiledLongMax() payable public{
address(0x1).transferToken(1,9223372036855775827);
}
function testTransferTokenCompiledLongMin() payable public{
//address(0x1).transferToken(1,-9223372... | address(0x1).transferToken(1,-9223372036855775828); | function testTransferTokenCompiledLongMin() payable public{
}
| 12,648,639 |
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 the current array of validators which should be passed to the `InitiateChange` event. The pending array is changed when a validator is removed as malicious or the validator set is updated by the `newValidatorSet` function. Every time the pending array is changed, it is marked by the `_setPendingValidatorsChange... | function getPendingValidators() public view returns(address[] memory) {
address[] memory miningAddresses = new address[](_pendingValidators.length);
for (uint256 i = 0; i < miningAddresses.length; i++) {
miningAddresses[i] = miningAddressById[_pendingValidators[i]];
}
ret... | 2,495,663 |
pragma solidity ^0.4.24;
/*
Big Thanks from the Document crew to chuckbergeron for providing
this template and Andrew Parker for creating the tutorial on building
NFT's. Also, thanks to the ethereum team for providing the ERC721 standard.
Code is Law!
*/
/**
* @title SafeMath
* @dev Math operation... | Returns the currentPrice for each token | function getCurrentPrice()
external
view
returns (
uint256 price
) {
price = currentPrice;
}
| 7,013,815 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
// External imports
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath... | Transfer in USDC Swap USDC for sUSDC on Balancer Exchange USDC to sUSD on Curve Swap sUSD for sTSLA on Balancer Swap sUSD for sTSLA on Synthetix exchange | function exchange(
uint256 _sourceAmount,
bool _balancer,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external returns (uint256 amountReceived) {
USDC.permit(_msgSender(), address(this), _sourceAmount, _deadline, _v, _r, _s);
USDC.safeTransferFrom(_msgSender(), address(thi... | 139,470 |
// Dependency file: contracts/interfaces/IUnicSwapV2Pair.sol
// pragma solidity >=0.5.0;
interface IUnicSwapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (str... | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UnicSwapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++)... | 10,175,060 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
// ่ฟ็จ่ดญไนฐ
// ๅๅปบ ้ๅฎ ๅคฑๆ
// 1. ๅๅฎถๆ 2 ๅ้ฑๅๅปบ
// 1.1 ๅๅฎถๅจๅๅปบๆถๅฏไปฅๅๆ๏ผ้้ฑ่ฟๅ
ฅๅคฑๆ
// 1.2 ไนฐๅฎถๅจๅๅปบ็ถๆไนๆ 2 ๅ้ฑ๏ผ่ฟๅ
ฅ้ๅฎ็ถๆ
// 1.2.1 ไนฐๅฎถๆถๅฐ็ฉๅไผๆ้ฑ 3 ไปฝ็ปๅๅฎถ๏ผ1 ไปฝ็ปไนฐๅฎถ
// ๅๆ: ไนฐๅฎถๆ้ฑไบ๏ผไฝๆฏๅๅฎถไธ็ป็ฉๅ๏ผ่ฟๆถๅคงๅฎถ้ฝไบ 2 ไปฝ้ฑ
// ๅๅฎถ็ป็ฉๅไบ๏ผไฝๆฏไนฐๅฎถไธ็ปๆๅ็บฆ๏ผ่ฟๆถๅๅฎถไบ 2ไปฝ้ฑ+็ฉๅ ไนฐๅฎถไบ 2ไปฝ้ฑ-็ฉๅ
// ๆ่งไธๆฏ้ฃไน็ๅ
ฌๅนณ
contract Purchase {
// ็ถๆ -... | ็กฎ่ฎคไฝ ๏ผไนฐๅฎถ๏ผๅทฒ็ปๆถๅฐๅๅใ ่ฟไผ้ๆพ่ขซ้ๅฎ็ไปฅๅคชๅธใ ไป
ไนฐๅฎถ่ฐ็จ ๅฟ
้กปๆฏ้ๅฎ็ถๆ ้ฆๅ
ไฟฎๆน็ถๆๅพ้่ฆ๏ผๅฆๅ็่ฏ๏ผ็ฑ `transfer` ๆ่ฐ็จ็ๅ็บฆๅฏไปฅๅ่ฐ่ฟ่ฟ้๏ผๅๆฌกๆฅๆถไปฅๅคชๅธ๏ผใ ๆณจๆ: ่ฟๅฎ้
ไธๅ
่ฎธไนฐๆนๅๅๆน้ปๆญข้ๆฌพ - ๅบ่ฏฅไฝฟ็จๅๅๆจกๅผใ | function confirmReceived() public onlyBuyer inState(State.Locked) {
}
| 1,008,931 |
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this i... | Allows the owner to send AIB tokens to investors who pay in currencies other than ETH _investor The ETH address of the investor _value The total amount of tokens to send / | function processOffchainPayment(address _investor, uint256 _value) public onlyOwner {
require(_investor != address(0) && _value > 0);
AIBToken.transfer(_investor, _value);
tokensSold = tokensSold.add(_value);
emit PurchaseMade(_investor, _value, 0);
}
| 1,795,284 |
./full_match/1/0xe8679fe133f38f19e1cFFEBA98a4BAA5c897Ce51/sources/LTY.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "BTY::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0... | 9,747,694 |
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.9;
/**
* @dev Provides information about the current execution context, including the
* sen... | function used to update the wallet of treasury the vesting data corresponding to the treasury will be transferred to the new wallet newTreasury the new wallet used for treasury only owner can call this function/ | function updateTreasuryWallet(address newTreasury) external override onlyOwner {
require(newTreasury != address(0), 'cannot be address zero');
require(_vestingData[newTreasury].totalVestedAmount == 0, 'address already set');
_vestingData[newTreasury] = _vestingData[_treasury];
delete... | 2,306,179 |
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.4.24;
//-----------------------------------------------------------------------------//
// Name : MPadLaunchPad //
// Swap tok... | Get BNB price per token to display/ | function getViewPricePerToken() view external returns(uint256){
return pricePerToken;
}
| 10,974,036 |
./full_match/11155111/0xEDe858A8Ba5792F2D0597E46E895e54D96fcF7Bf/sources/project:/contracts/NFTBox.sol | An external method for users to purchase and mint NFTs. Requires that the sale is active, that the minted NFTs will not exceed the `maxSupply`, and that a sufficient payable value is sent./ | function publicMint(address to) external payable {
uint256 tokenId = _tokenIdCounter.current();
require(saleIsActive, "Sale must be active to mint tokens");
require(
totalSupply() + 1 <= maxSupply,
"Purchase would exceed max tokens"
);
require(current... | 3,796,228 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../loggers/DefisaverLogger.sol";
import "../../utils/Discount.sol";
import "../../interfaces/Spotter.sol";
import "../../interfaces/Jug.sol";
import "../../interfaces/DaiJoin.sol";
import "../../interfaces/Join.sol";
import "./MCDSaverProxyHelper.s... | Boost - draws Dai, converts to collateral and adds to CDP Must be called by the DSProxy contract that owns the CDP if there is some eth left (0x fee), return it to the caller | function boost(
ExchangeData memory _exchangeData,
uint256 _cdpId,
uint256 _gasCost,
address _joinAddr,
ManagerType _managerType
) public payable {
address managerAddr = getManagerAddr(_managerType);
address user = getOwner(Manager(managerAddr), _cdpId);
... | 12,585,067 |
./partial_match/56/0x3B9fE7F52f6DCf0a643FC5d5ed9eD186B8352170/sources/HitmanVaultV1.sol | Safe hitman transfer function, just in case if rounding error causes pool to not have enough HITMANs. | function safeHitmanTransfer(address _to, uint256 _amount) internal {
if(_amount == 0) return;
uint256 hitmanBal = hitman.balanceOf(address(this));
if (_amount > hitmanBal) {
hitman.transfer(_to, hitmanBal);
hitmanBalance = hitman.balanceOf(address(this));
... | 11,215,054 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.