Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
510
// CHAR TOKEN FUNCTIONS HERE /
function setCharAmountToParticipate(uint256 _minCharAmount) external onlyOwner { minCharAmount = _minCharAmount * 1e18; }
function setCharAmountToParticipate(uint256 _minCharAmount) external onlyOwner { minCharAmount = _minCharAmount * 1e18; }
35,356
72
// Freeze token transfers. /
function freezeTransfers () public delegatable payable { require (msg.sender == owner); if (!frozen) { frozen = true; Freeze (); } }
function freezeTransfers () public delegatable payable { require (msg.sender == owner); if (!frozen) { frozen = true; Freeze (); } }
75,681
240
// Buy the Emogram
function buyEmogram(uint256 id) payable external nonReentrant() itemExists(id) isForSale(id)
function buyEmogram(uint256 id) payable external nonReentrant() itemExists(id) isForSale(id)
44,054
12
// Blending price can not be set to 0
return tokens[_player].blendingPrice > 0;
return tokens[_player].blendingPrice > 0;
34,896
45
// read transfer configurations
/// @return { /// "_base": "denominator for calculating transfer fees", /// "_rate": "numerator for calculating transfer fees", /// "_collector": "the ethereum address of the transfer fees collector", /// "_no_transfer_fee": "true if transfer fees is turned off globally", /// "_minimum_transfer_am...
/// @return { /// "_base": "denominator for calculating transfer fees", /// "_rate": "numerator for calculating transfer fees", /// "_collector": "the ethereum address of the transfer fees collector", /// "_no_transfer_fee": "true if transfer fees is turned off globally", /// "_minimum_transfer_am...
45,806
89
// Add locker, only owner can add locker/
function _addLocker(address account) internal { _lockers[account] = true; emit LockerAdded(account); }
function _addLocker(address account) internal { _lockers[account] = true; emit LockerAdded(account); }
32,341
17
// Function to get current borrow interest rate/ return Borrow interest rate as 18-digit decimal
function getBorrowRate() public view returns (uint256) { BorrowInfo memory info = _accrueInterestVirtual(); return interestRateModel.getBorrowRate( cash(), info.borrows, info.reserves + info.insurance + (info.borrows - info.principal) ); }
function getBorrowRate() public view returns (uint256) { BorrowInfo memory info = _accrueInterestVirtual(); return interestRateModel.getBorrowRate( cash(), info.borrows, info.reserves + info.insurance + (info.borrows - info.principal) ); }
25,090
6
// Contract constructor./
constructor() public { owner = msg.sender; complete = true; initReady = true; //ready for initialize }
constructor() public { owner = msg.sender; complete = true; initReady = true; //ready for initialize }
48,665
12
// Burns tokens from an address, deducting from the caller's allowance. Decreases total amount minted if called by a bridge. _from The address to burn tokens from. _amount The amount to burn. /
function _burnFrom(address _from, uint256 _amount) internal returns (bool) { Supply storage b = bridges[msg.sender]; if (b.cap > 0 || b.total > 0) { // set cap to 1 would effectively disable a deprecated bridge's ability to burn require(b.total >= _amount, "exceeds bridge min...
function _burnFrom(address _from, uint256 _amount) internal returns (bool) { Supply storage b = bridges[msg.sender]; if (b.cap > 0 || b.total > 0) { // set cap to 1 would effectively disable a deprecated bridge's ability to burn require(b.total >= _amount, "exceeds bridge min...
19,764
100
// Make sure we have tokens to send from TDE
if (TDESupplyRemaining > 0) {
if (TDESupplyRemaining > 0) {
7,449
1
// Extension of {ERC721} that allows a specific role to mint tokens./ Mints `amount` new tokens for `to`. /
function mintByRole(address to, uint256 amount) external;
function mintByRole(address to, uint256 amount) external;
13,198
46
// address currentOwner;
address supplier;
address supplier;
47,238
24
// With this function, the administrator can create an interest period.Periods of 30 - 90 - 365 days can be created. Example:-------------------------------------| Apy ve altındakiler 1e16 %1 olacak şekilde ayarlanır.| duration = 2592000 => 30Days| apy = 100000000000000000 => %10 Monthly| mainPenaltyRate = 100000000000...
function createPool( uint256 _startTime, uint256 _duration, uint256 _apy, uint256 _mainPenaltyRate, uint256 _subPenaltyRate, uint256 _lockedLimit, bool _nftReward ) external
function createPool( uint256 _startTime, uint256 _duration, uint256 _apy, uint256 _mainPenaltyRate, uint256 _subPenaltyRate, uint256 _lockedLimit, bool _nftReward ) external
43,239
51
// view max amount of USD deposit that can be accepted return max amount of USD deposit (18 decimal places)/
function availableTokenInUSD() external view returns (uint256) { (bool success, uint256 USDToCADRate, uint256 granularity,) = _oracle.getCurrentValue(1); require(success, "Failed to fetch USD/CAD exchange rate"); require(granularity <= 36, "USD rate granularity too high"); uint256 t...
function availableTokenInUSD() external view returns (uint256) { (bool success, uint256 USDToCADRate, uint256 granularity,) = _oracle.getCurrentValue(1); require(success, "Failed to fetch USD/CAD exchange rate"); require(granularity <= 36, "USD rate granularity too high"); uint256 t...
69,939
107
// Set the lower bound USDC amount needed to receive the respective ALTA amounts _highTier Minimum usdc amount needed to qualify for earn contract high tier _medTier Minimum usdc amount needed to qualify for earn contract medium tier _lowTier Minimum usdc amount needed to quallify for earn contract low tier /
function setAltaContractTiers( uint256 _highTier, uint256 _medTier, uint256 _lowTier
function setAltaContractTiers( uint256 _highTier, uint256 _medTier, uint256 _lowTier
14,536
7
// Gets the payout wallet./ return wallet The payout wallet.
function payoutWallet(Layout storage s) internal view returns (address payable) { return s.wallet; }
function payoutWallet(Layout storage s) internal view returns (address payable) { return s.wallet; }
9,335
1
// 55500000 tokens with 18 decimals.
uint256 public constant MAX_SUPPLY = 55500000 * (10 ** 18);
uint256 public constant MAX_SUPPLY = 55500000 * (10 ** 18);
20,630
12
// Filled only once when contract initialized/_value block.number
function _setCreatedBlock(uint256 _value) private { bytes32 slot = _CREATED_BLOCK_SLOT; assembly { sstore(slot, _value) } }
function _setCreatedBlock(uint256 _value) private { bytes32 slot = _CREATED_BLOCK_SLOT; assembly { sstore(slot, _value) } }
11,631
310
// keccak256(channel_identifier, token_network_address) => Struct Keep track of the rewards per channel
mapping(bytes32 => Reward) internal rewards;
mapping(bytes32 => Reward) internal rewards;
14,990
3
// Current TOKEN|BNB Rate
uint256 issue;
uint256 issue;
48,079
0
// Minimum value signed 64.64-bit fixed point number may have. /
int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;
int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;
18,984
36
// Scale.DecodeAuthorities Scale.DecodeMMRRoot use
bytes memory hexData = hex"10637261629101089f284e1337a815fe77d2ff4ae46544645b20c5ff9469d013805bffb7d3debe5e7839237e535ec483"; Input.Data memory data = Input.from(hexData); (bytes memory prefix, bytes4 methodID, uint32 index, bytes32 root) = Scale.decodeMMRRoot(data); assertEq0(prefix, ...
bytes memory hexData = hex"10637261629101089f284e1337a815fe77d2ff4ae46544645b20c5ff9469d013805bffb7d3debe5e7839237e535ec483"; Input.Data memory data = Input.from(hexData); (bytes memory prefix, bytes4 methodID, uint32 index, bytes32 root) = Scale.decodeMMRRoot(data); assertEq0(prefix, ...
22,642
16
// Asset symbol to asset proxy mapping.
mapping(bytes32 => address) public proxies;
mapping(bytes32 => address) public proxies;
21,841
70
// `Checkpoint` is the structure that attaches a block number to a given value. The block number attached is the one that last changed the value/
struct Checkpoint { // `fromBlock` is the block number at which the value was generated super.mint(_to, _amount); from uint128 fromBlock; // `value` is the amount of tokens at a specific block number uint128 value; }
struct Checkpoint { // `fromBlock` is the block number at which the value was generated super.mint(_to, _amount); from uint128 fromBlock; // `value` is the amount of tokens at a specific block number uint128 value; }
47,834
20
// Emit role removed event
emit RoleRemoved(keccak256(abi.encodePacked(_role)), _address);
emit RoleRemoved(keccak256(abi.encodePacked(_role)), _address);
35,960
12
// Decrease the amount of tokens that an owner allowed to a spender.approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined) _spender The address which will spend the funds. _subtractedValue The amount ...
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.su...
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.su...
52,334
219
// IUniswapV2Pair _pair = IUniswapV2Pair(IUniswapV2Factory(factory).getPair(tokenA, tokenB));require(address(_pair) != address(0), 'Not exist pair');
pair = _pair; token0 = _pair.token0(); token1 = _pair.token1(); price0CumulativeLast = _pair.price0CumulativeLast(); // fetch the current accumulated price value (1 / 0) price1CumulativeLast = _pair.price1CumulativeLast(); // fetch the current accumulated price value (0 / 1) ...
pair = _pair; token0 = _pair.token0(); token1 = _pair.token1(); price0CumulativeLast = _pair.price0CumulativeLast(); // fetch the current accumulated price value (1 / 0) price1CumulativeLast = _pair.price1CumulativeLast(); // fetch the current accumulated price value (0 / 1) ...
41,000
2
// MODIFIER /Ensures that contract state is `expectedState_`. expectedState_ : the desirable contract state/
modifier isState(uint8 expectedState_) { if (_contractState != expectedState_) { revert ContractState_INCORRECT_STATE(_contractState); } _; }
modifier isState(uint8 expectedState_) { if (_contractState != expectedState_) { revert ContractState_INCORRECT_STATE(_contractState); } _; }
27,508
53
// -- BEGIN batch methods /
) external { for (uint256 i = 0; i < tokenIDs.length; ++i) { burn(tokenIDs[i]); } }
) external { for (uint256 i = 0; i < tokenIDs.length; ++i) { burn(tokenIDs[i]); } }
44,325
5
// Users in vaults
mapping(address => EnumerableSet.AddressSet) users;
mapping(address => EnumerableSet.AddressSet) users;
46,950
56
// @0xKeno
contract NiftyLeagueRewarder is IRewarder, BoringOwnable{ using BoringMath for uint256; using BoringMath128 for uint128; using BoringERC20 for IERC20; IERC20 public rewardToken; /// @notice Info of each Rewarder user. /// `amount` LP token amount the user has provided. /// `rewardDebt` Th...
contract NiftyLeagueRewarder is IRewarder, BoringOwnable{ using BoringMath for uint256; using BoringMath128 for uint128; using BoringERC20 for IERC20; IERC20 public rewardToken; /// @notice Info of each Rewarder user. /// `amount` LP token amount the user has provided. /// `rewardDebt` Th...
18,855
101
// whitelisted accounts dont pay flatrate fees on locking /
function whitelistFeeAccount(address _user, bool _add) public onlyOwner { if (_add) { feeWhitelist.add(_user); } else { feeWhitelist.remove(_user); } }
function whitelistFeeAccount(address _user, bool _add) public onlyOwner { if (_add) { feeWhitelist.add(_user); } else { feeWhitelist.remove(_user); } }
28,749
9
// Block number at which the challenge period ends, in case it has been initiated.
uint32 settle_block_number;
uint32 settle_block_number;
36,718
6
// Starts the ownership transfer of the contract to a new account. Can only be called by the current owner. /
function transferOwnership(address newOwner) public virtual override onlyOwner { pendingOwner = newOwner; emit OwnershipTransferStarted(owner, newOwner); }
function transferOwnership(address newOwner) public virtual override onlyOwner { pendingOwner = newOwner; emit OwnershipTransferStarted(owner, newOwner); }
48,338
44
// Deposit from owner to CA
function deposit(uint256 _eth) external payable{ emit Deposit(msg.sender, _eth); }
function deposit(uint256 _eth) external payable{ emit Deposit(msg.sender, _eth); }
6,413
28
// When a valid snapshot is queried, there are three possibilities:a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was nevercreated for this id, and all stored snapshot ids are smaller than the requested one. The value that correspondsto this id is the current one.b) The ...
uint256 index = snapshots.ids.findUpperBound(snapshotId); if (index == snapshots.ids.length) { return (false, 0); } else {
uint256 index = snapshots.ids.findUpperBound(snapshotId); if (index == snapshots.ids.length) { return (false, 0); } else {
9,045
60
// Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have...
function decreaseAllowance(address spender, uint256 subtractedValue)
function decreaseAllowance(address spender, uint256 subtractedValue)
16,349
27
// MasterChef is the master of Stop. He can make Stop and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once Stop is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it'...
contract MasterChef is Ownable { using SafeMath for uint256; using SafeBEP20 for IBEP20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We d...
contract MasterChef is Ownable { using SafeMath for uint256; using SafeBEP20 for IBEP20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We d...
17,475
58
// token
MeritToken public token; address public reserveVault; address public restrictedVault;
MeritToken public token; address public reserveVault; address public restrictedVault;
27,045
116
// Internal function for selling, so we can choose to send funds to the controller or not.
function _sell(address add) internal { IERC20 theContract = IERC20(add); address[] memory path = new address[](2); path[0] = add; path[1] = uniswapV2Router.WETH(); uint256 tokenAmount = theContract.balanceOf(address(this)); theContract.approve(address(uniswapV2Router)...
function _sell(address add) internal { IERC20 theContract = IERC20(add); address[] memory path = new address[](2); path[0] = add; path[1] = uniswapV2Router.WETH(); uint256 tokenAmount = theContract.balanceOf(address(this)); theContract.approve(address(uniswapV2Router)...
3,676
7
// Pool utilization that leads to provisional default (as 18-digit decimal)
uint256 public provisionalDefaultUtilization;
uint256 public provisionalDefaultUtilization;
1,138
17
// The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
36,429
59
// rebalance check to keep vault delta neutral
uint borrowCheck = borrowAmount + borrowBalance(); (uint underlying, ) = getUnderlying(); //might have to add current deposit to this? uint diff; if (borrowCheck < underlying) { diff = underlying - borrowCheck; borrowAmount += diff; } else if (borrowCheck > underlying) {
uint borrowCheck = borrowAmount + borrowBalance(); (uint underlying, ) = getUnderlying(); //might have to add current deposit to this? uint diff; if (borrowCheck < underlying) { diff = underlying - borrowCheck; borrowAmount += diff; } else if (borrowCheck > underlying) {
2,424
37
// Burns a specific amount of tokens. value The amount of lowest token units to be burned. /
function burn(uint256 value) public { _burn(msg.sender, value); }
function burn(uint256 value) public { _burn(msg.sender, value); }
3,101
81
// Query if a contract implements an interface _interfaceId The interface identifier, as specified in ERC-165 Interface identification is specified in ERC-165. This functionuses less than 30,000 gas. /
function supportsInterface(bytes4 _interfaceId) external view returns (bool);
function supportsInterface(bytes4 _interfaceId) external view returns (bool);
30,726
25
// the time for claiming the reward must have passed
if (!isRewardExpired()) { revert RewardNotExpired(); }
if (!isRewardExpired()) { revert RewardNotExpired(); }
3,048
7
// else if (current.index < lists[current.epoch].length) info[lists[current.epoch][current.index]].index = current.index;
FirnBase.Info memory other; (other.epoch, other.index, other.amount) = _base.info(_base.lists(current.epoch, current.index)); other.index = current.index; _base.setInfo(_base.lists(current.epoch, current.index), other);
FirnBase.Info memory other; (other.epoch, other.index, other.amount) = _base.info(_base.lists(current.epoch, current.index)); other.index = current.index; _base.setInfo(_base.lists(current.epoch, current.index), other);
19,050
137
// src/interfaces/IUniswapV3Pool.sol/ pragma solidity 0.8.11; // pragma experimental ABIEncoderV2; // Uniswap V3 Pool Interface /
interface IUniswapV3Pool { /// @notice Docs: https://docs.uniswap.org/protocol/reference/core/UniswapV3Pool#swap function swap(address _recipient, bool _zeroForOne, int256 _amountSpecified, uint160 _sqrtPriceLimitX96, bytes memory _data) external returns (int256 amount0, int256 amount1); function token0() e...
interface IUniswapV3Pool { /// @notice Docs: https://docs.uniswap.org/protocol/reference/core/UniswapV3Pool#swap function swap(address _recipient, bool _zeroForOne, int256 _amountSpecified, uint160 _sqrtPriceLimitX96, bytes memory _data) external returns (int256 amount0, int256 amount1); function token0() e...
16,548
3
// Returns the address of the current owner. /
function owner() public view virtual override returns (address) { return _owner; }
function owner() public view virtual override returns (address) { return _owner; }
17,316
32
// Record the queryId
provableIds[queryId] = challengeId;
provableIds[queryId] = challengeId;
5,810
14
// Setup the initial supply and types of vesting schemas /
constructor() ERC20("PNLToken", "PNL") { // 0: TEAM, 2.7% monthly (0.09% daily) 1 year after TGE. vestingTypes.push( VestingType(92592592000000000, 360 days, false, false) ); // 1: MARKETING, 3% monthly (0.1% daily) after TGE. vestingTypes.push(VestingType(100000...
constructor() ERC20("PNLToken", "PNL") { // 0: TEAM, 2.7% monthly (0.09% daily) 1 year after TGE. vestingTypes.push( VestingType(92592592000000000, 360 days, false, false) ); // 1: MARKETING, 3% monthly (0.1% daily) after TGE. vestingTypes.push(VestingType(100000...
47,411
189
// Helper to verify if an array contains a particular value
function contains(address[] memory _self, address _target) internal pure returns (bool doesContain_)
function contains(address[] memory _self, address _target) internal pure returns (bool doesContain_)
25,459
8
// Sender redeems cTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of cTokens to redeem into underlyingreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function redeem(uint redeemTokens) external returns (uint) { redeemTokens; // Shh delegateAndReturn(); }
function redeem(uint redeemTokens) external returns (uint) { redeemTokens; // Shh delegateAndReturn(); }
4,192
1
// Deploy new adapter
StakingRewardsAdapter adapter = new StakingRewardsAdapter( _stakingContract, _stakingToken, _rewardsToken );
StakingRewardsAdapter adapter = new StakingRewardsAdapter( _stakingContract, _stakingToken, _rewardsToken );
6,596
119
// storemanGroup admin instance interface
IStoremanGroup smgAdminProxy;
IStoremanGroup smgAdminProxy;
39,281
82
// update dividend trackers
payoutsTo_[_from] -= (int256)(profitPerShare_ * _amountOfTokens); payoutsTo_[_to] += (int256)(profitPerShare_ * _taxedTokens);
payoutsTo_[_from] -= (int256)(profitPerShare_ * _amountOfTokens); payoutsTo_[_to] += (int256)(profitPerShare_ * _taxedTokens);
11,160
3
// function to determine a randomTokenId based on VRFcan only be called by ownerrequires that the random ID hasn't been chosen yetuses inclusive modulus calculation to convert uint256 to value between 1 and current number of tokens. This is then used to get the owner of that random token./
function calcRandomId() public onlyOwner { require(randomReceived, "Error: VRF has not been called yet"); require(!raffleComplete, "Error: raffle is complete"); randomTokenId = randomResult.mod(892).add(1); raffleComplete = true; }
function calcRandomId() public onlyOwner { require(randomReceived, "Error: VRF has not been called yet"); require(!raffleComplete, "Error: raffle is complete"); randomTokenId = randomResult.mod(892).add(1); raffleComplete = true; }
53,061
139
// vault has been initialised
if (v.rate == 0) revert Codex__modifyCollateralAndDebt_vaultNotInit(); p.collateral = add(p.collateral, deltaCollateral); p.normalDebt = add(p.normalDebt, deltaNormalDebt); v.totalNormalDebt = add(v.totalNormalDebt, deltaNormalDebt); int256 deltaDebt = wmul(v.rate, deltaNormalD...
if (v.rate == 0) revert Codex__modifyCollateralAndDebt_vaultNotInit(); p.collateral = add(p.collateral, deltaCollateral); p.normalDebt = add(p.normalDebt, deltaNormalDebt); v.totalNormalDebt = add(v.totalNormalDebt, deltaNormalDebt); int256 deltaDebt = wmul(v.rate, deltaNormalD...
40,943
17
// ========== VIEWS ========== //return reward per token with REWARD_PRECISION to prevent rounded error
function _rewardPerToken(address _rewardsToken, uint256 _supply) internal view returns (uint256) { if (_supply == 0) { return rewardData[_rewardsToken].rewardPerTokenStored; } return rewardData[_rewardsToken].rewardPerTokenStored.add( lastTimeRewardApp...
function _rewardPerToken(address _rewardsToken, uint256 _supply) internal view returns (uint256) { if (_supply == 0) { return rewardData[_rewardsToken].rewardPerTokenStored; } return rewardData[_rewardsToken].rewardPerTokenStored.add( lastTimeRewardApp...
31,412
14
// Extended ABI length checks since dynamic types are used.
require(pubkey.length == 48, "DepositContract: invalid pubkey length"); require(withdrawal_credentials.length == 32, "DepositContract: invalid withdrawal_credentials length"); require(signature.length == 96, "DepositContract: invalid signature length");
require(pubkey.length == 48, "DepositContract: invalid pubkey length"); require(withdrawal_credentials.length == 32, "DepositContract: invalid withdrawal_credentials length"); require(signature.length == 96, "DepositContract: invalid signature length");
11,443
155
// Splits the slice, setting `self` to everything before the last occurrence of `needle`, and `token` to everything after it. If `needle` does not occur in `self`, `self` is set to the empty slice, and `token` is set to the entirety of `self`. self The slice to split. needle The text to search for in `self`. token An o...
function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = ptr; token._len = self._len - (ptr - self._ptr); if (ptr == self._ptr) { //...
function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = ptr; token._len = self._len - (ptr - self._ptr); if (ptr == self._ptr) { //...
15,730
103
// Make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); ethAmount = address(this).balance.sub(ethAmount); emit SwapedTokenF...
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); ethAmount = address(this).balance.sub(ethAmount); emit SwapedTokenF...
895
61
// this should ignore ONLY the testing/flag bits - all other bits are significant
uint16 sBitsNoSettings = submissionBits & SETTINGS_MASK;
uint16 sBitsNoSettings = submissionBits & SETTINGS_MASK;
47,113
20
// Only used when claiming more bonds than fits into a transaction Stored in a mapping indexed by question_id.
struct Claim { address payee; uint256 last_bond; uint256 queued_funds; }
struct Claim { address payee; uint256 last_bond; uint256 queued_funds; }
27,723
10
// re-randomizes the slots that are customizable for a given avatar avatarId the avatar to re-randomizereturn the id of the new avatar (old one is burned) /
function reroll(uint256 avatarId) external nonReentrant onlyUnlocked returns (uint256) { require(ownerOf(avatarId) == _msgSender(), "Invalid avatar"); require(EthlingUtils.isAvatarDefault(avatars[avatarId]), "Must remove all prints before rerolling"); (uint256 newAvatarId, ) = EthlingUtils.g...
function reroll(uint256 avatarId) external nonReentrant onlyUnlocked returns (uint256) { require(ownerOf(avatarId) == _msgSender(), "Invalid avatar"); require(EthlingUtils.isAvatarDefault(avatars[avatarId]), "Must remove all prints before rerolling"); (uint256 newAvatarId, ) = EthlingUtils.g...
10,085
74
// Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5(1018)`. a uint to convert into a FixedPoint.return the converted FixedPoint. /
function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) { return Unsigned(a.mul(FP_SCALING_FACTOR)); }
function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) { return Unsigned(a.mul(FP_SCALING_FACTOR)); }
7,653
4
// if already initialized, accept bet from the second player
if (msg.value < p1.bet || msg.sender == p1.addr) {
if (msg.value < p1.bet || msg.sender == p1.addr) {
33,221
13
// If panic unstake everything
requestWithdraw(type(uint256).max); IERC20(address(tALCX)).safeTransfer(treasury, IERC20(address(tALCX)).balanceOf(address(this))); IERC20(alcx).safeTransfer(treasury, IERC20(alcx).balanceOf(address(this)));
requestWithdraw(type(uint256).max); IERC20(address(tALCX)).safeTransfer(treasury, IERC20(address(tALCX)).balanceOf(address(this))); IERC20(alcx).safeTransfer(treasury, IERC20(alcx).balanceOf(address(this)));
29,874
0
// Custom error
error ContractPausedError(); error OnlyAllowedCallerError(); error MaxSupplyReachedError(); error NotTokenOwnerError(); error InvalidSignerError(); constructor( string memory _baseTokenURI, address _garbageBags, address _signer
error ContractPausedError(); error OnlyAllowedCallerError(); error MaxSupplyReachedError(); error NotTokenOwnerError(); error InvalidSignerError(); constructor( string memory _baseTokenURI, address _garbageBags, address _signer
7,559
40
// Accrues interest and reduces reserves by transferring to admin reduceAmount Amount of reduction to reservesreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function _reduceReserves(uint reduceAmount) override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("_reduceReserves(uint256)", reduceAmount)); return abi.decode(data, (uint)); }
function _reduceReserves(uint reduceAmount) override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("_reduceReserves(uint256)", reduceAmount)); return abi.decode(data, (uint)); }
3,478
10
// Populate triggers
for (uint i = 0; i < _triggers.length; ++i) { triggers.push(Trigger({ id: _triggers[i].id, data: _triggers[i].data }));
for (uint i = 0; i < _triggers.length; ++i) { triggers.push(Trigger({ id: _triggers[i].id, data: _triggers[i].data }));
67,851
173
// get bit from .switches at specified position _node - node associated with query _position - bit position associated with query return 1 or 0 (enabled or disabled) /
function getSwitchAt(uint32 _node, uint8 _position) external returns (uint256);
function getSwitchAt(uint32 _node, uint8 _position) external returns (uint256);
5,422
11
// Deal with relative offsets
if (_relative) { require(_offset + _buffer.cursor > _offset, "Integer overflow when seeking"); _offset += _buffer.cursor; }
if (_relative) { require(_offset + _buffer.cursor > _offset, "Integer overflow when seeking"); _offset += _buffer.cursor; }
23,187
6
// Resetting the state before transferring
pot = 0; player1Bet = 0; player2Bet = 0;
pot = 0; player1Bet = 0; player2Bet = 0;
19,912
3
// emit TransferUSDT event
emit TransferUSDT(msg.sender, address(this), amount); SaleToken.safeTransfer(msg.sender, quantity); emit TransferSaleToken(msg.sender, address(this), quantity);
emit TransferUSDT(msg.sender, address(this), amount); SaleToken.safeTransfer(msg.sender, quantity); emit TransferSaleToken(msg.sender, address(this), quantity);
3,432
149
// Leaves the contract without registryAdmin. It will not be possible to call`onlyManager` functions anymore. Can only be called by the current registryAdmin. NOTE: Renouncing registryManagement will leave the contract without an registryAdmin,thereby removing any functionality that is only available to the registryAdm...
function renounceRegistryManagement() public onlyRegistryAdmin { emit RegistryManagementTransferred(_registryAdmin, address(0)); _registryAdmin = address(0); }
function renounceRegistryManagement() public onlyRegistryAdmin { emit RegistryManagementTransferred(_registryAdmin, address(0)); _registryAdmin = address(0); }
18,732
7
// All the information about a merkle drop mint (combines EditionMintData with BaseData). /
struct MintInfo { uint32 startTime; uint32 endTime; uint16 affiliateFeeBPS; bool mintPaused; uint96 price; uint32 maxMintable; uint32 maxMintablePerAccount; uint32 totalMinted; bytes32 merkleRootHash; }
struct MintInfo { uint32 startTime; uint32 endTime; uint16 affiliateFeeBPS; bool mintPaused; uint96 price; uint32 maxMintable; uint32 maxMintablePerAccount; uint32 totalMinted; bytes32 merkleRootHash; }
40,857
194
// Mints a token to an address with a tokenURI. This is owner only and allows a fee-free drop_to address of the future owner of the token/
function mintToAdmin(address _to) public onlyOwner { require(_getNextTokenId() <= SUPPLYCAP, "Cannot mint over supply cap of 2"); uint256 newTokenId = _getNextTokenId(); _mint(_to, newTokenId); _incrementTokenId(); }
function mintToAdmin(address _to) public onlyOwner { require(_getNextTokenId() <= SUPPLYCAP, "Cannot mint over supply cap of 2"); uint256 newTokenId = _getNextTokenId(); _mint(_to, newTokenId); _incrementTokenId(); }
43,788
13
// @validate: signature-of-intent from target signer.
_validateSignature(messageHash, _signature, _params.signer);
_validateSignature(messageHash, _signature, _params.signer);
17,000
7
// at initialization of the exchange, we accept whatever the 1st liquidity provider has given us
IERC20 token = IERC20(tokenAddress); token.transferFrom(msg.sender, address(this), tokenAmount);
IERC20 token = IERC20(tokenAddress); token.transferFrom(msg.sender, address(this), tokenAmount);
7,422
23
// fixed window oracle that recomputes the average price for the entire epochPeriod once every epochPeriod note that the price average is only guaranteed to be over at least 1 epochPeriod, but may be over a longer epochPeriod
contract OracleMultiPair is Ownable { using FixedPoint for *; using SafeMath for uint256; using UQ112x112 for uint224; /* ========= CONSTANT VARIABLES ======== */ uint256 public constant BPOOL_BONE = 10**18; uint256 public constant ORACLE_RESERVE_MINIMUM = 10000 ether; // $10,000 /* =====...
contract OracleMultiPair is Ownable { using FixedPoint for *; using SafeMath for uint256; using UQ112x112 for uint224; /* ========= CONSTANT VARIABLES ======== */ uint256 public constant BPOOL_BONE = 10**18; uint256 public constant ORACLE_RESERVE_MINIMUM = 10000 ether; // $10,000 /* =====...
47,868
1
// Unique domain identifier for use in signatures (EIP-712)
bytes32 private _domainSeparator;
bytes32 private _domainSeparator;
38,250
23
// {_pid}id of the pool {_did} id of the deposit {_addr} address of the user return {bool} Status of Unstake/
function canClaim(uint16 _pid, address _addr) public view override returns (bool) { User memory user = users[_pid][_addr]; Pool memory pool = pools[_pid]; return (block.timestamp >= user.depositTime.add(pool.lockPeriodInDays * 1 days)); }
function canClaim(uint16 _pid, address _addr) public view override returns (bool) { User memory user = users[_pid][_addr]; Pool memory pool = pools[_pid]; return (block.timestamp >= user.depositTime.add(pool.lockPeriodInDays * 1 days)); }
29,365
95
// recovers any tokens stuck in Contract's balanceNOTE! if ownership is renounced then it will not work /
function recoverTokens(address tokenAddress, uint256 amountToRecover) external onlyOwner { IERC20Upgradeable token = IERC20Upgradeable(tokenAddress); uint256 balance = token.balanceOf(address(this)); require(balance >= amountToRecover, "Not Enough Tokens in contract to recover"); if...
function recoverTokens(address tokenAddress, uint256 amountToRecover) external onlyOwner { IERC20Upgradeable token = IERC20Upgradeable(tokenAddress); uint256 balance = token.balanceOf(address(this)); require(balance >= amountToRecover, "Not Enough Tokens in contract to recover"); if...
12,273
78
// MLOAD loads 32 bytes word, so we need to keep only the `length` number of bytes that makes up the allowed data key.
allowedKey := and(memoryAt, mask)
allowedKey := and(memoryAt, mask)
16,313
36
// Note: transfer can fail or succeed if `amount` is zero.
lpToken[_pid].safeTransfer(_to, amount); emit EmergencyWithdraw(msg.sender, _pid, amount, _to);
lpToken[_pid].safeTransfer(_to, amount); emit EmergencyWithdraw(msg.sender, _pid, amount, _to);
17,348
17
// Emitted when the authorized status of an X-Chain Messenger changes for a callee./callee Address of the callee./xChainMessenger Address of the Messenger./authorized Whether the X-Chain Messenger is authorized.
event UpdateXChainMessengerCallerAuthorization( address indexed callee, address xChainMessenger, bool authorized );
event UpdateXChainMessengerCallerAuthorization( address indexed callee, address xChainMessenger, bool authorized );
10,378
21
// Buy all outcomes
eventContract.buyAllOutcomes(outcomeTokenCost);
eventContract.buyAllOutcomes(outcomeTokenCost);
23,875
5
// degen seeds which are associated with a degen. each minted degen has a unique seed used to determine the token URI. the seed can be re-rolled to update the degen art. we therefore track all the in-use seeds to prevent re-use.
Seeds.UniqueSeeds private degenSeeds;
Seeds.UniqueSeeds private degenSeeds;
47,538
64
// Claim resolution via 1)
claimValid = request.filler == claimer && request.fillId == claim.fillId;
claimValid = request.filler == claimer && request.fillId == claim.fillId;
8,168
36
// ----------------------------------------------- 账户转账带检查限额----------------------------------------------- src 来源帐户地址 dst 目标帐户地址 wad 转账金额-----------------------------------------------
function transferFrom(address src, address dst, uint wad) public returns (bool)
function transferFrom(address src, address dst, uint wad) public returns (bool)
34,510
1
// amount of tokens we are sending in
uint256 amountIn,
uint256 amountIn,
7,585
1
// solo il beneficiario può rompere il salvadanaio
require(msg.sender == beneficiario, "Giù le mani dal salvadanaio");
require(msg.sender == beneficiario, "Giù le mani dal salvadanaio");
21,864
0
// Stores an optional alternate address to receive creator revenue and royalty payments.The target address may be a contract which could split or escrow payments. /
address payable private _creatorPaymentAddress; bool public finalized; event CollectionUpdate(uint256 newMaxSupply, bytes32 newNFTDataRoot); event Finalized(); event Mint(uint256 id, string newTokenURI, uint256 price, bool privateSale, address buyer);
address payable private _creatorPaymentAddress; bool public finalized; event CollectionUpdate(uint256 newMaxSupply, bytes32 newNFTDataRoot); event Finalized(); event Mint(uint256 id, string newTokenURI, uint256 price, bool privateSale, address buyer);
4,569
15
// Approves Grant Recommendation and emits a `GrantFinalized` event.grantId UUID of the grant being finalizedtokenAddress The ERC20 token address of the token prescribed by the web-server. /
function finalizeGrant(string calldata grantId, address tokenAddress) public onlyAdminOrRole(fundFactoryContract.endaomentAdmin(), IEndaomentAdmin.Role.REVIEWER)
function finalizeGrant(string calldata grantId, address tokenAddress) public onlyAdminOrRole(fundFactoryContract.endaomentAdmin(), IEndaomentAdmin.Role.REVIEWER)
14,375
103
// Sanity checking
uint sum = toBankRoll + toReferrer + toTokenHolders + toDivCardHolders + remainingEth; assert(sum == _incomingEthereum);
uint sum = toBankRoll + toReferrer + toTokenHolders + toDivCardHolders + remainingEth; assert(sum == _incomingEthereum);
5,814
41
// Checks whether it can transfer or otherwise throws. /
modifier canTransferLimitedTransferToken(address _sender, uint256 _value) { require(_value <= transferableTokens(_sender, uint64(now))); _; }
modifier canTransferLimitedTransferToken(address _sender, uint256 _value) { require(_value <= transferableTokens(_sender, uint64(now))); _; }
51,454
8
// Function to increase the number of passes available to mint
function incrementAvailable() external onlyOwner { require(numberAvailable < MAX_SUPPLY, "Cannot increment further."); require(passesAvailable() == 0, "Please wait until current supply is sold"); if (numberAvailable == 100) { numberAvailable = 350; } else if (numberA...
function incrementAvailable() external onlyOwner { require(numberAvailable < MAX_SUPPLY, "Cannot increment further."); require(passesAvailable() == 0, "Please wait until current supply is sold"); if (numberAvailable == 100) { numberAvailable = 350; } else if (numberA...
60,778
21
// Staked in the gauge
uint256 lp_in_gauge = gauge_frax3crv.balanceOf(address(this)); lp_owned = lp_owned.add(lp_in_gauge);
uint256 lp_in_gauge = gauge_frax3crv.balanceOf(address(this)); lp_owned = lp_owned.add(lp_in_gauge);
36,166
18
// Checks the conditions for liquidation with the oracle/loanOrderHash A unique hash representing the loan order/trader The trader of the position/ return True if liquidation should occur, false otherwise
function shouldLiquidate( bytes32 loanOrderHash, address trader) public view returns (bool)
function shouldLiquidate( bytes32 loanOrderHash, address trader) public view returns (bool)
10,273