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
378
// Associate designer
designers[tokenId] = _designer; return tokenId;
designers[tokenId] = _designer; return tokenId;
2,853
67
// Address of operator
address public operator;
address public operator;
12,718
220
// WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible /
function _mint(address to, uint256 boosterId, string memory _typeOfBoost) internal { require(to != address(0), "BOOSTERS: Cannot mint to zero address"); require(!_exists(boosterId), "BOOSTERS: Already minted"); BoostersEnumerableSet.ownedBooster memory newBooster = BoostersEnumerableSet.ow...
function _mint(address to, uint256 boosterId, string memory _typeOfBoost) internal { require(to != address(0), "BOOSTERS: Cannot mint to zero address"); require(!_exists(boosterId), "BOOSTERS: Already minted"); BoostersEnumerableSet.ownedBooster memory newBooster = BoostersEnumerableSet.ow...
26,764
16
// External function for calculating how much SWM tokens are needed to be stakedin order to get 1 SRC20 tokensrc20 Address of src20 token contractreturn Amount of SWM tokens /
function getSrc20toSwmRatio(address src20) external returns (uint256) { uint256 totalSupply = ISRC20(src20).totalSupply(); return totalSupply.mul(10 ** 18).div(_registry[src20].stake); }
function getSrc20toSwmRatio(address src20) external returns (uint256) { uint256 totalSupply = ISRC20(src20).totalSupply(); return totalSupply.mul(10 ** 18).div(_registry[src20].stake); }
44,193
27
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
31,482
145
// Hook that is called after any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero.- `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]. /
function _afterTokenTransfer( address from, address to, uint256 tokenId
function _afterTokenTransfer( address from, address to, uint256 tokenId
3,479
242
// Used to store old model for use in the event that is emitted on success
InterestRateModel oldInterestRateModel;
InterestRateModel oldInterestRateModel;
259
111
// Gets the token name. return string representing the token name/
function name() external view returns (string memory) { return _name; }
function name() external view returns (string memory) { return _name; }
23,404
96
// Contract for locking mechanism.Locker can add and remove locked account.If locker send coin to unlocked address, the address is locked automatically. /
contract Lockable is Context { using SafeMath for uint; struct TimeLock { uint amount; uint expiresAt; } mapping(address => bool) private _lockers; mapping(address => bool) private _locks; mapping(address => TimeLock[]) private _timeLocks; event LockerAdded(address indexed account); event Loc...
contract Lockable is Context { using SafeMath for uint; struct TimeLock { uint amount; uint expiresAt; } mapping(address => bool) private _lockers; mapping(address => bool) private _locks; mapping(address => TimeLock[]) private _timeLocks; event LockerAdded(address indexed account); event Loc...
31,094
7
// Transfers `tokenId` token from `from` to `to`.
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to m...
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to m...
16,544
144
// Returns the token identifier for the `_index`th NFT. Sort order is not specified. _index A counter less than `totalSupply()`.return Token id. /
function tokenByIndex( uint256 _index ) external view
function tokenByIndex( uint256 _index ) external view
22,035
78
// TimeLocked/Applicature/helper mixed to other contracts to lock contract on a timestamp/Base class
contract TimeLocked { uint256 public time; mapping(address => bool) public excludedAddresses; modifier isTimeLocked(address _holder, bool _timeLocked) { bool locked = (block.timestamp < time); require(excludedAddresses[_holder] == true || locked == _timeLocked); _; } constr...
contract TimeLocked { uint256 public time; mapping(address => bool) public excludedAddresses; modifier isTimeLocked(address _holder, bool _timeLocked) { bool locked = (block.timestamp < time); require(excludedAddresses[_holder] == true || locked == _timeLocked); _; } constr...
36,594
8
// 1 - Uoptimal in WAD
_U_Optimal_inverted_WAD = WadRayMath.WAD.sub(U_optimal_WAD); _R_base_RAY = WadRayMath.RAY.percentMul(R_base); _R_slope1_RAY = WadRayMath.RAY.percentMul(R_slope1); _R_slope2_RAY = WadRayMath.RAY.percentMul(R_slope2);
_U_Optimal_inverted_WAD = WadRayMath.WAD.sub(U_optimal_WAD); _R_base_RAY = WadRayMath.RAY.percentMul(R_base); _R_slope1_RAY = WadRayMath.RAY.percentMul(R_slope1); _R_slope2_RAY = WadRayMath.RAY.percentMul(R_slope2);
34,150
20
// It's probably never going to happen, 4 billion cats is A LOT, but let's just be 100% sure we never let this happen.
require(newKittenId == uint256(uint32(newKittenId)), "4 Billion cats max"); emit Birth(owner, newKittenId, uint256(_kitty.mumId), uint256(_kitty.dadId), _kitty.genes);
require(newKittenId == uint256(uint32(newKittenId)), "4 Billion cats max"); emit Birth(owner, newKittenId, uint256(_kitty.mumId), uint256(_kitty.dadId), _kitty.genes);
17,255
294
// This is a function call as it minimized the bytecode size
requireSelfCall(); _;
requireSelfCall(); _;
26,780
18
// https:www.geeksforgeeks.org/bresenhams-circle-drawing-algorithm/
int256 x = 0; int256 y = int256(r); int256 d = 3 - 2 * r; canvas = _drawCircle(canvas, char, xc, yc, uint256(x), uint256(y)); while (y >= x) { x++; if (d > 0) { y--;
int256 x = 0; int256 y = int256(r); int256 d = 3 - 2 * r; canvas = _drawCircle(canvas, char, xc, yc, uint256(x), uint256(y)); while (y >= x) { x++; if (d > 0) { y--;
44,877
85
// Transfers ownership of the contract to a new account (`newOwner`).Internal function without access restriction. /
function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); }
function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); }
58,792
50
// Records number of AnyswapV3ERC20 token that account (second) will be allowed to spend on behalf of another account (first) through {transferFrom}.
mapping (address => mapping (address => uint256)) public override allowance; event LogChangeVault(address indexed oldVault, address indexed newVault, uint indexed effectiveTime); event LogChangeMPCOwner(address indexed oldOwner, address indexed newOwner, uint indexed effectiveHeight); event LogSwapin(b...
mapping (address => mapping (address => uint256)) public override allowance; event LogChangeVault(address indexed oldVault, address indexed newVault, uint indexed effectiveTime); event LogChangeMPCOwner(address indexed oldOwner, address indexed newOwner, uint indexed effectiveHeight); event LogSwapin(b...
1,402
2
// disable controller by setting ZeroAddress to the entry in controllers-mapping _controllerId The Id of controller-implementation in the controllers mapping /
function disableController(uint32 _controllerId) external;
function disableController(uint32 _controllerId) external;
3,491
0
// @custom:attribution https:github.com/GNSPS/solidity-bytes-utils/Slices a byte array with a given starting index and length. Returns a new byte array/ as opposed to a pointer to the original array. Will throw if trying to slice more/ bytes than exist in the array./_bytes Byte array to slice./_start Starting index of ...
function slice( bytes memory _bytes, uint256 _start, uint256 _length
function slice( bytes memory _bytes, uint256 _start, uint256 _length
23,818
46
// emit event attack boss
emit eventAttackBoss(b.bossRoundNumber, msg.sender, _value, dame, now, isLastHit, crystalsBonus);
emit eventAttackBoss(b.bossRoundNumber, msg.sender, _value, dame, now, isLastHit, crystalsBonus);
19,371
27
// Synth loan storage struct
struct SynthLoanStruct { // Acccount that created the loan address payable account; // Amount (in collateral token ) that they deposited uint256 collateralAmount; // Amount (in synths) that they issued to borrow uint256 loanAmount; // Minting Fee ui...
struct SynthLoanStruct { // Acccount that created the loan address payable account; // Amount (in collateral token ) that they deposited uint256 collateralAmount; // Amount (in synths) that they issued to borrow uint256 loanAmount; // Minting Fee ui...
20,708
55
// Taxes for last round token winner
if (tokenWinner[_tokenId]!=address(0)) tokenWinner[_tokenId].transfer(feeThree);
if (tokenWinner[_tokenId]!=address(0)) tokenWinner[_tokenId].transfer(feeThree);
43,902
28
// receive() external payable { }
function setShare(address shareholder, uint256 amount) external override onlyToken { if (shares[shareholder].amount > 0) { distributeDividend(shareholder); }
function setShare(address shareholder, uint256 amount) external override onlyToken { if (shares[shareholder].amount > 0) { distributeDividend(shareholder); }
39,920
0
// As goal needs to be met for a successful crowdsalethe value needs to less or equal than a cap which is limit for accepted funds
require(_goal <= _cap);
require(_goal <= _cap);
47,999
21
// De-Whitelist new provider Module(s)/_modules Addresses of the modules which will be removed
function removeProviderModules(IGelatoProviderModule[] calldata _modules) external;
function removeProviderModules(IGelatoProviderModule[] calldata _modules) external;
31,825
129
// settle();
}
}
27,873
66
// Check permission of administrator. Implementation is within the AdminController contract.Data will be used for future extension. /
modifier onlyAdmin(bytes memory data) { require(_adminController.isAdmin(msg.sender, data), "Caller is not the Admin"); _; }
modifier onlyAdmin(bytes memory data) { require(_adminController.isAdmin(msg.sender, data), "Caller is not the Admin"); _; }
14,850
42
// get DEA and send to Vault
if(rewards > 0){ controller.buyForStrategy( rewards, vault.getRewardToken(), address(vault) ); }
if(rewards > 0){ controller.buyForStrategy( rewards, vault.getRewardToken(), address(vault) ); }
52,875
299
// avoid stack too deep
(, SignedDecimal.signedDecimal memory unrealizedPnl) = getPositionNotionalAndUnrealizedPnl(_exchange, trader, PnlCalcOption.SPOT_PRICE); positionResp.unrealizedPnlAfter = unrealizedPnl;
(, SignedDecimal.signedDecimal memory unrealizedPnl) = getPositionNotionalAndUnrealizedPnl(_exchange, trader, PnlCalcOption.SPOT_PRICE); positionResp.unrealizedPnlAfter = unrealizedPnl;
10,241
91
// increase asyncDefiInteractionHashes.length by 1
let oldState := and(not(shl(ASYNCDEFIINTERACTIONHASHES_BIT_OFFSET, ARRAY_LENGTH_MASK)), state) let newState := or(oldState, shl(ASYNCDEFIINTERACTIONHASHES_BIT_OFFSET, add(asyncArrayLen, 0x01))) sstore(rollupState.slot, newState)
let oldState := and(not(shl(ASYNCDEFIINTERACTIONHASHES_BIT_OFFSET, ARRAY_LENGTH_MASK)), state) let newState := or(oldState, shl(ASYNCDEFIINTERACTIONHASHES_BIT_OFFSET, add(asyncArrayLen, 0x01))) sstore(rollupState.slot, newState)
14,666
26
// swap fee for reward token
bool isSuccess = _swapTokensForGB(amount); uint256 liqTokens = amount.div(4); uint256 daoTokens = amount.sub(liqTokens); if (isSuccess) { IERC20(rewardToken).transfer(_DAOWalletAddress, daoTokens); }
bool isSuccess = _swapTokensForGB(amount); uint256 liqTokens = amount.div(4); uint256 daoTokens = amount.sub(liqTokens); if (isSuccess) { IERC20(rewardToken).transfer(_DAOWalletAddress, daoTokens); }
482
3
// Emitted when the beacon is changed. /
event BeaconUpgraded(address indexed beacon);
event BeaconUpgraded(address indexed beacon);
24,787
296
// Return the actual amount withdrawn if less than requested
uint256 _withdrawn = MathUpgradeable.min(_postWant, _amount); emit WithdrawState(_amount, _preWant, _postWant, _withdrawn); return _withdrawn;
uint256 _withdrawn = MathUpgradeable.min(_postWant, _amount); emit WithdrawState(_amount, _preWant, _postWant, _withdrawn); return _withdrawn;
32,151
34
// Pausable/Iulian Rotaru/Pausable logics, reading storage slot to retrieve pause state
contract Pausable { // // _ _ // ___ ___ _ __ ___| |_ __ _ _ __ | |_ ___ // / __/ _ \| '_ \/ __| __/ _` | '_ \| __/ __| // | (_| (_) | | | \__ \ || (_| | | | | |_\__ \ // \___\___/|_| |_|___/\__\__,_|_| |_|\__|___/ // // Storage slot for the Paused state bytes3...
contract Pausable { // // _ _ // ___ ___ _ __ ___| |_ __ _ _ __ | |_ ___ // / __/ _ \| '_ \/ __| __/ _` | '_ \| __/ __| // | (_| (_) | | | \__ \ || (_| | | | | |_\__ \ // \___\___/|_| |_|___/\__\__,_|_| |_|\__|___/ // // Storage slot for the Paused state bytes3...
50,748
10
// Events :
event TokensReleased(uint256 releasedAmount); event TokenVestingRevoked(uint256 revokedAmount); event LockAccepted(); event LockCanceled();
event TokensReleased(uint256 releasedAmount); event TokenVestingRevoked(uint256 revokedAmount); event LockAccepted(); event LockCanceled();
19,085
97
// IConstantFlowAgreementV1.getFlowOperatorDataByID implementation
function getFlowOperatorDataByID( ISuperfluidToken token, bytes32 flowOperatorId ) external view override returns(uint8 permissions, int96 flowRateAllowance)
function getFlowOperatorDataByID( ISuperfluidToken token, bytes32 flowOperatorId ) external view override returns(uint8 permissions, int96 flowRateAllowance)
11,406
11
// Returns the delay period before a new owner can be accepted. /
function delay() public view returns (uint256) { return LibDiamond.acceptanceDelay(); }
function delay() public view returns (uint256) { return LibDiamond.acceptanceDelay(); }
24,170
315
// If no owedToken needed for payout: give lender all owedToken, even if more than owed
if (transaction.payoutInHeldToken) { assert(receivedOwedToken >= lenderOwedToken); lenderOwedToken = receivedOwedToken; }
if (transaction.payoutInHeldToken) { assert(receivedOwedToken >= lenderOwedToken); lenderOwedToken = receivedOwedToken; }
46,005
139
// Submitted for verification at Etherscan.io on 2020-07-14// Submitted for verification at Etherscan.io on 2020-05-27/ File: zos-lib/contracts/Initializable.sol/ Maestro The Maestro is the main entry point for rebase operations. It coordinates the policyactions with external consumers. /
contract Maestro is Ownable { struct Transaction { bool enabled; address destination; bytes data; } event TransactionFailed( address indexed destination, uint256 index, bytes data ); // Stable ordering is not guaranteed. Transaction[] public tran...
contract Maestro is Ownable { struct Transaction { bool enabled; address destination; bytes data; } event TransactionFailed( address indexed destination, uint256 index, bytes data ); // Stable ordering is not guaranteed. Transaction[] public tran...
74,688
324
// locks an nft in the shelf requires an issued loan
function lock(uint loan) external owner(loan) { if(address(subscriber) != address(0)) { subscriber.lockEvent(loan); } NFTLike(shelf[loan].registry).transferFrom(msg.sender, address(this), shelf[loan].tokenId); emit Lock(loan); }
function lock(uint loan) external owner(loan) { if(address(subscriber) != address(0)) { subscriber.lockEvent(loan); } NFTLike(shelf[loan].registry).transferFrom(msg.sender, address(this), shelf[loan].tokenId); emit Lock(loan); }
19,868
3
// bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
62,566
0
// {ERC721} token, including:This contract uses {AccessControl} to lock permissioned functions using the/ Creates the borrowor note contract linked to a specific loan coreThe loan core reference is non-upgradeableSee (_setURI).Grants `PAUSER_ROLE`, `MINTER_ROLE`, and `BURNER_ROLE` to the sendercontract, provided it is ...
constructor(string memory name, string memory symbol) ERC721(name, symbol) ERC721Permit(name) { _setupRole(BURNER_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender());
constructor(string memory name, string memory symbol) ERC721(name, symbol) ERC721Permit(name) { _setupRole(BURNER_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender());
23,335
17
// Burns a specific amount of tokens from the target address and decrements allowance. from The account whose tokens will be burned. value The amount of token to be burned. /
function burnFrom(address from, uint256 value) public { persistBalanceDemurrage(from); persistTotalSupplyDemurrage(); _burnFrom(from, value); }
function burnFrom(address from, uint256 value) public { persistBalanceDemurrage(from); persistTotalSupplyDemurrage(); _burnFrom(from, value); }
53,225
4
// pick ERC2771Context over Ownable
function _msgSender() internal view override(Context, ERC2771Context)
function _msgSender() internal view override(Context, ERC2771Context)
27,136
63
// AllocatedEditionsStorage MirrorXYZ /
contract AllocatedEditionsStorage { // ============ Structs ============ /// @notice Contains general data about the NFT. struct NFTMetadata { string name; string symbol; bytes32 contentHash; } /// @notice Contains information pertaining to the edition spec. struct Edit...
contract AllocatedEditionsStorage { // ============ Structs ============ /// @notice Contains general data about the NFT. struct NFTMetadata { string name; string symbol; bytes32 contentHash; } /// @notice Contains information pertaining to the edition spec. struct Edit...
47,299
16
// Owner can withdraw tokens/tokenAddress: The address of the token to withdraw./amt: The amount to withdraw/Contract should only hold `FUEL_TOKEN_ADDRESS` tokens, but we allow withdrawing any token for safety/WARNING : manually withdrawing tokens will leave the contract underfunded.
function withdrawTokens(address tokenAddress, uint256 amt) public onlyOwner { ERC20(tokenAddress).transfer(msg.sender, amt); }
function withdrawTokens(address tokenAddress, uint256 amt) public onlyOwner { ERC20(tokenAddress).transfer(msg.sender, amt); }
14,246
2
// set the send() LayerZero messaging library version to _version_version - new messaging library version
function setSendVersion(uint16 _version) external;
function setSendVersion(uint16 _version) external;
20,013
75
// CappedWhitelistedCrowdsale Crowdsale with a limit for total contributions and per-beneficiary caps. Combination of CappedCrowdsale and IndividuallyCappedCrowdsale /
contract TieredPriceCrowdsale is Crowdsale { uint256 private _baseRate; uint256 private _tier2Start; uint256 private _tier3Start; uint256 private _tier4Start; constructor( uint256 baseRate, uint256 openingTimeTier2, uint256 openingTimeTier3, uint256 openingTimeTier4 ) ...
contract TieredPriceCrowdsale is Crowdsale { uint256 private _baseRate; uint256 private _tier2Start; uint256 private _tier3Start; uint256 private _tier4Start; constructor( uint256 baseRate, uint256 openingTimeTier2, uint256 openingTimeTier3, uint256 openingTimeTier4 ) ...
50,378
32
// See `IERC20PoolBorrowerActions` and `IERC721PoolBorrowerActions` for descriptions === Write state === - `SettlerActions._settleAuction` (`_removeAuction`): decrement kicker locked accumulator, increment kicker claimable accumumlator decrement auctions count accumulator update auction queue state - `Loans.update` (`_...
function repayDebt( AuctionsState storage auctions_, mapping(uint256 => Bucket) storage buckets_, DepositsState storage deposits_, LoansState storage loans_, PoolState calldata poolState_, address borrowerAddress_, uint256 maxQuoteTokenAmountToRepay_, ...
function repayDebt( AuctionsState storage auctions_, mapping(uint256 => Bucket) storage buckets_, DepositsState storage deposits_, LoansState storage loans_, PoolState calldata poolState_, address borrowerAddress_, uint256 maxQuoteTokenAmountToRepay_, ...
40,222
33
// Which KIM are you selling?
TokenAuction storage tokenOnAuction = tokenAuction[tokenIndex];
TokenAuction storage tokenOnAuction = tokenAuction[tokenIndex];
16,472
49
// Caches aggregated values from the User->Stake[] map to save computation. If lastAccountingTimestampSec is 0, there's no entry for that user.
struct UserTotals { uint256 stakingShares; uint256 stakingShareSeconds; uint256 lastAccountingTimestampSec; }
struct UserTotals { uint256 stakingShares; uint256 stakingShareSeconds; uint256 lastAccountingTimestampSec; }
27,979
19
// report new approval amount
Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true;
Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true;
53,676
20
// Reward ratio between LP staker and CLA staker
uint256 public lpRewardRatio; uint256 private constant CLA_REWARD_RATIO_DIVISOR = 1e12; uint256 private constant ACC_CLA_PRECISION = 1e12; uint256 private constant YEAR = 12 * 30 * 24 * 60 * 60; // Blocks
uint256 public lpRewardRatio; uint256 private constant CLA_REWARD_RATIO_DIVISOR = 1e12; uint256 private constant ACC_CLA_PRECISION = 1e12; uint256 private constant YEAR = 12 * 30 * 24 * 60 * 60; // Blocks
3,806
142
// Add a new lp to the pool. Can only be called by the owner. DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add( uint256 _allocPoint, IERC20 _token, bool _withUpdate
function add( uint256 _allocPoint, IERC20 _token, bool _withUpdate
60,304
8
// ----------------------------------------------------------------------------Modifiers ----------------------------------------------------------------------------
modifier onlyCEO() { require(msg.sender == CEOAddress); _; }
modifier onlyCEO() { require(msg.sender == CEOAddress); _; }
8,353
4
// Add asset proxy and log registration.
assetProxies[assetProxyId] = assetProxy; emit AssetProxySet(assetProxyId, newAssetProxy, oldAssetProxy);
assetProxies[assetProxyId] = assetProxy; emit AssetProxySet(assetProxyId, newAssetProxy, oldAssetProxy);
48,179
3
// contextB
uint64 currBufferIndex; uint40 prevResetIndex; uint40 currResetIndex;
uint64 currBufferIndex; uint40 prevResetIndex; uint40 currResetIndex;
10,929
22
// We highly recommend revalidating the upkeep in the performUpkeep function
if ((block.timestamp - lastTimeStamp) > interval ) { lastTimeStamp = block.timestamp; counter = counter + 1; pairOpponents(); }
if ((block.timestamp - lastTimeStamp) > interval ) { lastTimeStamp = block.timestamp; counter = counter + 1; pairOpponents(); }
20,918
76
// Checks whether the period in which the crowdsale is open has already elapsed.return Whether crowdsale period has elapsed /
function hasClosed() public view returns (bool) { return block.timestamp > _closingTime; }
function hasClosed() public view returns (bool) { return block.timestamp > _closingTime; }
11,353
208
// buildDeck();
string memory cardone = getCardOne(tokenId);
string memory cardone = getCardOne(tokenId);
8,337
241
// Restrict approvals to OPERATOR_ROLE members
bool private _tradingRestricted = false;
bool private _tradingRestricted = false;
72,699
3
// extension node
require(_nibblesToTraverse(Rlp.toData(currentNodeList[0]), nibblePath, pathPtr) != 0, "invalid extension node"); nodeKey = Rlp.toBytes32(currentNodeList[1]);
require(_nibblesToTraverse(Rlp.toData(currentNodeList[0]), nibblePath, pathPtr) != 0, "invalid extension node"); nodeKey = Rlp.toBytes32(currentNodeList[1]);
19,625
10
// reward factory only allow this to be called once even if ownerremoves ability to inject malicious staking contractstoken factory can also be immutable
if (rewardFactory == address(0)) { rewardFactory = _rfactory; tokenFactory = _tfactory; }
if (rewardFactory == address(0)) { rewardFactory = _rfactory; tokenFactory = _tfactory; }
9,808
16
// Public airdrop of tokens to _other_ addresses/to list of addresses to airdrop to
function airdrop(address[] memory to) public { require(mintIsOpen(), "Mint not open"); for (uint256 i = 0; i < to.length; i++) { _mint(to[i], currentTokenId.current()); currentTokenId.increment(); } }
function airdrop(address[] memory to) public { require(mintIsOpen(), "Mint not open"); for (uint256 i = 0; i < to.length; i++) { _mint(to[i], currentTokenId.current()); currentTokenId.increment(); } }
36,754
114
// transfers ether from smartcontract to zebiwallet
function withdraw(uint256 _value) public onlyOwner { wallet.transfer(_value); Withdraw(_value); }
function withdraw(uint256 _value) public onlyOwner { wallet.transfer(_value); Withdraw(_value); }
25,556
50
// F1 - F10: OK C1 - C24: OK
function bridgeFor(address token) public view returns (address bridge) { bridge = _bridges[token]; if (bridge == address(0)) { bridge = wavax; } }
function bridgeFor(address token) public view returns (address bridge) { bridge = _bridges[token]; if (bridge == address(0)) { bridge = wavax; } }
7,178
2
// initial balance to dev wallet to be split between vendor contract and staking rewards contract
uint _dev_Marketing_Tokens = 10000000;//10000000 to dev to be left with 100000 uint _thiscontract_Tokens = 5000000;//10000000 to dev to be left with 100000 _approve(address(this), address(dev_marketing_wallet), _dev_Marketing_Tokens);
uint _dev_Marketing_Tokens = 10000000;//10000000 to dev to be left with 100000 uint _thiscontract_Tokens = 5000000;//10000000 to dev to be left with 100000 _approve(address(this), address(dev_marketing_wallet), _dev_Marketing_Tokens);
25,933
20
// emit NewLog(id, _signature, _hashOfMessage);
emit NewLog(id, _signature, _encryptedMessage); return true;
emit NewLog(id, _signature, _encryptedMessage); return true;
29,808
168
// withdraw everything from the strategy to accurately check the share value
if (numberOfShares == totalSupply) { (bool status,) = bridgeStrategy.delegatecall(abi.encodeWithSelector(IBridgeStrategy(bridgeStrategy).withdrawAllToVault.selector, strategy)); require(status, "V:17"); } else {
if (numberOfShares == totalSupply) { (bool status,) = bridgeStrategy.delegatecall(abi.encodeWithSelector(IBridgeStrategy(bridgeStrategy).withdrawAllToVault.selector, strategy)); require(status, "V:17"); } else {
1,154
66
// Contract symbol
string public symbol = "TIGERLIST";
string public symbol = "TIGERLIST";
44,327
20
// Execute swaps
for (uint256 i = 0; i < tokens.length; i++) { if (tokens[i] != token) { uint256 balance = IERC20(tokens[i]).balanceOf(address(this)); if (balance > 0) { uint256[] memory amountsOut = _router.getAmountsOut(balance, paths[i]); _...
for (uint256 i = 0; i < tokens.length; i++) { if (tokens[i] != token) { uint256 balance = IERC20(tokens[i]).balanceOf(address(this)); if (balance > 0) { uint256[] memory amountsOut = _router.getAmountsOut(balance, paths[i]); _...
26,495
165
// Returns a newly allocated string containing the concatenation of `self` and `other`. self The first slice to concatenate. other The second slice to concatenate.return The concatenation of the two strings. /
function concat(slice memory self, slice memory other) internal pure returns (string memory) { string memory ret = new string(self._len + other._len); uint retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); memcpy(retptr + self._len, other._ptr,...
function concat(slice memory self, slice memory other) internal pure returns (string memory) { string memory ret = new string(self._len + other._len); uint retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); memcpy(retptr + self._len, other._ptr,...
38,227
51
// Swap - A StableSwap implementation in solidity. This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokensin desired ratios for an exchange of the pool token that represents their s...
contract Mobius_atUST_Swap is OwnerPausable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using MathUtils for uint256; using SwapUtils for SwapUtils.Swap; // Struct storing data responsible for automatic market maker functionalities. In order to // access this data,...
contract Mobius_atUST_Swap is OwnerPausable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using MathUtils for uint256; using SwapUtils for SwapUtils.Swap; // Struct storing data responsible for automatic market maker functionalities. In order to // access this data,...
24,646
37
// addListing(): add a point to the registry, including its corresponding price and owner address. optional reserved buyer address can be included.
function addListing(uint32 _point, uint96 _price, address _reservedBuyer) external
function addListing(uint32 _point, uint96 _price, address _reservedBuyer) external
36,110
2
// ERC-20 Transfer event
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Transfer(address indexed from, address indexed to, uint256 tokens);
36,609
128
// Override to prevent immediate delivery of tokens.
function _processPurchase( address _beneficiary, uint256 _tokenAmount
function _processPurchase( address _beneficiary, uint256 _tokenAmount
8,002
44
// makes an attempt to set an account to the list of known ones, for mining Limbo 0 address will not be added
function TryAddToAccountList(address account) internal { if (account == address(0) || _existInSet[account]) return; _existInSet[account] = true; _SetOfAccounts.push(account); }
function TryAddToAccountList(address account) internal { if (account == address(0) || _existInSet[account]) return; _existInSet[account] = true; _SetOfAccounts.push(account); }
23,340
197
// Function setOpenSaleActive to activate/desactivate the opensale/
function setOpenSaleActive( bool _isActive ) external onlyOwner
function setOpenSaleActive( bool _isActive ) external onlyOwner
10,979
50
// TokenVault TokenVault is a token holder contract that will allow abeneficiary to spend the tokens from some function of a specified ERC20 token /
contract TokenVault { using SafeERC20 for ERC20; // ERC20 token contract being held ERC20 public token; constructor(ERC20 _token) { require(address(_token) != address(0), "Token is zero address"); token = _token; } /** * @notice Allow the token itself to send tokens ...
contract TokenVault { using SafeERC20 for ERC20; // ERC20 token contract being held ERC20 public token; constructor(ERC20 _token) { require(address(_token) != address(0), "Token is zero address"); token = _token; } /** * @notice Allow the token itself to send tokens ...
17,466
24
// The initial COMP index for a market
uint224 public constant compInitialIndex = 1e36;
uint224 public constant compInitialIndex = 1e36;
14,022
23
// reduce the sender balance by the amount he sends
senderBalance -= _value; balances[msg.sender] = senderBalance;
senderBalance -= _value; balances[msg.sender] = senderBalance;
41,552
1
// deposit eth on behalf of proxy
DSProxy(payable(proxy)).execute{value: ethAmount}(AAVE_BASIC_PROXY, abi.encodeWithSignature("deposit(address,address,uint256)", market, ETH_ADDR, ethAmount));
DSProxy(payable(proxy)).execute{value: ethAmount}(AAVE_BASIC_PROXY, abi.encodeWithSignature("deposit(address,address,uint256)", market, ETH_ADDR, ethAmount));
14,932
28
// Total token supply.
function totalSupply() public pure returns (uint256) { return 1; }
function totalSupply() public pure returns (uint256) { return 1; }
75,459
400
// EIP-712 typehash for token approval via EIP-2612 permit.
bytes32 public constant PERMIT_TYPEHASH = keccak256( 'Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)' );
bytes32 public constant PERMIT_TYPEHASH = keccak256( 'Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)' );
43,948
130
// redeem bond for user_recipient address_stake bool return uint /
function redeem( address _recipient, bool _stake ) external returns ( uint ) { Bond memory info = bondInfo[ _recipient ]; uint percentVested = percentVestedFor( _recipient ); // (blocks since last interaction / vesting term remaining) if ( percentVested >= 10000 ) { // if fully vest...
function redeem( address _recipient, bool _stake ) external returns ( uint ) { Bond memory info = bondInfo[ _recipient ]; uint percentVested = percentVestedFor( _recipient ); // (blocks since last interaction / vesting term remaining) if ( percentVested >= 10000 ) { // if fully vest...
69,240
49
// Initializes a Chainlink request Sets the ID, callback address, and callback function signature on the request self The uninitialized request _id The Job Specification ID _callbackAddress The callback address _callbackFunction The callback function signaturereturn The initialized request /
function initialize( Request memory self, bytes32 _id, address _callbackAddress, bytes4 _callbackFunction
function initialize( Request memory self, bytes32 _id, address _callbackAddress, bytes4 _callbackFunction
64,403
112
// If the vault has an existing strategy, withdraw all funds from it.
if (strategy != address(0x0)) { IStrategy(strategy).withdrawAll(); }
if (strategy != address(0x0)) { IStrategy(strategy).withdrawAll(); }
26,250
38
// TWAP min delta (10-min)
uint256 minDeltaTwap; event TwapUpdated(uint256 priceCumulativeLast, uint256 blockTimestampLast, uint256 priceAverageLast); constructor(address router, address factory) Ownable() ERC20() { uniswapV2Router = router; uniswapV2Factory = factory; }
uint256 minDeltaTwap; event TwapUpdated(uint256 priceCumulativeLast, uint256 blockTimestampLast, uint256 priceAverageLast); constructor(address router, address factory) Ownable() ERC20() { uniswapV2Router = router; uniswapV2Factory = factory; }
26,577
11
// Update the address that the contract will make OperatorFilter checks against. When set to the zeroaddress, checks will be bypassed. OnlyOwner.@custom:event OperatorFilterRegistryAddressUpdated newRegistry The address of the registry that will be used for this contract /
function updateOperatorFilterRegistryAddress(address newRegistry) public virtual { if (msg.sender != owner()) { revert OnlyOwner(); } UpdatableOperatorFiltererUpgradeableStorage.layout()._operatorFilterRegistry = newRegistry; emit OperatorFilterRegistryAddressUpdated(newR...
function updateOperatorFilterRegistryAddress(address newRegistry) public virtual { if (msg.sender != owner()) { revert OnlyOwner(); } UpdatableOperatorFiltererUpgradeableStorage.layout()._operatorFilterRegistry = newRegistry; emit OperatorFilterRegistryAddressUpdated(newR...
10,026
10
// adds a bridge operator to the registry/bridgeOperator address
function add(address bridgeOperator) public onlyOwner { require(bridgeOperator != address(0)); bridgeOperators[bridgeOperator] = true; AddedBridgeOperator(bridgeOperator); }
function add(address bridgeOperator) public onlyOwner { require(bridgeOperator != address(0)); bridgeOperators[bridgeOperator] = true; AddedBridgeOperator(bridgeOperator); }
28,474
4
// Order is actually filled
result = safeAdd ( result, safeMul (nodeOrder.price, remainingAmount)); toSell = safeSub (toSell, remainingAmount);
result = safeAdd ( result, safeMul (nodeOrder.price, remainingAmount)); toSell = safeSub (toSell, remainingAmount);
29,512
1,025
// After the Boost/Repay check if the ratio doesn't trigger another call
function ratioGoodAfter(Method _method, uint _cdpId, uint _nextPrice) public view returns(bool, uint) { CdpHolder memory holder; (, holder) = subscriptionsContract.getCdpHolder(_cdpId); uint currRatio = getRatio(_cdpId, _nextPrice); if (_method == Method.Repay) { retur...
function ratioGoodAfter(Method _method, uint _cdpId, uint _nextPrice) public view returns(bool, uint) { CdpHolder memory holder; (, holder) = subscriptionsContract.getCdpHolder(_cdpId); uint currRatio = getRatio(_cdpId, _nextPrice); if (_method == Method.Repay) { retur...
26,119
187
// linaToken.mint(msg.sender, totalStaking.add(totalReward) );
linaToken.transfer(msg.sender, totalStaking.add(totalReward) ); emit Claim(msg.sender, totalReward, totalStaking); return true;
linaToken.transfer(msg.sender, totalStaking.add(totalReward) ); emit Claim(msg.sender, totalReward, totalStaking); return true;
13,974
50
// Total amount of staking rewards available
uint256 public override rewardsAmount;
uint256 public override rewardsAmount;
10,316
114
// Copies 32 bytes of `src` starting at `srcIndex` into `dst` starting at `dstIndex`. /
function memcpy32(string memory src, uint srcIndex, bytes memory dst, uint dstIndex) internal pure { assembly { mstore(add(add(dst, 32), dstIndex), mload(add(add(src, 32), srcIndex))) } }
function memcpy32(string memory src, uint srcIndex, bytes memory dst, uint dstIndex) internal pure { assembly { mstore(add(add(dst, 32), dstIndex), mload(add(add(src, 32), srcIndex))) } }
18,985
26
// Check if it is an airline
function isAirline ( address airlineAddress ) external view returns(bool)
function isAirline ( address airlineAddress ) external view returns(bool)
2,894
27
// Remember the initial block number // Short-circuit accumulating 0 interest // Read the previous values out of storage // Calculate the current borrow interest rate / Error.TOKEN_ERROR.failOpaque(FailureInfo.BORROW_RATE_ABSURDLY_HIGH, borrowRateMantissa);
borrowRateMantissa = BORROW_RATE_MAX_MANTISSA;
borrowRateMantissa = BORROW_RATE_MAX_MANTISSA;
28,302
27
// depositing X RING for 12 months, interest is about (1_unitInterestX / 107) KTON default: 1000
bytes32 public constant UINT_BANK_UNIT_INTEREST = "UINT_BANK_UNIT_INTEREST";
bytes32 public constant UINT_BANK_UNIT_INTEREST = "UINT_BANK_UNIT_INTEREST";
81,952
137
// Total dsec
uint256 epoch_dsec = total_dsec[epoch]; epoch_wound_down[epoch] = true; emit WindDownEpochState(previous_epoch, SFI_earned[epoch], epoch_dsec);
uint256 epoch_dsec = total_dsec[epoch]; epoch_wound_down[epoch] = true; emit WindDownEpochState(previous_epoch, SFI_earned[epoch], epoch_dsec);
33,279