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
55
// See {BEP2E-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {BEP2E}; Requirements:- `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for `sender`'s tokens of at least`amount`. /
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP2E: transfer amount exceeds allowance")); return true; }
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP2E: transfer amount exceeds allowance")); return true; }
58,814
176
// Reset the value to the default value.
delete myMap[_addr];
delete myMap[_addr];
6,903
7
// At any point owner is able to cancel monitor change
function cancelMonitorChange() public onlyOwner { require(changeRequestedTimestamp > 0); changeRequestedTimestamp = 0; newMonitor = address(0); emit MonitorChangeCanceled(); }
function cancelMonitorChange() public onlyOwner { require(changeRequestedTimestamp > 0); changeRequestedTimestamp = 0; newMonitor = address(0); emit MonitorChangeCanceled(); }
5,738
37
// Accrues interest and reduces all reserves by transferring to adminreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function _reduceReserves() override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("_reduceReserves()")); return abi.decode(data, (uint)); }
function _reduceReserves() override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("_reduceReserves()")); return abi.decode(data, (uint)); }
2,885
31
// Method for canceling the offer/_nftAddress NFT contract address/_tokenId TokenId
function cancelOffer(address _nftAddress, uint256 _tokenId) external offerExists(_nftAddress, _tokenId, _msgSender())
function cancelOffer(address _nftAddress, uint256 _tokenId) external offerExists(_nftAddress, _tokenId, _msgSender())
16,666
192
// Gets the collateral configuration paramters of the NFT self The NFT configurationreturn The state params representing ltv, liquidation threshold, liquidation bonus /
{ uint256 dataLocal = self.data; return ( dataLocal & ~LTV_MASK, (dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION, (dataLocal & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION ); }
{ uint256 dataLocal = self.data; return ( dataLocal & ~LTV_MASK, (dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION, (dataLocal & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION ); }
54,030
14
// Ownable Check contract ownable for some admin operations /
contract Ownable { address public owner; modifier onlyOwner() { require(msg.sender == owner); _; } function Ownable() public { owner = msg.sender; } function updateContractOwner(address newOwner) external onlyOwner { require(newOwner != address(0)); owner = newOwner; } }
contract Ownable { address public owner; modifier onlyOwner() { require(msg.sender == owner); _; } function Ownable() public { owner = msg.sender; } function updateContractOwner(address newOwner) external onlyOwner { require(newOwner != address(0)); owner = newOwner; } }
13,288
45
// the amount of tokens to lock for liquidity during every transfer, i.e. 100 = 1%, 50 = 2%, 40 = 2.5%
uint256 public liquidityLockDivisor; uint256 public callerRewardDivisor; uint256 public rebalanceDivisor; uint256 public minRebalanceAmount; uint256 public lastRebalance; uint256 public rebalanceInterval; uint256 public lpUnlocked; bool public locked;
uint256 public liquidityLockDivisor; uint256 public callerRewardDivisor; uint256 public rebalanceDivisor; uint256 public minRebalanceAmount; uint256 public lastRebalance; uint256 public rebalanceInterval; uint256 public lpUnlocked; bool public locked;
11,056
27
// Functions and structs below used mainly to avoid stack limit.
struct ItemData { bytes data; GeneralizedTCR.Status status; uint numberOfRequests; }
struct ItemData { bytes data; GeneralizedTCR.Status status; uint numberOfRequests; }
47,853
306
// ///
struct Race { uint256 tokenId; address owner; uint256 amount; address acceptedBy; uint256 tokenIdAccepted; address winner; uint256 endDate; }
struct Race { uint256 tokenId; address owner; uint256 amount; address acceptedBy; uint256 tokenIdAccepted; address winner; uint256 endDate; }
29,899
13
// Initializes the Draw Context from the given data/ctx The Draw Context to initialize/data Binary data in the .xqst format./safe bool whether to validate the data
function _initDrawContext( DrawContext memory ctx, bytes memory data, bool safe
function _initDrawContext( DrawContext memory ctx, bytes memory data, bool safe
16,895
62
// price in ICO: first week: 1 ETH = 2400 NAC second week: 1 ETH = 23000 NAC 3rd week: 1 ETH = 2200 NAC 4th week: 1 ETH = 2100 NAC 5th week: 1 ETH = 2000 NAC 6th week: 1 ETH = 1900 NAC 7th week: 1 ETH = 1800 NAC 8th week: 1 ETH = 1700 nac time:1517443200: Thursday, February 1, 2018 12:00:00 AM 1518048000: Thursday, February 8, 2018 12:00:00 AM 1518652800: Thursday, February 15, 2018 12:00:00 AM 1519257600: Thursday, February 22, 2018 12:00:00 AM 1519862400: Thursday, March 1, 2018 12:00:00 AM 1520467200: Thursday, March 8, 2018 12:00:00
function getPrice() public view returns (uint price) { if (now < 1517443200) { // presale return 3450; } else if (1517443200 < now && now <= 1518048000) { // 1st week return 2400; } else if (1518048000 < now && now <= 1518652800) { // 2nd week return 2300; } else if (1518652800 < now && now <= 1519257600) { // 3rd week return 2200; } else if (1519257600 < now && now <= 1519862400) { // 4th week return 2100; } else if (1519862400 < now && now <= 1520467200) { // 5th week return 2000; } else if (1520467200 < now && now <= 1521072000) { // 6th week return 1900; } else if (1521072000 < now && now <= 1521676800) { // 7th week return 1800; } else if (1521676800 < now && now <= 1522281600) { // 8th week return 1700; } else { return binary; } }
function getPrice() public view returns (uint price) { if (now < 1517443200) { // presale return 3450; } else if (1517443200 < now && now <= 1518048000) { // 1st week return 2400; } else if (1518048000 < now && now <= 1518652800) { // 2nd week return 2300; } else if (1518652800 < now && now <= 1519257600) { // 3rd week return 2200; } else if (1519257600 < now && now <= 1519862400) { // 4th week return 2100; } else if (1519862400 < now && now <= 1520467200) { // 5th week return 2000; } else if (1520467200 < now && now <= 1521072000) { // 6th week return 1900; } else if (1521072000 < now && now <= 1521676800) { // 7th week return 1800; } else if (1521676800 < now && now <= 1522281600) { // 8th week return 1700; } else { return binary; } }
40,450
210
// Harvest ALPACAs earn from the pool. 更新池子并领奖
function harvest(uint256 _pid) public override { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); _harvest(msg.sender, _pid); user.rewardDebt = user.amount.mul(pool.accAlpacaPerShare).div(1e12); user.bonusDebt = user.amount.mul(pool.accAlpacaPerShareTilBonusEnd).div(1e12); }
function harvest(uint256 _pid) public override { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); _harvest(msg.sender, _pid); user.rewardDebt = user.amount.mul(pool.accAlpacaPerShare).div(1e12); user.bonusDebt = user.amount.mul(pool.accAlpacaPerShareTilBonusEnd).div(1e12); }
41,483
135
// Return the entire set in an array WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designedto mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind thatthis function has an unbounded cost, and using it as part of a state-changing function may render the functionuncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. /
function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; }
function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; }
9,651
7
// vault management business
function mintVault() external returns (address); function liquidateVault( uint96 id, address asset_address, uint256 tokenAmount ) external returns (uint256); function borrowUsdi(uint96 id, uint192 amount) external;
function mintVault() external returns (address); function liquidateVault( uint96 id, address asset_address, uint256 tokenAmount ) external returns (uint256); function borrowUsdi(uint96 id, uint192 amount) external;
7,958
3
// Sets multiple bits for the account `account` using a provided `indicesMask`. /
function _setMultipleStatuses(address account, uint256 indicesMask) internal { statusesByAccount[account] |= indicesMask; }
function _setMultipleStatuses(address account, uint256 indicesMask) internal { statusesByAccount[account] |= indicesMask; }
37,686
1
// VersioningUtils AZTEC Library of versioning utility functions Copyright 2020 Spilsbury Holdings LtdLicensed under the GNU Lesser General Public Licence, Version 3.0 (the "License");you may not use this file except in compliance with the License. This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See theGNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License/
library VersioningUtils { /** * @dev We compress three uint8 numbers into only one uint24 to save gas. * @param version The compressed uint24 number. * @return A tuple (uint8, uint8, uint8) representing the the deconstructed version. */ function getVersionComponents(uint24 version) internal pure returns (uint8 first, uint8 second, uint8 third) { assembly { third := and(version, 0xff) second := and(div(version, 0x100), 0xff) first := and(div(version, 0x10000), 0xff) } return (first, second, third); } }
library VersioningUtils { /** * @dev We compress three uint8 numbers into only one uint24 to save gas. * @param version The compressed uint24 number. * @return A tuple (uint8, uint8, uint8) representing the the deconstructed version. */ function getVersionComponents(uint24 version) internal pure returns (uint8 first, uint8 second, uint8 third) { assembly { third := and(version, 0xff) second := and(div(version, 0x100), 0xff) first := and(div(version, 0x10000), 0xff) } return (first, second, third); } }
6,223
67
// Any wallet owed value that's recorded under `addressToFailedOldOwnerTransferAmount`/ can use this function to withdraw that value.
function withdrawFailedOldOwnerTransferAmount() external whenNotPaused { uint256 failedTransferAmount = addressToFailedOldOwnerTransferAmount[msg.sender]; require(failedTransferAmount > 0); addressToFailedOldOwnerTransferAmount[msg.sender] = 0; totalFailedOldOwnerTransferAmounts -= failedTransferAmount; msg.sender.transfer(failedTransferAmount); }
function withdrawFailedOldOwnerTransferAmount() external whenNotPaused { uint256 failedTransferAmount = addressToFailedOldOwnerTransferAmount[msg.sender]; require(failedTransferAmount > 0); addressToFailedOldOwnerTransferAmount[msg.sender] = 0; totalFailedOldOwnerTransferAmounts -= failedTransferAmount; msg.sender.transfer(failedTransferAmount); }
64,867
11
// require(block.timestamp - _lastActionMap[msg.sender] >= 6 hours, "too soon");
uint256 weaponId = _synthLoot.weaponComponents(msg.sender)[0]; uint8 amount = 1; if (_xpMap[msg.sender] >= 48) { amount = 3; } else if (_xpMap[msg.sender] >= 12) {
uint256 weaponId = _synthLoot.weaponComponents(msg.sender)[0]; uint8 amount = 1; if (_xpMap[msg.sender] >= 48) { amount = 3; } else if (_xpMap[msg.sender] >= 12) {
18,789
12
// Returns the id of the Aave market to which this contract points to.return The market id /
function getMarketId() external view returns (string memory);
function getMarketId() external view returns (string memory);
18,819
46
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted");
(bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted");
5,025
10
// Emits a {Conversion} event indicating the amount of Vether the user"burned" and the amount of Vader that they acquired. Here, "burned" refers to the action of transferring them to an irrecoverableaddress, the {BURN} address. Requirements: - the caller has approved the contract for the necessary amount via Vether- the amount specified is non-zero- the contract has been supplied with the necessary Vader amount to fulfill the trade /
function convert(bytes32[] calldata proof, uint256 amount, uint256 minVader) external override returns (uint256 vaderReceived) { require( amount != 0, "Converter::convert: Non-Zero Conversion Amount Required" );
function convert(bytes32[] calldata proof, uint256 amount, uint256 minVader) external override returns (uint256 vaderReceived) { require( amount != 0, "Converter::convert: Non-Zero Conversion Amount Required" );
59,079
64
// Only whitelisted borrwers can submit for credit ratings /
modifier onlyAllowedSubmitters() { require(allowedSubmitters[msg.sender], "TrueRatingAgency: Sender is not allowed to submit"); _; }
modifier onlyAllowedSubmitters() { require(allowedSubmitters[msg.sender], "TrueRatingAgency: Sender is not allowed to submit"); _; }
22,873
503
// Addressing a broken checker contract
require(transferToAmount.add(transferToFeeDistributorAmount) == amount, "Math broke, does gravity still work?"); _balances[recipient] = _balances[recipient].add(transferToAmount); emit Transfer(sender, recipient, transferToAmount); if(transferToFeeDistributorAmount > 0 && feeDistributor != address(0)){ _balances[feeDistributor] = _balances[feeDistributor].add(transferToFeeDistributorAmount); emit Transfer(sender, feeDistributor, transferToFeeDistributorAmount); if(feeDistributor != address(0)){ IFortyTwoCoinVault(feeDistributor).addPendingRewards(transferToFeeDistributorAmount);
require(transferToAmount.add(transferToFeeDistributorAmount) == amount, "Math broke, does gravity still work?"); _balances[recipient] = _balances[recipient].add(transferToAmount); emit Transfer(sender, recipient, transferToAmount); if(transferToFeeDistributorAmount > 0 && feeDistributor != address(0)){ _balances[feeDistributor] = _balances[feeDistributor].add(transferToFeeDistributorAmount); emit Transfer(sender, feeDistributor, transferToFeeDistributorAmount); if(feeDistributor != address(0)){ IFortyTwoCoinVault(feeDistributor).addPendingRewards(transferToFeeDistributorAmount);
10,043
139
// than voting power is zero - return the result
return 0;
return 0;
1,786
50
// Spend `amount` form the allowance of `owner` toward `spender`. Does not update the allowance amount in case of infinite allowance.Revert if not enough allowance is available.
* Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require( currentAllowance >= amount, "ERC20: insufficient allowance" ); unchecked { _approve(owner, spender, currentAllowance - amount); } } }
* Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require( currentAllowance >= amount, "ERC20: insufficient allowance" ); unchecked { _approve(owner, spender, currentAllowance - amount); } } }
1,683
116
// uint256 private _authNum;
uint256 private saleMaxBlock; uint256 private salePrice = 2000; // 0.01 eth = 20;
uint256 private saleMaxBlock; uint256 private salePrice = 2000; // 0.01 eth = 20;
7,028
103
// Snap the rebase time to the start of this window.
lastRebaseTimestampSec = now.sub( now.mod(minRebaseTimeIntervalSec)).add(rebaseWindowOffsetSec); epoch = epoch.add(1); uint256 targetRate; bool targetRateValid; (targetRate, targetRateValid) = targetPriceOracle.getData(); require(targetRateValid);
lastRebaseTimestampSec = now.sub( now.mod(minRebaseTimeIntervalSec)).add(rebaseWindowOffsetSec); epoch = epoch.add(1); uint256 targetRate; bool targetRateValid; (targetRate, targetRateValid) = targetPriceOracle.getData(); require(targetRateValid);
3,524
382
// Get original owner
address originalOwner = _stakingTokenToOwner[carId];
address originalOwner = _stakingTokenToOwner[carId];
4,087
51
// List of IDs of open proposals for a given type of contract call targetContractAddress of the contract selectorSelector of the function in the contractreturn List of IDs of open proposals /
function getOpenProposals(address targetContract, bytes4 selector) external view returns (uint256[] memory)
function getOpenProposals(address targetContract, bytes4 selector) external view returns (uint256[] memory)
24,725
115
// currently there are tokens in the smart contract pre-allocated as rewards while the contract holds more tokens than are allocated as rewards, we don't need to mint new tokens
if (balance < allocatedRewards) { uint256 mintAmount = allocatedRewards.sub(balance); _mint(address(this), mintAmount); }
if (balance < allocatedRewards) { uint256 mintAmount = allocatedRewards.sub(balance); _mint(address(this), mintAmount); }
29,661
19
// returns the last change in block number and timestamp / Some implementations may use this data to estimate timestamps for recent rate readings, if we only know the block number
function getBlockSlope() external view returns (uint256 blockChange, uint32 timeChange);
function getBlockSlope() external view returns (uint256 blockChange, uint32 timeChange);
3,585
24
// Maximum tokens that can be minted
uint256 public totalSupplyLimit;
uint256 public totalSupplyLimit;
28,549
7
// Chainlink config
VRFCoordinatorV2Interface public immutable vrfCoordinatorInterface; uint64 public vrfSubscriptionId; bytes32 public vrfKeyHash; uint32 public vrfCallbackGasLimit; uint16 public vrfRequestConfirmations; uint32 public vrfNumWords;
VRFCoordinatorV2Interface public immutable vrfCoordinatorInterface; uint64 public vrfSubscriptionId; bytes32 public vrfKeyHash; uint32 public vrfCallbackGasLimit; uint16 public vrfRequestConfirmations; uint32 public vrfNumWords;
37,114
21
// Gets the postal address of the VASP. return The postal address of the VASP. /
function postalAddress()
function postalAddress()
43,412
469
// Function a contract must implement in order to let other addresses call cancelMarginCall(). NOTE: If not returning zero (or not reverting), this contract must assume that Margin willeither revert the entire transaction or that the margin-call was successfully canceled. cancelerAddress of the caller of the cancelMarginCall functionpositionIdUnique ID of the positionreturn This address to accept, a different address to ask that contract /
function cancelMarginCallOnBehalfOf( address canceler, bytes32 positionId ) external
function cancelMarginCallOnBehalfOf( address canceler, bytes32 positionId ) external
31,511
23
// TokenManager ref
ITokenManager public tokenManager;
ITokenManager public tokenManager;
28,755
28
// Transfer token for a specified addressesfrom The address to transfer from.to The address to transfer to.value The amount to be transferred./
function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); }
function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); }
5,945
43
// Sets a token as an approved kind of NFT or as ineligible for trading/ This is callable only by the owner./ _nftaddress of the NFT to be approved/ _status the kind of NFT approved, or NOT_APPROVED to remove approval
function setTokenApprovalStatus(address _nft, TokenApprovalStatus _status) external onlyRole(SAPPHIRE_MARKETPLACE_ADMIN_ROLE) { if (_status == TokenApprovalStatus.ERC_721_APPROVED) { require(IERC165Upgradeable(_nft).supportsInterface(INTERFACE_ID_ERC721), "SapphireMarketplace: not an ERC721 contract"); } else if (_status == TokenApprovalStatus.ERC_1155_APPROVED) { require(IERC165Upgradeable(_nft).supportsInterface(INTERFACE_ID_ERC1155), "SapphireMarketplace: not an ERC1155 contract"); } tokenApprovals[_nft] = _status; emit TokenApprovalStatusUpdated(_nft, _status); }
function setTokenApprovalStatus(address _nft, TokenApprovalStatus _status) external onlyRole(SAPPHIRE_MARKETPLACE_ADMIN_ROLE) { if (_status == TokenApprovalStatus.ERC_721_APPROVED) { require(IERC165Upgradeable(_nft).supportsInterface(INTERFACE_ID_ERC721), "SapphireMarketplace: not an ERC721 contract"); } else if (_status == TokenApprovalStatus.ERC_1155_APPROVED) { require(IERC165Upgradeable(_nft).supportsInterface(INTERFACE_ID_ERC1155), "SapphireMarketplace: not an ERC1155 contract"); } tokenApprovals[_nft] = _status; emit TokenApprovalStatusUpdated(_nft, _status); }
9,702
119
// Proposed new contract owner address
address public newOwner;
address public newOwner;
31,421
32
// 清理旧的列表
address[] memory sl = new address[](_signerList.length); for (uint j = 0; j < sl.length; j++) { sl[j] = _signerList[j]; }
address[] memory sl = new address[](_signerList.length); for (uint j = 0; j < sl.length; j++) { sl[j] = _signerList[j]; }
14,237
7
// Any other/different contract wrapper methods if ownership transfer is not via transferOwnership
function transferOwnership(address payable _address) external;
function transferOwnership(address payable _address) external;
17,753
43
// BiFi's market si handler data storage contract BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) /
contract MarketSIHandlerDataStorage is IMarketSIHandlerDataStorage, SIDataStorageModifier, BlockContext { bool emergency; address owner; address SIHandlerAddr; MarketRewardInfo marketRewardInfo; mapping(address => UserRewardInfo) userRewardInfo; struct MarketRewardInfo { uint256 rewardLane; uint256 rewardLaneUpdateAt; uint256 rewardPerBlock; } struct UserRewardInfo { uint256 rewardLane; uint256 rewardLaneUpdateAt; uint256 rewardAmount; } uint256 betaRate; modifier onlyOwner { require(msg.sender == owner, ONLY_OWNER); _; } modifier onlySIHandler { address msgSender = msg.sender; require((msgSender == SIHandlerAddr) || (msgSender == owner), ONLY_SI_HANDLER); _; } modifier circuitBreaker { address msgSender = msg.sender; require((!emergency) || (msgSender == owner), CIRCUIT_BREAKER); _; } constructor (address _SIHandlerAddr) public { owner = msg.sender; SIHandlerAddr = _SIHandlerAddr; betaRate = 5 * (10 ** 17); marketRewardInfo.rewardLaneUpdateAt = _blockContext(); } function ownershipTransfer(address _owner) onlyOwner external returns (bool) { owner = _owner; return true; } function setCircuitBreaker(bool _emergency) onlySIHandler external override returns (bool) { emergency = _emergency; return true; } function setSIHandlerAddr(address _SIHandlerAddr) onlyOwner public returns (bool) { SIHandlerAddr = _SIHandlerAddr; return true; } function updateRewardPerBlockStorage(uint256 _rewardPerBlock) onlySIHandler circuitBreaker external override returns (bool) { marketRewardInfo.rewardPerBlock = _rewardPerBlock; return true; } function getSIHandlerAddr() public view returns (address) { return SIHandlerAddr; } function getRewardInfo(address userAddr) external view override returns (uint256, uint256, uint256, uint256, uint256, uint256) { MarketRewardInfo memory market = marketRewardInfo; UserRewardInfo memory user = userRewardInfo[userAddr]; return (market.rewardLane, market.rewardLaneUpdateAt, market.rewardPerBlock, user.rewardLane, user.rewardLaneUpdateAt, user.rewardAmount); } function getMarketRewardInfo() external view override returns (uint256, uint256, uint256) { MarketRewardInfo memory vars = marketRewardInfo; return (vars.rewardLane, vars.rewardLaneUpdateAt, vars.rewardPerBlock); } function setMarketRewardInfo(uint256 _rewardLane, uint256 _rewardLaneUpdateAt, uint256 _rewardPerBlock) onlySIHandler circuitBreaker external override returns (bool) { MarketRewardInfo memory vars; vars.rewardLane = _rewardLane; vars.rewardLaneUpdateAt = _rewardLaneUpdateAt; vars.rewardPerBlock = _rewardPerBlock; marketRewardInfo = vars; return true; } function getUserRewardInfo(address userAddr) external view override returns (uint256, uint256, uint256) { UserRewardInfo memory vars = userRewardInfo[userAddr]; return (vars.rewardLane, vars.rewardLaneUpdateAt, vars.rewardAmount); } function setUserRewardInfo(address userAddr, uint256 _rewardLane, uint256 _rewardLaneUpdateAt, uint256 _rewardAmount) onlySIHandler circuitBreaker external override returns (bool) { UserRewardInfo memory vars; vars.rewardLane = _rewardLane; vars.rewardLaneUpdateAt = _rewardLaneUpdateAt; vars.rewardAmount = _rewardAmount; userRewardInfo[userAddr] = vars; return true; } function getBetaRate() external view override returns (uint256) { return betaRate; } function setBetaRate(uint256 _betaRate) onlyOwner external override returns (bool) { betaRate = _betaRate; return true; } }
contract MarketSIHandlerDataStorage is IMarketSIHandlerDataStorage, SIDataStorageModifier, BlockContext { bool emergency; address owner; address SIHandlerAddr; MarketRewardInfo marketRewardInfo; mapping(address => UserRewardInfo) userRewardInfo; struct MarketRewardInfo { uint256 rewardLane; uint256 rewardLaneUpdateAt; uint256 rewardPerBlock; } struct UserRewardInfo { uint256 rewardLane; uint256 rewardLaneUpdateAt; uint256 rewardAmount; } uint256 betaRate; modifier onlyOwner { require(msg.sender == owner, ONLY_OWNER); _; } modifier onlySIHandler { address msgSender = msg.sender; require((msgSender == SIHandlerAddr) || (msgSender == owner), ONLY_SI_HANDLER); _; } modifier circuitBreaker { address msgSender = msg.sender; require((!emergency) || (msgSender == owner), CIRCUIT_BREAKER); _; } constructor (address _SIHandlerAddr) public { owner = msg.sender; SIHandlerAddr = _SIHandlerAddr; betaRate = 5 * (10 ** 17); marketRewardInfo.rewardLaneUpdateAt = _blockContext(); } function ownershipTransfer(address _owner) onlyOwner external returns (bool) { owner = _owner; return true; } function setCircuitBreaker(bool _emergency) onlySIHandler external override returns (bool) { emergency = _emergency; return true; } function setSIHandlerAddr(address _SIHandlerAddr) onlyOwner public returns (bool) { SIHandlerAddr = _SIHandlerAddr; return true; } function updateRewardPerBlockStorage(uint256 _rewardPerBlock) onlySIHandler circuitBreaker external override returns (bool) { marketRewardInfo.rewardPerBlock = _rewardPerBlock; return true; } function getSIHandlerAddr() public view returns (address) { return SIHandlerAddr; } function getRewardInfo(address userAddr) external view override returns (uint256, uint256, uint256, uint256, uint256, uint256) { MarketRewardInfo memory market = marketRewardInfo; UserRewardInfo memory user = userRewardInfo[userAddr]; return (market.rewardLane, market.rewardLaneUpdateAt, market.rewardPerBlock, user.rewardLane, user.rewardLaneUpdateAt, user.rewardAmount); } function getMarketRewardInfo() external view override returns (uint256, uint256, uint256) { MarketRewardInfo memory vars = marketRewardInfo; return (vars.rewardLane, vars.rewardLaneUpdateAt, vars.rewardPerBlock); } function setMarketRewardInfo(uint256 _rewardLane, uint256 _rewardLaneUpdateAt, uint256 _rewardPerBlock) onlySIHandler circuitBreaker external override returns (bool) { MarketRewardInfo memory vars; vars.rewardLane = _rewardLane; vars.rewardLaneUpdateAt = _rewardLaneUpdateAt; vars.rewardPerBlock = _rewardPerBlock; marketRewardInfo = vars; return true; } function getUserRewardInfo(address userAddr) external view override returns (uint256, uint256, uint256) { UserRewardInfo memory vars = userRewardInfo[userAddr]; return (vars.rewardLane, vars.rewardLaneUpdateAt, vars.rewardAmount); } function setUserRewardInfo(address userAddr, uint256 _rewardLane, uint256 _rewardLaneUpdateAt, uint256 _rewardAmount) onlySIHandler circuitBreaker external override returns (bool) { UserRewardInfo memory vars; vars.rewardLane = _rewardLane; vars.rewardLaneUpdateAt = _rewardLaneUpdateAt; vars.rewardAmount = _rewardAmount; userRewardInfo[userAddr] = vars; return true; } function getBetaRate() external view override returns (uint256) { return betaRate; } function setBetaRate(uint256 _betaRate) onlyOwner external override returns (bool) { betaRate = _betaRate; return true; } }
55,356
1
// assert B.foo(p) == 3;
t++;
t++;
2,845
14
// Función para obtener todos los NFTs de un propietario específico
function tokensOfOwner(address owner) public view returns (uint256[] memory) { uint256 tokenCount = balanceOf(owner); uint256[] memory ownedTokenIds = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { ownedTokenIds[i] = tokenOfOwnerByIndex(owner, i); } return ownedTokenIds; }
function tokensOfOwner(address owner) public view returns (uint256[] memory) { uint256 tokenCount = balanceOf(owner); uint256[] memory ownedTokenIds = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { ownedTokenIds[i] = tokenOfOwnerByIndex(owner, i); } return ownedTokenIds; }
26,420
8
// transfer ownership
super.addTokenTo(this, _tokenId); tokenOwner[_tokenId] = this; emit Transfer(_owner, this, _tokenId);
super.addTokenTo(this, _tokenId); tokenOwner[_tokenId] = this; emit Transfer(_owner, this, _tokenId);
9,143
69
// receiveData - should be overridden by contract developers to process the data fulfilment in their own contract._price uint256 result being sent_requestId bytes32 request ID of the request being fulfilled/
function receiveData( uint256 _price, bytes32 _requestId ) internal virtual;
function receiveData( uint256 _price, bytes32 _requestId ) internal virtual;
61,913
39
// Send `_value` tokens to `_to` from your account_to The address of the recipient _value the amount to send /
function transfer(address _to, uint256 _value) public returns (bool success) { // Require that the sender is not restricted require(restrictedAddresses[msg.sender] == false); updateAccount(_to); updateAccount(msg.sender); return super.transfer(_to, _value); }
function transfer(address _to, uint256 _value) public returns (bool success) { // Require that the sender is not restricted require(restrictedAddresses[msg.sender] == false); updateAccount(_to); updateAccount(msg.sender); return super.transfer(_to, _value); }
53,507
29
// User Default: Returns 0 Address for Expired Tokens
return address(0);
return address(0);
7,685
20
// ========== VIEWS ========== /
function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) { for (uint i = 0; i < names.length; i++) { if (repository[names[i]] != destinations[i]) { return false; } } return true; }
function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) { for (uint i = 0; i < names.length; i++) { if (repository[names[i]] != destinations[i]) { return false; } } return true; }
463
88
// Funcion que determina si un string está vacío o no/ str El string a comprobar/return True si el string está vacío, False en otro caso.
function isEmpty(string memory str) private pure returns (bool){ bytes memory tempEmptyStringTest = bytes(str); return tempEmptyStringTest.length == 0; }
function isEmpty(string memory str) private pure returns (bool){ bytes memory tempEmptyStringTest = bytes(str); return tempEmptyStringTest.length == 0; }
56,894
0
// The following functions are not subject to the timelock
function approveClaim(HATGovernanceArbitrator _arbitrator, HATVault _vault, bytes32 _claimId) external onlyRole(PROPOSER_ROLE) { _arbitrator.approveClaim(_vault, _claimId); }
function approveClaim(HATGovernanceArbitrator _arbitrator, HATVault _vault, bytes32 _claimId) external onlyRole(PROPOSER_ROLE) { _arbitrator.approveClaim(_vault, _claimId); }
14,523
125
// Borrower pay back ETH /
function borrowerMakePayment() public payable onlyBorrower atState(States.Funded) notDefault { require(msg.value >= installmentAmount); remainingInstallment--; lenderAddress.transfer(installmentAmount); if (remainingInstallment == 0) { currentState = States.Finished; } else { nextPaymentDateTime = nextPaymentDateTime.add(daysPerInstallment.mul(1 days)); } }
function borrowerMakePayment() public payable onlyBorrower atState(States.Funded) notDefault { require(msg.value >= installmentAmount); remainingInstallment--; lenderAddress.transfer(installmentAmount); if (remainingInstallment == 0) { currentState = States.Finished; } else { nextPaymentDateTime = nextPaymentDateTime.add(daysPerInstallment.mul(1 days)); } }
2,055
119
// to recieve ETH from uniswapV2Router when swapping
receive() external payable {} }
receive() external payable {} }
4,940
587
// Transfer the LUSD tokens from the user to the Stability Pool's address, and update its recorded LUSD
function _sendLUSDtoStabilityPool(address _address, uint _amount) internal { lusdToken.sendToPool(_address, address(this), _amount); uint newTotalLUSDDeposits = totalLUSDDeposits.add(_amount); totalLUSDDeposits = newTotalLUSDDeposits; emit StabilityPoolLUSDBalanceUpdated(newTotalLUSDDeposits); }
function _sendLUSDtoStabilityPool(address _address, uint _amount) internal { lusdToken.sendToPool(_address, address(this), _amount); uint newTotalLUSDDeposits = totalLUSDDeposits.add(_amount); totalLUSDDeposits = newTotalLUSDDeposits; emit StabilityPoolLUSDBalanceUpdated(newTotalLUSDDeposits); }
43,696
77
// Constructs a position ID from a collateral token and an outcome collection. These IDs are used as the ERC-1155 ID for this contract./collateralToken Collateral token which backs the position./collectionId ID of the outcome collection associated with this position.
function getPositionId(IERC20 collateralToken, bytes32 collectionId) internal pure returns (uint) { return uint(keccak256(abi.encodePacked(collateralToken, collectionId))); }
function getPositionId(IERC20 collateralToken, bytes32 collectionId) internal pure returns (uint) { return uint(keccak256(abi.encodePacked(collateralToken, collectionId))); }
24,226
203
// Miscellaneous events
event VersionChanged(address indexed seller, uint256 version); event AltSignerChanged(address newSigner);
event VersionChanged(address indexed seller, uint256 version); event AltSignerChanged(address newSigner);
38,467
40
// Emitting transfer event since assigning all tokens to the creator also corresponds to the transfer of tokens to the creator
emit Transfer(address(0), wallet, totalSupply);
emit Transfer(address(0), wallet, totalSupply);
28,268
14
// Check if the input starts with "" symbol
if (data[0] != 0x23) {
if (data[0] != 0x23) {
12,187
26
// Returning Residue in token1, if any
if (token1Bought.sub(amountB) > 0) { IERC20(_ToUnipoolToken1).safeTransfer( msg.sender, token1Bought.sub(amountB) ); }
if (token1Bought.sub(amountB) > 0) { IERC20(_ToUnipoolToken1).safeTransfer( msg.sender, token1Bought.sub(amountB) ); }
59,884
153
// Allow users to burn dVIX tokens to liquidate vaults with vault collateral ratio under the minium ratio, the liquidator receives the staked collateral of the liquidated vault at a premium _vaultId to liquidate _maxDVIX max amount of DVIX the liquidator is willing to pay to liquidate vault Resulting ratio must be above or equal minimun ratio A fee of exactly burnFee must be sent as value on AVAX The fee goes to the dev team to fund the further project development & expansion initiatives /
function liquidateVault(uint256 _vaultId, uint256 _maxDVIX) external payable nonReentrant whenNotPaused
function liquidateVault(uint256 _vaultId, uint256 _maxDVIX) external payable nonReentrant whenNotPaused
5,211
39
// Ballot receipt record for a voter
struct Receipt { /// @notice Whether or not a vote has been cast bool hasVoted; /// @notice Whether or not the voter supports the proposal bool support; /// @notice The number of votes the voter had, which were cast uint256 votes; }
struct Receipt { /// @notice Whether or not a vote has been cast bool hasVoted; /// @notice Whether or not the voter supports the proposal bool support; /// @notice The number of votes the voter had, which were cast uint256 votes; }
22,711
42
// Set OUSD Meta strategy _ousdMetaStrategy Address of ousd meta strategy /
function setOusdMetaStrategy(address _ousdMetaStrategy) external onlyGovernor
function setOusdMetaStrategy(address _ousdMetaStrategy) external onlyGovernor
802
655
// Send dust back to sender
if (amountETH > amountETHRequired) { msg.sender.transfer(amountETH.sub(amountETHRequired)); }
if (amountETH > amountETHRequired) { msg.sender.transfer(amountETH.sub(amountETHRequired)); }
80,971
18
// must check a property... bc solidity!
return users[usernameHash].creationDate != 0;
return users[usernameHash].creationDate != 0;
48,135
103
// require the availible value of the LP locked in this contract the user hasis greater than or equal to the amount being withdrawn
require(maxAmount >= amount, "Trying to withdraw too much");
require(maxAmount >= amount, "Trying to withdraw too much");
2,729
17
// INITIALIZE
/*function setupTokens(address _votingPowerToken, address _rewardToken, uint256 _rewardAmount) external OnlyOwner { rewardToken = _rewardToken; rewardAmount = _rewardAmount; votingPowerToken = _votingPowerToken; }*/
/*function setupTokens(address _votingPowerToken, address _rewardToken, uint256 _rewardAmount) external OnlyOwner { rewardToken = _rewardToken; rewardAmount = _rewardAmount; votingPowerToken = _votingPowerToken; }*/
36,702
154
// Deposit eth for liqudity.
if (wethBalance < wethAmount) { weth.deposit{value: wethAmount.sub(wethBalance)}();
if (wethBalance < wethAmount) { weth.deposit{value: wethAmount.sub(wethBalance)}();
13,327
0
// enum containing the different type of messages that can be bridged Null empty state Proposal indicates that the message is to bridge a proposal configuration /
enum MessageType { Null, Proposal }
enum MessageType { Null, Proposal }
26,651
37
// Checks if a contract is behind an address. Does it by checking if it has ANY code. /
function isContract(address _addr) public view returns(bool is_contract){ uint length; assembly { //retrieve the code length/size on target address length := extcodesize(_addr) } return (length>0); }
function isContract(address _addr) public view returns(bool is_contract){ uint length; assembly { //retrieve the code length/size on target address length := extcodesize(_addr) } return (length>0); }
48,731
113
// we record that fee collected from the underlying
feesUnderlying += uint120(impliedYieldFee);
feesUnderlying += uint120(impliedYieldFee);
60,258
186
// Use this to adjust the threshold at which running a debt causes a harvest trigger. See `setDebtThreshold()` for more details.
uint256 public debtThreshold = 0;
uint256 public debtThreshold = 0;
5,865
1,109
// Returns if the LendingPool is paused /
function paused() external view override returns (bool) { return _paused; }
function paused() external view override returns (bool) { return _paused; }
15,493
81
// Constructor_registry Address of `ServiceRegistry` contract_name Name of the token: See ERC20Detailed_symbol Symbol of the token: See ERC20Detailed/
constructor(ServiceRegistry _registry, string memory _name, string memory _symbol) public
constructor(ServiceRegistry _registry, string memory _name, string memory _symbol) public
3,005
102
// Gets the return amount of the specified address._user The address to specify the return of return returnAmount uint[] memory representing the return amount. return incentive uint[] memory representing the amount incentive. return _incentiveTokens address[] memory representing the incentive tokens./
function getReturn(address _user)public view returns (uint[] memory returnAmount, address[] memory _predictionAssets, uint incentive, address _incentiveToken){ (uint256 ethStaked, uint256 plotStaked) = getTotalAssetsStaked(); if(marketStatus() != PredictionStatus.Settled || ethStaked.add(plotStaked) ==0) { return (returnAmount, _predictionAssets, incentive, incentiveToken); } _predictionAssets = new address[](2); _predictionAssets[0] = plotToken; _predictionAssets[1] = ETH_ADDRESS; uint256 _totalUserPredictionPoints = 0; uint256 _totalPredictionPoints = 0; (returnAmount, _totalUserPredictionPoints, _totalPredictionPoints) = _calculateUserReturn(_user); incentive = _calculateIncentives(_totalUserPredictionPoints, _totalPredictionPoints); if(userData[_user].predictionPoints[marketSettleData.WinningOption] > 0) { returnAmount = _addUserReward(_user, returnAmount); } return (returnAmount, _predictionAssets, incentive, incentiveToken); }
function getReturn(address _user)public view returns (uint[] memory returnAmount, address[] memory _predictionAssets, uint incentive, address _incentiveToken){ (uint256 ethStaked, uint256 plotStaked) = getTotalAssetsStaked(); if(marketStatus() != PredictionStatus.Settled || ethStaked.add(plotStaked) ==0) { return (returnAmount, _predictionAssets, incentive, incentiveToken); } _predictionAssets = new address[](2); _predictionAssets[0] = plotToken; _predictionAssets[1] = ETH_ADDRESS; uint256 _totalUserPredictionPoints = 0; uint256 _totalPredictionPoints = 0; (returnAmount, _totalUserPredictionPoints, _totalPredictionPoints) = _calculateUserReturn(_user); incentive = _calculateIncentives(_totalUserPredictionPoints, _totalPredictionPoints); if(userData[_user].predictionPoints[marketSettleData.WinningOption] > 0) { returnAmount = _addUserReward(_user, returnAmount); } return (returnAmount, _predictionAssets, incentive, incentiveToken); }
30,370
29
// Funds recipient for sale (new slot, uint160)
address payable fundsRecipient;
address payable fundsRecipient;
3,341
10
// Set the rewards as claimed for that period And transfer the rewards to the user
_setClaimed(token, index); IERC20(token).safeTransfer(account, amount); emit Claimed(token, index, account, amount, nonce[token]);
_setClaimed(token, index); IERC20(token).safeTransfer(account, amount); emit Claimed(token, index, account, amount, nonce[token]);
32,272
16
// transfer : Transfer token to another etherum address /
function transfer(address to, uint tokens) public virtual override isAuthorized returns (bool success) { require(to != address(0), "Null address"); require(isWhitelisted(to),"investor is not authorized to send tokens"); require(tokens > 0, "Invalid Value"); // adding to != address(this), permits the investor to transfer their shares back to the contract if (msg.sender != getOwner() || to != address(this)) { require (block.timestamp >= SafeMath.safeAdd(transfer_log[msg.sender], holdingTime),"transfer not permitted under Rule 144, holding period has not elapsed"); } transfer_log[to] = block.timestamp; balances[msg.sender] = SafeMath.safeSub(balances[msg.sender], tokens); balances[to] = SafeMath.safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
function transfer(address to, uint tokens) public virtual override isAuthorized returns (bool success) { require(to != address(0), "Null address"); require(isWhitelisted(to),"investor is not authorized to send tokens"); require(tokens > 0, "Invalid Value"); // adding to != address(this), permits the investor to transfer their shares back to the contract if (msg.sender != getOwner() || to != address(this)) { require (block.timestamp >= SafeMath.safeAdd(transfer_log[msg.sender], holdingTime),"transfer not permitted under Rule 144, holding period has not elapsed"); } transfer_log[to] = block.timestamp; balances[msg.sender] = SafeMath.safeSub(balances[msg.sender], tokens); balances[to] = SafeMath.safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
47,394
5
// Called by the delegator on a delegate to forfeit its responsibility /
function _resignImplementation() public { // Shh -- we don't ever want this hook to be marked pure if (false) { implementation = address(0); } require(msg.sender == admin, "only the admin may call _resignImplementation"); }
function _resignImplementation() public { // Shh -- we don't ever want this hook to be marked pure if (false) { implementation = address(0); } require(msg.sender == admin, "only the admin may call _resignImplementation"); }
25,343
77
// assert(from ==address(0) || from == address(this));
lastNft = _tokensOfOwnerWithSubstitutions[from].length;
lastNft = _tokensOfOwnerWithSubstitutions[from].length;
44,704
16
// Accumulated SFT tokens for a SatoshiFaces token index. /
function accumulated(uint256 tokenIndex) public view override returns (uint256) { require(block.timestamp > EMISSION_START, "Emission has not started yet"); require(IFaces(_facesAddress).ownerOf(tokenIndex) != address(0), "Owner cannot be 0 address"); require(tokenIndex < IFaces(_facesAddress).totalSupply(), "NFT at index has not been minted yet"); uint256 lastClaimed = lastClaim(tokenIndex); // sanity check if last claim was on or after emission end if (lastClaimed >= EMISSION_END) return 0; uint256 accumulatedQty = totalAccumulated(tokenIndex).sub(totalClaimed(tokenIndex)); return accumulatedQty; }
function accumulated(uint256 tokenIndex) public view override returns (uint256) { require(block.timestamp > EMISSION_START, "Emission has not started yet"); require(IFaces(_facesAddress).ownerOf(tokenIndex) != address(0), "Owner cannot be 0 address"); require(tokenIndex < IFaces(_facesAddress).totalSupply(), "NFT at index has not been minted yet"); uint256 lastClaimed = lastClaim(tokenIndex); // sanity check if last claim was on or after emission end if (lastClaimed >= EMISSION_END) return 0; uint256 accumulatedQty = totalAccumulated(tokenIndex).sub(totalClaimed(tokenIndex)); return accumulatedQty; }
42,740
103
// Any vestedJiffys are transferred immediately to the beneficiary
if (vestedJiffys > 0) { balances[issuer] = balances[issuer].sub(vestedJiffys); balances[beneficiary] = balances[beneficiary].add(vestedJiffys); Transfer(issuer, beneficiary, vestedJiffys); }
if (vestedJiffys > 0) { balances[issuer] = balances[issuer].sub(vestedJiffys); balances[beneficiary] = balances[beneficiary].add(vestedJiffys); Transfer(issuer, beneficiary, vestedJiffys); }
43,014
367
// Stores high level basket info
struct Basket { // Array of Bassets currently active Basset[] bassets; // Max number of bAssets that can be present in any Basket uint8 maxBassets; // Some bAsset is undergoing re-collateralisation bool undergoingRecol; // // In the event that we do not raise enough funds from the auctioning of a failed Basset, // The Basket is deemed as failed, and is undercollateralised to a certain degree. // The collateralisation ratio is used to calc Masset burn rate. bool failed; uint256 collateralisationRatio; }
struct Basket { // Array of Bassets currently active Basset[] bassets; // Max number of bAssets that can be present in any Basket uint8 maxBassets; // Some bAsset is undergoing re-collateralisation bool undergoingRecol; // // In the event that we do not raise enough funds from the auctioning of a failed Basset, // The Basket is deemed as failed, and is undercollateralised to a certain degree. // The collateralisation ratio is used to calc Masset burn rate. bool failed; uint256 collateralisationRatio; }
42,719
20
// MODIFIERS /
event D(uint x);
event D(uint x);
20,040
9
// And set our TransitionPhases to the PreExecution phase.
currentTransitionPhase = TransitionPhases.PreExecution;
currentTransitionPhase = TransitionPhases.PreExecution;
13,875
17
// INSURANCE STUFF/
struct Insurance{ address payable passenger; uint insuranceAmount; uint money; uint256 updatedTimestamp; string insuranceId; address payable airline; }
struct Insurance{ address payable passenger; uint insuranceAmount; uint money; uint256 updatedTimestamp; string insuranceId; address payable airline; }
34,540
10
// get erc20 token
IERC20 USDT = IERC20(USDTAddress);
IERC20 USDT = IERC20(USDTAddress);
28,138
98
// Modifier with the conditions to be able to exercisebased on option exerciseType. /
modifier exerciseWindow() { require(_isExerciseWindow(), "PodOption: not in exercise window"); _; }
modifier exerciseWindow() { require(_isExerciseWindow(), "PodOption: not in exercise window"); _; }
62,033
179
// This will pay HashLips 5% of the initial sale. You can remove this if you want, or keep it in to support HashLips and his channel. =============================================================================
(bool hs, ) = payable(0x943590A42C27D08e3744202c4Ae5eD55c2dE240D).call{value: address(this).balance * 5 / 100}("");
(bool hs, ) = payable(0x943590A42C27D08e3744202c4Ae5eD55c2dE240D).call{value: address(this).balance * 5 / 100}("");
16,985
16
// Updates all of the token IDs on the contract. /
function _setTokenIds(uint16[] memory _tokenIds) internal { HeyMintStorage.State storage state = HeyMintStorage.state(); uint256 oldLength = state.data.tokenIds.length; uint256 newLength = _tokenIds.length; // Update the existing token ids & push any new ones. for (uint256 i = 0; i < newLength; i++) { if (i < oldLength) { state.data.tokenIds[i] = _tokenIds[i]; state.tokens[_tokenIds[i]].tokenId = _tokenIds[i]; } else { state.data.tokenIds.push(_tokenIds[i]); state.tokens[_tokenIds[i]].tokenId = _tokenIds[i]; } } // Pop any extra token ids. for (uint256 i = oldLength; i > newLength; i--) { state.data.tokenIds.pop(); } }
function _setTokenIds(uint16[] memory _tokenIds) internal { HeyMintStorage.State storage state = HeyMintStorage.state(); uint256 oldLength = state.data.tokenIds.length; uint256 newLength = _tokenIds.length; // Update the existing token ids & push any new ones. for (uint256 i = 0; i < newLength; i++) { if (i < oldLength) { state.data.tokenIds[i] = _tokenIds[i]; state.tokens[_tokenIds[i]].tokenId = _tokenIds[i]; } else { state.data.tokenIds.push(_tokenIds[i]); state.tokens[_tokenIds[i]].tokenId = _tokenIds[i]; } } // Pop any extra token ids. for (uint256 i = oldLength; i > newLength; i--) { state.data.tokenIds.pop(); } }
13,996
54
// Initializes the contract with a given `minDelay`. /
constructor(uint256 minDelay, address[] memory proposers, address[] memory executors) { _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);
constructor(uint256 minDelay, address[] memory proposers, address[] memory executors) { _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);
43,951
164
// Returns the amount of tokens owned by `account`./
function balanceOf(address account) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
27,523
20
// Split total reward to be swapped
uint256 swapAmountSDVD = totalNetReward.div(2);
uint256 swapAmountSDVD = totalNetReward.div(2);
12,444
7
// for this example we'll enforce that the location string can't be longer than 32 chars, obv in a prod env you'd just shorten the string here...
require(bytes(src).length <= 32, "Error: Location must be 32 characters or less");
require(bytes(src).length <= 32, "Error: Location must be 32 characters or less");
40,531
120
// Because its possible that price of someting legitimately goes +50% Then the updateRunningAveragePrice would be stuck until it goes down, This allows the admin to "rescue" it by writing a new average skiping the +50% check
function rescueRatioLock(address token) public onlyOwner{ updateRunningAveragePrice(token, true); }
function rescueRatioLock(address token) public onlyOwner{ updateRunningAveragePrice(token, true); }
45,547
10
// allows an admin to turn whitelist validation on/off/ _whitelistEnabled whether or not admin wants to turn whitelist lookup on/off
function setWhitelistEnabled(bool _whitelistEnabled) external onlyAdmin payable { whitelistEnabled = _whitelistEnabled; }
function setWhitelistEnabled(bool _whitelistEnabled) external onlyAdmin payable { whitelistEnabled = _whitelistEnabled; }
24,279
182
// finalise and color the specular lighting
int256[3] memory colSpec = ShackledMath.vector3DivScalar( ShackledMath.vector3MulScalar(lp.lightColSpec, specular), lv.falloff );
int256[3] memory colSpec = ShackledMath.vector3DivScalar( ShackledMath.vector3MulScalar(lp.lightColSpec, specular), lv.falloff );
45,342
370
// Helper to parse validation arguments from encoded data for PostCallOnExternalPosition policy hook
function __decodePostCallOnExternalPositionValidationData(bytes memory _validationData) internal pure returns ( address caller_, address externalPosition_, address[] memory assetsToTransfer_, uint256[] memory amountsToTransfer_, address[] memory assetsToReceive_, bytes memory encodedActionData_
function __decodePostCallOnExternalPositionValidationData(bytes memory _validationData) internal pure returns ( address caller_, address externalPosition_, address[] memory assetsToTransfer_, uint256[] memory amountsToTransfer_, address[] memory assetsToReceive_, bytes memory encodedActionData_
47,971
191
// Validate user signing key signature unless it is `msg.sender`.
if (msg.sender != userSigningKey) { require( _validateUserSignature( messageHash, action, arguments, userSigningKey, userSignature ), "Invalid action - invalid user signature." ); }
if (msg.sender != userSigningKey) { require( _validateUserSignature( messageHash, action, arguments, userSigningKey, userSignature ), "Invalid action - invalid user signature." ); }
26,752
10
// 投票到結算時間差距
uint256 campaignDurationFromVoteToConfirm;
uint256 campaignDurationFromVoteToConfirm;
10,115