file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0xDB77d0d3d9bf850E38282eD8B5Fb410D02E75d2D/sources/contracts/external/openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol | Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation./ | function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
| 3,025,079 |
pragma solidity >=0.5.0 <0.7.0;
contract CrowdfundingContract {
string public state = "START";
struct Sender {
address payable addr;
uint date;
uint val;
}
event Message(string msg);
event Message2(uint msg);
Sender[] public senders;
mapping(address => Sender) public senderMap;
address payable public com... | Entry Activity of new StateEntry Activity of new StateEntry Activity of new StateEntry Activity of new StateEntry Activity of new StateEntry Activity of new StateEntry Activity of new State | function handle(string memory input) public payable {
if (isEqual(state, "START") && isEqual(input, "init")) {
state = "CREATED";
company = 0x0ad875cadf6CD921c5DB2cDD3dddC24A8b61B2d3;
endDate = 1610406000000;
title = "IrgendeinProjekt";
goal = 10 ether;
}
else if (isEqual(state, "CREATED") && isEq... | 908,326 |
./partial_match/2222/0xf082344DA54A8aB24f13495a5598a0CB763bF7b2/sources/contracts/concentrator/contracts/MultiStrategy.sol | Sets a new strategy for the contract This function can only be called by the owner of the contract _currentStrategy A list of Strategy structs representing the new strategy/ | function setStrategy(Strategy[] calldata _currentStrategy) external onlyOwner {
uint256 strategyNum = _currentStrategy.length;
ErrLib.requirement(strategyNum < MAX_STRATEGIES_NUM, ErrLib.ErrorCode.EXCESS_OF_STRATEGIES);
delete currentStrategy;
uint256 weightSum;
uint24 checkS... | 16,904,813 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract CryptoFightersPotio... | Allows owner to set Crypto Fighters Alliance address/ | function setCryptoFightersAllianceContract(address _cryptoFightersAlliance) external onlyOwner {
cryptoFightersAlliance = _cryptoFightersAlliance;
}
| 1,678,091 |
./partial_match/1/0xE50D1b7dc3Ac3702caBaDB48E59F4b0aaF99DA14/sources/Utcoin.sol | withdraw accumulated balance, called by payee | function withdrawPayments() {
address payee = msg.sender;
uint payment = payments[payee];
if (payment == 0) {
throw;
}
if (this.balance < payment) {
throw;
}
payments[payee] = 0;
if (!payee.send(payment)) {
throw;
}
LogRefundETH(payee,payment);
}
| 15,967,073 |
./full_match/11155111/0x86A85e145ed21247633AdBC545DC30f4eD0E9916/sources/contracts/MetaDisplay.sol | Increment no_of_appreciators | function appreciateAssetById(address payable _receiver, string memory _assetId) public payable {
bytes32 assetId = keccak256(abi.encodePacked(_assetId));
Assets storage asset = assets_display[assetId];
uint256 index = assetAppreciatorIndex[assetId][msg.sender];
if (index == 0) {
... | 3,802,369 |
./full_match/1/0x76E7BE90D0BF6bfaa2CA07381169654c6b45793F/sources/recharge.io/ropsten/token/RCG.sol | Destroy the token by transferring it to the 0x address. | function _destroy(address account, uint256 amount) internal {
require(amount != 0, "Amount Cannot be 0");
_balances[account] = _balances[account]-amount;
_totalSupply = _totalSupply-amount;
emit Transfer(account, address(0), amount);
}
| 9,688,086 |
//Address: 0xf2e5623ecbf7ca0aa59951c3c114153f96731632
//Contract name: StockBetToken
//Balance: 0 Ether
//Verification Date: 10/23/2017
//Transacion Count: 0
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control... | Function to check if an address is authorized _addr the address to check if it is authorized. return boolean flag if address is authorized./ | function isAuthorized(address _addr) public constant returns(bool) {
return authorizerIndex[_addr] > 0;
}
| 1,821,501 |
./full_match/43113/0xe2Cd6d9947720966298Da8537c919c000841Bd72/sources/doggesRouter.sol | SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = DoggesLibrary.sortTokens(input, output);
IDoggesPair p... | 13,150,285 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
contract JoetrollerErrorReporter {
enum Error {
NO_ERROR,
UNAUTHORIZED,
JOETROLLER_MISMATCH,
INSUFFICIENT_SHORTFALL,
INSUFFICIENT_LIQUIDITY,
INVALID_CLOSE_FACTOR,
INVALID_COLLATERAL_FACTOR,
... | The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this jToken to be liquidated repayAmount The amount of the underlying borrowed asset to repay jTokenCollateral The market in which to seize collateral from the borrower isNative The amou... | function liquidateBorrowInternal(
address borrower,
uint256 repayAmount,
JTokenInterface jTokenCollateral,
bool isNative
) internal nonReentrant returns (uint256, uint256) {
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
retu... | 1,810,061 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/utils/Address... | renbtc/tbtc pool sBTC pool bUSD pool | interface ICurveFi {
function get_virtual_price() external view returns (uint256 out);
function add_liquidity(
uint256[2] calldata amounts,
uint256 min_mint_amount
) external;
function add_liquidity(
uint256[3] calldata amounts,
uint256 min_mint_amount
) external;
... | 10,328,087 |
pragma solidity ^0.4.11;
/*
--------------------------------------------------------------------------------
ERC20: https://github.com/ethereum/EIPs/issues/20
ERC223: https://github.com/ethereum/EIPs/issues/223
MIT Licence
--------------------------------------------------------------------------------
*/
/*
* Cont... | Transfer the balance from the sender's address to the address _to / | function transfer(address _to, uint _value) returns (bool success) {
if (balances[msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, ... | 6,152,045 |
./partial_match/1/0x378cb791eBE3a93075B1dFC843C1552bE3a7A884/sources/Distributor.sol | Function to set the base URI for all token IDs. It is automatically added as a prefix to the value returned in {tokenURI}, or to the token ID if {tokenURI} is empty./ | function setBaseURI(string memory baseURI_) public onlyOwner {
_setBaseURI(baseURI_);
}
| 3,537,504 |
pragma solidity >= 0.5.0 <0.7.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// ... | Return whether the proof is supported or not by this asset. Note that we have to subtract 1 from the proof id because the original representation is uint8, but here that id is considered to be an exponent | function supportsProof(uint24 _proof) public view returns (bool) {
(uint8 epoch, uint8 category, uint8 id) = _proof.getProofComponents();
require(category == uint8(ProofCategory.BALANCED), "this asset only supports balanced proofs");
uint8 bit = uint8(proofs[epoch] >> (id.sub(1)) & 1);
... | 6,481,842 |
./partial_match/42/0x4ffADC639B57e864150ff98a55D249fed53fa63B/sources/ZuniBadge.sol | Exit a pool - redeem pool tokens for underlying assets Emits a LogExit event for each token bPool is a contract interface; function calls on it are external poolAmountIn - amount of pool tokens to redeem minAmountsOut - minimum amount of asset tokens to receive/ Delegate to library to save space Library compute... | function exitPool(uint256 poolAmountIn, uint256[] calldata minAmountsOut)
external
logs
lock
needsBPool
lockUnderlyingPool
{
(
uint256 exitFee,
uint256 pAiAfterExitFee,
uint256[] memory actualAmountsOut
) = SmartPoolMan... | 3,449,024 |
/**
*Submitted for verification at Etherscan.io on 2019-12-27
*/
/**
Copyright 2019 PoolTogether LLC
This file is part of PoolTogether.
PoolTogether is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation under version... | Returns the token underlying the cToken. return An ERC20 token address/ | function token() public view returns (IERC20) {
return IERC20(cToken.underlying());
}
| 14,091,954 |
pragma solidity ^0.8.0;
import "../lib/Ownable.sol";
import "./DepositLockerInterface.sol";
import "../equivocation-inspector/EquivocationInspector.sol";
contract ValidatorSlasher is Ownable {
bool public initialized = false;
DepositLockerInterface public depositContract;
fallback() external {}
func... | Report a malicious validator for having equivocated. The reporter must provide the both blocks with their related signature. By the given blocks, the equivocation will be verified. In case a equivocation could been proven, the issuer of the blocks get removed from the set of validators, if his address is registered. Al... | function reportMaliciousValidator(
bytes calldata _rlpUnsignedHeaderOne,
bytes calldata _signatureOne,
bytes calldata _rlpUnsignedHeaderTwo,
bytes calldata _signatureTwo
) external {
EquivocationInspector.verifyEquivocationProof(
_rlpUnsignedHeaderOne,
... | 6,441,360 |
pragma solidity ^0.4.21;
// import './DOTFactory.sol';
// import './Strings.sol';
// import './StringUtils.sol';
import '@daostack/arc/contracts/VotingMachines/GenesisProtocol.sol';
/**
* @title MarketTrustInterface
* @dev Interface for XOR Market Trust Contract for calculating trust score
*/
contract ExampleMa... | Set the address of the sibling contract that tracks trust score./ | function setMarketAvatarContractAddress(address _address) external {
exampleMarketAvatarContract = ExampleMarketAvatarInterface(_address);
}
| 14,084,141 |
./partial_match/1/0xc3461F79e6260c463ef6C3CcCEfB6CaEAb5140c4/sources/src/utils/ScalingUtils.sol | Scale value by decimals sourceValue Value of the source to scale sourceDecimals Decimals of the source targetDecimals Decimals of the target rounding Rounding mode that is `Up` or `Down` return Value of the target/ | function scaleByDecimals(
uint256 sourceValue,
uint8 sourceDecimals,
uint8 targetDecimals,
MathUpgradeable.Rounding rounding
) internal pure returns (uint256) {
return scaleByBases(sourceValue, 10 ** sourceDecimals, 10 ** targetDecimals, rounding);
}
| 15,595,884 |
pragma solidity 0.4.23;
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
functio... | ------------------------------------------------------------------------ Transfer _amount tokens to address _to Sender must have enough tokens. Cannot send to 0x0. ------------------------------------------------------------------------ | function transfer(address _to, uint _amount)
public
returns (bool success) {
require(_to != address(this));
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
... | 2,157,474 |
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
/// @title Cr... | Destroys `amount` tokens of token type `id` from `account` Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens of token type `id`./ | function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _a... | 15,687 |
// SPDX-License-Identifier: MIT
pragma solidity >0.7.0 <0.9.0;
import "./utils/MaterialReferencer.sol";
abstract contract Shipper is MaterialReferencer {
event TransportCreated(
address indexed sender,
address indexed receiver,
address indexed transportCompany,
uint256 transportId
... | Create a new transport _receiver The address of the transport sender _transportCompany The address of the transport company associated with this transport _batchIds The ids of the batches that will be sent with this transport/ require(_batchIds.length > 0, "Can not create an empty transport"); | function createTransport(
address _receiver,
address _transportCompany,
uint256[] memory _batchIds
) public batchesOwner(_batchIds) {
require(msg.sender != _receiver, "Cannot initiate a transport to yourself");
transports[transportIdCounter].transportId = transportIdCoun... | 15,825,126 |
/**
*Submitted for verification at Etherscan.io on 2020-11-03
*/
pragma experimental ABIEncoderV2;
// File: contracts/modules/common/Utils.sol
// Copyright (C) 2020 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General P... | ILimitStorage LimitStorage interface/ | interface ILimitStorage {
function recoverToken(address _token) external;
function init(address _wallet) external;
function isFeatureAuthorisedInVersionManager(address _wallet, address _feature) external view returns (bool);
function getRequiredSignatures(address _wallet, bytes calldata _data) external ... | 1,256,868 |
./full_match/80001/0x6b807cB56f7a8eBE896B93D0960bE3cA84F98aF0/sources/modules/ERC5058/ERC5058Upgradeable.sol | Locks `tokenId` from `from` until `expired`. Requirements: - `tokenId` token must be owned by `from`. Emits a {Locked} event./ | function _lock(address operator, uint256 tokenId, uint256 expired) internal virtual {
address owner = ERC721Upgradeable.ownerOf(tokenId);
_beforeTokenLock(operator, owner, tokenId, expired);
lockedTokens[tokenId] = expired;
_lockApprovals[tokenId] = operator;
emit Locked(operator, owner, tokenId, expired)... | 845,741 |
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;
}
/**
*... | Begins creating a storage buffer - values and locations pushed will be committed to storage at the end of execution Get pointer to buffer length - Push requestor to the end of buffer, as well as to the 'current action' slot - Push '0' to the end of the 4 bytes just pushed - this will be the length of the STORES action ... | function storing() conditions(validStoreBuff, isStoring) internal pure {
bytes4 action_req = STORES;
assembly {
let ptr := add(0x20, mload(0xc0))
mstore(add(0x20, add(ptr, mload(ptr))), action_req)
mstore(add(0x24, add(ptr, mload(ptr))), 0)
mstore(ptr, add(0x24, mload(ptr)))
msto... | 1,484,859 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/bridge/Bridge.sol | Updates treasury address. The treasury receives the system fees. treasury New value of the treasury address. The treasury address must not be 0x0. slither-disable-next-line shadowing-local | function updateTreasury(address treasury) external onlyGovernance {
self.updateTreasury(treasury);
}
| 4,856,495 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "../common/BaseWithStorage/ImmutableERC721.sol";
import "../common/BaseWithStorage/WithMinter.sol";
import "../common/interfaces/IAssetToken.sol";
import "../common/interfaces/IGameToken.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializ... | Allow token owner to set game editors. gameOwner The address of a GAME token creator. editor The address of the editor to set. isEditor Add or remove the ability to edit. | function setGameEditor(
address gameOwner,
address editor,
bool isEditor
) external override {
require(_msgSender() == gameOwner, "EDITOR_ACCESS_DENIED");
_setGameEditor(gameOwner, editor, isEditor);
}
| 13,092,510 |
./full_match/1/0xB51B89140D168734d656B2C8959A4E3F7205b8b4/sources/contracts/modules/TransactionManager.sol | Enable the static calls required to make the vault compatible with the ERC1155TokenReceiver needs to be called for wallets deployed in version lower or equal to 2.4.0 as the ERC1155 static calls are not available by default for these versions of BaseWallet _vault The target vault./ | function enableERC1155TokenReceiver(address _vault) external onlyVaultOwnerOrSelf(_vault) onlyWhenUnlocked(_vault) {
IVault(_vault).enableStaticCall(address(this), ERC165_INTERFACE);
IVault(_vault).enableStaticCall(address(this), ERC1155_RECEIVED);
IVault(_vault).enableStaticCall(address(thi... | 16,575,478 |
contract BasicUpKeep {
bool public shouldPerformUpkeep;
bytes public bytesToSend;
bytes public receivedBytes;
function setShouldPerformUpkeep(bool _should) public {
shouldPerformUpkeep = _should;
}
function setBytesToSend(bytes memory _bytes) public {
bytesToSend = _bytes;
}
function checkUpk... | decide if an upkeep is needed and return bool accordingly | function checkUpkeep(bytes calldata data) external returns (bool, bytes memory) {
return (shouldPerformUpkeep, bytesToSend);
}
| 9,885,198 |
./full_match/8453/0x2499D94880B30fA505543550ac8a1e24cfFeFe78/sources/contracts/past-versions/UnlockV12.sol | Returns an `BooleanSlot` with member `value` located at `slot`./ @solidity memory-safe-assembly | function getBooleanSlot(
bytes32 slot
) internal pure returns (BooleanSlot storage r) {
assembly {
r.slot := slot
}
}
| 11,554,611 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
... | hash the parameters, save them if necessary, and return the hash value/ | function setParameters(
bytes32 _voteRegisterParams,
bytes32 _voteRemoveParams,
IntVoteInterface _intVote
) public returns(bytes32)
{
bytes32 paramsHash = getParametersHash(_voteRegisterParams, _voteRemoveParams, _intVote);
parameters[paramsHash].voteRegisterParams = ... | 1,417,185 |
./partial_match/1/0x9a0b2FFD7e32D5501034df127C849Ae3dc74F728/sources/contracts/legacy/L1ChugSplashProxy.sol | Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the "from" address to address(0). return Owner address./ | function getOwner() external proxyCallIfNotOwner returns (address) {
return _getOwner();
}
| 15,910,989 |
./partial_match/1/0x87c3C6B9C917B1732f13d36d6938E4f8802f7c7E/sources/DigitalaxPodePortal.sol | / Valid args Mint token and set token URI | function mint(address _beneficiary) external returns (uint256) {
require(balanceOf(_msgSender()) < maxLimit, "DigitalaxPodePortal.mint: Sender already minted");
require(podeNft.balanceOf(_msgSender()) > 0, "DigitalaxPodePortal.mint: Sender must have PODE NFT");
uint256 _randomIndex = _rand(... | 4,217,333 |
pragma solidity ^0.4.15;
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* Based on OpenZeppelin
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c /... | Define pricing schedule using tranches./ Amount in weis when this tranche becomes active How many tokens per wei you will get while this tranche is active | function isPresaleFull(uint weiRaised) public constant returns (bool);
function getAmountOfTokens(uint value, uint weiRaised) public constant returns (uint tokensAmount);
}
struct Tranche {
uint amount;
uint rate;
}
Tranche[4] public tranches;
| 12,961,830 |
./partial_match/1/0xD898456E39A461B102Ce4626Aac191582C38Acb6/sources/contracts/vault/AssetVault.sol | Call a function on an external contract. Intended for claiming airdrops and other forms of NFT utility. All allowed calls are whitelist by the "whitelist" contract. The vault must have withdrawals disabled, and the caller must either be the owner, or the owner must have explicitly delega... | function call(address to, bytes calldata data) external override onlyWithdrawDisabled nonReentrant {
if (msg.sender != owner() && !ICallDelegator(owner()).canCallOn(msg.sender, address(this)))
revert AV_CallDisallowed(msg.sender);
if (!whitelist.isWhitelisted(to, bytes4(data[:4]))) reve... | 15,722,464 |
pragma solidity ^0.4.0;
/// @title EthDuck
/// @author acityinohio
contract EthDuck {
uint8 public size;
address public black;
address public white;
bool public confirmed;
bool public blackTurn;
bool public approvalLock;
bool public draw;
enum State { Empty, Black, White }
struct Move {
uint8 x;
uint8 y;
... | confirms game for white player; requires them to bet at least as much as black player"confirm" bool is used as a check for "refundGame" belowalso sets blackTurn to true, to let black move first | function confirmNewGame() payable {
if (msg.value < this.balance / 2 || msg.sender != white) {
throw;
(confirmed, blackTurn) = (true, true);
}
}
| 12,976,174 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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... | generates an entire SVG by composing multiple <image> elements of PNGs tokenId the ID of the token to generate an SVG for return a valid SVG of the Wizard / Dragon/ | function drawSVG(uint256 tokenId) internal view returns (string memory) {
ISharks.SGToken memory s = sharksNft.getTokenTraits(tokenId);
uint8 shift = uint8(s.tokenType) * 2;
string memory svgString = string(abi.encodePacked(
drawTrait(traitData[0 + shift][s.base]),
drawTrait(traitData[1 + shi... | 6,125,032 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "../../interfaces/mcd/IManager.sol";
import "../../interfaces/mcd/ISpotter.sol";
import "../../interfaces/mcd/IVat.sol";
import "../../interfaces/mcd/IDaiJoin.sol";
import "../../interfaces/mcd/IJug.sol";
import "../../interfaces/mcd/ICropper.sol";
impor... | @inheritdoc ActionBase | function executeActionDirect(bytes memory _callData) public payable override {
Params memory inputData = parseInputs(_callData);
(, bytes memory logData) = _mcdGenerate(inputData.vaultId, inputData.amount, inputData.to, inputData.mcdManager);
logger.logActionDirectEvent("McdGenerate", logDat... | 1,020,517 |
// 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/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract Fraktal1155 is Ownable{
... | Lookup the owner of an NFT and get the percentage of their ownership. returns percentage with 2 decimal places. Divide by 100 to get natural percent/return _balances[tokenIdToShares[_id]][_owner]; | function getPercentByNFT(address _owner, uint _id) external view returns(uint percent){
return balanceOf(_owner, tokenIdToShares[_id]);
}
| 1,006,151 |
/**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
... | Common interface for the Trove Manager. --- Events --- --- Functions --- | interface IBorrowerOperations {
event TroveManagerAddressChanged(address _newTroveManagerAddress);
event ActivePoolAddressChanged(address _activePoolAddress);
event DefaultPoolAddressChanged(address _defaultPoolAddress);
event StabilityPoolAddressChanged(address _stabilityPoolAddress);
event GasPo... | 1,367,018 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
import "./vault/MochiVaultFactory.sol";
import "./assets/usdm.sol";
import "./interfaces/IMochiEngine.sol";
contract MochiEngine is IMochiEngine {
// immutable values
IMochiVaultFactory public immutable override vaultFactory;
// mutable values
... | get the keccak256 hash of the init code for address derivation. | function calculateAddress(
address deployer,
address beacon,
bytes memory initializationCalldata
) internal view returns (address addr) {
bytes memory createCode =
abi.encodePacked(
type(Create2BeaconMaker).creationCode,
abi.encode(addr... | 7,009,350 |
./partial_match/42/0x0627f8B8dFCB3F82e3319e4Fd0F7d28907C578d5/sources/EtherCollateral.sol | Get the loan from storage | function currentInterestOnLoan(address _account, uint256 _loanID) external view returns (uint256) {
PynthLoanStruct memory PynthLoan = _getLoanFromStorage(_account, _loanID);
uint256 loanLifeSpan = _loanLifeSpan(PynthLoan);
return accruedInterestOnLoan(PynthLoan.loanAmount, loanLifeSpan);
... | 3,358,979 |
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
// File: contracts\farming\FarmDataGen1.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
struct FarmingPositionRequest {
uint256 setupIndex; // index of the chosen setup.
uint256 amount; // amount of main token or liquidity pool toke... | method used to update the extension host. host new host address./ | function setHost(address host) public virtual override hostOnly {
_host = host;
}
| 6,541,903 |
// SPDX-License-Identifier: MIT
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` is no longer needed starti... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toS... | 236,088 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^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 should not b... | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), 'ERC721: mint to the zero address');
require(!_exists(tokenId), 'ERC721: token already minted');
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
| 6,243,272 |
pragma solidity 0.6.12;
import "./base/EternalStorage.sol";
import "./base/Controller.sol";
import "./base/IMarket.sol";
import "./base/IERC20.sol";
/**
* @dev Entity facet base class
*/
abstract contract EntityFacetBase is EternalStorage, Controller {
modifier assertIsEntityAdmin (address _addr) {
require(in... | approve mkt to use my tokens make the offer | function _sellAtBestPriceOnMarket(address _sellUnit, uint256 _sellAmount, address _buyUnit) internal returns (uint256) {
IMarket mkt = _getMarket();
IERC20 tok = IERC20(_sellUnit);
tok.approve(address(mkt), _sellAmount);
return mkt.sellAllAmount(_sellUnit, _sellAmount, _buyUnit, _sellAmount);
}
| 964,966 |
./full_match/4/0xF4701742ED9De96B19a186979faF9a51BbF37B6D/sources/browser/SmartFundETHFactory.sol | calculate the net profit/loss for an address in this fund | function calculateAddressProfit(address _address) public view returns (int256) {
uint256 currentAddressValue = calculateAddressValue(_address);
return int256(currentAddressValue) - addressesNetDeposit[_address];
}
| 715,303 |
./full_match/1/0x6f11a89d41b0cC86E05714A701462E788C989b6A/sources/contracts/interfaces/ICreditAccount.sol | / Set general credit account parameters. Restricted to credit managers only / _borrowedAmount Amount which pool lent to credit account / _cumulativeIndexAtOpen Cumulative index at open. Uses for interest calculation function setGenericParameters( ) external; | interface ICreditAccount {
function initialize() external;
function connectTo(
address _creditManager,
uint256 _borrowedAmount,
uint256 _cumulativeIndexAtOpen
) external;
function updateParameters(
uint256 _borrowedAmount,
uint256 _cumulativeIndexAtOpen
) e... | 9,629,259 |
./full_match/1/0x073Eb3b0Ac56454341C5f36216aAc0B801bDC431/sources/home/enamakel/Work/mahadao.com/arthcoin/arthcoin-v2/contracts/Oracle/Variants/gmu/UniversalGMUOracle.sol | If we have chainlink oracle for base set return that price. NOTE: this chainlink is subject to Aggregator being in BASE/USD and USD/GMU(Simple oracle). Else return price from uni pair. | function getRawPrice() public view returns (uint256, uint256) {
if (address(chainlinkFeed) != address(0)) return (getChainlinkPrice(), 10 ** oraclePriceFeedDecimals);
return (getPairPrice(), _PRICE_PRECISION);
}
| 3,847,140 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import 'base64-sol/base64.sol';
import './HexStrings.sol';
import './ToC... | Visibility is `public` to enable it being called by other contracts for composition. mustache svg from https:www.svgrepo.com/svg/85048/mustache-shape with CCO Licence | function renderTokenById(uint256 id) public view returns (string memory) {
string memory render = string(abi.encodePacked(
'<g class="mustache" transform="translate(140,195) scale(1.50 1.50)">',
'<path fill="#',color[id].toColor(),'" d="M21.455,13.025c-0.604-3.065-5.861-4.881-7.083-2.583c-1.22-2.2... | 12,940,255 |
./partial_match/1/0x005685a5a1889FC7BFc3e9c11657703A67fB663B/sources/CoretoStaking.sol | Multiplies two unsigned integers, reverts on overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256){
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b,"Calculation error in multiplication");
return c;
}
| 2,605,711 |
/**
* Source Code first verified at https://etherscan.io on Thursday, March 21, 2019
(UTC) */
pragma solidity >=0.4.22 <0.6.0;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return... | limit the withdrawal | function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public {
require(balances_re_ent31[msg.sender] >= _weiToWithdraw);
balances_re_ent31[msg.sender] -= _weiToWithdraw;
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
bool not_called_re_ent13 = true;
| 6,437,709 |
pragma solidity ^0.7.0;
contract Purchase {
uint256 public minimumDepositValueInWei; // can also be considered as the starting value for bidding
uint public endBiddingTime;
uint public endRevealingTime;
uint public endFinalizationTime;
uint256 public secondHighestRevealedBid;
ui... | called by manager after the winner called the "winner send money to manager" function to send the transaction with the send bid to the contract the manager refund his deposit manager's deposit now is equal to zero as he refunded his money. | {
auctionManager.transfer(auctionManagerDeposit);
auctionManagerDeposit = 0;
uint totalBalance = address(this).balance;
uint sum = 0;
function abort()
public
auctionInState(AuctionState.Created)
calledByAuctionManager()
}
function placeDeposit... | 12,728,052 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma experimental ABIEncoderV2;
import "./IPermissions.sol";
import "../token/IRusd.sol";
/// @title Core Interface
/// @author Ring Protocol
interface ICore is IPermissions {
// ----------- Events -----------
event RusdUpdate(address in... | amount of pool liquidity owned by this contract return amount of liquidity | function liquidityOwned() public view override returns (uint128) {
(, , , , , , , uint128 liquidity, , , , ) = nft.positions(tokenId);
return liquidity;
}
| 5,929,665 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./BaseUpgradeablePausable.sol";
import "./ConfigHelper.sol";
/**
* @title Goldfinch's Pool contract
* @notice Main entry point for LP's (a.k.a. capital providers)
* Handles key logic for depositing and wi... | Determine current shares the address has and the shares requested to withdraw Ensure the address has enough value in the pool | function _withdraw(uint256 usdcAmount, uint256 withdrawShares) internal withinTransactionLimit(usdcAmount) {
IToken token = config.getToken();
uint256 currentShares = token.balanceOf(msg.sender);
require(withdrawShares <= currentShares, "Amount requested is greater than what this address owns");
if (... | 1,811,176 |
./partial_match/42/0xaa06958B7Ee178d63D01118536A3a50ffa2488fA/sources/StrategyUSDT3pool.sol | IERC20(y3crv).safeTransfer(strategist, _s.mul(1e18).div(_p)); IERC20(y3crv).safeTransfer(Controller(controller).rewards(), _t.mul(1e18).div(_p)); test notifyProfitInRewardToken(_s.mul(1e18).div(_p)); | function drip() public isAuthorized {
uint _p = yvERC20(y3crv).getPricePerFullShare();
_p = _p.mul(ICurveFi(_3pool).get_virtual_price()).div(1e18);
require(_p >= p, 'backward');
uint _r = (_p.sub(p)).mul(balanceOfy3CRV()).div(1e18);
uint _s = _r.mul(adminFee).div(DENOMINATOR)... | 9,005,463 |
pragma solidity >=0.4.21 <0.7.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract Logic {
////////////////////////////////// Globals ////////////////////////////////
using SafeMath for uint256;
// Game play variable funcitonality:
// Plays are numbered 0 - 2
... | Check function for determining the winner and calling the function to allocate funds to the winner in the Data contract it's a draw! return 50% of funds to both players Player1 wins Player2 wins | function checkWinner()
private
requireUnpaused
{
if (play1 == play2) {
draw(player1, player2);
}
else if (compare(play1, play2)) {
win(player1);
}
else if (compare(play2, play1)) {
win... | 14,102,702 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ERC721A.sol";
import ".... | See {IERC721-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
| 3,997 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "./GameToken.sol";
contract RockPaperScissors is AccessControlEnumerable, Pausable {
bytes32 public constant PAUSER_ROLE = keccak... | player commits move Explain to a developer any extra details gameId game identifier encrMove encrypted move, first char in encrypted string should corresponds with Moves enum return if commit phase was successful. | function commit(uint gameId, bytes32 encrMove) public whenNotPaused() isRegistered(gameId) returns (bool) {
Game storage currentGame = games[gameId];
if (currentGame.playerMoves[msg.sender].encrMove == 0x0) {
currentGame.playerMoves[msg.sender].encrMove = encrMove;
emit MoveCommited(msg.sender, ga... | 1,761,682 |
./full_match/56/0xF6ccc791fE477B0c3e98EcC46699e7A85cebf6Fb/sources/src/DiamondFactory.sol | @solidity memory-safe-assembly Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes of the `implementation` address with the bytecode before the address. Packs the remaining 17 bytes of `implementation` with the bytecode after the address. | function _clone(address implementation) internal returns (address instance) {
assembly {
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
... | 3,248,673 |
./full_match/5/0x4bC32699A85E87A3295c86db63c83D4d392B94DC/sources/contracts/BUFF.sol | checks for exceptions | function _transfer(address sender, address recipient, uint256 amount) internal nonReentrant {
require(lockedSwap == false ,"Transacitons are temporarily disabled for this token");
if (!_excludedFromTxLimit[msg.sender]){
uint256 outAmt= _totalSupply.mul(maxTx).div(100);
require(amoun... | 11,593,020 |
./full_match/1/0x8731843B1f748d39F9c52bfbeB7516eDC50B2D7B/sources/project_/contracts/ForeverMarketV2.sol | Cancel a bid after authorizing it off-chain. Can only be called by the bid creator/ | function cancelBid(
Bid memory bid
) external {
if (block.timestamp > bid.deadline) revert SignatureExpired();
if (msg.sender != bid.bidder) revert Unauthorized();
if (bids[msg.sender][bid.bidNonce] != BidStatus.ONGOING) revert InvalidBid();
bids[bid.bidder][bid.bidNonce] = BidStatus.CANCELED;
... | 9,735,261 |
./full_match/80001/0x366cCAd015255F047EBF189f3550258aFF9C5C7A/sources/contracts/PartyKarts.sol | Check if the race with the given ID already exists | function createRaceLobby(
uint256 _entryFee,
string memory _raceID,
string memory _trackName,
uint256 _maxRacers,
bool _isVisible,
bool _isOpen
) external payable returns (RaceLobby memory) {
require(_entryFee >= 0, "Entry fee must be a positive number");
... | 875,142 |
pragma solidity ^0.4.23;
/******* USING Registry **************************
Gives the inherting contract access to:
.addressOf(bytes32): returns current address mapped to the name.
[modifier] .fromOwner(): requires the sender is owner.
*************************************************/
// Returned by .getReg... | Both _hand and _draws store the first card in the rightmost position. _hand uses chunks of 6 bits. In the below example, hand is [9,18,35,12,32], and the cards 18 and 35 will be replaced. _hand: [9,18,35,12,32] encoding: XX 100000 001100 100011 010010 001001 chunks: ... | function drawToHand(uint256 _hash, uint32 _hand, uint _draws)
public
pure
returns (uint32)
{
assert(_draws <= 31);
assert(_hand != 0 || _draws == 31);
if (_draws == 0) return _hand;
if (_draws == 31) return uint32(getCardsFromHash(_hash, 5, handToBitmap(_h... | 2,445,889 |
/**
*Submitted for verification at Etherscan.io on 2021-03-08
*/
pragma solidity ^0.5.16;
/**
* @title Bird's BController Interface
*/
contract BControllerInterface {
/// @notice Indicator that this is a BController contract (for inspection)
bool public constant isBController = true;
/*** Assets Yo... | Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex account The address whose balance should be calculated after updating borrowIndex return The calculated balance/ | function borrowBalanceCurrent(address account) external returns (uint) {
delegateAndReturn();
}
| 2,118,456 |
pragma solidity ^0.4.24;
contract BeatProfitMembership{
address owner= 0x6A3CACAbaA5958A0cA73bd3908445d81852F3A7E;
uint256 [] priceOfPeriod = [10000000000000000, 30000000000000000,300000000000000000,2000000000000000000, 5000000000000000000];
uint256 [] TimeInSec = [3600, 86400,2592000,31536000];
ma... | Type:[0]:hour, [1]:day, [2]:month, [3]:year, [4]:premium Premium Membership | function extendMembership(uint256 _type) public payable{
require(msg.value >= priceOfPeriod[_type], "Payment Amount Wrong.");
if(_type==4){
Premium[msg.sender] = true;
DueTime[msg.sender] = 4689878400;
}
else if(DueTime[msg.sender]>now){
DueTi... | 6,786,778 |
pragma solidity 0.5.1;
library SafeMath {
uint256 constant internal MAX_UINT = 2 ** 256 - 1; // max uint256
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns(uint256) {
if (_a == 0) {
return 0;
}
... | getLockedAmount function get the amount of locked token which belong to appointed address at the current time. account The address of appointed account./ | function getLockedAmount(address account) public view returns(uint256 _lockedAmount) {
uint256 _Amount = 0;
uint256 _lockAmount = 0;
for(uint i = 0; i < locktime[account].length; i++) {
if(now < locktime[account][i]) {
_Amount = lockamount[account][i];
... | 7,677,912 |
./partial_match/8453/0x697813e9eFdF48E9c299ec635F86f98665252eBa/sources/BaseswapRouter.sol | LIBRARY FUNCTIONS | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) public pure virtual override returns (uint256 amountB) {
return BaseswapLibrary.quote(amountA, reserveA, reserveB);
}
| 16,802,571 |
./full_match/122/0xFAE02d404c327A1Eb2fB38eb89C38860a02D70e6/sources/contracts/LiquidStakingPool.sol | Returns value of current index/ return uintStorage[VALIDATOR_INDEX]; | function getValidatorIndex() public view returns(uint256) {
return _validatorsIndex;
}
| 16,366,177 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
// File: @openzeppelin/contracts/utils/Context.sol
/*
* @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 shou... | Set token uri by the owner of contract | function setTokenURI(uint256 tokenId, string memory tokenURI) public onlyOwner {
_setTokenURI(tokenId, tokenURI);
}
| 10,225,999 |
./full_match/137/0x03927788e5A9C3E901B63EE122a08CA58eb1dD13/sources/project_/contracts/MinimaCrowdsale.sol | Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. beneficiary Address performing the token purchase usdtAmount Value in wei involved in the purchase/ solhint-disable-previous-line no-empty-blocks | function _postValidatePurchase(address beneficiary, uint256 usdtAmount)
internal
view
{
}
| 4,677,944 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
... | inject NONSTANDARD NAMING | function SETSTAKINGLISTLIMIT246(uint256 _limit) external ONLYADMIN30 { | 12,739,075 |
./partial_match/1/0x11b2164DDf1C3c0a420cEaD050d422B26530d11C/sources/contracts/facets/ERC721A/ERC721AUpgradeableFacet.sol | Returns the token collection name./ | function name() public view virtual returns (string memory) {
return ERC721AStorage.layout()._name;
}
| 9,188,647 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./CashflowTokens.sol";
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Con... | Allows to remove an supplier. Transaction has to be sent by wallet. supplier Address of supplier. | function removeSupplier(address supplier)
public
supplierExists(supplier)
{
isSupplier[supplier] = false;
for (uint i=0; i<suppliers.length - 1; i++)
if (suppliers[i] == supplier) {
suppliers[i] = suppliers[suppliers.length - 1];
break;
... | 15,787,494 |
pragma solidity ^0.5.9;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | onlyManybeneficiaries modifier helper/ If enough beneficiaries confirmed the same operation | function checkHowManyBeneficiaries(uint howMany) internal returns(bool) {
if (insideCallSender == msg.sender) {
require(howMany <= insideCallCount, "checkHowManyBeneficiaries: nested beneficiaries modifier check require more beneficiarys");
return true;
}
... | 12,684,415 |
./full_match/137/0x43369C08Aa7efbf00F8b181A0a851e31D91315B0/sources/MaticSwapRouter.sol | LIBRARY FUNCTIONS | function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return MatisSwapLibrary.quote(amountA, reserveA, reserveB);
}
| 4,755,967 |
// Wow Internet Labz Pvt. Ltd. (connect@wowlabz.com)
pragma solidity ^0.4.15;
import './lifecycle/Pausable.sol';
import './math/SafeMath.sol';
import './BloodlineBLCToken.sol';
/**
* The BloodlineBLCSale smart contract is used for selling BloodlineBLCToken
* tokens (BLC). It does so by converting ETH received into... | The owner can call this function to withdraw the funds that have been sent to this contract for the crowdsale subject to the funding goal having been reached. The funds will be sent to the beneficiary specified when the crowdsale was created./ | function ownerSafeWithdrawal() external onlyOwner nonReentrant {
require(fundingGoalReached);
uint balanceToSend = this.balance;
beneficiary.transfer(balanceToSend);
FundTransfer(beneficiary, balanceToSend, false);
}
| 973,864 |
pragma solidity ^0.5.2;
import "../installed_contracts/zeppelin/contracts/math/SafeMath.sol";
import "./BehaviourToken.sol"
contract BikeSharing {
using SafeMath for uint256;
// CONSTANTS
uint constant public MAX_BIKE_COUNT = 1000;
uint constant public DAMAGE_PAYMENT = 1 ether;
uint constan... | Compute the amount charged for the bike ============== Insurance ============== / The dude will not be charged (or a little extra) TODO : How is the insurer going to pay the charge ?? His count of accident changes His payout also. THIS IS A NET VALUE, NORMALLY THE CLIENT IS OWED NOTHING The insurance will pay for the ... | function surrenderBike(uint bikeId, bool newCondition)
public
bikeClientOnly(msg.sender)
validParametersBike(bikeId)
bikeInRide(bikeId)
clientInRide(msg.sender)
bikeUser(bikeId, msg.sender)
adminExcluded
returns (bool success) {
uin... | 13,126,298 |
./full_match/5/0x8fDe9A3B05D15c298792276f7dB59B20281990b9/sources/contracts/SubtapeFactoryCreator.sol | Get the factory fiven the created ID | function getFactoryAtId(uint256 factoryId)
external
view
returns (SubtapeFactory)
{
return
SubtapeFactory(
Clones.predictDeterministicAddress(
implementation,
bytes32(abi.encodePacked(factoryId)),
... | 1,932,485 |
./full_match/43113/0x2e37Da6f80b9D6e5cFec1a10fDFf81Bb86dEAd06/sources/SWAPTOKEN.sol | Returns amount of Token2 required when providing liquidity with _amountToken1 quantity of Token1 | function getEquivalentToken2Estimate(uint256 _amountToken1) public view activePool returns(uint256 reqToken2) {
reqToken2 = totalToken2.mul(_amountToken1).div(totalToken1);
}
| 7,155,146 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./BTokens.sol";
import "./Players.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./GameConstants.sol";
contract Battle is AccessControl {
// Instance of BTokens to access balances of tokens for each player
BTokens priva... | Players submit their energy before a battle starts In cases of disconnecting or rage quitting the energy will still be consumed Burn tokens | function startBattle(
address playerOne,
address playerTwo,
uint256 energyAmountOne,
uint256 energyAmountTwo
) external onlyRole(DEFAULT_ADMIN_ROLE) {
tokens.burn(playerOne, GameConstants.NRGY, energyAmountOne);
tokens.burn(playerTwo, GameConstants.NRGY, energy... | 12,740,505 |
pragma solidity 0.8.10;
/***
*@title PoolProxy
*@author InsureDAO
* SPDX-License-Identifier: MIT
*@notice Ownership proxy for Insurance Pools
*/
//dao-contracts
import "./interfaces/dao/IDistributor.sol";
//pool-contracts
import "./interfaces/pool/ICDSTemplate.sol";
import "./interfaces/pool/IFactory.sol";
impo... | ==================================[Fee Distribution]================================== Withdraw admin fees from `_vault` any account can execute this function _token fee token address to withdraw and allocate to the token's distributors/allocate the fee to corresponding distributors | function withdraw_admin_fee(address _token) external nonReentrant {
require(_token != address(0), "_token cannot be zero address");
uint256 amount = IVault(_vault).withdrawAllAttribution(address(this));
if (amount != 0) {
uint256 _distributors = n_distributors[_token];
... | 1,327,942 |
/**
*Submitted for verification at Etherscan.io on 2021-09-25
*/
// SPDX-License-Identifier: MIT
pragma solidity ^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, ... | Strings Library (author James Lockhart: james at n3tw0rk.co.uk) Index Of Locates and returns the position of a character within a string starting from a defined offset _base When being used for a data type this is the extended object otherwise this is the string acting as the haystack to be s... | function _indexOf(string memory _base, string memory _value, uint _offset)
internal
pure
returns (int) {
bytes memory _baseBytes = bytes(_base);
bytes memory _valueBytes = bytes(_value);
assert(_valueBytes.length == 1);
for (uint i = _offset; i < _baseBy... | 15,062,690 |
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* man... | Returns the holder reward./ | function _calculateAmount(address _property, address _user)
private
view
returns (uint256 _amount, uint256 _price)
{
ILockup lockup = ILockup(config().lockup());
ERC20Mintable property = ERC20Mintable(_property);
uint256 reward = lockup.calculateCumulativeHoldersRewardAmount(
_property
);
uint256... | 10,323,220 |
./partial_match/1/0x5A9D49679319FCF3AcFe5559602Dbf31A221BaD6/sources/Strategy.sol | maxDeleverage is how much we want to increase by | function _normalLeverage(
uint256 maxLeverage,
uint256 lent,
uint256 borrowed,
uint256 collatRatio
) internal returns (uint256 leveragedAmount) {
uint256 theoreticalBorrow = lent.mul(collatRatio).div(1e18);
leveragedAmount = theoreticalBorrow.sub(borrowed);
... | 4,014,400 |
/**
*Submitted for verification at Etherscan.io on 2022-01-10
*/
// SPDX-License-Identifier: MIT
/**
... | Project owner can change how many can be minted at a time/ | function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
maxMintAmount = _newmaxMintAmount;
}
| 15,414,421 |
pragma solidity >=0.7.5;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
i... | using VaultMath for IVault; | {
using SafeMath for uint256;
using LongMath for uint256;
using SafeERC20 for IERC20Metadata;
IFactory public override factory;
ISwapRouter public swapRouter =
ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);
IUniswapV3Pool public immutable override pool;
IERC20Metadata pub... | 5,960,414 |
./full_match/4/0xd25E6aee259049DD6fE44bFF03bD1cA78165F1E8/sources/contracts/version1/Awknd.sol | / _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); | function mintMultiPass(uint8 amount, uint32 invitationCode)
external canMint(0, amount) invitationCheck(0, invitationCode, amount) payable {
address account = _msgSender();
require(account != address(0), "E21");
require(msg.value >= uint(nftTokens[0].nftCost) * amount * 10 ** 15, "Low P... | 12,383,728 |
// SPDX-License-Identifier: MIT
/**
* @authors: [@unknownunknown1, @jaybuidl]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.8;
import "./BaseDisputeKit.sol";
import "../../rng/RNG.sol";
interface IProofOfHumanity {
/** @dev Return true if the submission is... | RNG function return rn A random number./ | function getRandomNumber() internal returns (uint256) {
return rng.getUncorrelatedRN(RNBlock);
}
| 7,216,621 |
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | When allowed on RebalancingSetToken, anyone can call to start a new rebalance. Assuming the criteria have been met, transition state to rebalance/ Make sure Manager has been initialized with RebalancingSetToken Check that enough time has passed for the proposal and RebalancingSetToken is in Default state Make sure in c... | function confirmPropose()
external
{
require(
address(rebalancingSetToken) != address(0),
"AssetPairManagerV2.confirmPropose: Manager must be initialized with RebalancingSetToken."
);
require(
rebalancingSetReady(),
"AssetPairManag... | 12,786,416 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import './lib/AdminRole.sol';
import './lib/Safe112.sol';
import './utils/ContractGuar... | =========== Snapshot getters 一些只读方法:获取快照信息 最后快照索引 return 索引值/ 董事会数组长度-1 | function latestSnapshotIndex() public view returns (uint256) {
return boardHistory.length.sub(1);
}
| 6,414,623 |
./partial_match/42/0xE48E2041EABC90eff82D1e5509b22a23663d1870/sources/HaggleXToken.sol | Get all tokens including staked/ | function getMyFullBalance() public view returns(uint) {
uint balance = balanceOf(_msgSender());
for (uint i = 0; i < _staking[_msgSender()].length; i++){
balance += getStakeAmount(i);
}
return balance;
}
| 9,095,878 |
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
// import {StructTypes} from '../lib/StructTypes.sol';
import '../routeManage/routeManage.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '../base/daoMembers.sol';
import '../interface/IdaoManageCore.sol';
contract Vote {
uint index;
... | require(block.timestamp > ,'Unexpired'); | function endMsManagerVote(uint nodeId) public {
}
| 12,794,886 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contra... | Withdraw tokens from the pool using claims and send to recipient claims Claim[] token address recipient address/ | function withdrawWithRecipient(
Claim[] memory claims,
address token,
uint256 minimumAmount,
address recipient
) external override {
withdrawProtected(claims, token, minimumAmount, recipient);
}
| 5,374,782 |
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they sho... | TransferHelper.safeTransferFrom(TAL, address(this), msg.sender, _amount); | function withdraw(uint _amount) public limitedAccess returns(bool) {
require(_amount > 0, "amount must be greater than 0");
require(IERC20(TAL).balanceOf(address(this)) >= _amount, "insufficient TAL balance");
IERC20(TAL).safeTransfer(address(this), _amount);
emit Withdraw(_amount);
... | 5,954,652 |
./partial_match/3/0x3bF4788621B18eCE94B9C2F916b39FDB6d1dF8aa/sources/MineDAPP.sol | //initiate mining for all nfts | function initiateMiningForAllNFTs() external payable returns(bool) {
uint256 timeStarted;
for(uint256 i=0; i < numberOfHeroesOwned; i++) {
timeStarted = CryptoHeroes(CryptoHeroesAddress).timeStartedMining(CryptoHeroes(CryptoHeroesAddress).tokenOfOwnerByIndex(msg.sender,... | 5,272,033 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Multiply an Exp by a scalar, then truncate to return an unsigned integer./ | function mul_ScalarTruncate(Exp memory a, uint256 scalar) internal pure returns (uint256) {
Exp memory product = mul_(a, scalar);
return truncate(product);
}
| 333,415 |
//cUSD/UST Address: 0x9F4AdBD0af281C69a582eB2E6fa2A594D4204CAe
//Mastermind Address: 0x107f94409746e8c8e6eff139a100d17d9ca7fdfe
//Vyper Address: 0x5f0200ca03196d5b817e2044a0bb0d837e0a7823
interface cUSDUSTWrapper{
//This adds liquidity to the pool
//Amounts is a array with 2 numbers each being which token to d... | This adds liquidity to the poolAmounts is a array with 2 numbers each being which token to deposit liquidity to | interface cUSDUSTWrapper{
function addLiquidity(uint256[2] memory amounts, uint256 minToMint, uint256 deadline) external;
function removeLiquidity(uint256 amount, uint256[] memory minAmounts, uint256 deadline) external;
}
| 12,763,969 |
./partial_match/56/0xd56C4bf872130a4b4e2Ab5DEA191750eCC2bcbF7/sources/VaultProfiter.sol | Swap to WBNB to this address | function unpoolSmoke() internal {
ismokeVault.withdraw(uint256(-1),address(this),1);
address[] memory sellpath = new address[](2);
sellpath[0] = SMOKE;
sellpath[1] = WBNB;
router.swapExactTokensForTokens(
getTokenBalance(SMOKE),
0,
sellpath... | 11,074,864 |
./full_match/1/0x15315dFc9E2Cc4F7F5456323Ab7010a1A74a337d/sources/contracts/BasePool_v_1_1.sol | expiry check to make sure last loan in aggregation (one prior to _toLoanIdx for bucket) was taken out and expired | function getClaimsFromAggregated(
uint256 _fromLoanIdx,
uint256 _toLoanIdx,
uint256 _shares
) public view returns (uint256 repayments, uint256 collateral) {
uint256 fromToDiff = _toLoanIdx - _fromLoanIdx;
uint256 _baseAggrBucketSize = baseAggrBucketSize;
uint32 ex... | 3,121,249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.