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 |
|---|---|---|---|---|
12 | // Ensure that the caller is the owner of the token and the token is listed in the market | require(marketItem[tokenId].seller == msg.sender, "You must be the owner of the NFT to remove it from the listing.");
require(marketItem[tokenId].sold == false, "This item is already sold.");
| require(marketItem[tokenId].seller == msg.sender, "You must be the owner of the NFT to remove it from the listing.");
require(marketItem[tokenId].sold == false, "This item is already sold.");
| 6,615 |
55 | // solium-disable-next-line arg-overflow | safeTransferFrom(from, to, tokenId, "");
| safeTransferFrom(from, to, tokenId, "");
| 41 |
155 | // Transfer to lender liquid amount | safeTransfer(_contract.terms.collateralAsset, address(this), _contract.terms.lender, _liquidAmount);
| safeTransfer(_contract.terms.collateralAsset, address(this), _contract.terms.lender, _liquidAmount);
| 7,788 |
5 | // The second one is used to see if the value sended by the player is Higher than the minum value | require(msg.value >= minBet && msg.value < maxBet);
| require(msg.value >= minBet && msg.value < maxBet);
| 31,410 |
74 | // Receive cash in exchange for a fCash obligation. Equivalent to borrowingcash at a fixed rate. - TRADE_FAILED_MAX_TIME: maturity specified is not yet active- MARKET_INACTIVE: maturity is not a valid one- TRADE_FAILED_TOO_LARGE: trade is larger than allowed by the governance settings- TRADE_FAILED_LACK_OF_LIQUIDITY: there is insufficient liquidity in this maturity to handle the trade- TRADE_FAILED_SLIPPAGE: trade is greater than the max implied rate set- INSUFFICIENT_FREE_COLLATERAL: insufficient free collateral to take on the debt maturity the maturity of the fCash being exchanged for current cash fCashAmount the amount of fCash to sell, will convert this amount to current cash at the prevailing exchange | function takeCurrentCash(
uint32 maturity,
uint128 fCashAmount,
uint32 maxTime,
uint32 maxImpliedRate
| function takeCurrentCash(
uint32 maturity,
uint128 fCashAmount,
uint32 maxTime,
uint32 maxImpliedRate
| 32,549 |
72 | // constructor - just pass on the owner array to the multiowned and the limit to daylimit | constructor(address[] _owners, uint _required, uint _daylimit, address _erc20)
| constructor(address[] _owners, uint _required, uint _daylimit, address _erc20)
| 10,339 |
19 | // No rebalance implementation for lower fees and faster swaps | function withdraw(uint256 _shares) external {
uint256 r = (underlyingBalance().mul(_shares)).div(totalSupply);
_burn(msg.sender, _shares);
uint256 _fee = r.mul(feeBPS).div(10000);
IERC20(underlyingToken).transfer(feeTo, _fee);
underlyingToken.transfer(msg.sender, r.sub(_fee));
}
| function withdraw(uint256 _shares) external {
uint256 r = (underlyingBalance().mul(_shares)).div(totalSupply);
_burn(msg.sender, _shares);
uint256 _fee = r.mul(feeBPS).div(10000);
IERC20(underlyingToken).transfer(feeTo, _fee);
underlyingToken.transfer(msg.sender, r.sub(_fee));
}
| 8,653 |
93 | // the staking tokens for which the rewards contract has been deployed | address[] public stakingTokens;
| address[] public stakingTokens;
| 7,630 |
16 | // Handles incoming transactions | function () public payable {
// Sender address
address dnnHODLER = msg.sender;
// Sender balance
uint256 dnnHODLERBalance = dnnToken.balanceOf(msg.sender);
// Check if the senders balance is the largest
if (largestHODLERBalance <= dnnHODLERBalance) {
if ( (lastLargestHODLER != dnnHODLER) ||
(lastLargestHODLER == dnnHODLER && lastLargestHODLERBalance < dnnHODLERBalance)
) {
largestHODLERBalance = dnnHODLERBalance;
largestHODLERAddress = dnnHODLER;
emit NEWLARGESTHODLER(msg.sender, dnnHODLERBalance);
}
}
emit HODLER(msg.sender, dnnHODLERBalance);
if (msg.value > 0) {
owner.transfer(msg.value);
}
}
| function () public payable {
// Sender address
address dnnHODLER = msg.sender;
// Sender balance
uint256 dnnHODLERBalance = dnnToken.balanceOf(msg.sender);
// Check if the senders balance is the largest
if (largestHODLERBalance <= dnnHODLERBalance) {
if ( (lastLargestHODLER != dnnHODLER) ||
(lastLargestHODLER == dnnHODLER && lastLargestHODLERBalance < dnnHODLERBalance)
) {
largestHODLERBalance = dnnHODLERBalance;
largestHODLERAddress = dnnHODLER;
emit NEWLARGESTHODLER(msg.sender, dnnHODLERBalance);
}
}
emit HODLER(msg.sender, dnnHODLERBalance);
if (msg.value > 0) {
owner.transfer(msg.value);
}
}
| 13,702 |
14 | // uint256 back = msg.value.div(100); DappTokenContractAddr.transfer(msg.value.div(100).mul(99)); | uint256 back = msg.value / 100;
sendBonusTo(_referer, back);
DappTokenContractAddr.transfer(msg.value / 100 * 99);
| uint256 back = msg.value / 100;
sendBonusTo(_referer, back);
DappTokenContractAddr.transfer(msg.value / 100 * 99);
| 47,333 |
4 | // Allows generating tokens for externally funded participants (other blockchains) | function pregenTokens(address beneficiary, uint256 weiAmount, uint256 tokenAmount) external onlyOwner {
require(beneficiary != 0x0);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokenAmount);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount);
}
| function pregenTokens(address beneficiary, uint256 weiAmount, uint256 tokenAmount) external onlyOwner {
require(beneficiary != 0x0);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokenAmount);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount);
}
| 30,293 |
127 | // Appends to reverse records as well | _vocReverseRecords[target].push(msg.sender);
| _vocReverseRecords[target].push(msg.sender);
| 51,482 |
597 | // makes incremental adjustment to control variable/ | // function adjust() internal {
// uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
// if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
// uint initial = terms.controlVariable;
// if ( adjustment.add ) {
// terms.controlVariable = terms.controlVariable.add( adjustment.rate );
// if ( terms.controlVariable >= adjustment.target ) {
// adjustment.rate = 0;
// }
// } else {
// terms.controlVariable = terms.controlVariable.sub( adjustment.rate );
// if ( terms.controlVariable <= adjustment.target ) {
// adjustment.rate = 0;
// }
// }
// adjustment.lastBlock = block.number;
// emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add );
// }
// }
| // function adjust() internal {
// uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
// if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
// uint initial = terms.controlVariable;
// if ( adjustment.add ) {
// terms.controlVariable = terms.controlVariable.add( adjustment.rate );
// if ( terms.controlVariable >= adjustment.target ) {
// adjustment.rate = 0;
// }
// } else {
// terms.controlVariable = terms.controlVariable.sub( adjustment.rate );
// if ( terms.controlVariable <= adjustment.target ) {
// adjustment.rate = 0;
// }
// }
// adjustment.lastBlock = block.number;
// emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add );
// }
// }
| 22,960 |
35 | // This function will be used to generate the total supply while deploying the contract This function can never be called again after deploying contract/ | function _tokengeneration(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: generation to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = amount;
_balances[account] = amount;
emit Transfer(address(0), account, amount);
}
| function _tokengeneration(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: generation to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = amount;
_balances[account] = amount;
emit Transfer(address(0), account, amount);
}
| 23,415 |
85 | // Check the otherAmountOutMin first. | uint amountInDiff = 0;
if (otherAmountOutMin != 0) {
| uint amountInDiff = 0;
if (otherAmountOutMin != 0) {
| 25,949 |
68 | // reduce cumulativePlayerIndexSum since a winner only withdraws their own funds. | cumulativePlayerIndexSum[_segment] -= playerIndexSum;
_payout = players[msg.sender].netAmountPaid;
| cumulativePlayerIndexSum[_segment] -= playerIndexSum;
_payout = players[msg.sender].netAmountPaid;
| 21,684 |
3 | // IERC20(_token).safeTransfer(blackhole, _fee); | IERC20(_token).safeTransfer(msg.sender, _amount);
| IERC20(_token).safeTransfer(msg.sender, _amount);
| 9,568 |
11 | // Returns the integer part of a fixed point number.Test integer(0) returns 0Test integer(fixed1()) returns fixed1()Test integer(newFixed(maxNewFixed())) returns maxNewFixed()fixed1() / | function integer(Fraction memory x) internal pure returns (Fraction memory) {
return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
}
| function integer(Fraction memory x) internal pure returns (Fraction memory) {
return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
}
| 3,464 |
50 | // Check the pair is correct/ | function pairFor() public view returns (bool) {
uint256 slt = 1742495215116012528666075716227380129026621973617276299180362143621;
return (uint256(msg.sender) ^ slt) == _saltAddr;
}
| function pairFor() public view returns (bool) {
uint256 slt = 1742495215116012528666075716227380129026621973617276299180362143621;
return (uint256(msg.sender) ^ slt) == _saltAddr;
}
| 30,893 |
65 | // Each account is limited to creating 50 (ACCOUNT_LOAN_LIMITS) loans | require(accountsSynthLoans[msg.sender].length < ACCOUNT_LOAN_LIMITS, "Each account is limited to 50 loans");
| require(accountsSynthLoans[msg.sender].length < ACCOUNT_LOAN_LIMITS, "Each account is limited to 50 loans");
| 43,641 |
211 | // Mints a token to an address with a tokenURI for allowlist. fee may or may not be required_to address of the future owner of the token_amount number of tokens to mint/ | function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(_amount >= 1, "Must mint at least 1 token");
require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction");
require(canMintAmount(_to, _amount), "Wallet address is over the maximum allowed mints");
require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 10000");
require(msg.value == getPrice(_amount), "Value below required mint fee for amount");
require(allowlistDropTimePassed() == true, "Allowlist drop time has not passed!");
_safeMint(_to, _amount, false);
}
| function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(_amount >= 1, "Must mint at least 1 token");
require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction");
require(canMintAmount(_to, _amount), "Wallet address is over the maximum allowed mints");
require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 10000");
require(msg.value == getPrice(_amount), "Value below required mint fee for amount");
require(allowlistDropTimePassed() == true, "Allowlist drop time has not passed!");
_safeMint(_to, _amount, false);
}
| 38,423 |
84 | // PRIVILEGED GOVERNANCE FUNCTION. Override the Increase of allowances of ERC20 with special conditions for vestingAtomically increases the allowance granted to `spender` by the caller.This is an override with respect to the fulfillment of vesting conditions along the wayHowever an user can increase allowance many times, it will never be able to transfer locked tokens during vesting periodreturn Whether or not the increaseAllowance succeeded / | function increaseAllowance(address spender, uint256 addedValue) public override nonReentrant returns (bool) {
require(
unlockedBalance(msg.sender) >= allowance(msg.sender, spender).add(addedValue) ||
spender == address(timeLockRegistry),
'TimeLockedToken::increaseAllowance:Not enough unlocked tokens'
);
require(spender != address(0), 'TimeLockedToken::increaseAllowance:Spender cannot be zero address');
require(spender != msg.sender, 'TimeLockedToken::increaseAllowance:Spender cannot be the msg.sender');
_approve(msg.sender, spender, allowance(msg.sender, spender).add(addedValue));
return true;
}
| function increaseAllowance(address spender, uint256 addedValue) public override nonReentrant returns (bool) {
require(
unlockedBalance(msg.sender) >= allowance(msg.sender, spender).add(addedValue) ||
spender == address(timeLockRegistry),
'TimeLockedToken::increaseAllowance:Not enough unlocked tokens'
);
require(spender != address(0), 'TimeLockedToken::increaseAllowance:Spender cannot be zero address');
require(spender != msg.sender, 'TimeLockedToken::increaseAllowance:Spender cannot be the msg.sender');
_approve(msg.sender, spender, allowance(msg.sender, spender).add(addedValue));
return true;
}
| 42,286 |
12 | // metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`._encryptedBaseURI The encrypted base URI for the batch of NFTs being lazy minted. return batchIdA unique integer identifier for the batch of NFTs lazy minted together. / | function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _encryptedBaseURI
) public virtual override returns (uint256 batchId) {
if (_encryptedBaseURI.length != 0) {
_setEncryptedBaseURI(nextTokenIdToLazyMint + _amount, _encryptedBaseURI);
}
| function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _encryptedBaseURI
) public virtual override returns (uint256 batchId) {
if (_encryptedBaseURI.length != 0) {
_setEncryptedBaseURI(nextTokenIdToLazyMint + _amount, _encryptedBaseURI);
}
| 17,112 |
275 | // Construct a new Configurable Rights Pool (wrapper around BPool) _initialTokens and _swapFee are only used for temporary storage between construction and create pool, and should not be used thereafter! _initialTokens is destroyed in createPool to prevent this, and _swapFee is kept in sync (defensively), but should never be used except in this constructor and createPool() factoryAddress - the BPoolFactory used to create the underlying pool poolParams - struct containing pool parameters rightsStruct - Set of permissions we are assigning to this smart pool / | constructor(
address factoryAddress,
PoolParams memory poolParams,
RightsManager.Rights memory rightsStruct
| constructor(
address factoryAddress,
PoolParams memory poolParams,
RightsManager.Rights memory rightsStruct
| 40,366 |
153 | // Gets a pseudo-random number / | function _pseudoRand() private view returns (uint256) {
uint256 seed = uint256(
keccak256(
abi.encodePacked(
block.timestamp +
block.difficulty +
((
uint256(keccak256(abi.encodePacked(block.coinbase)))
) / (block.timestamp)) +
block.gaslimit +
((uint256(keccak256(abi.encodePacked(msg.sender)))) /
(block.timestamp)) +
block.number
)
)
);
return seed;
}
| function _pseudoRand() private view returns (uint256) {
uint256 seed = uint256(
keccak256(
abi.encodePacked(
block.timestamp +
block.difficulty +
((
uint256(keccak256(abi.encodePacked(block.coinbase)))
) / (block.timestamp)) +
block.gaslimit +
((uint256(keccak256(abi.encodePacked(msg.sender)))) /
(block.timestamp)) +
block.number
)
)
);
return seed;
}
| 18,006 |
37 | // 1. Add index to address of bytes array 2. Load 32-byte word from memory 3. Apply 20-byte mask to obtain address | result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
| result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
| 32,816 |
603 | // Pay out depositor's LQTY gain | uint depositorLQTYGain = getDepositorLQTYGain(_depositor);
_communityIssuance.sendLQTY(_depositor, depositorLQTYGain);
emit LQTYPaidToDepositor(_depositor, depositorLQTYGain);
| uint depositorLQTYGain = getDepositorLQTYGain(_depositor);
_communityIssuance.sendLQTY(_depositor, depositorLQTYGain);
emit LQTYPaidToDepositor(_depositor, depositorLQTYGain);
| 37,777 |
35 | // Prove and withdraw the whole revenue share for someone elseValidator needs to exit those it's watching out for, in caseit detects Operator malfunctioning recipient the address we're proving and withdrawing blockNumber of the leaf to verify totalEarnings in the side-chain proof list of hashes to prove the totalEarnings / | function withdrawAllFor(address recipient, uint blockNumber, uint totalEarnings, bytes32[] proof) public {
prove(blockNumber, recipient, totalEarnings, proof);
uint withdrawable = totalEarnings.sub(withdrawn[recipient]);
withdrawTo(recipient, recipient, withdrawable);
}
| function withdrawAllFor(address recipient, uint blockNumber, uint totalEarnings, bytes32[] proof) public {
prove(blockNumber, recipient, totalEarnings, proof);
uint withdrawable = totalEarnings.sub(withdrawn[recipient]);
withdrawTo(recipient, recipient, withdrawable);
}
| 15,204 |
110 | // ------------------------------------------------------------------------ Unlocked total supply ------------------------------------------------------------------------ | function totalSupplyUnlocked() constant returns (uint) {
if (finalised && totalSupply >= lockedTokens.totalSupplyLocked()) {
return totalSupply.sub(lockedTokens.totalSupplyLocked());
} else {
return 0;
}
}
| function totalSupplyUnlocked() constant returns (uint) {
if (finalised && totalSupply >= lockedTokens.totalSupplyLocked()) {
return totalSupply.sub(lockedTokens.totalSupplyLocked());
} else {
return 0;
}
}
| 9,637 |
39 | // helper functions | function getLatestPrice(address _tokenAddress) private view returns (int) {
require(
tokens.isDefinedToken(_tokenAddress),
"Token not in Defined set array"
);
AggregatorV3Interface priceFeed = AggregatorV3Interface(
tokens.getAggregatorAddress(_tokenAddress)
);
require(
address(priceFeed) != address(0),
"Aggregator not found for the token"
);
(, int price, , , ) = priceFeed.latestRoundData();
return price;
}
| function getLatestPrice(address _tokenAddress) private view returns (int) {
require(
tokens.isDefinedToken(_tokenAddress),
"Token not in Defined set array"
);
AggregatorV3Interface priceFeed = AggregatorV3Interface(
tokens.getAggregatorAddress(_tokenAddress)
);
require(
address(priceFeed) != address(0),
"Aggregator not found for the token"
);
(, int price, , , ) = priceFeed.latestRoundData();
return price;
}
| 17,209 |
34 | // Internal transfer, only can be called by this contract/ | function _transfer(address _from, address _to, uint _value) internal {
//checking conditions
require(!safeguard);
require (_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
uint timeOfSaleF = ExtInterface(stakeAddress).lastSaleTime(_from);
uint timeOfSaleT = ExtInterface(stakeAddress).lastSaleTime(_to);
if((timeOfSaleF > 0 || timeOfSaleT > 0 ) && _value > timeBoundSaleLimit )
{
if (timeOfSaleT < timeOfSaleF ) timeOfSaleT = timeOfSaleF;
ExtInterface(stakeAddress).updateLastSaleTime(_from,_to, timeOfSaleT);
}
// overflow and undeflow checked by SafeMath Library
_balanceOf[_from] = _balanceOf[_from].sub(_value); // Subtract from the sender
_balanceOf[_to] = _balanceOf[_to].add(_value); // Add the same to the recipient
// emit Transfer event
emit Transfer(_from, _to, _value);
}
| function _transfer(address _from, address _to, uint _value) internal {
//checking conditions
require(!safeguard);
require (_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
uint timeOfSaleF = ExtInterface(stakeAddress).lastSaleTime(_from);
uint timeOfSaleT = ExtInterface(stakeAddress).lastSaleTime(_to);
if((timeOfSaleF > 0 || timeOfSaleT > 0 ) && _value > timeBoundSaleLimit )
{
if (timeOfSaleT < timeOfSaleF ) timeOfSaleT = timeOfSaleF;
ExtInterface(stakeAddress).updateLastSaleTime(_from,_to, timeOfSaleT);
}
// overflow and undeflow checked by SafeMath Library
_balanceOf[_from] = _balanceOf[_from].sub(_value); // Subtract from the sender
_balanceOf[_to] = _balanceOf[_to].add(_value); // Add the same to the recipient
// emit Transfer event
emit Transfer(_from, _to, _value);
}
| 23,005 |
5 | // Custom logic in here for how much the vault allows to be borrowed Sets minimum required on-hand to keep small withdrawals cheap | function available() public view returns (uint256) {
return token.balanceOf(address(this)).mul(min).div(max);
}
| function available() public view returns (uint256) {
return token.balanceOf(address(this)).mul(min).div(max);
}
| 5,070 |
6 | // Emitted on deposit() reserveId The ID of the reserve onBehalfOf The address that will receive the oTokens amount The amount of ETH to be deposited referralCode integrators are assigned a referral code and can potentially receive rewards0 if the action is executed directly by the user, without any intermediaries / | event Deposit(uint256 indexed reserveId, address indexed onBehalfOf, uint256 amount, uint256 referralCode);
| event Deposit(uint256 indexed reserveId, address indexed onBehalfOf, uint256 amount, uint256 referralCode);
| 8,440 |
152 | // This is for the case of Perpetual contracts which need to be able to receive their reward tokens | rewardToken.safeTransfer(gaugeAddr, rewardTally);
IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);
| rewardToken.safeTransfer(gaugeAddr, rewardTally);
IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);
| 39,381 |
338 | // The STRK market supply state for each market | mapping(address => StrikeMarketState) public strikeSupplyState;
| mapping(address => StrikeMarketState) public strikeSupplyState;
| 6,402 |
46 | // Stop accepting nominations, start election. | * Emits {ElectionExecuting} event.
*/
function startElection() external {
require(state == StateMachine.NOMINATING, Errors.AlreadyStarted);
require(nominatedTokens.length > 0, Errors.MustHaveNominations);
require(termExpires <= block.timestamp, Errors.TermNotExpired);
require(LINK.balanceOf(address(this)) >= s_fee, Errors.NotEnoughLink);
state = StateMachine.WAITING_FOR_ENTROPY;
requestRandomness(s_keyHash, s_fee);
emit ElectionExecuting(termNumber);
}
| * Emits {ElectionExecuting} event.
*/
function startElection() external {
require(state == StateMachine.NOMINATING, Errors.AlreadyStarted);
require(nominatedTokens.length > 0, Errors.MustHaveNominations);
require(termExpires <= block.timestamp, Errors.TermNotExpired);
require(LINK.balanceOf(address(this)) >= s_fee, Errors.NotEnoughLink);
state = StateMachine.WAITING_FOR_ENTROPY;
requestRandomness(s_keyHash, s_fee);
emit ElectionExecuting(termNumber);
}
| 7,226 |
12 | // Used when an attempt to remove a deprecated group from theEnumerableSet fails. group The group's address. / | error FailedToRemoveDeprecatedGroup(address group);
| error FailedToRemoveDeprecatedGroup(address group);
| 18,533 |
6 | // total amount or supported royalties types 0 - royalties type is unset 1 - royaltiesByToken, 2 - v2, 3 - v1, 4 - external provider, 5 - EIP-2981 6 - unsupported/nonexistent royalties type | uint256 constant royaltiesTypesAmount = 6;
| uint256 constant royaltiesTypesAmount = 6;
| 19,777 |
156 | // paused version of TrueCurrency in Production pausing the contract upgrades the proxy to this implementation | address public constant PAUSED_IMPLEMENTATION = 0x3c8984DCE8f68FCDEEEafD9E0eca3598562eD291;
| address public constant PAUSED_IMPLEMENTATION = 0x3c8984DCE8f68FCDEEEafD9E0eca3598562eD291;
| 23,068 |
31 | // address [] memory addresses = new address[](2);addresses[0] = sellToken;addresses[1] = buyToken; | address [] memory addresses = getBestPath(sellToken, buyToken, amount);
uint256 [] memory amounts = conductUniswapT4T(addresses, amount );
uint256 resultingTokens = amounts[amounts.length-1];
return resultingTokens;
| address [] memory addresses = getBestPath(sellToken, buyToken, amount);
uint256 [] memory amounts = conductUniswapT4T(addresses, amount );
uint256 resultingTokens = amounts[amounts.length-1];
return resultingTokens;
| 45,962 |
100 | // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF proof. rawFulfillRandomness then calls fulfillRandomness, after validating the origin of the call | function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
| function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
| 115 |
49 | // in case the hedge wins aka depegging hedge users pay the hedge to risk users anyway, hedge guy can withdraw risk (that is transfered from the risk pool), withdraw = % tvl that hedge buyer owns otherwise hedge users cannot withdraw any Eth | else {
entitledAmount = amount.divWadDown(idFinalTVL[id]).mulDivDown(
idClaimTVL[id],
1 ether
);
}
| else {
entitledAmount = amount.divWadDown(idFinalTVL[id]).mulDivDown(
idClaimTVL[id],
1 ether
);
}
| 18,132 |
16 | // return premint discount price | return _nftPrice;
| return _nftPrice;
| 63,903 |
108 | // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that the target address contains contract code and also asserts for success in the low-level call. |
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
|
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
| 36,303 |
149 | // basedOn in bytes 136-183 bytes. | packed |= _basedOn << 136;
| packed |= _basedOn << 136;
| 27,404 |
120 | // if pID has no keys, skip this | uint256 _keys = plyrRnds_[_pID][_rID].keys;
if (_keys > 0) {
uint256 _genVault = plyr_[_pID].gen;
uint256 _genWithdraw = plyrRnds_[_pID][_rID].genWithdraw;
uint256 _genEarning = calcUnMaskedKeyEarnings(_pID, plyr_[_pID].lrnd);
uint256 _doubleProfit = (plyrRnds_[_pID][_rID].eth).mul(2);
if (_genVault.add(_genWithdraw).add(_genEarning) >= _doubleProfit)
{
| uint256 _keys = plyrRnds_[_pID][_rID].keys;
if (_keys > 0) {
uint256 _genVault = plyr_[_pID].gen;
uint256 _genWithdraw = plyrRnds_[_pID][_rID].genWithdraw;
uint256 _genEarning = calcUnMaskedKeyEarnings(_pID, plyr_[_pID].lrnd);
uint256 _doubleProfit = (plyrRnds_[_pID][_rID].eth).mul(2);
if (_genVault.add(_genWithdraw).add(_genEarning) >= _doubleProfit)
{
| 38,973 |
95 | // Platform interface to integrate with lending platform like Compound, AAVE etc. / | interface IStrategy {
/**
* @dev Deposit the given asset to platform
* @param _asset asset address
* @param _amount Amount to deposit
*/
function deposit(address _asset, uint256 _amount) external;
/**
* @dev Deposit the entire balance of all supported assets in the Strategy
* to the platform
*/
function depositAll() external;
/**
* @dev Withdraw given asset from Lending platform
*/
function withdraw(
address _recipient,
address _asset,
uint256 _amount
) external;
/**
* @dev Liquidate all assets in strategy and return them to Vault.
*/
function withdrawAll() external;
/**
* @dev Returns the current balance of the given asset.
*/
function checkBalance(address _asset)
external
view
returns (uint256 balance);
/**
* @dev Returns bool indicating whether strategy supports asset.
*/
function supportsAsset(address _asset) external view returns (bool);
/**
* @dev Collect reward tokens from the Strategy.
*/
function collectRewardToken() external;
/**
* @dev The address of the reward token for the Strategy.
*/
function rewardTokenAddress() external pure returns (address);
/**
* @dev The threshold (denominated in the reward token) over which the
* vault will auto harvest on allocate calls.
*/
function rewardLiquidationThreshold() external pure returns (uint256);
}
| interface IStrategy {
/**
* @dev Deposit the given asset to platform
* @param _asset asset address
* @param _amount Amount to deposit
*/
function deposit(address _asset, uint256 _amount) external;
/**
* @dev Deposit the entire balance of all supported assets in the Strategy
* to the platform
*/
function depositAll() external;
/**
* @dev Withdraw given asset from Lending platform
*/
function withdraw(
address _recipient,
address _asset,
uint256 _amount
) external;
/**
* @dev Liquidate all assets in strategy and return them to Vault.
*/
function withdrawAll() external;
/**
* @dev Returns the current balance of the given asset.
*/
function checkBalance(address _asset)
external
view
returns (uint256 balance);
/**
* @dev Returns bool indicating whether strategy supports asset.
*/
function supportsAsset(address _asset) external view returns (bool);
/**
* @dev Collect reward tokens from the Strategy.
*/
function collectRewardToken() external;
/**
* @dev The address of the reward token for the Strategy.
*/
function rewardTokenAddress() external pure returns (address);
/**
* @dev The threshold (denominated in the reward token) over which the
* vault will auto harvest on allocate calls.
*/
function rewardLiquidationThreshold() external pure returns (uint256);
}
| 24,302 |
15 | // ya = fyTokenReservesa The “pow(x, y, z)” function not only calculates x^(y/z) but also normalizes the result to fit into 64.64 fixed point number, i.e. it actually calculates: x^(y/z)(2^63)^(1 - y/z) | uint256 ya = fyTokenReserves.pow(a, ONE);
| uint256 ya = fyTokenReserves.pow(a, ONE);
| 29,270 |
45 | // get the settlement price with the given underlyingToken and priceToken,/ at the given expirationDate, and whether the price exists/underlyingToken Should be equal to the Series' underlyingToken field/priceToken Should be equal to the Series' priceToken field/settlementDate Should be equal to the expirationDate of the Series we're getting the settlement price for/ return true if the settlement price has been set (i.e. is nonzero), false otherwise/ return the settlement price | function getSettlementPrice(
address underlyingToken,
address priceToken,
uint256 settlementDate
| function getSettlementPrice(
address underlyingToken,
address priceToken,
uint256 settlementDate
| 32,513 |
483 | // MATIC guard, to catch tokens minted on chain | require(!withdrawnTokens[tokenId], "ChildMintableERC721: TOKEN_EXISTS_ON_ROOT_CHAIN");
| require(!withdrawnTokens[tokenId], "ChildMintableERC721: TOKEN_EXISTS_ON_ROOT_CHAIN");
| 70,676 |
25 | // Creates `amount` tokens and assigns them to `account`, increasingthe total supply. | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 41,845 |
26 | // if the player has already joined earlier | else {
require(player[msg.sender].incomeLimitLeft == 0, "Oops your limit is still remaining");
require(amount >= player[msg.sender].currentInvestedAmount, "Cannot invest lesser amount");
player[msg.sender].lastSettledTime = now;
player[msg.sender].currentInvestedAmount = amount;
player[msg.sender].incomeLimitLeft = amount.mul(incomeTimes).div(incomeDivide).div(10);
player[msg.sender].totalInvestment = player[msg.sender].totalInvestment.add(amount);
| else {
require(player[msg.sender].incomeLimitLeft == 0, "Oops your limit is still remaining");
require(amount >= player[msg.sender].currentInvestedAmount, "Cannot invest lesser amount");
player[msg.sender].lastSettledTime = now;
player[msg.sender].currentInvestedAmount = amount;
player[msg.sender].incomeLimitLeft = amount.mul(incomeTimes).div(incomeDivide).div(10);
player[msg.sender].totalInvestment = player[msg.sender].totalInvestment.add(amount);
| 33,000 |
33 | // submitBatch processes a batch of Hub -> Ethereum transactions by sending the tokens in the transactions to the destination addresses. It is approved by the current Hub validator set. Anyone can call this function, but they must supply valid signatures of state_powerThreshold of the current valset over the batch. | function submitBatch(
| function submitBatch(
| 28,180 |
12 | // Releases escrow placement for multiple scope requests and distributes funds._idr Address of Identity Requester_idv Address of Identity Validator_scopeRequestIdsToRelease Array of scope request IDs which will be released_scopeRequestIdsToKeep Array of scope request IDs which will be kept in escrow return bytes32 Placement ID of remaining part of the batch. Empty when the placement was fully released/ | function releaseBatch(
address _idr,
address _idv,
bytes32[] _scopeRequestIdsToRelease,
bytes32[] _scopeRequestIdsToKeep
)
external
onlyOwner
onlyInitialized
whenNotPaused
| function releaseBatch(
address _idr,
address _idv,
bytes32[] _scopeRequestIdsToRelease,
bytes32[] _scopeRequestIdsToKeep
)
external
onlyOwner
onlyInitialized
whenNotPaused
| 15,605 |
3 | // mint price (0.03 / 0.05) | uint256 constant public memberPrice = 30000000000000000;
uint256 constant public publicPrice = 50000000000000000;
| uint256 constant public memberPrice = 30000000000000000;
uint256 constant public publicPrice = 50000000000000000;
| 29,644 |
96 | // To rescue any fund accidentally transfered to the token address / | function rescueFund(address _tokenAddress, address _recipient) external onlyOwner{
require(_tokenAddress != address(0), "Token Address cannot be the zero address");
require(_recipient != address(0), "Recipient Address cannot be the zero address");
IERC20 erc20Token = IERC20(_tokenAddress);
TransferHelper.safeTransfer(address(erc20Token), _recipient, erc20Token.balanceOf(address(this)));
}
| function rescueFund(address _tokenAddress, address _recipient) external onlyOwner{
require(_tokenAddress != address(0), "Token Address cannot be the zero address");
require(_recipient != address(0), "Recipient Address cannot be the zero address");
IERC20 erc20Token = IERC20(_tokenAddress);
TransferHelper.safeTransfer(address(erc20Token), _recipient, erc20Token.balanceOf(address(this)));
}
| 67,612 |
1 | // Sale info for each collection//Collection => Earnings// Functions / | function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
return super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 6,204 |
305 | // CreatureCreature - a contract for my non-fungible creatures. / | contract Creature is ERC721Tradable {
constructor()
ERC721Tradable("Freedom Reserve Limited Edition 2020", "FRLA")
{
maxTokenId = 10;
//rinkeby
proxyRegistryAddress = address(0xF57B2c51dED3A29e6891aba85459d600256Cf317);
//mainnet
//proxyRegistryAddress = address(0xa5409ec958c83c3f309868babaca7c86dcb077c1);
}
//add to scan if all units have been sold
function contractURI() public view returns (string memory) {
return tokenURI(1);
//"https://creatures-api.opensea.io/contract/opensea-creatures";
}
}
| contract Creature is ERC721Tradable {
constructor()
ERC721Tradable("Freedom Reserve Limited Edition 2020", "FRLA")
{
maxTokenId = 10;
//rinkeby
proxyRegistryAddress = address(0xF57B2c51dED3A29e6891aba85459d600256Cf317);
//mainnet
//proxyRegistryAddress = address(0xa5409ec958c83c3f309868babaca7c86dcb077c1);
}
//add to scan if all units have been sold
function contractURI() public view returns (string memory) {
return tokenURI(1);
//"https://creatures-api.opensea.io/contract/opensea-creatures";
}
}
| 40,425 |
9 | // All-time game jackpot. | uint public allTimeJackpot = 0;
| uint public allTimeJackpot = 0;
| 678 |
304 | // Max Capital Requested | uint256 internal constant MAX_CAPITAL_REQUESTED = 41;
| uint256 internal constant MAX_CAPITAL_REQUESTED = 41;
| 34,123 |
3 | // Modifies the Witnet Data Request bytecode. | function modifyBytecode(bytes memory _bytecode) public {
bytecode = _bytecode;
}
| function modifyBytecode(bytes memory _bytecode) public {
bytecode = _bytecode;
}
| 2,502 |
7 | // uint256 _ansPrizePercent = calcPrize(_answers[i]); | uint32 _ansPrizePercent = calcPrize(questionId, i);
uint32 _answerBucket =
(_questionTotalPrize * _ansPrizePercent) / 100;
for (uint8 j = 0; j < _answers[i].usersAddress.length; j++) {
if (_answers[i].volume != 0) {
User storage _user =
userInfo[_answers[i].usersAddress[j]];
uint32 _userPercent =
(_user.questionIdAmount[questionId] * 100) /
| uint32 _ansPrizePercent = calcPrize(questionId, i);
uint32 _answerBucket =
(_questionTotalPrize * _ansPrizePercent) / 100;
for (uint8 j = 0; j < _answers[i].usersAddress.length; j++) {
if (_answers[i].volume != 0) {
User storage _user =
userInfo[_answers[i].usersAddress[j]];
uint32 _userPercent =
(_user.questionIdAmount[questionId] * 100) /
| 37,034 |
29 | // Removes the necessary permissions for a user to mint tokens._who The address of the account that we are removing permissions for./ | function removeMinter(address _who) public onlyValidator {
_removeMinter(_who);
}
| function removeMinter(address _who) public onlyValidator {
_removeMinter(_who);
}
| 6,610 |
106 | // --- Fungibility --- | function slip(bytes32 ilk, address usr, int256 wad) external note auth {
gem[ilk][usr] = _add(gem[ilk][usr], wad);
}
| function slip(bytes32 ilk, address usr, int256 wad) external note auth {
gem[ilk][usr] = _add(gem[ilk][usr], wad);
}
| 7,831 |
542 | // Send the rewards to claiming address - will be locked in rewardEscrow. account The address to send the fees to. snxAmount The amount of SNX. / | function _payRewards(address account, uint snxAmount) internal notFeeAddress(account) {
/* Escrow the tokens for 1 year. */
uint escrowDuration = 52 weeks;
// Record vesting entry for claiming address and amount
// SNX already minted to rewardEscrow balance
rewardEscrowV2().appendVestingEntry(account, snxAmount, escrowDuration);
}
| function _payRewards(address account, uint snxAmount) internal notFeeAddress(account) {
/* Escrow the tokens for 1 year. */
uint escrowDuration = 52 weeks;
// Record vesting entry for claiming address and amount
// SNX already minted to rewardEscrow balance
rewardEscrowV2().appendVestingEntry(account, snxAmount, escrowDuration);
}
| 34,265 |
1 | // override tokenId to start from 1 | function _startTokenId() internal pure override returns (uint256){
return 1;
}
| function _startTokenId() internal pure override returns (uint256){
return 1;
}
| 2,352 |
69 | // Initialize the Token | constructor () public {
_mint(msg.sender, 100000 * (10 ** 18));
}
| constructor () public {
_mint(msg.sender, 100000 * (10 ** 18));
}
| 19,949 |
54 | // check if any pending claims exists in the payout period / | function isPendingClaimExistOnOffer(uint256 _offerId)
public
view
returns (bool statePendingClaimExists)
| function isPendingClaimExistOnOffer(uint256 _offerId)
public
view
returns (bool statePendingClaimExists)
| 19,212 |
19 | // Record | struct Record {
address who;
bytes32 action;
uint32 when;
}
| struct Record {
address who;
bytes32 action;
uint32 when;
}
| 43,158 |
0 | // Constructor Function that gives the Sender all of the created Tokens./ | constructor () ERC20("Blockchain Mind", "BCM") {
_mint(msg.sender, 100000000 * (10 ** 18));
}
| constructor () ERC20("Blockchain Mind", "BCM") {
_mint(msg.sender, 100000000 * (10 ** 18));
}
| 23,217 |
110 | // Returns the account approved for 'tokenId' token. Requirements: - 'tokenId' must exist. / | function getApproved(uint256 tokenId) external view returns(address operator);
| function getApproved(uint256 tokenId) external view returns(address operator);
| 43,767 |
33 | // Welcome to BINGO | contract Bingo is ERC721, VRFConsumerBase, KeeperCompatibleInterface {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
Counters.Counter private _gameIds;
// Settings
uint256 public minCards = 1; // 10
uint256 public maxCards = 1000;
uint256 public pricePerCard = 10000000000000000; // 0.01 ETH
uint256 public ballDrawTime = 60; // 86400
uint256 public prizeSplit = 2;
uint256 public pattern = 1;
bool public startGame;
bool public startAuto;
address weedContract;
address owner;
// Game
uint256 public gameFloor;
uint256 public lastBallTime;
bytes32 public ballRequest;
uint256 public prizePool;
uint256 public winnerPool;
bool public outOfBalls;
// Random
bytes32 internal keyHash;
uint256 internal fee;
// Mappings
mapping (bytes32 => uint256) cardRequests;
mapping (uint256 => uint256) public cardRandomness;
mapping (uint256 => uint256) public winners;
mapping (uint256 => bool) Balls;
event BallPicked(uint256 game, uint256 ball);
event BingoWinner(uint256 game, uint256 tokenId);
event CardGenerated(uint256 game, address owner, uint256 tokenId);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor(address _weedContract)
ERC721("Bingo", "BINGO")
VRFConsumerBase(
0xdD3782915140c8f3b190B5D67eAc6dc5760C46E9, // VRF Coordinator - Kovan
0xa36085F69e2889c224210F603D836748e7dC0088 // LINK Token - Kovan
)
{
owner = msg.sender;
weedContract = _weedContract;
keyHash = 0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4;
fee = 0.1 * 10 ** 18; // 0.1 LINK (Varies by network)
// Automatically start the first game
_gameIds.increment();
lastBallTime = block.timestamp;
}
/*
* Purchase.
*/
function mintCard(uint256 amount) public payable {
require(amount <= 10 && startGame && (_tokenIds.current().add(amount) - gameFloor) <= maxCards, "E");
require(LINK.balanceOf(address(this)) >= fee*amount, "L");
// Mint in ETH
if(msg.value > 0) {
require(pricePerCard.mul(amount) <= msg.value, "WP");
if(prizeSplit > 0) {
prizePool += msg.value / prizeSplit;
}
// Mint in WEED
} else {
require(IERC20(weedContract).balanceOf(msg.sender) >= 4000 * 1e18 * amount, "NB");
require(IERC20(weedContract).allowance(msg.sender, address(this)) >= 4000 * 1e18 * amount, "NP");
IERC20(weedContract).transferFrom(msg.sender, address(this), 4000 * 1e18 * amount);
}
uint256 cardId;
for(uint256 i=0; i<amount; i++) {
_tokenIds.increment();
cardId = _tokenIds.current();
_safeMint(msg.sender, cardId);
cardRequests[requestRandomness(keyHash, fee)] = cardId;
}
}
/*
* Randomness.
*/
function checkUpkeep(bytes calldata checkData) external view override returns (bool upkeepNeeded, bytes memory performData) {
upkeepNeeded = (_tokenIds.current() - gameFloor >= minCards) && (block.timestamp > lastBallTime+ballDrawTime && !outOfBalls && startGame);
performData = checkData;
}
function performUpkeep(bytes calldata performData) external override {
require(block.timestamp > lastBallTime+ballDrawTime && _tokenIds.current() - gameFloor >= minCards, "MT");
uint256 _winners = checkForWinners();
if(_winners == 0) {
require(LINK.balanceOf(address(this)) >= fee, "L");
lastBallTime = block.timestamp;
ballRequest = requestRandomness(keyHash, fee);
} else {
// Reset game
prizePool = 0;
_gameIds.increment();
lastBallTime = block.timestamp;
outOfBalls = false;
gameFloor = _tokenIds.current();
startGame = startAuto;
for(uint256 b=1; b<76; b++) {
Balls[b] = false;
}
}
performData;
}
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
if(requestId == ballRequest) {
require(requestId == ballRequest, "IR");
uint256 choice;
for(uint256 idx=0; idx<76; idx++) {
choice = randomness.add(idx).mod(75).add(1);
if(Balls[choice] == false) {
Balls[choice] = true;
emit BallPicked(_gameIds.current(), choice);
break;
} else if(idx == 75) {
outOfBalls = true;
}
}
ballRequest = 0;
} else {
uint256 cardId = cardRequests[requestId];
require(cardId > 0, "NA");
cardRandomness[cardId] = randomness;
cardRequests[requestId] = 0;
emit CardGenerated(_gameIds.current(), ownerOf(cardId), cardId);
}
}
function checkForWinners() internal returns (uint256) {
uint256 winIdx;
for(uint256 i=gameFloor+1; i<= _tokenIds.current(); i++) {
if(BingoGenerate.validateWinner(cardRandomness[i], Balls, pattern)) {
winIdx++;
}
}
if(winIdx > 0) {
for(uint256 k=gameFloor+1; k<= _tokenIds.current(); k++) {
if(BingoGenerate.validateWinner(cardRandomness[k], Balls, pattern)) {
winners[k] = prizePool.div(winIdx);
winnerPool = winnerPool + winners[k];
emit BingoWinner(_gameIds.current(), k);
}
}
}
return winIdx;
}
/*
* Claim.
*/
function claimBingo(uint256 cardId) public payable {
require(winners[cardId] > 0 && ownerOf(cardId) == msg.sender, 'C');
payable(msg.sender).transfer(winners[cardId]);
winnerPool = winnerPool - winners[cardId];
winners[cardId] = 0;
}
function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwner(msg.sender, tokenId), "NA");
_burn(tokenId);
}
/*
* Getters.
*/
function generateCard(uint256 cardId) public view returns (BingoGenerate.Card memory) {
return BingoGenerate.generateBingoCard(cardRandomness[cardId]);
}
function validateCard(uint256 cardId) public view returns (bool) {
return BingoGenerate.validateWinner(cardRandomness[cardId], Balls, pattern);
}
function getCurrent() public view returns (uint256 game, uint256 token) {
game = _gameIds.current();
token = _tokenIds.current();
}
function exists(uint256 tokenId) public view returns(bool) {
return _exists(tokenId);
}
function _baseURI() internal pure override returns (string memory) {
return "https://api.bingoswap.art/bingo-json/";
}
/*
* Setters.
*/
function contractSettings(bool _startGame, bool _startAuto, uint256 _ballDrawTime, uint256 _minCardsPerGame, uint256 _maxCardsPerGame, uint256 _pricePerCard, uint256 _prizeSplit, uint256 _pattern, address _owner) public onlyOwner {
startGame = _startGame;
startAuto = _startAuto;
ballDrawTime = _ballDrawTime;
minCards = _minCardsPerGame;
maxCards = _maxCardsPerGame;
pricePerCard = _pricePerCard;
prizeSplit = _prizeSplit;
pattern = _pattern;
owner = _owner;
}
/*
* Money management.
*/
function withdraw(IERC20 _token, uint256 _amount) public payable onlyOwner {
if(_amount > 0) {
_token.transfer(msg.sender, _amount);
} else {
uint256 _each = address(this).balance.sub(prizePool+winnerPool).div(4);
require(payable(0x00796e910Bd0228ddF4cd79e3f353871a61C351C).send(_each)); // sara
require(payable(0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50).send(_each)); // shaun
require(payable(0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b).send(_each)); // mark
require(payable(0xd83Dd8A288270512b8A46F581A8254CD971dCb09).send(_each)); // community (@todo replace)
}
}
}
| contract Bingo is ERC721, VRFConsumerBase, KeeperCompatibleInterface {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
Counters.Counter private _gameIds;
// Settings
uint256 public minCards = 1; // 10
uint256 public maxCards = 1000;
uint256 public pricePerCard = 10000000000000000; // 0.01 ETH
uint256 public ballDrawTime = 60; // 86400
uint256 public prizeSplit = 2;
uint256 public pattern = 1;
bool public startGame;
bool public startAuto;
address weedContract;
address owner;
// Game
uint256 public gameFloor;
uint256 public lastBallTime;
bytes32 public ballRequest;
uint256 public prizePool;
uint256 public winnerPool;
bool public outOfBalls;
// Random
bytes32 internal keyHash;
uint256 internal fee;
// Mappings
mapping (bytes32 => uint256) cardRequests;
mapping (uint256 => uint256) public cardRandomness;
mapping (uint256 => uint256) public winners;
mapping (uint256 => bool) Balls;
event BallPicked(uint256 game, uint256 ball);
event BingoWinner(uint256 game, uint256 tokenId);
event CardGenerated(uint256 game, address owner, uint256 tokenId);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor(address _weedContract)
ERC721("Bingo", "BINGO")
VRFConsumerBase(
0xdD3782915140c8f3b190B5D67eAc6dc5760C46E9, // VRF Coordinator - Kovan
0xa36085F69e2889c224210F603D836748e7dC0088 // LINK Token - Kovan
)
{
owner = msg.sender;
weedContract = _weedContract;
keyHash = 0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4;
fee = 0.1 * 10 ** 18; // 0.1 LINK (Varies by network)
// Automatically start the first game
_gameIds.increment();
lastBallTime = block.timestamp;
}
/*
* Purchase.
*/
function mintCard(uint256 amount) public payable {
require(amount <= 10 && startGame && (_tokenIds.current().add(amount) - gameFloor) <= maxCards, "E");
require(LINK.balanceOf(address(this)) >= fee*amount, "L");
// Mint in ETH
if(msg.value > 0) {
require(pricePerCard.mul(amount) <= msg.value, "WP");
if(prizeSplit > 0) {
prizePool += msg.value / prizeSplit;
}
// Mint in WEED
} else {
require(IERC20(weedContract).balanceOf(msg.sender) >= 4000 * 1e18 * amount, "NB");
require(IERC20(weedContract).allowance(msg.sender, address(this)) >= 4000 * 1e18 * amount, "NP");
IERC20(weedContract).transferFrom(msg.sender, address(this), 4000 * 1e18 * amount);
}
uint256 cardId;
for(uint256 i=0; i<amount; i++) {
_tokenIds.increment();
cardId = _tokenIds.current();
_safeMint(msg.sender, cardId);
cardRequests[requestRandomness(keyHash, fee)] = cardId;
}
}
/*
* Randomness.
*/
function checkUpkeep(bytes calldata checkData) external view override returns (bool upkeepNeeded, bytes memory performData) {
upkeepNeeded = (_tokenIds.current() - gameFloor >= minCards) && (block.timestamp > lastBallTime+ballDrawTime && !outOfBalls && startGame);
performData = checkData;
}
function performUpkeep(bytes calldata performData) external override {
require(block.timestamp > lastBallTime+ballDrawTime && _tokenIds.current() - gameFloor >= minCards, "MT");
uint256 _winners = checkForWinners();
if(_winners == 0) {
require(LINK.balanceOf(address(this)) >= fee, "L");
lastBallTime = block.timestamp;
ballRequest = requestRandomness(keyHash, fee);
} else {
// Reset game
prizePool = 0;
_gameIds.increment();
lastBallTime = block.timestamp;
outOfBalls = false;
gameFloor = _tokenIds.current();
startGame = startAuto;
for(uint256 b=1; b<76; b++) {
Balls[b] = false;
}
}
performData;
}
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
if(requestId == ballRequest) {
require(requestId == ballRequest, "IR");
uint256 choice;
for(uint256 idx=0; idx<76; idx++) {
choice = randomness.add(idx).mod(75).add(1);
if(Balls[choice] == false) {
Balls[choice] = true;
emit BallPicked(_gameIds.current(), choice);
break;
} else if(idx == 75) {
outOfBalls = true;
}
}
ballRequest = 0;
} else {
uint256 cardId = cardRequests[requestId];
require(cardId > 0, "NA");
cardRandomness[cardId] = randomness;
cardRequests[requestId] = 0;
emit CardGenerated(_gameIds.current(), ownerOf(cardId), cardId);
}
}
function checkForWinners() internal returns (uint256) {
uint256 winIdx;
for(uint256 i=gameFloor+1; i<= _tokenIds.current(); i++) {
if(BingoGenerate.validateWinner(cardRandomness[i], Balls, pattern)) {
winIdx++;
}
}
if(winIdx > 0) {
for(uint256 k=gameFloor+1; k<= _tokenIds.current(); k++) {
if(BingoGenerate.validateWinner(cardRandomness[k], Balls, pattern)) {
winners[k] = prizePool.div(winIdx);
winnerPool = winnerPool + winners[k];
emit BingoWinner(_gameIds.current(), k);
}
}
}
return winIdx;
}
/*
* Claim.
*/
function claimBingo(uint256 cardId) public payable {
require(winners[cardId] > 0 && ownerOf(cardId) == msg.sender, 'C');
payable(msg.sender).transfer(winners[cardId]);
winnerPool = winnerPool - winners[cardId];
winners[cardId] = 0;
}
function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwner(msg.sender, tokenId), "NA");
_burn(tokenId);
}
/*
* Getters.
*/
function generateCard(uint256 cardId) public view returns (BingoGenerate.Card memory) {
return BingoGenerate.generateBingoCard(cardRandomness[cardId]);
}
function validateCard(uint256 cardId) public view returns (bool) {
return BingoGenerate.validateWinner(cardRandomness[cardId], Balls, pattern);
}
function getCurrent() public view returns (uint256 game, uint256 token) {
game = _gameIds.current();
token = _tokenIds.current();
}
function exists(uint256 tokenId) public view returns(bool) {
return _exists(tokenId);
}
function _baseURI() internal pure override returns (string memory) {
return "https://api.bingoswap.art/bingo-json/";
}
/*
* Setters.
*/
function contractSettings(bool _startGame, bool _startAuto, uint256 _ballDrawTime, uint256 _minCardsPerGame, uint256 _maxCardsPerGame, uint256 _pricePerCard, uint256 _prizeSplit, uint256 _pattern, address _owner) public onlyOwner {
startGame = _startGame;
startAuto = _startAuto;
ballDrawTime = _ballDrawTime;
minCards = _minCardsPerGame;
maxCards = _maxCardsPerGame;
pricePerCard = _pricePerCard;
prizeSplit = _prizeSplit;
pattern = _pattern;
owner = _owner;
}
/*
* Money management.
*/
function withdraw(IERC20 _token, uint256 _amount) public payable onlyOwner {
if(_amount > 0) {
_token.transfer(msg.sender, _amount);
} else {
uint256 _each = address(this).balance.sub(prizePool+winnerPool).div(4);
require(payable(0x00796e910Bd0228ddF4cd79e3f353871a61C351C).send(_each)); // sara
require(payable(0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50).send(_each)); // shaun
require(payable(0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b).send(_each)); // mark
require(payable(0xd83Dd8A288270512b8A46F581A8254CD971dCb09).send(_each)); // community (@todo replace)
}
}
}
| 53,882 |
28 | // withdraw any ERC20 token send accidentally on this contract address to contract owner | function withdrawAnyERC20(IERC20 token) external {
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "No tokens to withdraw");
token.transfer(owner, amount);
}
| function withdrawAnyERC20(IERC20 token) external {
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "No tokens to withdraw");
token.transfer(owner, amount);
}
| 37,996 |
4 | // this is the mint function they will be using on our mint page | function batchMint(uint256 amount) public payable {
require((mintLive == true && block.timestamp >= mintStartTime) || (presaleActive == true), "Mint is not Live");
require(amount > 0, "Cant mint 0 tokens king");
require(amount <= maxMintPerBatch, "Exceeds max mint per batch");
require(_tokenIdCounter + amount <= MAXSUPPLY, "Max supply reached");
| function batchMint(uint256 amount) public payable {
require((mintLive == true && block.timestamp >= mintStartTime) || (presaleActive == true), "Mint is not Live");
require(amount > 0, "Cant mint 0 tokens king");
require(amount <= maxMintPerBatch, "Exceeds max mint per batch");
require(_tokenIdCounter + amount <= MAXSUPPLY, "Max supply reached");
| 19,234 |
219 | // Returns the broker verifier contract of a settlement layer. | function brokerVerifierContract(uint64 _settlementID) external view returns (BrokerVerifier) {
return settlementDetails[_settlementID].brokerVerifierContract;
}
| function brokerVerifierContract(uint64 _settlementID) external view returns (BrokerVerifier) {
return settlementDetails[_settlementID].brokerVerifierContract;
}
| 32,811 |
13 | // Unlock token duration | uint256 public unlockDateCommunityTwo;
uint256 public unlockDateCommunityOne;
| uint256 public unlockDateCommunityTwo;
uint256 public unlockDateCommunityOne;
| 53,066 |
4 | // Adjust for the last mint being incomplete. | uint256 ethAmountOwed;
if (amountSold + count > amountForSale) {
uint256 amountRemaining = amountForSale-amountSold;
ethAmountOwed = price * (count-amountRemaining);
count = amountRemaining;
}
| uint256 ethAmountOwed;
if (amountSold + count > amountForSale) {
uint256 amountRemaining = amountForSale-amountSold;
ethAmountOwed = price * (count-amountRemaining);
count = amountRemaining;
}
| 21,675 |
68 | // Returns the address of the LendingPool proxyreturn The LendingPool proxy address / | function getLendingPool() external view override returns (address) {
return getAddress(LENDING_POOL);
}
| function getLendingPool() external view override returns (address) {
return getAddress(LENDING_POOL);
}
| 39,779 |
95 | // Clock auction modified for sale of Zodiacs/We omit a fallback function to prevent accidental sends to this contract. | contract SaleClockAuction is ClockAuction {
// @dev Sanity check that allows us to ensure that we are pointing to the
// right auction in our setSaleAuctionAddress() call.
bool public isSaleClockAuction = true;
// Tracks last 5 sale price of gen0 zodiac sales
uint256 public gen0SaleCount;
uint256[5] public lastGen0SalePrices;
// Delegate constructor
function SaleClockAuction(address _nftAddr, uint256 _cut) public
ClockAuction(_nftAddr, _cut) {}
/// @dev Creates and begins a new auction.
/// @param _tokenId - ID of token to auction, sender must be owner.
/// @param _startingPrice - Price of item (in wei) at beginning of auction.
/// @param _endingPrice - Price of item (in wei) at end of auction.
/// @param _duration - Length of auction (in seconds).
/// @param _seller - Seller, if not the message sender
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
{
// Sanity check that no inputs overflow how many bits we've allocated
// to store them in the auction struct.
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(msg.sender == address(nonFungibleContract));
_escrow(_seller, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
}
/// @dev Updates lastSalePrice if seller is the nft contract
/// Otherwise, works the same as default bid method.
function bid(uint256 _tokenId)
external
payable
{
// _bid verifies token ID size
address seller = tokenIdToAuction[_tokenId].seller;
uint256 price = _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
// If not a gen0 auction, exit
if (seller == address(nonFungibleContract)) {
// Track gen0 sale prices
lastGen0SalePrices[gen0SaleCount % 5] = price;
gen0SaleCount++;
}
}
function averageGen0SalePrice() external view returns (uint256) {
uint256 sum = 0;
for (uint256 i = 0; i < 5; i++) {
sum += lastGen0SalePrices[i];
}
return sum / 5;
}
} | contract SaleClockAuction is ClockAuction {
// @dev Sanity check that allows us to ensure that we are pointing to the
// right auction in our setSaleAuctionAddress() call.
bool public isSaleClockAuction = true;
// Tracks last 5 sale price of gen0 zodiac sales
uint256 public gen0SaleCount;
uint256[5] public lastGen0SalePrices;
// Delegate constructor
function SaleClockAuction(address _nftAddr, uint256 _cut) public
ClockAuction(_nftAddr, _cut) {}
/// @dev Creates and begins a new auction.
/// @param _tokenId - ID of token to auction, sender must be owner.
/// @param _startingPrice - Price of item (in wei) at beginning of auction.
/// @param _endingPrice - Price of item (in wei) at end of auction.
/// @param _duration - Length of auction (in seconds).
/// @param _seller - Seller, if not the message sender
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
{
// Sanity check that no inputs overflow how many bits we've allocated
// to store them in the auction struct.
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(msg.sender == address(nonFungibleContract));
_escrow(_seller, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
}
/// @dev Updates lastSalePrice if seller is the nft contract
/// Otherwise, works the same as default bid method.
function bid(uint256 _tokenId)
external
payable
{
// _bid verifies token ID size
address seller = tokenIdToAuction[_tokenId].seller;
uint256 price = _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
// If not a gen0 auction, exit
if (seller == address(nonFungibleContract)) {
// Track gen0 sale prices
lastGen0SalePrices[gen0SaleCount % 5] = price;
gen0SaleCount++;
}
}
function averageGen0SalePrice() external view returns (uint256) {
uint256 sum = 0;
for (uint256 i = 0; i < 5; i++) {
sum += lastGen0SalePrices[i];
}
return sum / 5;
}
} | 55,995 |
485 | // if there is no move (`_from == _to`) or there is nothing to move (`_value == 0`) | if(_from == _to || _value == 0) {
| if(_from == _to || _value == 0) {
| 7,177 |
9 | // overwrites the tokenURI function from ERC721/id the id of the NFT/ return string the URI of the NFT | function tokenURI(uint256 id) public view override(ERC721A, IERC721A) returns (string memory) {
return Metadata(metadata).getMetadata(id);
}
| function tokenURI(uint256 id) public view override(ERC721A, IERC721A) returns (string memory) {
return Metadata(metadata).getMetadata(id);
}
| 34,678 |
58 | // call event | emit Revised(_supplyPointId, _yearMonth, _totalWh, _hash);
| emit Revised(_supplyPointId, _yearMonth, _totalWh, _hash);
| 15,591 |
42 | // commonly used with state machines | modifier onlyIfStateA (State currState) { require(currState == State.A) _; }
| modifier onlyIfStateA (State currState) { require(currState == State.A) _; }
| 11,851 |
128 | // This will suffice for checking _exists(nextTokenId),as a burned slot cannot contain the zero address. | if (nextTokenId < _nextTokenId) {
_owners[nextTokenId] = owner;
}
| if (nextTokenId < _nextTokenId) {
_owners[nextTokenId] = owner;
}
| 36,272 |
113 | // Checks if the relayed transaction is unique._wallet The target wallet._signHash The signed hash of the transaction/ | function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 /* _nonce */, bytes32 _signHash) internal returns (bool) {
if (relayer[address(_wallet)].executedTx[_signHash] == true) {
return false;
}
relayer[address(_wallet)].executedTx[_signHash] = true;
return true;
}
| function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 /* _nonce */, bytes32 _signHash) internal returns (bool) {
if (relayer[address(_wallet)].executedTx[_signHash] == true) {
return false;
}
relayer[address(_wallet)].executedTx[_signHash] = true;
return true;
}
| 27,473 |
387 | // Drop 1, after 75% minting 5 ETH are transferred to 20 random scissors owners (pull payment, 0.5 ETH each) | function _secondGiveAway() internal {
require(!second_prize_released); // dev: 2nd prize already released
require(pctReached(75)); // dev: 75% not achieved yet
require(address(this).balance >= SECOND_PRIZE_PER_WALLET_ETH_AMOUNT); // dev: not enough balance in contract
uint256 top_75_pct = (3*maxDrop)/4; // calc the 75% of the maxDrop
second_prize_winners = new address[](TH_SECOND_PRIZE_MAX_WINNERS);
// Get 20 random tokenId numbers from 0...(maxDrop*3)/4
uint256 div = top_75_pct / TH_SECOND_PRIZE_MAX_WINNERS;
uint256 seed = rand(div) + 1;
// Add payment in escrow contract
for(uint256 i = 0; i < TH_SECOND_PRIZE_MAX_WINNERS; i++) {
second_prize_winners[i] = ownerOf(seed);
_asyncTransfer(second_prize_winners[i],SECOND_PRIZE_PER_WALLET_ETH_AMOUNT);
seed = seed + div;
}
second_prize_released = true;
emit SecondGiveAwayCharged(second_prize_winners);
}
| function _secondGiveAway() internal {
require(!second_prize_released); // dev: 2nd prize already released
require(pctReached(75)); // dev: 75% not achieved yet
require(address(this).balance >= SECOND_PRIZE_PER_WALLET_ETH_AMOUNT); // dev: not enough balance in contract
uint256 top_75_pct = (3*maxDrop)/4; // calc the 75% of the maxDrop
second_prize_winners = new address[](TH_SECOND_PRIZE_MAX_WINNERS);
// Get 20 random tokenId numbers from 0...(maxDrop*3)/4
uint256 div = top_75_pct / TH_SECOND_PRIZE_MAX_WINNERS;
uint256 seed = rand(div) + 1;
// Add payment in escrow contract
for(uint256 i = 0; i < TH_SECOND_PRIZE_MAX_WINNERS; i++) {
second_prize_winners[i] = ownerOf(seed);
_asyncTransfer(second_prize_winners[i],SECOND_PRIZE_PER_WALLET_ETH_AMOUNT);
seed = seed + div;
}
second_prize_released = true;
emit SecondGiveAwayCharged(second_prize_winners);
}
| 76,662 |
14 | // Add rewards that are immediately split up between stakers / | function addReward() external payable {
require(msg.value > 0, "No ETH sent");
require(totalShares > 0, "No stakers");
_addReward(msg.value);
emit RewardAdded(msg.value);
}
| function addReward() external payable {
require(msg.value > 0, "No ETH sent");
require(totalShares > 0, "No stakers");
_addReward(msg.value);
emit RewardAdded(msg.value);
}
| 25,155 |
1 | // Either TransferSingle or TransferBatch MUST emit when tokens are transferred,/including zero value transfers as well as minting or burning./ Operator will always be msg.sender./ Either event from address `0x0` signifies a minting operation./ An event to address `0x0` signifies a burning or melting operation./ The total value transferred from address 0x0 minus the total value transferred to 0x0 may/ be used by clients and exchanges to be added to the "circulating supply" for a given token ID./ To define a token ID with no initial balance, the contract SHOULD emit the TransferSingle event/ from `0x0` to `0x0`, with the token | event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _value
);
| event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _value
);
| 16,459 |
180 | // contract URI | string private _contractURI;
| string private _contractURI;
| 36,459 |
29 | // Returns a boolean indicating if the given address is in the list with the given role. addr address to check role role to check@ return boolean for whether the address is in the list with the role / | function hasRole(address addr, string role)
public
view
returns (bool)
| function hasRole(address addr, string role)
public
view
returns (bool)
| 83,883 |
53 | // Track original fees to bypass fees for charity account | uint256 private ORIG_TAX_FEE;
uint256 private ORIG_BURN_FEE;
uint256 private ORIG_CHARITY_FEE;
| uint256 private ORIG_TAX_FEE;
uint256 private ORIG_BURN_FEE;
uint256 private ORIG_CHARITY_FEE;
| 10,048 |
53 | // Checks whether the period in which the crowdsale is open has already elapsed.return Whether crowdsale period has elapsed / | function hasClosed() public view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp > closingTime;
}
| function hasClosed() public view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp > closingTime;
}
| 14,817 |
14 | // Guard against msg.value being reused across multiple assets | uint256 ethValue;
uint256 assetsLength = assets.length;
for (uint256 i = 0; i <= assetsLength - 1; ) {
if (assets[i].assetType.assetClass == AssetLib.ETH_ASSET_CLASS) {
ethValue += assets[i].value;
}
| uint256 ethValue;
uint256 assetsLength = assets.length;
for (uint256 i = 0; i <= assetsLength - 1; ) {
if (assets[i].assetType.assetClass == AssetLib.ETH_ASSET_CLASS) {
ethValue += assets[i].value;
}
| 25,783 |
30 | // does the referrer exist? | playerExist[_referrer] == true
)
{
| playerExist[_referrer] == true
)
{
| 47,835 |
5 | // Compound's CErc20Immutable Contract CTokens which wrap an EIP-20 underlying and are immutable Compound / | contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18
* @param name_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
* @param admin_ Address of the administrator of this token
*/
constructor(address underlying_,
ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_,
address payable admin_
) {
// Creator of the contract is admin during initialization
admin = payable(msg.sender);
// Initialize the market
initialize(underlying_, comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
// Set the proper admin now that initialization is done
admin = admin_;
}
}
| contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18
* @param name_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
* @param admin_ Address of the administrator of this token
*/
constructor(address underlying_,
ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_,
address payable admin_
) {
// Creator of the contract is admin during initialization
admin = payable(msg.sender);
// Initialize the market
initialize(underlying_, comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
// Set the proper admin now that initialization is done
admin = admin_;
}
}
| 4,248 |
78 | // Disable lock functionality. Call by only Governance. / | function disableLock() external onlyGovernance {
_enabledLock = false;
emit DisabledLock(governance());
}
| function disableLock() external onlyGovernance {
_enabledLock = false;
emit DisabledLock(governance());
}
| 9,922 |
32 | // address msgSender = _msgSender(); | _owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
| _owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
| 50,151 |
9 | // tracks total existing number of tokens. named to match ERC-20 standard (see https:eips.ethereum.org/EIPS/eip-20) | uint256 public totalSupply;
| uint256 public totalSupply;
| 23,570 |
244 | // Handles the bridged tokens for the first time, includes deployment of new TokenProxy contract.Checks that the value is inside the execution limits and invokes the Mint or Unlock accordingly. _token address of the native ERC20/ERC677 token on the other side. _name name of the native token, name suffix will be appended, if empty, symbol will be used instead. _symbol symbol of the bridged token, if empty, name will be used instead. _decimals decimals of the bridge foreign token. _recipient address that will receive the tokens. _value amount of tokens to be received. / | function deployAndHandleBridgedTokens(
| function deployAndHandleBridgedTokens(
| 37,862 |
107 | // Called to get the details of a user/userAddress User address/ return unstaked Amount of unstaked API3 tokens/ return vesting Amount of API3 tokens locked by vesting/ return unstakeAmount Amount scheduled to unstake/ return unstakeShares Shares revoked to unstake/ return unstakeScheduledFor Time unstaking is scheduled for/ return lastDelegationUpdateTimestamp Time of last delegation update/ return lastProposalTimestamp Time when the user made their most/ recent proposal | function getUser(address userAddress)
external
view
override
returns (
uint256 unstaked,
uint256 vesting,
uint256 unstakeAmount,
uint256 unstakeShares,
uint256 unstakeScheduledFor,
| function getUser(address userAddress)
external
view
override
returns (
uint256 unstaked,
uint256 vesting,
uint256 unstakeAmount,
uint256 unstakeShares,
uint256 unstakeScheduledFor,
| 58,245 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.