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
17
// ==================================================== Views =====================================================/
* @dev See {IGovernorCompatibilityBravo-proposals}. */ function proposals(uint256 proposalId) public view virtual override returns ( uint256 id, address proposer, uint256 eta, uint256 startBlock, uint256 endBlock, uint256 forVotes, uint256 againstVotes, uint256 abstainVotes, bool canceled, bool executed ) { id = proposalId; eta = proposalEta(proposalId); startBlock = proposalSnapshot(proposalId); endBlock = proposalDeadline(proposalId); ProposalDetails storage details = _proposalDetails[proposalId]; proposer = details.proposer; forVotes = details.forVotes; againstVotes = details.againstVotes; abstainVotes = details.abstainVotes; ProposalState status = state(proposalId); canceled = status == ProposalState.Canceled; executed = status == ProposalState.Executed; }
* @dev See {IGovernorCompatibilityBravo-proposals}. */ function proposals(uint256 proposalId) public view virtual override returns ( uint256 id, address proposer, uint256 eta, uint256 startBlock, uint256 endBlock, uint256 forVotes, uint256 againstVotes, uint256 abstainVotes, bool canceled, bool executed ) { id = proposalId; eta = proposalEta(proposalId); startBlock = proposalSnapshot(proposalId); endBlock = proposalDeadline(proposalId); ProposalDetails storage details = _proposalDetails[proposalId]; proposer = details.proposer; forVotes = details.forVotes; againstVotes = details.againstVotes; abstainVotes = details.abstainVotes; ProposalState status = state(proposalId); canceled = status == ProposalState.Canceled; executed = status == ProposalState.Executed; }
11,102
1,250
// Interface Imports // Contract Imports // External Imports // OVM_ExecutionManager The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxedenvironment allowing us to execute OVM transactions deterministically on either Layer 1 orLayer 2.The EM's run() function is the first function called during the execution of anytransaction on L2.For each context-dependent EVM operation the EM has a function which implements a correspondingOVM operation, which will read state from the State Manager contract.The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain anycontext-dependent operations. Compiler used: solcRuntime target: EVM
contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
57,140
111
// 0x23b872dd = bytes4(keccak256("transferFrom(address,address,uint256)"))
_callOptionalReturn(token, abi.encodeWithSelector(0x23b872dd, from, to, value));
_callOptionalReturn(token, abi.encodeWithSelector(0x23b872dd, from, to, value));
18,725
18
// Checks whether the signature provided is valid for the provided data and hash. Reverts otherwise. Since the EIP-1271 does an external call, be mindful of reentrancy attacks. The function was moved to the fallback handler as a part of 1.5.0 contract upgrade. It used to be a part of the Safe core contract, but was replaced by the same function that accepts the executor as a parameter. dataHash Hash of the data (could be either a message hash or transaction hash) signatures Signature data that should be verified.
* Can be packed ECDSA signature ({bytes32 r}{bytes32 s}{uint8 v}), contract signature (EIP-1271) or approved hash. * @param requiredSignatures Amount of required valid signatures. */ function checkNSignatures(bytes32 dataHash, bytes memory, bytes memory signatures, uint256 requiredSignatures) public view { Safe(payable(_manager())).checkNSignatures(_msgSender(), dataHash, "", signatures, requiredSignatures); }
* Can be packed ECDSA signature ({bytes32 r}{bytes32 s}{uint8 v}), contract signature (EIP-1271) or approved hash. * @param requiredSignatures Amount of required valid signatures. */ function checkNSignatures(bytes32 dataHash, bytes memory, bytes memory signatures, uint256 requiredSignatures) public view { Safe(payable(_manager())).checkNSignatures(_msgSender(), dataHash, "", signatures, requiredSignatures); }
22,467
10
// Variables/ Messenger contract used to send and recieve messages from the other domain.
address public messenger;
address public messenger;
39,312
1
// Constructor started with the storage contract address.
constructor(address _storageDatabase) public { owner = msg.sender; storageDatabase = _storageDatabase; }
constructor(address _storageDatabase) public { owner = msg.sender; storageDatabase = _storageDatabase; }
16,857
45
// Emergency functions
function execute(address _target, bytes memory _data) public payable returns (bytes memory response)
function execute(address _target, bytes memory _data) public payable returns (bytes memory response)
3,190
84
// Take A fee
if(_AFee != 0){ uint256 AFee = amount.mul(_AFee).div(10**(_feeDecimal + 2)); transferAmount = transferAmount.sub(AFee); _reflectionBalance[_AWallet] = _reflectionBalance[_AWallet].add(AFee.mul(rate)); _AFeeTotal = _AFeeTotal.add(AFee); emit Transfer(account,_AWallet,AFee); }
if(_AFee != 0){ uint256 AFee = amount.mul(_AFee).div(10**(_feeDecimal + 2)); transferAmount = transferAmount.sub(AFee); _reflectionBalance[_AWallet] = _reflectionBalance[_AWallet].add(AFee.mul(rate)); _AFeeTotal = _AFeeTotal.add(AFee); emit Transfer(account,_AWallet,AFee); }
1,192
43
// require (_pid != 0, 'withdraw STAR by unstaking');if (_pid == 0) require(userNFTs[_msgSender()].length == 0, "nft user");
PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; require(user.amount >= _amount, "withdraw: amount error"); updatePool(_pid); (uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain(); uint256 _amountGain = user.amount.add(user.amount.mul(_selfGain).div(100)); uint256 pending = _amountGain.mul(pool.accStarPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) {
PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; require(user.amount >= _amount, "withdraw: amount error"); updatePool(_pid); (uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain(); uint256 _amountGain = user.amount.add(user.amount.mul(_selfGain).div(100)); uint256 pending = _amountGain.mul(pool.accStarPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) {
24,094
117
// /
function safeTransferFrom( address from, address to, uint256 tokenId, uint256 amount, bytes memory data ) public virtual
function safeTransferFrom( address from, address to, uint256 tokenId, uint256 amount, bytes memory data ) public virtual
7,176
96
// events // Constants / Configure these for your own deployment
string internal constant NAME = "RedToken"; string internal constant SYMBOL = "REDT"; string internal tokenMetadataBaseURI = "https://doc.reditus.co.kr/?docid=";
string internal constant NAME = "RedToken"; string internal constant SYMBOL = "REDT"; string internal tokenMetadataBaseURI = "https://doc.reditus.co.kr/?docid=";
36,716
2
// Calculate amount of LP to mint : ( deposit + reward )TotalAssetSupply / Liability
uint256 liability = asset.liability(); lpTokenToMint = (liability == 0 ? liabilityToMint : (liabilityToMint * asset.totalSupply()) / liability);
uint256 liability = asset.liability(); lpTokenToMint = (liability == 0 ? liabilityToMint : (liabilityToMint * asset.totalSupply()) / liability);
30,221
6
// Hashes a cross domain message based on the V0 (legacy) encoding._target Address of the target of the message. _sender Address of the sender of the message. _data Data to send with the message. _nonceMessage nonce. return Hashed cross domain message. /
function hashCrossDomainMessageV0( address _target, address _sender, bytes memory _data, uint256 _nonce
function hashCrossDomainMessageV0( address _target, address _sender, bytes memory _data, uint256 _nonce
15,854
232
// Emitted during finish minting /
event MintFinished();
event MintFinished();
460
55
// Get storage root.
bytes32 storageRoot = storageRoots[_blockHeight]; require( storageRoot != bytes32(0), "Storage root must not be zero" );
bytes32 storageRoot = storageRoots[_blockHeight]; require( storageRoot != bytes32(0), "Storage root must not be zero" );
3,519
262
// Mints the inflationary SNX supply. The inflation shedule isdefined in the SupplySchedule contract.The mint() function is publicly callable by anyone. The caller will /
function mint() external returns (bool) { require(rewardsDistribution() != address(0), "RewardsDistribution not set"); SupplySchedule _supplySchedule = supplySchedule(); IRewardsDistribution _rewardsDistribution = rewardsDistribution(); uint supplyToMint = _supplySchedule.mintableSupply(); require(supplyToMint > 0, "No supply is mintable"); // record minting event before mutation to token supply _supplySchedule.recordMintEvent(supplyToMint); // Set minted SNX balance to RewardEscrow's balance // Minus the minterReward and set balance of minter to add reward uint minterReward = _supplySchedule.minterReward(); // Get the remainder uint amountToDistribute = supplyToMint.sub(minterReward); // Set the token balance to the RewardsDistribution contract tokenState.setBalanceOf(_rewardsDistribution, tokenState.balanceOf(_rewardsDistribution).add(amountToDistribute)); emitTransfer(this, _rewardsDistribution, amountToDistribute); // Kick off the distribution of rewards _rewardsDistribution.distributeRewards(amountToDistribute); // Assign the minters reward. tokenState.setBalanceOf(msg.sender, tokenState.balanceOf(msg.sender).add(minterReward)); emitTransfer(this, msg.sender, minterReward); totalSupply = totalSupply.add(supplyToMint); return true; }
function mint() external returns (bool) { require(rewardsDistribution() != address(0), "RewardsDistribution not set"); SupplySchedule _supplySchedule = supplySchedule(); IRewardsDistribution _rewardsDistribution = rewardsDistribution(); uint supplyToMint = _supplySchedule.mintableSupply(); require(supplyToMint > 0, "No supply is mintable"); // record minting event before mutation to token supply _supplySchedule.recordMintEvent(supplyToMint); // Set minted SNX balance to RewardEscrow's balance // Minus the minterReward and set balance of minter to add reward uint minterReward = _supplySchedule.minterReward(); // Get the remainder uint amountToDistribute = supplyToMint.sub(minterReward); // Set the token balance to the RewardsDistribution contract tokenState.setBalanceOf(_rewardsDistribution, tokenState.balanceOf(_rewardsDistribution).add(amountToDistribute)); emitTransfer(this, _rewardsDistribution, amountToDistribute); // Kick off the distribution of rewards _rewardsDistribution.distributeRewards(amountToDistribute); // Assign the minters reward. tokenState.setBalanceOf(msg.sender, tokenState.balanceOf(msg.sender).add(minterReward)); emitTransfer(this, msg.sender, minterReward); totalSupply = totalSupply.add(supplyToMint); return true; }
14,447
1
// ERC165 check interface
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) { bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165 bytes4 secondSupportedInterface = ITuringHelper.TuringTx.selector; return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface; }
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) { bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165 bytes4 secondSupportedInterface = ITuringHelper.TuringTx.selector; return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface; }
3,420
140
// Returns the integer division of two signed integers. Reverts ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero. /
function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; }
function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; }
6,391
161
// gets existing or registers new pID.use this when a player may be newreturn pID /
function determinePID(SPCdatasets.EventReturns memory _eventData_) private returns (SPCdatasets.EventReturns)
function determinePID(SPCdatasets.EventReturns memory _eventData_) private returns (SPCdatasets.EventReturns)
1,846
285
// Get new redeemable coupons
newRedeemable = totalCoupons.sub(totalRedeemable);
newRedeemable = totalCoupons.sub(totalRedeemable);
38,160
1
// --- Functions ---/Initial checks:- Frontend is registered or zero address- Sender is not a registered frontend- _amount is not zero---- Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between all depositors and front ends- Tags the deposit with the provided front end tag param, if it's a new deposit- Sends depositor's accumulated gains (LQTY, ETH) to depositor- Sends the tagged front end's accumulated LQTY gains to the tagged front end- Increases deposit and tagged front end's stake, and takes new snapshots for each. /
function provideToSP(uint256 _amount, address _frontEndTag) external;
function provideToSP(uint256 _amount, address _frontEndTag) external;
39,120
233
// if vault is missing a long or a short, return True
if (!_vaultDetails.hasLong || !_vaultDetails.hasShort) return true; return _vault.longOtokens[0] != _vault.shortOtokens[0] && _vaultDetails.longUnderlyingAsset == _vaultDetails.shortUnderlyingAsset && _vaultDetails.longStrikeAsset == _vaultDetails.shortStrikeAsset && _vaultDetails.longCollateralAsset == _vaultDetails.shortCollateralAsset && _vaultDetails.longExpiryTimestamp == _vaultDetails.shortExpiryTimestamp && _vaultDetails.isLongPut == _vaultDetails.isShortPut;
if (!_vaultDetails.hasLong || !_vaultDetails.hasShort) return true; return _vault.longOtokens[0] != _vault.shortOtokens[0] && _vaultDetails.longUnderlyingAsset == _vaultDetails.shortUnderlyingAsset && _vaultDetails.longStrikeAsset == _vaultDetails.shortStrikeAsset && _vaultDetails.longCollateralAsset == _vaultDetails.shortCollateralAsset && _vaultDetails.longExpiryTimestamp == _vaultDetails.shortExpiryTimestamp && _vaultDetails.isLongPut == _vaultDetails.isShortPut;
15,072
30
// Update reward vairables for all pools. Be careful of gas spending!
function massUpdatePools() public override { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } }
function massUpdatePools() public override { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } }
22,564
17
// UTILITY FUNCTIONS/
{ return registeredAirlines[airline].isFunded; }
{ return registeredAirlines[airline].isFunded; }
1,295
16
// bid an amount to given tokenId/ holds bid amount of the bidder and set it as current bidder if bid amount is higher than previous bidder/ _tokenId TokenId of NFT
function bidForAuction(uint256 _tokenId) public payable { Auction storage act = TokenAuctions[_tokenId]; require( act.onAuction == true && act.expiresAt > block.timestamp, "MarketPlace: Token expired from auction" ); require( msg.value >= act.startingPrice, "MarketPlace: Bid amount is lower than startingPrice" ); if (act.currentBidPrice != 0) { require( msg.value >= (act.currentBidPrice + cutPer10000(minimunBidPer10000, act.currentBidPrice)), "MarketPlace: Bid Amount is less than minimunBid required" ); } address payable currentBidder = payable(act.currentBidder); uint256 prevBidPrice = act.currentBidPrice; act.currentBidPrice = 0; currentBidder.transfer(prevBidPrice); act.currentBidPrice = msg.value; act.currentBidder = msg.sender; emit BidCreated(_tokenId, msg.sender, msg.value); }
function bidForAuction(uint256 _tokenId) public payable { Auction storage act = TokenAuctions[_tokenId]; require( act.onAuction == true && act.expiresAt > block.timestamp, "MarketPlace: Token expired from auction" ); require( msg.value >= act.startingPrice, "MarketPlace: Bid amount is lower than startingPrice" ); if (act.currentBidPrice != 0) { require( msg.value >= (act.currentBidPrice + cutPer10000(minimunBidPer10000, act.currentBidPrice)), "MarketPlace: Bid Amount is less than minimunBid required" ); } address payable currentBidder = payable(act.currentBidder); uint256 prevBidPrice = act.currentBidPrice; act.currentBidPrice = 0; currentBidder.transfer(prevBidPrice); act.currentBidPrice = msg.value; act.currentBidder = msg.sender; emit BidCreated(_tokenId, msg.sender, msg.value); }
16,680
13
// mint tokenid to msg.sender
_mintTokens(msg.sender, tokenId);
_mintTokens(msg.sender, tokenId);
30,251
454
// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {} // ================================= HAs ======================================= /// @notice Lets a HA join the protocol and create a perpetual /// @param owner Address of the future owner of the perpetual /// @param margin Amount of collateral brought by the HA /// @param committedAmount Amount of collateral covered by the HA /// @param maxOracleRate Maximum oracle value that the HA wants to see stored in the perpetual /// @param minNetMargin Minimum net margin that the HA is willing to see stored in the perpetual /// @return perpetualID The ID of the perpetual opened by this HA /// @dev The future owner of the perpetual cannot be the zero address /// @dev It is possible to open a perpetual on behalf of someone else /// @dev The `maxOracleRate` parameter serves as a protection against oracle manipulations for HAs opening perpetuals /// @dev `minNetMargin` is a protection against too big variations in the fees for HAs function openPerpetual( address owner, uint256 margin, uint256 committedAmount, uint256 maxOracleRate, uint256 minNetMargin ) external override whenNotPaused zeroCheck(owner) returns (uint256 perpetualID) { // Transaction will revert anyway if `margin` is zero require(committedAmount > 0, "27"); // There could be a reentrancy attack as a call to an external contract is done before state variables // updates. Yet in this case, the call involves a transfer from the `msg.sender` to the contract which // eliminates the risk _token.safeTransferFrom(msg.sender, address(poolManager), margin); // Computing the oracle value // Only the highest oracle value (between Chainlink and Uniswap) we get is stored in the perpetual (, uint256 rateUp) = _getOraclePrice(); // Checking if the oracle rate is not too big: a too big oracle rate could mean for a HA that the price // has become too high to make it interesting to open a perpetual require(rateUp <= maxOracleRate, "28"); // Computing the total amount of stablecoins that this perpetual is going to hedge for the protocol uint256 totalHedgeAmountUpdate = (committedAmount * rateUp) / _collatBase; // Computing the net amount brought by the HAs to store in the perpetual uint256 netMargin = _getNetMargin(margin, totalHedgeAmountUpdate, committedAmount); require(netMargin >= minNetMargin, "29"); // Checking if the perpetual is not too leveraged, even after computing the fees require((committedAmount * BASE_PARAMS) <= maxLeverage * netMargin, "30"); // ERC721 logic _perpetualIDcount.increment(); perpetualID = _perpetualIDcount.current(); // In the logic of the staking contract, the `_updateReward` should be called // before the perpetual is opened _updateReward(perpetualID, 0); // Updating the total amount of stablecoins hedged by HAs and creating the perpetual totalHedgeAmount += totalHedgeAmountUpdate; perpetualData[perpetualID] = Perpetual(rateUp, block.timestamp, netMargin, committedAmount); // Following ERC721 logic, the function `_mint(...)` calls `_checkOnERC721Received` and could then be used as // a reentrancy vector. Minting should then only be done at the very end after updating all variables. _mint(owner, perpetualID); emit PerpetualOpened(perpetualID, rateUp, netMargin, committedAmount); }
constructor() initializer {} // ================================= HAs ======================================= /// @notice Lets a HA join the protocol and create a perpetual /// @param owner Address of the future owner of the perpetual /// @param margin Amount of collateral brought by the HA /// @param committedAmount Amount of collateral covered by the HA /// @param maxOracleRate Maximum oracle value that the HA wants to see stored in the perpetual /// @param minNetMargin Minimum net margin that the HA is willing to see stored in the perpetual /// @return perpetualID The ID of the perpetual opened by this HA /// @dev The future owner of the perpetual cannot be the zero address /// @dev It is possible to open a perpetual on behalf of someone else /// @dev The `maxOracleRate` parameter serves as a protection against oracle manipulations for HAs opening perpetuals /// @dev `minNetMargin` is a protection against too big variations in the fees for HAs function openPerpetual( address owner, uint256 margin, uint256 committedAmount, uint256 maxOracleRate, uint256 minNetMargin ) external override whenNotPaused zeroCheck(owner) returns (uint256 perpetualID) { // Transaction will revert anyway if `margin` is zero require(committedAmount > 0, "27"); // There could be a reentrancy attack as a call to an external contract is done before state variables // updates. Yet in this case, the call involves a transfer from the `msg.sender` to the contract which // eliminates the risk _token.safeTransferFrom(msg.sender, address(poolManager), margin); // Computing the oracle value // Only the highest oracle value (between Chainlink and Uniswap) we get is stored in the perpetual (, uint256 rateUp) = _getOraclePrice(); // Checking if the oracle rate is not too big: a too big oracle rate could mean for a HA that the price // has become too high to make it interesting to open a perpetual require(rateUp <= maxOracleRate, "28"); // Computing the total amount of stablecoins that this perpetual is going to hedge for the protocol uint256 totalHedgeAmountUpdate = (committedAmount * rateUp) / _collatBase; // Computing the net amount brought by the HAs to store in the perpetual uint256 netMargin = _getNetMargin(margin, totalHedgeAmountUpdate, committedAmount); require(netMargin >= minNetMargin, "29"); // Checking if the perpetual is not too leveraged, even after computing the fees require((committedAmount * BASE_PARAMS) <= maxLeverage * netMargin, "30"); // ERC721 logic _perpetualIDcount.increment(); perpetualID = _perpetualIDcount.current(); // In the logic of the staking contract, the `_updateReward` should be called // before the perpetual is opened _updateReward(perpetualID, 0); // Updating the total amount of stablecoins hedged by HAs and creating the perpetual totalHedgeAmount += totalHedgeAmountUpdate; perpetualData[perpetualID] = Perpetual(rateUp, block.timestamp, netMargin, committedAmount); // Following ERC721 logic, the function `_mint(...)` calls `_checkOnERC721Received` and could then be used as // a reentrancy vector. Minting should then only be done at the very end after updating all variables. _mint(owner, perpetualID); emit PerpetualOpened(perpetualID, rateUp, netMargin, committedAmount); }
30,207
54
// Called by the users DSProxy/Owner who subscribed cancels his subscription
function unsubscribe() external { _unsubscribe(msg.sender); }
function unsubscribe() external { _unsubscribe(msg.sender); }
4,741
5
// Withdraws ETH from an EigenPod. The ETH must have first been withdrawn from the beacon chain. podOwner The owner of the pod whose balance must be withdrawn. recipient The recipient of the withdrawn ETH. amount The amount of ETH to withdraw. Callable only by the StrategyManager contract. /
function withdrawRestakedBeaconChainETH(address podOwner, address recipient, uint256 amount) external;
function withdrawRestakedBeaconChainETH(address podOwner, address recipient, uint256 amount) external;
29,960
30
// Add boosted NFT id to set
boostedNftIds.add(boostedNftId);
boostedNftIds.add(boostedNftId);
35,274
32
// Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function'spurpose is to provide a mechanism for accounts to lose their privilegesif they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked}event. Requirements: - the caller must be `account`. /
function renounceRole(bytes32 role, address account) external;
function renounceRole(bytes32 role, address account) external;
2,445
16
// RedeemEther reward for proposal_proposalId the ID of the voting in the voting machine return amount ether redeemed amount/
function redeemEther(bytes32 _proposalId) public returns(uint256 amount) { ContributionProposal storage proposal = organizationProposals[_proposalId]; require(proposal.acceptedByVotingMachine, "proposal was not accepted by the voting machine"); if (proposal.beneficiary == address(this)) { if (proposal.ethRewardLeft == 0) { proposal.ethRewardLeft = proposal.ethReward; } } amount = proposal.ethReward; //set proposal rewards to zero to prevent reentrancy attack. proposal.ethReward = 0; if (amount > 0) { require(Controller(avatar.owner()).sendEther(amount, proposal.beneficiary, avatar)); emit RedeemEther(address(avatar), _proposalId, proposal.beneficiary, amount); } }
function redeemEther(bytes32 _proposalId) public returns(uint256 amount) { ContributionProposal storage proposal = organizationProposals[_proposalId]; require(proposal.acceptedByVotingMachine, "proposal was not accepted by the voting machine"); if (proposal.beneficiary == address(this)) { if (proposal.ethRewardLeft == 0) { proposal.ethRewardLeft = proposal.ethReward; } } amount = proposal.ethReward; //set proposal rewards to zero to prevent reentrancy attack. proposal.ethReward = 0; if (amount > 0) { require(Controller(avatar.owner()).sendEther(amount, proposal.beneficiary, avatar)); emit RedeemEther(address(avatar), _proposalId, proposal.beneficiary, amount); } }
15,986
30
// Set the BAT-A Flip ttl BAT_FLIP_TTL is the bid lifetime Existing ttl: 10 minutes New ttl: 6 hours
uint256 BAT_FLIP_TTL = 6 hours; FlipAbstract(MCD_FLIP_BAT_A).file(bytes32("ttl"), BAT_FLIP_TTL);
uint256 BAT_FLIP_TTL = 6 hours; FlipAbstract(MCD_FLIP_BAT_A).file(bytes32("ttl"), BAT_FLIP_TTL);
31,913
12
// Adds two unsigned integers, reverts on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; }
2,794
13
// Active votes are those for which at least one following election has been held. These votes have contributed to the election of validators and thus accrue rewards.
struct ActiveVotes { // The total number of active votes cast across all groups. uint256 total; mapping(address => GroupActiveVotes) forGroup; }
struct ActiveVotes { // The total number of active votes cast across all groups. uint256 total; mapping(address => GroupActiveVotes) forGroup; }
18,175
72
// IAnycallProxy interface of the anycall proxy/ Note: `receiver` is the `fallback receive address` when exec failed.
interface IAnycallProxy { function exec( address token, address receiver, uint256 amount, bytes calldata data ) external returns (bool success, bytes memory result); }
interface IAnycallProxy { function exec( address token, address receiver, uint256 amount, bytes calldata data ) external returns (bool success, bytes memory result); }
33,055
75
// Returns the ERC20 token balance of a given account. /
function balanceOf(address account) external view returns (uint) { return tokenState.balanceOf(account); }
function balanceOf(address account) external view returns (uint) { return tokenState.balanceOf(account); }
35,360
130
// Mints tokens to an address in batch using an ERC-20 token for paymentfee may or may not be required _to address of the future owner of the token _amount number of tokens to mint _erc20TokenContract erc-20 token contract to mint with /
function mintToMultipleERC20(address _to, uint256 _amount, address _erc20TokenContract) public payable { if(_amount == 0) revert MintZeroQuantity(); if(_amount > maxBatchSize) revert TransactionCapExceeded(); if(!mintingOpen) revert PublicMintClosed(); if(currentTokenId() + _amount > collectionSize) revert CapExceeded(); if(mintingOpen && onlyAllowlistMode) revert PublicMintClosed(); if(msg.value != PROVIDER_FEE) revert InvalidPayment(); // ERC-20 Specific pre-flight checks if(!isApprovedForERC20Payments(_erc20TokenContract)) revert ERC20TokenNotApproved(); uint256 tokensQtyToTransfer = chargeAmountForERC20(_erc20TokenContract) * _amount; IERC20 payableToken = IERC20(_erc20TokenContract); if(payableToken.balanceOf(_to) < tokensQtyToTransfer) revert ERC20InsufficientBalance(); if(payableToken.allowance(_to, address(this)) < tokensQtyToTransfer) revert ERC20InsufficientAllowance(); bool transferComplete = payableToken.transferFrom(_to, address(this), tokensQtyToTransfer); if(!transferComplete) revert ERC20TransferFailed(); sendProviderFee(); _safeMint(_to, _amount, false); }
function mintToMultipleERC20(address _to, uint256 _amount, address _erc20TokenContract) public payable { if(_amount == 0) revert MintZeroQuantity(); if(_amount > maxBatchSize) revert TransactionCapExceeded(); if(!mintingOpen) revert PublicMintClosed(); if(currentTokenId() + _amount > collectionSize) revert CapExceeded(); if(mintingOpen && onlyAllowlistMode) revert PublicMintClosed(); if(msg.value != PROVIDER_FEE) revert InvalidPayment(); // ERC-20 Specific pre-flight checks if(!isApprovedForERC20Payments(_erc20TokenContract)) revert ERC20TokenNotApproved(); uint256 tokensQtyToTransfer = chargeAmountForERC20(_erc20TokenContract) * _amount; IERC20 payableToken = IERC20(_erc20TokenContract); if(payableToken.balanceOf(_to) < tokensQtyToTransfer) revert ERC20InsufficientBalance(); if(payableToken.allowance(_to, address(this)) < tokensQtyToTransfer) revert ERC20InsufficientAllowance(); bool transferComplete = payableToken.transferFrom(_to, address(this), tokensQtyToTransfer); if(!transferComplete) revert ERC20TransferFailed(); sendProviderFee(); _safeMint(_to, _amount, false); }
32,004
270
// Add the managed token to the blacklist to disallow a token holder from executing actions on the token controller's (this contract) behalf
address[] memory blacklist = new address[](1); blacklist[0] = address(token); runScript(_evmScript, input, blacklist);
address[] memory blacklist = new address[](1); blacklist[0] = address(token); runScript(_evmScript, input, blacklist);
47,114
187
// checkpoint before userCollateralShare is changed
ICheckpointToken(address(collateral)).user_checkpoint([user,address(0)]); userCollateralShare[user] = userCollateralShare[user].sub(collateralShare); emit LogRemoveCollateral(user, to, collateralShare); emit LogRepay(msg.sender, user, borrowAmount, borrowPart);
ICheckpointToken(address(collateral)).user_checkpoint([user,address(0)]); userCollateralShare[user] = userCollateralShare[user].sub(collateralShare); emit LogRemoveCollateral(user, to, collateralShare); emit LogRepay(msg.sender, user, borrowAmount, borrowPart);
14,226
347
// Redeeming
function redeem(address _basset, uint256 _bassetQuantity) external returns (uint256 massetRedeemed); function redeemTo(address _basset, uint256 _bassetQuantity, address _recipient) external returns (uint256 massetRedeemed); function redeemMulti(address[] calldata _bAssets, uint256[] calldata _bassetQuantities, address _recipient) external returns (uint256 massetRedeemed); function redeemMasset(uint256 _mAssetQuantity, address _recipient) external;
function redeem(address _basset, uint256 _bassetQuantity) external returns (uint256 massetRedeemed); function redeemTo(address _basset, uint256 _bassetQuantity, address _recipient) external returns (uint256 massetRedeemed); function redeemMulti(address[] calldata _bAssets, uint256[] calldata _bassetQuantities, address _recipient) external returns (uint256 massetRedeemed); function redeemMasset(uint256 _mAssetQuantity, address _recipient) external;
42,709
0
// Deployer nodes on the network run the deployment app and deploy MuonApps
bool isDeployer;
bool isDeployer;
3,056
137
// when sending to a "foreign" address, enforce a withdraw pattern,making the caller the owner in the mean time
else { doSpawn(_galaxy, _target, false, msg.sender); }
else { doSpawn(_galaxy, _target, false, msg.sender); }
43,061
1
// Constructor _avatar The avatar of the DAO _identity The identity contract _gasLimit The gas limit /
constructor(Avatar _avatar, Identity _identity) public FeelessScheme(_identity, _avatar)
constructor(Avatar _avatar, Identity _identity) public FeelessScheme(_identity, _avatar)
48,974
944
// Zones and contract offerers can communicate which schemas they implement along with any associated metadata related to each schema. /
struct Schema { uint256 id; bytes metadata; }
struct Schema { uint256 id; bytes metadata; }
23,835
9
// Facilitates the change of ownership/Only called by the contract owner/_newOwner the address of the new owner
function setOwner(address _newOwner) external onlyOwner { require(_newOwner != address(0), "Cannot be zero addr"); owner = _newOwner; }
function setOwner(address _newOwner) external onlyOwner { require(_newOwner != address(0), "Cannot be zero addr"); owner = _newOwner; }
31,930
295
// Returns total remaining number of tokens available in the Genesis sale/
function remainingGenesisTokens() public view returns (uint256) { return _getMaxGenesisContributionTokens() - (totalSupply() - totalAdminMints); }
function remainingGenesisTokens() public view returns (uint256) { return _getMaxGenesisContributionTokens() - (totalSupply() - totalAdminMints); }
14,559
18
// Snapshots the totalSupply after it has been increased. /
function _mint(address account, uint256 amount) internal virtual override { super._mint(account, amount); require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes"); _writeCheckpoint(_totalSupplyCheckpoints, _add, amount); }
function _mint(address account, uint256 amount) internal virtual override { super._mint(account, amount); require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes"); _writeCheckpoint(_totalSupplyCheckpoints, _add, amount); }
24,764
6
// Data used for checking whether a subscription is active and is refund possible
struct Subscription { uint256 expiration; Currency currency; uint256 balance; }
struct Subscription { uint256 expiration; Currency currency; uint256 balance; }
33,442
4
// User withdraws tokens from the Aave protocol/_market address provider for specific market/_tokenAddr The address of the token to be withdrawn/_amount Amount of tokens to be withdrawn -> send -1 for whole amount
function withdraw(address _market, address _tokenAddr, uint256 _amount) public burnGas(8) { address lendingPool = ILendingPoolAddressesProviderV2(_market).getLendingPool(); _tokenAddr = changeToWeth(_tokenAddr); if (_tokenAddr == WETH_ADDRESS) { // if weth, pull to proxy and return ETH to user ILendingPoolV2(lendingPool).withdraw(_tokenAddr, _amount, address(this)); // needs to use balance of in case that amount is -1 for whole debt TokenInterface(WETH_ADDRESS).withdraw(TokenInterface(WETH_ADDRESS).balanceOf(address(this))); msg.sender.transfer(address(this).balance); } else { // if not eth send directly to user ILendingPoolV2(lendingPool).withdraw(_tokenAddr, _amount, msg.sender); } }
function withdraw(address _market, address _tokenAddr, uint256 _amount) public burnGas(8) { address lendingPool = ILendingPoolAddressesProviderV2(_market).getLendingPool(); _tokenAddr = changeToWeth(_tokenAddr); if (_tokenAddr == WETH_ADDRESS) { // if weth, pull to proxy and return ETH to user ILendingPoolV2(lendingPool).withdraw(_tokenAddr, _amount, address(this)); // needs to use balance of in case that amount is -1 for whole debt TokenInterface(WETH_ADDRESS).withdraw(TokenInterface(WETH_ADDRESS).balanceOf(address(this))); msg.sender.transfer(address(this).balance); } else { // if not eth send directly to user ILendingPoolV2(lendingPool).withdraw(_tokenAddr, _amount, msg.sender); } }
41,648
50
// Updates LXL management settings. _manager Account that governs LXL contract settings. _swiftResolverToken Token to mark participants in swift resolution. _wETH Standard contract reference to wrap ether._MAX_DURATION Time limit in seconds on token lockup - default 63113904 (2-year). _resolutionRate Rate to determine resolution fee for locker (e.g., 20 = 5% of remainder). _swiftResolverTokenBalance Token balance required to perform swift resolution._lockerTerms General terms wrapping LXL. /
function updateLockerSettings( address _manager, address _swiftResolverToken, address _wETH, uint256 _MAX_DURATION, uint256 _resolutionRate, uint256 _swiftResolverTokenBalance, string calldata _lockerTerms
function updateLockerSettings( address _manager, address _swiftResolverToken, address _wETH, uint256 _MAX_DURATION, uint256 _resolutionRate, uint256 _swiftResolverTokenBalance, string calldata _lockerTerms
40,586
7
// This set of contract is to create a ERC721 token with URI support for each game trade listing ERC721URIStorage we use here is an OpenZeppelin contract for ERC721 that allows to set URI on token creation
contract GameListing is ERC721URIStorage { // Counters for the total supply and balances of all tokens using Counters for Counters.Counter; Counters.Counter private _tokenIds; address contractAddress; // Take the markeplace contract address to deploy the contract constructor(address marketplaceAddress) ERC721("DeGame Australia", "DEGAME") { contractAddress = marketplaceAddress; } // Pass game trading metadata to the createToken function will create a new ERC721 token for the DeGame Trading contract to use // The metadata will be stored in the URI of the token function createGameListing(string memory gameListingDetails) public returns (uint) { _tokenIds.increment(); uint256 newgameID = _tokenIds.current(); _mint(msg.sender, newgameID); _setTokenURI(newgameID, gameListingDetails); setApprovalForAll(contractAddress, true); return newgameID; } // This function is to check if the game listing exist or not function checkGameListing(uint gameID) public view returns (bool) { return _exists(gameID); } // This function is to get the game listing details function getGameListingDetails(uint gameID) public view returns (string memory) { return tokenURI(gameID); } // Martketplace contract can call this function to burn/cancel the game listing function cancelGameListing(uint gameID) public { require(msg.sender == contractAddress); require(checkGameListing(gameID)); _burn(gameID); } function getLastListingID() public view returns (uint) { return _tokenIds.current(); } }
contract GameListing is ERC721URIStorage { // Counters for the total supply and balances of all tokens using Counters for Counters.Counter; Counters.Counter private _tokenIds; address contractAddress; // Take the markeplace contract address to deploy the contract constructor(address marketplaceAddress) ERC721("DeGame Australia", "DEGAME") { contractAddress = marketplaceAddress; } // Pass game trading metadata to the createToken function will create a new ERC721 token for the DeGame Trading contract to use // The metadata will be stored in the URI of the token function createGameListing(string memory gameListingDetails) public returns (uint) { _tokenIds.increment(); uint256 newgameID = _tokenIds.current(); _mint(msg.sender, newgameID); _setTokenURI(newgameID, gameListingDetails); setApprovalForAll(contractAddress, true); return newgameID; } // This function is to check if the game listing exist or not function checkGameListing(uint gameID) public view returns (bool) { return _exists(gameID); } // This function is to get the game listing details function getGameListingDetails(uint gameID) public view returns (string memory) { return tokenURI(gameID); } // Martketplace contract can call this function to burn/cancel the game listing function cancelGameListing(uint gameID) public { require(msg.sender == contractAddress); require(checkGameListing(gameID)); _burn(gameID); } function getLastListingID() public view returns (uint) { return _tokenIds.current(); } }
14,913
6
// Event emitted when deposits are disabled or enabled for a specific StructuredPortfolio status newDepositAllowed Value indicating whether deposits should be enabled or disabled portfolioStatus StructuredPortfolio status for which changes are applied /
event DepositAllowedChanged(bool newDepositAllowed, Status portfolioStatus);
event DepositAllowedChanged(bool newDepositAllowed, Status portfolioStatus);
5,666
33
// Deletes an existing entry/Owner can delete an existing entry/_adapter address of the adapter of the exchange that is to be removed/_adapterIndex index of the exchange in array
function removeExchangeAdapter( address _adapter, uint _adapterIndex
function removeExchangeAdapter( address _adapter, uint _adapterIndex
32,971
11
// return Returns the address of the Uniswap V3 factory
function factory() external view returns (address);
function factory() external view returns (address);
1,376
3
// description
string public description = "Celebrating Pride Month 2022";
string public description = "Celebrating Pride Month 2022";
12,698
50
// Get a reference to the number of tiers being removed.
uint256 _numberOfTiersToRemove = _tierIdsToRemove.length;
uint256 _numberOfTiersToRemove = _tierIdsToRemove.length;
11,789
8
// initialize currency contract
currency = ERC20(currencyAddress_);
currency = ERC20(currencyAddress_);
48,999
203
// Mark as invalid
serviceTypeInfo[_serviceType].isValid = false;
serviceTypeInfo[_serviceType].isValid = false;
38,381
72
// On trade failure, we will simply return 0
uint128 fee = _calculateTransactionFee(cash, timeToMaturity); return cash.sub(fee);
uint128 fee = _calculateTransactionFee(cash, timeToMaturity); return cash.sub(fee);
32,548
46
// Drain all coins
function drain() external onlyOwner { owner.transfer(this.balance); }
function drain() external onlyOwner { owner.transfer(this.balance); }
34,097
8
// 玩家陣列
Player[] public playersInGame;
Player[] public playersInGame;
10,477
50
// Transfer specified NFT tokenId
tokenId );
tokenId );
43,978
0
// claimedToken event
event ClaimedTokens(address indexed token, address indexed owner, uint amount); bool private singletonLock = false;
event ClaimedTokens(address indexed token, address indexed owner, uint amount); bool private singletonLock = false;
46,815
23
// Maximum fraction of interest that can be set aside for reserves /
uint internal constant reserveFactorMaxMantissa = 1e18;
uint internal constant reserveFactorMaxMantissa = 1e18;
15,342
226
// unsuccess:
success := 0 cb := 0
success := 0 cb := 0
6,805
103
// end the round (distributes pot) & start new round
round_[_rID].ended = true; _eventData_ = endRound(_eventData_);
round_[_rID].ended = true; _eventData_ = endRound(_eventData_);
11,379
101
// ========== CALL FUNCTIONS ========== //return staking contract address /
function getStakingAddress() external view override returns (address) { return _stakingAddress; }
function getStakingAddress() external view override returns (address) { return _stakingAddress; }
18,785
199
// check if user is part of whitelist, if he is then he is able to mint at discount
if (checkWhitelist(msg.sender)) { MINT_PRICE = WL_PRICE; }
if (checkWhitelist(msg.sender)) { MINT_PRICE = WL_PRICE; }
4,854
6
// private
function _Doihave(uint8 gaoIdx) private view returns (bool) { return doihave[msg.sender][gaoIdx]; }
function _Doihave(uint8 gaoIdx) private view returns (bool) { return doihave[msg.sender][gaoIdx]; }
1,371
36
// Verify inclusion
require(checkTransitionInclusion(_transition0), 'The first transition must be included!'); require(checkTransitionInclusion(_transition1), 'The second transition must be included!');
require(checkTransitionInclusion(_transition0), 'The first transition must be included!'); require(checkTransitionInclusion(_transition1), 'The second transition must be included!');
5,574
32
// Updates the description of the product (visible to the user)._plan is the hash of the user's plan._description the description which they want to update it to./
function setPlanDescription(bytes32 _plan, string _description) public isOwnerOfPlan(_plan) shouldEmitPlanChanges(_plan)
function setPlanDescription(bytes32 _plan, string _description) public isOwnerOfPlan(_plan) shouldEmitPlanChanges(_plan)
29,900
27
// Register a new anchorroot - Aergo blocks state rootheight - block height of rootsigners - array of signer indexesvs, rs, ss - array of signatures matching signers indexes
function newStateAnchor( bytes32 root, uint height, uint[] memory signers, uint8[] memory vs, bytes32[] memory rs, bytes32[] memory ss
function newStateAnchor( bytes32 root, uint height, uint[] memory signers, uint8[] memory vs, bytes32[] memory rs, bytes32[] memory ss
31,609
47
// Short circuit if interest already calculated this block OR if interest is paused
if (_currentRateInfo.lastTimestamp != block.timestamp && !isInterestPaused) {
if (_currentRateInfo.lastTimestamp != block.timestamp && !isInterestPaused) {
16,690
100
// verifies return of flash loan
require( address(this).balance >= beforeEtherBalance && _underlyingBalance() .add(totalAssetBorrow()) >= beforeAssetsBalance, "40" ); return returnData;
require( address(this).balance >= beforeEtherBalance && _underlyingBalance() .add(totalAssetBorrow()) >= beforeAssetsBalance, "40" ); return returnData;
15,819
30
// the sender has claimed already
if (tokenAmount == 0) { return; }
if (tokenAmount == 0) { return; }
8,599
148
// Get the total rewards.
function getPendingOGReward(address user) internal view returns(uint256) { return Noundles.noundleBalance(user) * rate * (block.timestamp - (lastUpdate[user] >= startBlock ? lastUpdate[user] : startBlock)) / interval; }
function getPendingOGReward(address user) internal view returns(uint256) { return Noundles.noundleBalance(user) * rate * (block.timestamp - (lastUpdate[user] >= startBlock ? lastUpdate[user] : startBlock)) / interval; }
31,972
27
// Burn liquidity from the sender and collect tokens owed for the liquidity/tickLower The lower tick of the position for which to burn liquidity/tickUpper The upper tick of the position for which to burn liquidity/liquidity The amount of liquidity to burn/to The address which should receive the fees collected/collectAll If true, collect all tokens owed in the pool, else collect the owed tokens of the burn/ return amount0 The amount of fees collected in token0/ return amount1 The amount of fees collected in token1
function _burnLiquidity( int24 tickLower, int24 tickUpper, uint128 liquidity, address to, bool collectAll, uint256 amount0Min, uint256 amount1Min
function _burnLiquidity( int24 tickLower, int24 tickUpper, uint128 liquidity, address to, bool collectAll, uint256 amount0Min, uint256 amount1Min
8,665
70
// Pops the last 20 bytes off of a byte array by modifying its length./b Byte array that will be modified./ return The 20 byte address that was popped off.
function popLast20Bytes(bytes memory b) internal pure returns (address result)
function popLast20Bytes(bytes memory b) internal pure returns (address result)
37,516
5
// rate Number of token units a buyer gets per wei The rate is the conversion between wei and the smallest and indivisibletoken unit. So, if you are using a rate of 1 with a ERC20Detailed tokenwith 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK. wallet Address where collected funds will be forwarded to token Address of the token being sold /
constructor (uint256 rate, address payable wallet, IERC20 token) { require(rate > 0, "Crowdsale: rate is 0"); require(wallet != address(0), "Crowdsale: wallet is the zero address"); require(address(token) != address(0), "Crowdsale: token is the zero address"); _rate = rate; _wallet = wallet; _token = token; }
constructor (uint256 rate, address payable wallet, IERC20 token) { require(rate > 0, "Crowdsale: rate is 0"); require(wallet != address(0), "Crowdsale: wallet is the zero address"); require(address(token) != address(0), "Crowdsale: token is the zero address"); _rate = rate; _wallet = wallet; _token = token; }
1,880
24
// Override of mint function with rewards corrections/account Account to mint for/amount Amount to mint
function _mint(address account, uint256 amount) internal virtual override { _distributeReward(); super._mint(account, amount); _magnifiedRewardCorrections[account] -= (_magnifiedRewardPerShare * amount).toInt256(); }
function _mint(address account, uint256 amount) internal virtual override { _distributeReward(); super._mint(account, amount); _magnifiedRewardCorrections[account] -= (_magnifiedRewardPerShare * amount).toInt256(); }
25,073
91
// Sets wallets for taxes. /
function setTaxWallets(address dev, address marketing, address charity) public onlyOwner { taxWallets["dev"] = dev; taxWallets["marketing"] = marketing; taxWallets["charity"] = charity; }
function setTaxWallets(address dev, address marketing, address charity) public onlyOwner { taxWallets["dev"] = dev; taxWallets["marketing"] = marketing; taxWallets["charity"] = charity; }
15,334
2
// solhint-disable-next-line not-rely-on-timerequire(openingTime >= block.timestamp, "TimedCrowdsale: opening time is before current time"); solhint-disable-next-line max-line-length
require(closingTime > openingTime, "TimedCrowdsale: opening time is not before closing time"); _openingTime = openingTime; _closingTime = closingTime;
require(closingTime > openingTime, "TimedCrowdsale: opening time is not before closing time"); _openingTime = openingTime; _closingTime = closingTime;
18,723
130
// Fee address
address public feeAddress; event TicketPurchase(address indexed user, uint256 indexed lottery, uint256 tickets, uint256 amount); event FreeTicket(address indexed user, uint256 indexed lottery, address nft, uint256 id); event LotteryStart(uint256 indexed lottery, uint256 startTimestamp); event LotteryEnd(uint256 prize, address indexed winner, uint256 totalTickets); event NameChange(address indexed user, bytes32 name); constructor(IERC20 _boob, IERC721 _nft) public
address public feeAddress; event TicketPurchase(address indexed user, uint256 indexed lottery, uint256 tickets, uint256 amount); event FreeTicket(address indexed user, uint256 indexed lottery, address nft, uint256 id); event LotteryStart(uint256 indexed lottery, uint256 startTimestamp); event LotteryEnd(uint256 prize, address indexed winner, uint256 totalTickets); event NameChange(address indexed user, bytes32 name); constructor(IERC20 _boob, IERC721 _nft) public
48,434
17
// revokeRole remove a role to an address role role check line 22 account of the removed role /
function revokeRole(bytes32 role, address account) public onlyAdmin { _revokeRole(role, account); }
function revokeRole(bytes32 role, address account) public onlyAdmin { _revokeRole(role, account); }
30,346
15
// Make account participating in the buyback. If the sender has a staked balance, thenthe weight will be equal to the discounted amount of staked funds. /
function participate() external;
function participate() external;
37,231
0
// Token => Requester => bountyAmount
mapping (address => mapping (address => uint256)) public pendingBounty;
mapping (address => mapping (address => uint256)) public pendingBounty;
11,807
16
// return displays the user's share of the pooled alTokens.
function dividendsOwing(address account) public view returns (uint256) { uint256 newDividendPoints = totalDividendPoints.sub(lastDividendPoints[account]); return depositedAlTokens[account].mul(newDividendPoints).div(pointMultiplier); }
function dividendsOwing(address account) public view returns (uint256) { uint256 newDividendPoints = totalDividendPoints.sub(lastDividendPoints[account]); return depositedAlTokens[account].mul(newDividendPoints).div(pointMultiplier); }
82,672
52
// return The total number of fragments. /
function totalSupply() public view returns (uint256)
function totalSupply() public view returns (uint256)
13,173
14
// Insert node `_new` beside existing node `_node` in direction `NEXT`. self stored linked list from contract _node existing node _newnew node to insertreturn bool true if success, false otherwise /
function face(List storage self, uint256 _node, uint256 _new) internal returns (bool) { return insert(self, _node, _new, NEXT); }
function face(List storage self, uint256 _node, uint256 _new) internal returns (bool) { return insert(self, _node, _new, NEXT); }
23,123
92
// Map to keep the list of allowed swap tokens. i.e if user pass token K to swap with wrapped token and K is not present in `allowedSwapTokens` list then transaction will get revert.
mapping (address => bool) public allowedSwapTokens;
mapping (address => bool) public allowedSwapTokens;
33,499
7
// Key is block number
mapping (uint32 => Block) public blocks;
mapping (uint32 => Block) public blocks;
16,574
129
// this overridable function returns the current conversion rate factor /
function getConversionRateFactor() public pure returns (uint256) { return CONVERSION_RATE_FACTOR; }
function getConversionRateFactor() public pure returns (uint256) { return CONVERSION_RATE_FACTOR; }
36,427
31
// Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], butwith `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ /
function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require( address(this).balance >= value, "Address: insufficient balance for call" );
function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require( address(this).balance >= value, "Address: insufficient balance for call" );
14,668
74
// Utility mapping for UI to figure out the vault id of a strategy.
function strategyVaultId(IStrategy strategy) external view returns(uint256);
function strategyVaultId(IStrategy strategy) external view returns(uint256);
4,490
3
// Returns the address where a contract will be stored if deployed via {deploy}. Any change in the`bytecodeHash` or `salt` will result in a new destination address. /
function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) { return computeAddress(salt, bytecodeHash, address(this)); }
function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) { return computeAddress(salt, bytecodeHash, address(this)); }
29,368
65
// Returns the number of values on the set. O(1). /
function _length(Set storage set) private view returns (uint256) { return set._values.length; }
function _length(Set storage set) private view returns (uint256) { return set._values.length; }
9,449
8
// To let this Smart Contract work, you need to pass the ERC721 token addresses supported by this survey (ARTE/ETRA).
constructor(address[] memory allowedTokenAddresses, uint256 surveyEndBlock) public { for(uint256 i = 0; i < allowedTokenAddresses.length; i++) { _allowedTokenAddresses[allowedTokenAddresses[i]] = true; } _surveyEndBlock = surveyEndBlock; _allowedVotingAmounts[4000000000000000] = 1; _allowedVotingAmounts[30000000000000000] = 5; _allowedVotingAmounts[100000000000000000] = 10; _allowedVotingAmounts[300000000000000000] = 20; }
constructor(address[] memory allowedTokenAddresses, uint256 surveyEndBlock) public { for(uint256 i = 0; i < allowedTokenAddresses.length; i++) { _allowedTokenAddresses[allowedTokenAddresses[i]] = true; } _surveyEndBlock = surveyEndBlock; _allowedVotingAmounts[4000000000000000] = 1; _allowedVotingAmounts[30000000000000000] = 5; _allowedVotingAmounts[100000000000000000] = 10; _allowedVotingAmounts[300000000000000000] = 20; }
24,856
16
// Ensure staker has enough balance to stake
require( balances[msg.sender][balances[msg.sender].length - 1].value >= uints[_STAKE_AMOUNT], "Balance is lower than stake amount" );
require( balances[msg.sender][balances[msg.sender].length - 1].value >= uints[_STAKE_AMOUNT], "Balance is lower than stake amount" );
63,267
3
// Mointain the overall backing policy; handout assets otherwise/ @custom:interaction
function manageTokens(IERC20[] memory erc20s) external;
function manageTokens(IERC20[] memory erc20s) external;
31,117