file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.25;
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint2... | same as above. Replace this line with the following if you want to protect against wrapping uints.if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { | function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_t... | 1,806,296 |
// File: contracts/zeppelin/upgradable/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer f... | safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' solhint-disable-next-line max-line-length | function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, sp... | 5,452,531 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contract... | Just in case the image changes. Wouldn't be in mainnet | function changeImageURI(uint256 characterID, string memory imageURI) public onlyOwner returns(bool){ | 5,395,510 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
import "../YakStrategyV2.sol";
import "../interfaces/IPair.sol";
import "../lib/DexLibrary.sol";
/**
* @notice Adapter strategy for MasterChef.
*/
abstract contract MasterChefStrategy is YakStrategyV2 {
using SafeMath for uint256;
IWAVAX private consta... | Reinvest rewards from staking contract to deposit tokens Reverts if the expected amount of tokens are not returned from `MasterChef`/ | function _reinvest(
uint256 rewardTokenBalance,
uint256 poolTokenAmount,
uint256 extraTokenAmount
) private {
_getRewards(PID);
uint256 amount = rewardTokenBalance.add(_convertPoolTokensIntoReward(poolTokenAmount));
amount.add(_convertExtraTokensIntoReward(rewardT... | 1,039,628 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_100(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,813 |
./partial_match/1/0x7fb8f5D04b521B6880158819E69538655AABD5c4/sources/GasStationExact.sol | Sweep the full contract's balance for a given ERC-20 token token The ERC-20 token which needs to be swept payee The address to pay/ | function sweep(address token, address payee) external onlyOwner {
uint256 balance = IERC20(token).balanceOf(address(this));
emit ERC20Swept(token, payee, balance);
SafeERC20.safeTransfer(IERC20(token), payee, balance);
}
| 3,542,047 |
pragma solidity ^0.4.21;
import "./zeppelin/token/ERC20/SafeERC20.sol";
import "./zeppelin/math/SafeMath.sol";
import "./utils/SaleWithListAndVault.sol";
import "./SEADToken.sol";
/**
* @title SEADSale
* @dev SEADSale is a extend contract for managing a token crowdsale,
* allowing investors to purchase tokens wit... | Setup token allocation limitaion for each sale phase/ | function initialSale() external onlyOwner {
limitInvestorSaleToken = 20 * millionUnit;
limitPrivateSaleToken = 50 * millionUnit;
limitPublicSaleToken1 = limitPrivateSaleToken.add(10 * millionUnit);
limitPublicSaleToken2 = limitPublicSaleToken1.add(15 * millionUnit);
limitPublicSaleToken3 = limitPu... | 15,859,944 |
pragma solidity ^0.5.0;
import "../../../interfaces/IEscrow.sol";
import "../../../interfaces/ICAT20EscrowCreated.sol";
import "../../../interfaces/ICAT20EscrowCanceled.sol";
import "../../../interfaces/ICAT20EscrowProcessed.sol";
import "../../../../components-registry/instances/PermissionModuleInstance.sol";
import ... | Returns number of the tokens on the escrow tokenHolder Token holder address/ | function getTokensOnEscrow(address tokenHolder) public view returns (uint) {
return tokensOnEscrow[tokenHolder];
}
| 15,863,244 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | ======================================================= PUBLIC API ======================================================= | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
string[5] memory svgParts;
svgParts[1] = storySeeds[tokenId];
svgParts[2] = '</strong> ';
svgParts[3] = storyTexts[tokenId];
svgParts[4] = '</div></foreignObject></svg>';
string... | 1,353,885 |
./partial_match/56/0xB17Fbfa6dC55093E8c01cb26Fa45570C2460a344/sources/MasterYield.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBl... | 11,100,604 |
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/protocol/libraries/configuration/ReserveConfiguration.sol | Gets the configuration parameters of the reserve from storage self The reserve configuration return The state param representing ltv return The state param representing liquidation threshold return The state param representing liquidation bonus return The state param representing reserve decimals return The state para... | function getParams(DataTypes.ReserveConfigurationMap memory self)
internal
pure
returns (
uint256,
uint256,
uint256,
uint256,
uint256
)
{
uint256 dataLocal = self.data;
return (
dataLocal & ~... | 4,312,172 |
./full_match/1/0x833f7bDa72AcDbE7acA33F28d00bBF2dF20682d6/sources/contracts/adapters/UniswapV3.sol | Swaps `amountIn` of one token for as much as possible of another token params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata return amountOut The amount of the received token | function exactInputSingle(ExactInputSingleParams calldata params)
external
payable
override
nonReentrant
returns (uint256 amountOut)
{
address creditAccount = creditManager.getCreditAccountOrRevert(
msg.sender
);
creditManager.provideC... | 4,976,575 |
./full_match/43113/0x7B1B246E8dDD7631832defF16E4978B5c5828040/sources/contracts/AvaxPrediction.sol | End round, intervalSeconds is used as the buffer period/ | function _endRound(uint256 epoch) internal {
Round storage round = rounds[epoch];
uint80 roundId;
int256 price;
uint256 updatedAt;
if(rounds[epoch+1].closeOracleId > 0)
(roundId, price, , updatedAt, ) = oracle.getRoundData(rounds[epoch+1].closeOracleId - 1);
... | 7,175,855 |
./partial_match/3/0x0B1f567Ca36289d32d6df47C285A72667f342C72/sources/FUNDSZ.sol | roll up - matrix commission | function rollUp(address _user) internal returns(address) {
if(!users[_user].isExist) {
matrixCommissionBreakage[msg.sender]++;
bonusEligibleUsers[msg.sender].push(_user);
return userList[1];
}
if((users[_user].membershipExpired.add(GRACE... | 5,281,285 |
pragma solidity >=0.4.18 <0.7.0;
import '../solidity-lib/openzeppelin-solidity-112/contracts/math/SafeMath.sol';
import '../solidity-lib/openzeppelin-solidity-112/contracts/ownership/Claimable.sol';
import './Withdrawable.sol';
/**
* contract that manage the wallet operations on DRC platform
*/
contract DRCWallet... | get the deposit address by index _ind the deposit address index/ | function depositAddressByIndex(uint256 _ind) public view returns(address payable) {
return depositAddresses[_ind];
}
| 12,653,559 |
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.4.22 <0.7.0;
contract LazyPurchaseReverse {
uint public price;
address payable public seller;
address payable public buyer;
enum State { Inactive, Created, Locked, Soldout }
// The state variable has a default value of the first member, `S... | Place order. anyone can do this. | function placeOrder() public inState(State.Inactive) condition(msg.value == (2 * price)) payable {
emit OrderCreated();
buyer = msg.sender;
state = State.Created;
}
| 6,463,804 |
./partial_match/1/0xdefac16715671b7b6aeeFE012125f1E19Ee4b7d7/sources/_PrimeToken.sol | Get the total staked tokens for an account. Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)/ | function stakeOf(address account) public view returns (uint256) {
return stakes[account];
}
| 2,630,704 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | Returns total value of vesper pool, in terms of collateral token | function totalValue() public view override returns (uint256) {
return IPoolAccountant(poolAccountant).totalDebt() + tokensHere();
}
| 166,390 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {FixedPointMath} from "../libraries/Fixe... | Withdraws staked tokens from a pool. _poolId The pool to withdraw staked tokens from. _withdrawAmount The number of tokens to withdraw. | function withdraw(uint256 _poolId, uint256 _withdrawAmount) external nonReentrant {
Pool.Data storage _pool = _pools.get(_poolId);
_pool.update(_ctx);
Stake.Data storage _stake = _stakes[msg.sender][_poolId];
_stake.update(_pool, _ctx);
_claim(_poolId);
_withdraw(_poolId, _withdrawAmount... | 94,355 |
//SPDX-License-Identifier: stupid
//Compiles and clean
//needs to be tested on Rinkeby
//needs front end integration (getters)
pragma solidity >= 0.6;
import "./AnyPrice.sol";
import "./_ERC20.sol";
import "./Address.sol";
contract AnyStake_Library is Any_Price {
using SafeMath for uint256;
using Addre... | mapping updatearray update | function addToken(address _token, bool _activated) public onlyAllowed {
(tokens[_token].name,
tokens[_token].symbol,
tokens[_token].decimals,
,
tokens[_token].spotPrice)
= getTokenInfo(_token);
tokens[_token].activated = _activated;
... | 6,449,215 |
pragma solidity ^0.4.24;
// solium-disable-next-line no-experimental
pragma experimental ABIEncoderV2;
import "../math/SafeMath.sol";
import "../ownership/Ownable.sol";
/**
* @title Ticket
* @dev Base contract supporting smart tickets
*/
contract TicketManager is Ownable {
using SafeMath for uint256;
enum St... | check time constraints and invalidate the ticket if there is a need/ solium-disable-next-line security/no-block-members | function validateTicket(address user, uint index) public returns (bool) {
require(ticketsPerPerson[user].length > index, "Out of bound");
Ticket storage t = ticketsPerPerson[user][index];
uint256 elapsedTime = block.timestamp.sub(t.startedUsing);
if (elapsedTime > t.validInMinutes) {
t.state = ... | 12,754,348 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
... | Expire staking after an amount of blocks are mined. _expiration The number of blocks that are mined before staking expires./ | function setExpiration(uint256 _expiration) external onlyOwner {
expiration = block.number + _expiration;
}
| 6,045,400 |
./full_match/4/0x1DC826B3712cf9d1D879af8870Cb3E2250f7d495/sources/contracts/TheSouthPark.sol | Contract namestring public baseMetadataUri;string constant URI_ID = "https:thesouthpark.s3.us-west-1.amazonaws.com/metadatas/tsp-metadata-{id}.json"; Mapping from token ID to account balances | {
uint256 public currentID = 101;
string constant NAME = "The South Park";
uint256 constant totalSupply = 10000;
uint256 constant batchCount = 500;
uint256 constant MAX_NUM_PER_TOKEN = 1;
string constant URI_BASE =
mapping (uint256 => mapping(address => uint256)) assets_balances;
byt... | 12,361,666 |
//Address: 0xdac4f0d74592012eb4baeb608b1992ffe5cc537a
//Contract name: WorldCupBroker
//Balance: 1.88335987807420416 Ether
//Verification Date: 6/9/2018
//Transacion Count: 33
// CODE STARTS HERE
pragma solidity ^0.4.18;
// File: contracts/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner... | Returns a positive number if `other` comes lexicographically after `self`, a negative number if it comes before, or zero if the contents of the two slices are equal. Comparison is done per-rune, on unicode codepoints. self The first slice to compare. other The second slice to compare. return The result... | function compare(slice self, slice other) internal pure returns (int) {
uint shortest = self._len;
if (other._len < self._len)
shortest = other._len;
uint selfptr = self._ptr;
uint otherptr = other._ptr;
for (uint idx = 0; idx < shortest; idx += 32) {
... | 1,790,045 |
./full_match/4/0x3C4EF024B173eceF832039E93D62BAAA3a0D792f/sources/random.sol | Request randomness from a user-provided seed _seed: seed provided by the Almanack lottery/ | function getRandomNumber(uint256 _seed) external override {
require(msg.sender == almanackLottery, "Only AlmanackLottery");
require(keyHash != bytes32(0), "Must have valid key hash");
require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK tokens");
latestRequestId = requestR... | 12,339,077 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20SnapshotUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppeli... | Overrides with Snapshot mechanisms _beforeTokenTransfer functions. / | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20Upgradeable, ERC20SnapshotUpgradeable) {
ERC20SnapshotUpgradeable._beforeTokenTransfer(from, to, amount);
}
| 14,102,572 |
./full_match/43114/0x7F2aeC7795593DC06B75F9CFFf9b728a775601Cb/sources/HECTOR.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 4,537,055 |
./full_match/100/0x17aB9B14AC7659390B3994f9e67Bf833e60Ec1BD/sources/contracts/core/connext/helpers/OwnerPausableUpgradeable.sol | Unpause the contract. Revert if already unpaused./ | function unpause() external onlyOwner {
PausableUpgradeable._unpause();
}
| 14,276,191 |
/**
*Submitted for verification at Etherscan.io on 2021-10-26
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | Use pessimistic price to determine the worst ratio possible If for some reason we do not have debt (e.g: deposits under dust) make sure the operation does not revert | function getPessimisticRatioOfCdpWithExternalPrice(
uint256 cdpId,
bytes32 ilk,
uint256 externalPrice,
uint256 collateralizationRatioPrecision
) public view returns (uint256) {
uint256 price = Math.min(getSpotPrice(ilk), externalPrice);
uint256 totalCollateralVal... | 508,309 |
// SPDX-License-Identifier: UNLICENSED
// Cauldron
// ( ( (
// )\ ) ( )\ )\ ) (
// (((_) ( /( ))\ ((_)(()/( )( ( (
// )\___ )(_)) /((_) _ ((_))(()\ )\ )\ )
// ((/ __|((_)_ (_))( | | _| | ((_) ((_) _(_/(
// | (__ / _` || || || |/ _` | | '_|/ _ \| ' \))
// \___... | Swaps to a flexible amount, from an exact input amount | function swap(
address recipient,
uint256 shareToMin,
uint256 shareFrom
) public returns (uint256 extraShare, uint256 shareReturned) {
(uint256 amountFrom, ) = bentoBox.withdraw(MIM, address(this), address(pair), 0, shareFrom);
(uint256 reserve0, uint256 reserve1, ) = p... | 6,036,917 |
// SPDX-License-Identifier: Apache-2.0.
pragma solidity 0.8.10;
import {WadRayMath} from "@aave/core-v3/contracts/protocol/libraries/math/WadRayMath.sol";
import {IERC20} from "@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol";
import {IScaledBalanceToken} from "@aave/core-v3/contracts/interfaces... | Approves a new L1<->L2 token bridge. Function is invoked only by bridge admin l1AToken token address l2Token token address/ | function _approveToken(address l1AToken, uint256 l2Token)
internal
onlyValidL2Address(l2Token)
{
require(l1AToken != address(0), Errors.B_INVALID_ADDRESS);
require(
_aTokenData[l1AToken].l2TokenAddress == 0,
Errors.B_TOKEN_ALREADY_APPROVED
);
... | 1,049,104 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract Lottery {
enum UserType {Issuer,Investor}
enum LotteryState {NotStarted, Started,Finished}
LotteryState public state;
struct Player {
address payable playerAddress;
string playerName;
string emailI... | require(msg.sender == owner, "Only owner can execute "); | function getTotalAmount() view public returns (uint256 _price ) {
_price = address(this).balance;
}
| 13,115,255 |
pragma solidity 0.8.4;
contract Foo {
/// #if_succeeds old(x) == 0;
function changesArg1(uint x) public {
x = 1;
}
/// #if_succeeds x == 0;
function changesArg2(uint x) public {
x = 1;
// NOTE: For functions that modify the arguments, you still
// always get the old value
}
uint[] x = [1,2];
/// #if_s... | if_succeeds RET == 1; | function newRet() public returns (uint RET) {
return 2;
}
| 13,044,872 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.2;
interface IPlatformIntegration {
/**
* @dev Deposit the given bAsset to Lending platform
* @param _bAsset bAsset address
* @param _amount Amount to deposit
*/... | Swaps two assets - either internally between fAsset<>mAsset, or between fAsset<>mpAsset by first routing through the mAsset pool. _data Feeder pool storage state _config Core config for use in the invariant validator _input Data on bAsset to deposit _output Data on bAs... | function swap(
FeederData storage _data,
FeederConfig calldata _config,
Asset calldata _input,
Asset calldata _output,
uint256 _inputQuantity,
uint256 _minOutputQuantity,
address _recipient
) external returns (uint256 swapOutput, uint256 localFee) {
... | 15,213,726 |
pragma solidity >=0.4.21 <0.7.0;
import "./Account.sol";
contract Protector {
using SafeMath for uint;
Account accountInstance;
constructor(address _account_address) public {
accountInstance = Account(_account_address);
}
mapping (address => uint) public numOfProtector;
mapping... | accountInstance.setUserHealth(_owner, numOfProtector[_owner] levelOfProtector[_owner] protectorHealth); | function _updateProtectorPower(address _owner) public {
accountInstance.setUserProtectorPower(_owner, numOfProtector[_owner] * levelOfProtector[_owner] * protectorPower);
}
| 12,573,219 |
// SPDX-License-Identifier: MIT
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemente... | Returns the maxPerWallet for passId | function getMaxPerWallet(uint256 passId) public view returns (uint256) {
Pass storage pass = _passes[passId];
require(pass.maxItems > 0, "TOKEN_ID_NOT_EXIST");
return pass.maxPerWallet;
}
| 1,358,082 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "../interfaces/IContractsRegistry.sol";
abstract contract AbstractDependant {
/// @dev keccak256(AbstractDependant.setInjector(address)) - 1
bytes32 private constant _INJECTOR_SLOT =
0xd6b8f2e074594ceb05d47c27386969754b6ad0c15e5eb8f691399c... | starts the voting process returns true if the user has no PENDING votes returns true if the user has no AWAITING_CALCULATION votes returns how many votes the user has returns status of the vote returns a list of claims that are votable for msg.sender returns info list of ALL claims returns info list of claims of... | interface IClaimingRegistry {
function initializeVoting(
address claimer,
string calldata evidenceURI,
uint256 coverTokens,
bool appeal
) external;
function canWithdraw(address user) external view returns (bool);
function canVote(address user) external view returns (boo... | 430,386 |
./partial_match/3/0x25E2e5D8EcC4fE46a9505079Ed29266779dC7D6f/sources/HoprChannels.sol | Computes the Ethereum address from a public key given as a compressed EC-point./ | function compressedPubKeyToEthereumAddress(uint256 compressedX, uint8 odd) internal returns (address) {
(uint256 x, uint256 y) = decompress(compressedX, odd);
return pubKeyToEthereumAddress(x, y);
}
| 5,147,819 |
./full_match/5/0xd507cebBd76bFA8ef39562282a2c8EdD4Fc68D77/sources/project_/contracts/BaseContracts/Base721A.sol | before transfer hook function from the address to send the token from to the address to send the token to startTokenId the start token id quantity the quantity transfered/ | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override(ERC721A) {
super._beforeTokenTransfers(from, to, startTokenId, quantity);
require(!paused(), "Base721A: token transfer while paused");
}
| 1,901,241 |
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
pragma solidity 0.8.11;
contract Ply {
address public governance;
address public pendingGovernance;
uint256 public createdAt;
/// @notice EIP-20 token name for this token
string public constant name = "PLY";
/// @notice EIP-20... | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Ply::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowan... | 6,755,696 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeabl... | Set veJoePerSharePerSec _veJoePerSharePerSec The new veJoePerSharePerSec | function setVeJoePerSharePerSec(uint256 _veJoePerSharePerSec) external onlyOwner {
require(
_veJoePerSharePerSec <= upperLimitVeJoePerSharePerSec,
"VeJoeStaking: expected _veJoePerSharePerSec to be <= 1e36"
);
updateRewardVars();
veJoePerSharePerSec = _veJoePe... | 15,826,598 |
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);
... | Sets or unsets the approval of a given operator An operator is allowed to transfer all tokens of the sender on their behalf _to operator address to set the approval _approved representing the status of the approval to be set/ | function setApprovalForAll(address _to, bool _approved) public {
require(_to != msg.sender);
operatorApprovals[msg.sender][_to] = _approved;
emit ApprovalForAll(msg.sender, _to, _approved);
}
| 151,300 |
./full_match/1/0x33631575B027Ad75aEBbc9c829FbD0e18Fec91D2/sources/curveff.sol | https:docs.synthetix.io/contracts/source/interfaces/iaddressresolver | interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
function getSynth(bytes32 key) external view returns (address);
function requireAndGetAddress(bytes32 name, string calldata reason)
external
view
returns (address);
}
| 3,192,274 |
./partial_match/56/0xc114Aa3eDE9F32A5E7E5f89f4E04250d84C30111/sources/MasterChef.sol | First check most recent balance Next check implicit zero balance | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "PIZZA::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 11,193,856 |
./full_match/1/0xD2d3f38419bE8A82185e33d3560fE7D8Bd825453/sources/contracts/UnikuraPhygitalCollection/UnikuraPhygitalCollection.sol | This function packs the ownership data into a single uint256 value. This includes the owner's address, timestamp of transfer and certain flags. owner The address of the token's owner. flags A uint256 representing various binary flags. return result Returns the packed ownership data./ Mask `owner` to the lower 160 bit... | function _packOwnershipDataLocal(
address owner,
uint256 flags
) private view returns (uint256 result) {
assembly {
owner := and(owner, _BITMASK_ADDRESS)
result := or(
owner,
or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)
... | 17,199,110 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
/**
* @title CrystalEth Token (CRY)
* @author Giancarlo Sanchez... | View all aggregated stakes/ | function totalStakes() public view returns(uint256) {
uint256 _totalStakes = 0;
for (uint256 s = 0; s < stakeholders.length; s += 1){
_totalStakes = _totalStakes.add(stakes[stakeholders[s]]);
}
return _totalStakes;
}
| 1,833,744 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @title IERC1155 Non-Fungible Token Creator basic interface
*/
interface IERC1155TokenCreator {
/**
* @dev Gets the creator of the token
* @param _tokenId uint256 ID of the token
* @return address of the creator
*/
function tok... | / Send some value to an address. _to address to send some value to. _value uint256 amount to send./ attempt to make the transfer if it fails, transfer it into escrow for them to redeem at their will. | function sendValueOrEscrow(address payable _to, uint256 _value) internal {
bool successfulTransfer = MaybeSendValue.maybeSendValue(_to, _value);
if (!successfulTransfer) {
_asyncTransfer(_to, _value);
}
emit SendValue(_to, _value);
}
| 1,455,548 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../openzeppelin/ERC20.sol";
import "../openzeppelin/SafeERC20.sol";
import "../openzeppelin/SafeMath.sol";
import "./LiquidityMiningStorageV2.sol";
import "./IRewardTransferLogic.sol";
import "./ILiquidityMiningV2.sol";
/// @notice This contract is a n... | updates the given pool's reward tokens allocation point _poolToken the address of pool token _rewardTokens the addresses of reward tokens for given pool _allocationPoints the allocation points (weight) for the given pool and each reward token _updateAllFlag the flag whether we need to update all pools/ | function update(
address _poolToken,
address[] memory _rewardTokens,
uint96[] memory _allocationPoints,
bool _updateAllFlag
) public onlyAuthorized {
if (_updateAllFlag) {
updateAllPools();
updatePool(_poolToken);
}
_updateTokens(_poolToken, _rewardTokens, _allocationPoints);
}
| 15,797,147 |
pragma solidity ^0.5.3;
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./interfaces/IReleaseGoldInstance.sol";
import "../common/FixidityLib.sol";
import "../common/UsingRegistry.sol";
contract ReleaseGoldInstance is UsingRegis... | A wrapper function for the authorize attestation signer account method. signer The address of the signing key to authorize. v The recovery id of the incoming ECDSA signature. r Output value r of the ECDSA signature. s Output value s of the ECDSA signature. The v,r and s signature should be a signed message by the ... | function authorizeAttestationSigner(address signer, uint8 v, bytes32 r, bytes32 s)
external
nonReentrant
onlyCanValidate
onlyWhenInProperState
{
getAccounts().authorizeAttestationSigner(signer, v, r, s);
}
| 12,696,381 |
./full_match/97/0x00F9aca415c8d5425cDe7ACc9dB43b27263d93B6/sources/project_/contracts/Lottery.sol | Criamos a função 'capenga' de aleatoriedade. A blockchain não tem aleatoriedade, então é um improviso. | function random() private view returns (uint){ | 5,029,878 |
./full_match/1/0xEA24e9Bac006DE9635Ac7fA4D767fFb64FB5645c/sources/contracts/token/OUSD.sol | Add a contract address to the non-rebasing exception list. The address's balance will be part of rebases and the account will be exposed to upside and downside./ Convert balance into the same amount at the current exchange rate Decreasing non rebasing supply Increase rebasing credits, totalSupply remains unchanged so n... | function rebaseOptIn() public nonReentrant {
require(_isNonRebasingAccount(msg.sender), "Account has not opted out");
uint256 newCreditBalance = _creditBalances[msg.sender]
.mul(_rebasingCreditsPerToken)
.div(_creditsPerToken(msg.sender));
nonRebasingSupply = nonReb... | 4,918,432 |
./full_match/421613/0xD60CD2151e118Dd796efcb1ceFFcF892226F9b3a/sources/src/gateway/HomeGateway.sol | Changes the receiver gateway. _receiverGateway The address of the new receiver gateway. | function changeReceiverGateway(address _receiverGateway) external {
require(governor == msg.sender, "Access not allowed: Governor only.");
receiverGateway = _receiverGateway;
}
| 11,584,763 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/Assertions.sol | Internal pure function to validate calldata offsets for dynamic types in BasicOrderParameters and other parameters. This ensures that functions using the calldata object normally will be using the same data as the assembly functions and that values that are bound to a given range are within that ran... | function _assertValidBasicOrderParameters() internal pure {
bool validOffsets;
assembly {
validOffsets := and(
and(
and(
eq(
calldataload(BasicOrder_parameters_cdPtr),
Bas... | 4,301,637 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "ERC721Enumerable.sol";
import "Ownable.sol";
import "SafeMath.sol";
import "ECDSA.sol";
contract Vortex is ERC721Enumerable, Ownable {
using SafeMath for uint256;
using Strings for uint256;
using ECDSA for bytes32;
uint8 private _giftCoun... | generates a random number based on block info/ | function random() private view returns (uint256) {
bytes32 randomHash = keccak256(
abi.encode(
block.timestamp,
block.difficulty,
block.coinbase,
msg.sender
)
);
return uint256(randomHash);
}
| 1,206,294 |
./full_match/43114/0xC4729E56b831d74bBc18797e0e17A295fA77488c/sources/contracts/YakRouter.sol | Swap token to token without the need to approve the first token/ | function swapNoSplitWithPermit(
Trade calldata _trade,
address _to,
uint _fee,
uint _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external {
IERC20(_trade.path[0]).permit(
msg.sender,
address(this),
_trade.am... | 4,551,383 |
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: MIT
// File: erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol
pragma solidity ^0.8.0;
/**
* @title IERC1363Spender Interface
* @author Vittorio Minacori (https://github.com/vittominacori)
* @dev Interface ... | IERC1363Spender Interface Interface for any contract that wants to support approveAndCall from ERC1363 token contracts as defined in/ | interface IERC1363Spender {
function onApprovalReceived(
address sender,
uint256 amount,
bytes calldata data
) external returns (bytes4);
}
| 7,847,697 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausab... | Verify if a token transfer can be executed or not, on the validator's perspective. token Address of the token. functionSig ID of the function that is called. partition Name of the partition (left empty for ERC20 transfer). operator Address which triggered the balance decrease (through transfer or redemption). from... | function canValidate(
address token,
bytes4 functionSig,
bytes32 partition,
address operator,
address from,
address to,
uint value,
bytes calldata data,
bytes calldata operatorData
external
view
returns(bool)
{
return(_canValidate(token, functionSig, partition, o... | 2,487,578 |
./full_match/137/0xb8cece5AE3E408149EcD3037FF8F6939C0E77B2F/sources/contracts/PoolPartyAaveMinion.sol | submit proposal to its moloch | function proposeAction(
address token,
uint256 tributeOffered,
uint256 paymentRequested,
string memory details
) internal returns (uint256) {
uint256 proposalId = moloch.submitProposal(
address(this),
0,
0,
tributeO... | 3,746,807 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
... | inject NONSTANDARD NAMING | function RECOVERTOKENS78(IERC20 token, address to, uint256 amount) public ONLYGOVERNANCEBOARD725 { | 5,357,313 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IPhon... | Deposit Phone tokens to Store for iphone. | function deposit(uint256 _amount) public {
UserInfo storage user = userInfo[msg.sender];
updateFactory();
if (user.amount > 0) {
uint256 pending = user.amount.mul(accIPhonePerShare).div(1e12).sub(
user.rewardDebt
);
if (pending > 0) {
... | 12,703,489 |
./full_match/42220/0x3fC943f1842C4CC273C12988D2EF4D360571f4C4/sources/contracts/TreasuryV3.sol | OPERATOR FUNCTIONS / | function setMaxPaperToMint(uint256 _paperAmount) external onlyOperator {
maxPaperToMint = _paperAmount;
emit SetMaxPaperToMint(_paperAmount);
}
| 16,330,102 |
pragma solidity =0.6.6;
interface IMulanV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) externa... | refund dust eth, if any | function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
(amountToken, amountETH) = _addLiquidity(
token,
WETH,
amountTokenDesired,... | 13,696,631 |
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
contract Auction {
using SafeMath for uint256;
uint256 public endTime; // Timestamp of the end of the auction (in seconds)
uint256 public startTime; // The block timestamp ... | Returns a list of all bids and addresses | {
address[] memory addrs = new address[](bids.length);
uint256[] memory bidPrice = new uint256[](bids.length);
function allBids()
external
view
returns (address[] memory, uint256[] memory)
for (uint256 i = 0; i < bids.length; i++) {
addrs[i] = bids[i].... | 5,506,611 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationStructs.sol | Get a CalldataPointer from OrderComponents. obj The OrderComponents object. return ptr The CalldataPointer./ | function toCalldataPointer(
OrderComponents calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
| 4,300,895 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.3;
/*
▄████▄ ██▀███ ▄▄▄ ▒███████▒▓██ ██▓
▒██▀ ▀█ ▓██ ▒ ██▒▒████▄ ▒ ▒ ▒ ▄▀░ ▒██ ██▒
▒▓█ ▄ ▓██ ░▄█ ▒▒██ ▀█▄ ░ ▒ ▄▀▒░ ▒██ ██░
▒▓▓▄ ▄██▒▒██▀▀█▄ ░██▄▄▄▄██ ▄▀▒ ░ ░ ▐██▓░
▒ ▓███▀ ░░██▓ ▒██▒ ▓█ ▓██▒▒███████▒ ░ ██▒▓░
░ ░▒ ▒ ░░ ... | Add an array of wallet addresses to the presale white list | function addToPreSaleList(address[] calldata entries) external onlyOwner {
for (uint256 i = 0; i < entries.length; i++) {
address entry = entries[i];
require(entry != address(0), 'NULL_ADDRESS');
require(!preSaleWhitelist[entry], 'DUPLICATE_ENTRY');
preSaleWhitelist[entry] = true;
}
... | 1,671,636 |
./full_match/5/0x631CadF9267a7784D690AFa0Bd9128760CF555Cf/sources/contracts/extensions/WithdrawalLimitation.sol | Sets daily limit amounts for the withdrawals. Requirements: - The method caller is admin. - The arrays have the same length and its length larger than 0. Emits the `DailyWithdrawalLimitsUpdated` event./ | function setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) external virtual onlyAdmin {
require(_tokens.length > 0, "WithdrawalLimitation: invalid array length");
_setDailyWithdrawalLimits(_tokens, _limits);
}
| 1,908,386 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "./ReferenceTable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/... | Sets iban associated to contract _iban the iban/ | function setIban(string memory _iban) public onlyOwner {
iban = _iban;
}
| 13,641,889 |
pragma solidity ^0.4.25;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol spender The address which will spend the funds. ... | function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
require(!frozenAccount[msg.sender]);
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
em... | 13,058,003 |
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity ... | Internal function to determine if an address is a contract _addr The address being queried return True if `_addr` is a contract | function isContract(address _addr) constant internal returns(bool) {
uint size;
if (_addr == 0) {
return false;
}
assembly {
size := extcodesize(_addr)
}
return size>0;
}
| 469,095 |
pragma solidity ^0.8.0;
import "./PriceOracle.sol";
import "../Interfaces/FeedRegistryInterface.sol";
import "../CToken/CErc20.sol";
import "../CToken/CToken.sol";
import "../Utils/Exponential.sol";
import "../Interfaces/EIP20Interface.sol";
import "../Utils/SafeMath.sol";
// import "./Uniswap/UniswapLib.sol";
import ... | emit PriceUpdated(symbol, anchorPrice); | function updateTokenPrice(address cToken) internal {
TokenConfig memory config = configForCToken[cToken];
bytes32 symbolHash = config.symbolHash;
uint anchorPrice = fetchAnchorPrice(config);
prices[symbolHash] = anchorPrice;
}
| 12,709,107 |
./partial_match/1/0x8AD1BFAb08Fc8f5664cCa46E5E1C69B2f4619645/sources/contracts/EAPass.sol | Toggle The Regular Claim Period./ | function toggleRegSale() external onlyOwner {
regSaleActive = !regSaleActive;
}
| 15,776,775 |
./full_match/11155111/0x4DB19Edf2D596C03d23282D5cA708B434A903aAF/sources/project_/contracts/ClipzoToken.sol | 将Unix时间戳解析为DateTimeStruct结构体 解析年份 解析月份 解析日期 | function parseTimestamp(uint timestamp) internal pure returns (DateTimeStruct memory dt) {
uint secondsInMonth;
for (i = 1; i <= 12; i++) {
if (secondsInMonth + secondsAccountedFor > timestamp) {
break;
}
}
... | 3,792,366 |
./partial_match/5/0x3121dCF2CB403eaF0575f3D2a819f0902DeCE347/sources/ManagerFactory.sol | 토큰 생성 만들어진 토큰과 토큰 계약 권한은 이 계약에 있음 @TODO: tokenTemplateKey 넣고 필요 금액을 가져와야 함. 매니저 생성 + 오너 EOA + 각종 설정(min use token, burning token) solhint-disable-next-line no-inline-assembly call `CREATE2` w/ 4 arguments. pass along failure message from failed contract deployment and revert. | function newManager(
string calldata tokenName,
string calldata tokenSymbol,
uint256 mintingAmount,
uint256 requireAmount,
uint256 burningAmount
) external payable returns (address result) {
address token =
tokenTemplateKey,
"1",
... | 16,833,465 |
./full_match/1/0x4361b1B8aE2E4f96bFB7A2BC95D6aB748882fdbB/sources/src/Fiefdoms.sol | Called with the sale price to determine how much royalty is owed and to whom. (unused) _salePrice The sale price of the NFT asset specified by _tokenId return receiver Address of who should be sent the royalty payment return royaltyAmount The royalty payment amount for _salePrice See EIP-2981: https://eips.ethereum.... | function royaltyInfo(uint256, uint256 _salePrice) external view returns (address, uint256) {
return (_royaltyBeneficiary, _salePrice * _royaltyBasisPoints / 10000);
}
| 4,962,762 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import {
CrossDomainEnabled
} from "@eth-optimism/contracts/contracts/libraries/bridge/CrossDomainEnabled.sol";
import {
OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ERC165Checker } from "@openzep... | Initiates a bridge of an NFT to the caller's account on L1. _localToken Address of the ERC721 on this domain. _remoteToken Address of the ERC721 on the remote domain. _tokenId Token ID to bridge. _minGasLimit Minimum gas limit for the bridge message on the other domain. _extraData Optional data to forward t... | function bridgeERC721(
address _localToken,
address _remoteToken,
uint256 _tokenId,
uint32 _minGasLimit,
bytes calldata _extraData
) external {
require(!Address.isContract(msg.sender), "L2ERC721Bridge: account is not externally owned");
_initiateBridgeERC... | 927,482 |
// 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.
... | mint a number of NFTs _v ECDSA signature parameter v. _r ECDSA signature parameters r. _s ECDSA signature parameters s.function to blacklist bots | function presaleMint(uint256 number, uint8 _v, bytes32 _r, bytes32 _s) onlyValidAccess(_v, _r, _s) external payable {
require(saleState() != State.NoSale, "Sale in not open yet!");
require(saleState() != State.PublicSale, "Presale has closed!");
require(totalSupply() + number <= maxTokensPr... | 6,273,820 |
pragma solidity ^0.4.24;
// File: contracts/interface/DiviesInterface.sol
interface DiviesInterface {
function deposit() external payable;
}
// File: contracts/interface/otherFoMo3D.sol
interface otherFoMo3D {
function potSwap() external payable;
}
// File: contracts/interface/PlayerBookInterface.sol
inte... | grab their player ID, name and last aff ID, from player names contract set up player account | function reloadPlayerInfo(address addr)
private
{
uint256 _pID = PlayerBook.getPlayerID(addr);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
uint8 _level = PlayerBook.getPlayerLevel(_pID);
pIDxAddr_[msg.sender] = _pID;... | 5,951,049 |
pragma solidity ^0.4.21;
// ----------------------------------------------------------------------------
// ZAN token contract
//
// Symbol : ZAN
// Name : ZAN Coin
// Total supply: 17,148,385.000000000000000000
// Decimals : 18
//
// ---------------------------------------------------------------------... | ------------------------------------------------------------------------ Token holders are able to burn their tokens. ------------------------------------------------------------------------ | function burn(uint amount) public {
require(amount > 0);
require(amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(amount);
_totalSupply = _totalSupply.sub(amount);
burnedTokensCount = burnedTokensCount + amount;
emit BurnTokens(msg.sen... | 5,882,034 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.6;
// CONTRACT FOR CUSTOMER RELATED OPERATIONS
contract SCFCustomerOperations {
// BookingStatus of customer
enum SCFBookingStatus {INITIATED, CONFIRMED, AIRLINE_CANCELLED_REFUND_COMPLETED, USER_CANCELLED_REFUND_COMPLETED, CLAIM_REFUND_COMPLE... | Get function: Returns flight timestamp | function getFlightTime() public view returns(uint) {
return (_flightData.flight_datetime);
}
| 6,369,712 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | Will fail if fully collateralized or fully algorithmic > 0% and < 100% collateral-backed | function mintFractionalFRAX(uint256 collateral_amount, uint256 fxs_amount, uint256 FRAX_out_min) external notMintPaused {
uint256 fxs_price = FRAX.fxs_price();
uint256 global_collateral_ratio = FRAX.global_collateral_ratio();
require(global_collateral_ratio < COLLATERAL_RATIO_MAX && global_... | 221,093 |
./full_match/97/0x735f90Ee29b8C33c6b1f5166B84f2360112BD159/sources/project_/contracts/rtlol/rtlolPackFunctions.sol | randSig is pseudorandomness supplied by verifier signiture so can't be influenced by miners | function getWinningTicketIndex(
bytes memory randSig,
uint256 lotteryId,
uint256 ticketCount,
uint256 prizePostition,
bytes32 merkleRoot) public view returns (uint256) {
LotteryResult memory _result = lotteryResults[lotteryId];
... | 3,264,869 |
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
pragma solidity 0.4.19;
contract ERC20Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupp... | The owner will call this method to extract the tokens | function collectTokens() public onlyOwner {
uint256 finalizedTime = contribution.finalizedTime();
require(finalizedTime > 0 && getTime() > finalizedTime);
uint256 balance = miniMeToken.balanceOf(address(this));
collectedTokens = balance;
miniMeToken.transfer(owner, balance... | 1,109,494 |
./full_match/1/0x4B8092CdF0FF8473f7CAB01b267208Eb565943AD/sources/contracts/libraries/Percent.sol | Return _percent of _amount with _decimals many decimals | function getPercentage(uint256 _amount, uint256 _percent, uint256 _decimals)
internal
pure
returns (uint256 percentage)
{
percentage =_getPercentage(_amount, _percent, _decimals);
}
| 4,846,133 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) intern... | Contructor that gives msg.sender all of existing tokens./ | function KToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
| 6,589,561 |
./full_match/8453/0x1cAfA2eB160C1FeAA9E8cc0495Ff435E21f99c1f/sources/src/utils/ABDataRegistry.sol | Return the details required to withdraw the mint proceeds _publisher publisher to be queried return _treasury the treasury account address return _fee the fees associated to the given `_publisher`/ | function getPayoutDetails(address _publisher) external view returns (address _treasury, uint256 _fee) {
_treasury = abTreasury;
_fee = publisherFees[_publisher];
}
| 11,558,927 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
// Airline registration code
uint8 private constant REGISTRATION_CODE_UNKNOWN = 0;
uint8 private constant REGISTRATION_CODE_ADDED_TO... | Returns boolean indicating whether an airline has been added to the queue or not./ | function isAirlineAdded (
address airline
)
internal
view
returns (bool)
{
return airlines[airline].registra... | 15,838,170 |
pragma solidity ^0.4.23;
library StringUtils {
struct slice {
uint _len;
uint _ptr;
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
... | Allows the Hydro API to set minimum hydro balances required for sign ups | function setMinimumHydroStakes(uint newMinimumHydroStakeUser, uint newMinimumHydroStakeDelegatedUser)
public onlyOwner
{
ERC20Basic hydro = ERC20Basic(hydroTokenAddress);
minimumHydroStakeUser = newMinimumHydroStakeUser;
minimumHydroStakeDelegatedUser = newMinimumHydroStakeDelega... | 7,289,354 |
import { RoleManagement } from "./RoleManagement.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
pragma solidity ^0.5.0;
contract Registry {
function updateProperty(address ownerAddress, uint256 pin) public returns(bool success);
function grantPermission(address _operator,string m... | If one of the owner wants to sell part of all his share _pct pourcentage of his share that the owner is willing to sell _amount how much money the onwer is asking for his share/ | function sellShare(uint256 _pct, uint256 _amount) public onlyOwner() {
onSale memory share = onSale(msg.sender,_pct,SafeMath.mul(_amount,FINNEY));
sales.push(share);
emit SharedPutMarket(msg.sender,SafeMath.div(SafeMath.mul(ownersPct[msg.sender],_pct),100),SafeMath.mul(_amount,FINNEY));
... | 12,656,534 |
pragma solidity ^0.4.23;
contract Election {
// Model a Candidate
struct Candidate {
uint id;
string name;
uint voteCount;
}
//Modle a voter
struct Voter {
uint NID; // govt issued national identification number of candidate
bool eligibility; // stores the valid list of voters during registration
bo... | candidates are pre populated for the election (privately intitialized by the contract) | function addCandidate(string _name) private {
candidatesCount++;
}
| 12,725,528 |
./full_match/42/0xcd61283f2B8588Fe14589218bC3fc0929b4D5F6F/sources/BlockchainForestDefi.sol | fonction swap usdt vers daiLocal variablesActions | function swapHalfUsdtToDai(uint _amount) public onlyOwner {
IUniswapV2Router02 UniswapRouter = IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);
address[] memory path = new address[](2);
path[0] = usdtTokenAddress;
path[1] = daiTokenAddress;
... | 9,579,035 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "../BrightIDValidatorBase.sol";
contract BrightIDValidatorSingle is BrightIDValidatorBase {
address private _verifier;
constructor(address verifier_, bytes32 context_) BrightIDValidatorBase(context_) {
_verifier = verifier_;
}
/... | Returns the trusted verifier of the BrightID validator./ | function verifier() public view virtual returns (address) {
return _verifier;
}
| 1,775,030 |
// SPDX-License-Identifier: AGPLv3
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
interface IVestable {
function vest(
bool vest,
address _receiver,
uint256 _amount
) ex... | Verify the merkle proof. Mark it claimed and send the token. | function claim(
bool vest,
uint256 trancheId,
uint128 amount,
bytes32[] calldata merkleProof
) external {
require(trancheId < tranches, "claim: !trancheId");
require(!isClaimed(trancheId, msg.sender), "claim: Drop already claimed");
DropInfo storage di = d... | 1,290,528 |
import "./StorageCore.sol";
/**
* A simple file storage protocol using storage core.
*
* Ethereum account can
*
* - upload file
* - list files (offchain)
* - delete file
*
*
* The rent payer for all stored files is the FlatFileStorage contract.
* Any upload will autoamtically move tokens from uploader to F... | Get the path for indexing upload files./ Get first 8 bytes of the hash The highest byte 31 is application id The highest 30-10 bytes are the file owner The highest bytes 9-1 are the part of the hash The last byte 0 is the content type | function calculateMask(address owner, bytes32 contentHash, uint8 contentType) public pure returns(uint256 mask) {
uint256 compressedHash = uint256(hash) >> (8**24);
uint256 mask =
APPLICATION_ID << (8**31) |
uint256(owner) << (8**10) |
compressedHash |
... | 1,789,638 |
./full_match/4/0xC7AC8Df0116Aaf785A384EFDCff80a3D4238686F/sources/browser/TickerERC20.sol | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./require(onlyAdminTransfer[msg.sender] == true); | function transfer(address recipient, uint256 amount) public onlyAdminTransfer virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| 13,341,977 |
// SPDX-License-Identifier: MIT
/*
* Contract by pr0xy.io
* _______ _______ ______ _______ ______ _______ _______ _______ _______
* | _ || || _ | | || | | _ || || || |
* | |_| || _ || | || | ___|| _ | | |_| || _ || ___|| ____... | Bored Ape Yacht Club Interface | interface BAYC {
function ownerOf(uint tokenId) external view returns (address);
}
| 12,139,046 |
./partial_match/56/0x82F7774391BAB1Ad5E427bA8a0BcD89F33c2badA/sources/Orchestrator.sol | Main entry point to initiate a rebase operation. The Orchestrator calls rebase on the policy and notifies downstream applications. Contracts are guarded from calling, to avoid flash loan attacks on liquidity providers. If a transaction in the transaction list reverts, it is swallowed and... | function rebase()
external
{
uint256 rewardsDistributed = pool0.totalRewards().add(pool1.totalRewards());
policy.rebase();
address(UniSync).call.gas(SYNC_GAS)(UniSync.sync.selector);
}
| 11,185,597 |
./full_match/1/0x2F89A4aA5cB9e5Ed930dc47915850949aD757BA1/sources/contracts/nfts/ERC1155.sol | See {IERC1155MetadataURI-uri}. This implementation returns the same URI for all token types. It relies on the token type ID substitution mechanism Clients calling this function must replace the `\{id\}` substring with the actual token type ID./ | function uri(uint256 _id) external view virtual override returns (string memory) {
return Strings.strConcat(_uri, Strings.uint2str(_id)).strConcat(".json");
}
| 3,156,736 |
pragma solidity ^ 0.4.24;
import "./Util.sol";
import "./ERC20.sol";
import "./ERC777.sol";
contract ERC820Implementer {
ERC820Registry erc820Registry = ERC820Registry(0xa691627805d5FAE718381ED95E04d00E20a1fea6);
function setInterfaceImplementation(string _interfaceLabel, address impl) internal {
bytes32 inter... | ERC20 backwards compatible allowance. This function makes it easy to read the `allowed[]` map _owner The address of the account that owns the token _spender The address of the account able to transfer the tokens return Amount of remaining tokens of _owner that _spender is allowed to spend | function allowance(address _owner, address _spender) public erc20 constant returns(uint256 remaining) {
return mAllowed[_owner][_spender];
}
| 12,902,216 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "../utils/DAOUpgradeableContract.sol";
import "../utils/NameService.sol";
import "./GoodReserveCDai.sol";
contract ExchangeHelper is DAOUpgradeableContract {
uint256 private _status;
function initialize(INameService _ns) public virtual initializer {
... | Calculates how much to decrease the reserve ratio for _token by the `reserveRatioDailyExpansion` _token The reserve token to calculate the reserve ratio for return The new reserve ratio/ | function calculateNewReserveRatio(ERC20 _token) public view returns (uint32) {
ReserveToken memory reserveToken = reserveTokens[address(_token)];
uint256 ratio = uint256(reserveToken.reserveRatio);
if (ratio == 0) {
ratio = 1e6;
}
uint256 daysPassed = (block.timestamp - reserveToken.lastExpansion) /
1... | 243,065 |
pragma solidity ^0.4.11;
import "../PublicMarket.sol";
import "../Product.sol";
import "../KioskMarketToken.sol";
import "../OrderTracker.sol";
/**
* EtherMarket exchanges KMT for ETH. It also sells ETH as a Kiosk Product.
*/
contract EtherMarket is PublicMarket, Product {
// The DIN for ETH
uint256 public ETH_DI... | TODO: This should implement some logic to prove it is a fair market. | function isFulfilled(uint256 orderID) constant returns (bool) {
return true;
}
| 1,069,235 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.