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 |
|---|---|---|---|---|
1 | // function transferOwnership(address newOwner) external; | function allowance(address _owner, address _spender) external view returns (uint256);
function frozenAccount(address _account) external view returns (bool);
function frozenAmount(address _account) external view returns (uint256);
| function allowance(address _owner, address _spender) external view returns (uint256);
function frozenAccount(address _account) external view returns (bool);
function frozenAmount(address _account) external view returns (uint256);
| 40,311 |
193 | // Returns the committee members and their weights/Private function called by getCommittee and emitCommitteeSnapshot/ return addrs is the committee members list/ return weights is an array of uint, indicating committee members list weight/ return certification is an array of bool, indicating the committee members certification status | function _getCommittee() private view returns (address[] memory addrs, uint256[] memory weights, bool[] memory certification) {
CommitteeMember[] memory _committee = committee;
addrs = new address[](_committee.length);
weights = new uint[](_committee.length);
certification = new bool[](_committee.length);
for (uint i = 0; i < _committee.length; i++) {
addrs[i] = _committee[i].addr;
(weights[i], certification[i]) = getWeightCertification(_committee[i]);
}
}
| function _getCommittee() private view returns (address[] memory addrs, uint256[] memory weights, bool[] memory certification) {
CommitteeMember[] memory _committee = committee;
addrs = new address[](_committee.length);
weights = new uint[](_committee.length);
certification = new bool[](_committee.length);
for (uint i = 0; i < _committee.length; i++) {
addrs[i] = _committee[i].addr;
(weights[i], certification[i]) = getWeightCertification(_committee[i]);
}
}
| 1,095 |
133 | // Reverts if the current stage is not the specified stage. / | modifier onlyAtStage(Stage _stage) {
require(stage == _stage, "Raise: not at correct stage");
_;
}
| modifier onlyAtStage(Stage _stage) {
require(stage == _stage, "Raise: not at correct stage");
_;
}
| 28,515 |
100 | // If selling, contract balance > numTokensSellToAddToLiquidity and not already swapping then swap | if (balanceOf(address(this)) >= numTokensSellToAddToLiquidity && !inSwapAndLiquify && !automatedMarketMakerPairs[sender] && swapAndLiquifyEnabled) {
inSwapAndLiquify = true;
uint256 _marketingFee = marketingFee;
uint256 marketingTokensToSwap = numTokensSellToAddToLiquidity * _marketingFee / (_marketingFee + liquidityFee);
uint256 liquidityTokens = (numTokensSellToAddToLiquidity - marketingTokensToSwap) / 2;
swapTokensForEth (numTokensSellToAddToLiquidity - liquidityTokens);
addLiquidity (liquidityTokens, address(this).balance);
if (address(this).balance > 0)
payable(marketingWallet).sendValue (address(this).balance);
| if (balanceOf(address(this)) >= numTokensSellToAddToLiquidity && !inSwapAndLiquify && !automatedMarketMakerPairs[sender] && swapAndLiquifyEnabled) {
inSwapAndLiquify = true;
uint256 _marketingFee = marketingFee;
uint256 marketingTokensToSwap = numTokensSellToAddToLiquidity * _marketingFee / (_marketingFee + liquidityFee);
uint256 liquidityTokens = (numTokensSellToAddToLiquidity - marketingTokensToSwap) / 2;
swapTokensForEth (numTokensSellToAddToLiquidity - liquidityTokens);
addLiquidity (liquidityTokens, address(this).balance);
if (address(this).balance > 0)
payable(marketingWallet).sendValue (address(this).balance);
| 37,651 |
72 | // Returns the storage pointer to the BaseData for (`edition`, `mintId`). edition The edition address. mintIdThe mint ID.return data Storage pointer to a BaseData. / | function _getBaseDataUnchecked(address edition, uint128 mintId) internal view returns (BaseData storage data) {
data = _baseData[edition][mintId];
}
| function _getBaseDataUnchecked(address edition, uint128 mintId) internal view returns (BaseData storage data) {
data = _baseData[edition][mintId];
}
| 8,077 |
4 | // Return the price, in wei, of submitting a new retryable tx with a given calldata size. Return value is (price, nextUpdateTimestamp). Price is guaranteed not to change until nextUpdateTimestamp. | function getSubmissionPrice(uint calldataSize) external view returns (uint, uint);
| function getSubmissionPrice(uint calldataSize) external view returns (uint, uint);
| 17,336 |
94 | // Minmum amount of veCRV for the boost for this Offer | uint256 minBoostAmount = (userBalance * minPerc) / MAX_PCT;
| uint256 minBoostAmount = (userBalance * minPerc) / MAX_PCT;
| 4,670 |
182 | // offset the bitboard to scan from `bucketIndex`. | bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
if(bb > 0) {
unchecked {
setBitIndex = (bucket << 8) | (bucketIndex - bb.bitScanForward256());
}
| bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
if(bb > 0) {
unchecked {
setBitIndex = (bucket << 8) | (bucketIndex - bb.bitScanForward256());
}
| 38,766 |
57 | // Push new observation data in the observation arraytimeElapsedSinceLatest Time elapsed between now and the earliest observation in the windownewResult Latest result coming from Chainlink/ | ) internal {
// Compute the new time adjusted result
uint256 newTimeAdjustedResult = multiply(newResult, timeElapsedSinceLatest);
// Add Chainlink observation
chainlinkObservations.push(ChainlinkObservation(now, newTimeAdjustedResult));
// Add the new update
converterResultCumulative = addition(converterResultCumulative, newTimeAdjustedResult);
// Subtract the earliest update
if (updates >= granularity) {
ChainlinkObservation memory chainlinkObservation = getFirstObservationInWindow();
converterResultCumulative = subtract(converterResultCumulative, chainlinkObservation.timeAdjustedResult);
}
}
| ) internal {
// Compute the new time adjusted result
uint256 newTimeAdjustedResult = multiply(newResult, timeElapsedSinceLatest);
// Add Chainlink observation
chainlinkObservations.push(ChainlinkObservation(now, newTimeAdjustedResult));
// Add the new update
converterResultCumulative = addition(converterResultCumulative, newTimeAdjustedResult);
// Subtract the earliest update
if (updates >= granularity) {
ChainlinkObservation memory chainlinkObservation = getFirstObservationInWindow();
converterResultCumulative = subtract(converterResultCumulative, chainlinkObservation.timeAdjustedResult);
}
}
| 29,041 |
76 | // y' = w + x z | dydt := add(w, sar(PRECISION, mul(x, z)))
| dydt := add(w, sar(PRECISION, mul(x, z)))
| 40,450 |
4 | // Emitted when fee rate is updated | event FeeRateChanged(uint256 feeRate, uint256 feeShareRate);
| event FeeRateChanged(uint256 feeRate, uint256 feeShareRate);
| 23,326 |
28 | // Overrides StandardToken._burn in order for burn and burnFrom to emitan additional Burn event. / | function _burn(address _who, uint256 _value) internal {
super._burn(_who, _value);
emit Burn(_who, _value);
}
| function _burn(address _who, uint256 _value) internal {
super._burn(_who, _value);
emit Burn(_who, _value);
}
| 28,145 |
308 | // total non-optimized amount of shares for each strategy | uint128[] memory totalShares = new uint128[](withdrawData.reallocationTable.length);
| uint128[] memory totalShares = new uint128[](withdrawData.reallocationTable.length);
| 34,778 |
144 | // NOTE: As individual market debt is not tracked here, the underlying markets need to be careful never to subtract more debt than they added. This can't be enforced without additional state/communication overhead. | totalDeposited = totalDeposited.sub(delta);
| totalDeposited = totalDeposited.sub(delta);
| 2,656 |
55 | // Jekyll_Island_Inc.deposit.value(address(this).balance)(); | 223 | ||
8 | // balanceAtTs returns the amount of BOND that the user currently staked (bonus NOT included) | function balanceAtTs(address user, uint256 timestamp) external view returns (uint256);
| function balanceAtTs(address user, uint256 timestamp) external view returns (uint256);
| 6,747 |
106 | // Auth checks. | require(globals.isValidLoanFactory(loanFactory), "P:INVALID_LF");
require(ILoanFactory(loanFactory).isLoan(loan), "P:INVALID_L");
require(globals.isValidSubFactory(superFactory, dlFactory, DL_FACTORY), "P:INVALID_DLF");
address debtLocker = debtLockers[loan][dlFactory];
| require(globals.isValidLoanFactory(loanFactory), "P:INVALID_LF");
require(ILoanFactory(loanFactory).isLoan(loan), "P:INVALID_L");
require(globals.isValidSubFactory(superFactory, dlFactory, DL_FACTORY), "P:INVALID_DLF");
address debtLocker = debtLockers[loan][dlFactory];
| 25,109 |
21 | // source of truth for subscriptions | mapping(uint64 => Subscription) public subscriptions;
| mapping(uint64 => Subscription) public subscriptions;
| 4,110 |
0 | // Diamond specific errors | error IncorrectFacetCutAction();
error NoSelectorsInFace();
error FunctionAlreadyExists();
error FacetAddressIsZero();
error FacetAddressIsNotZero();
error FacetContainsNoCode();
error FunctionDoesNotExist();
error FunctionIsImmutable();
error InitZeroButCalldataNotEmpty();
error CalldataEmptyButInitNotZero();
| error IncorrectFacetCutAction();
error NoSelectorsInFace();
error FunctionAlreadyExists();
error FacetAddressIsZero();
error FacetAddressIsNotZero();
error FacetContainsNoCode();
error FunctionDoesNotExist();
error FunctionIsImmutable();
error InitZeroButCalldataNotEmpty();
error CalldataEmptyButInitNotZero();
| 3,306 |
5 | // testing retrieval of all participants in projects | function testGetProjectAdopterAddressByProjectIdInArray() public {
//there should be a participant
address expected = this;
//store participants in memory
address[16] memory projectAdopters = project.getProjectAdopters();
Assert.equal(projectAdopters[8], expected, "Participant of ProjectId 8 should be here");
}
| function testGetProjectAdopterAddressByProjectIdInArray() public {
//there should be a participant
address expected = this;
//store participants in memory
address[16] memory projectAdopters = project.getProjectAdopters();
Assert.equal(projectAdopters[8], expected, "Participant of ProjectId 8 should be here");
}
| 43,164 |
9 | // onlyENGNS comment this out for testing | {
winner = _highestBidder;
winningPrice = _highestBidAmount;
state = AuctionState.COMPLETED;
stakeAmounts[_highestBidder] -= winningPrice;
emit Winner(_highestBidder, _highestBidAmount);
}
| {
winner = _highestBidder;
winningPrice = _highestBidAmount;
state = AuctionState.COMPLETED;
stakeAmounts[_highestBidder] -= winningPrice;
emit Winner(_highestBidder, _highestBidAmount);
}
| 33,261 |
35 | // The actual balance could be greater than totalBalances[token] because anyone can send tokens to the contract's address which cannot be accounted forassert(TokenInteract.balanceOf(token, address(this)) >= totalBalances[token]); | return (balances[token][user].availableBalance,
balances[token][user].frozenBalace);
| return (balances[token][user].availableBalance,
balances[token][user].frozenBalace);
| 27,054 |
1 | // This is the interface that {BeaconProxy} expects of its beacon./ Must return an address that can be used as a delegate call target. {BeaconProxy} will check that this address is a contract. / | function implementation() external view returns (address);
| function implementation() external view returns (address);
| 964 |
130 | // transfers the interest to the lender, less the interest fee | VAULTWITHDRAW131(
interestToken,
lender,
interestOwedNow
.SUB395(lendingFee)
);
| VAULTWITHDRAW131(
interestToken,
lender,
interestOwedNow
.SUB395(lendingFee)
);
| 43,494 |
112 | // Callback Proof managment / |
event WorkOrderCallbackProof(address indexed woid, address requester, address beneficiary,address indexed callbackTo, address indexed gasCallbackProvider,string stdout, string stderr , string uri);
|
event WorkOrderCallbackProof(address indexed woid, address requester, address beneficiary,address indexed callbackTo, address indexed gasCallbackProvider,string stdout, string stderr , string uri);
| 22,875 |
42 | // Crypxie Contract to create the Crypxie / | contract Crypxie is CrowdsaleToken {
string public constant name = "Crypxie";
string public constant symbol = "CPX";
uint32 public constant decimals = 18;
} | contract Crypxie is CrowdsaleToken {
string public constant name = "Crypxie";
string public constant symbol = "CPX";
uint32 public constant decimals = 18;
} | 30,325 |
9 | // When error occurs during document key retrieval. | event DocumentKeyShadowRetrievalError(bytes32 indexed serverKeyId, address indexed requester);
| event DocumentKeyShadowRetrievalError(bytes32 indexed serverKeyId, address indexed requester);
| 8,482 |
26 | // total LP tokens locked | uint256 public totalLpTokensLocked;
| uint256 public totalLpTokensLocked;
| 67,287 |
25 | // Sets {amount} as the allowance of {spender} over the {owner} s tokens. | function _approve(address owner, address spender, uint256 amount) internal virtual returns (bool)
{
if ((owner == address(0)) || (spender == address(0)))
return false;
mDataAllowed[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
| function _approve(address owner, address spender, uint256 amount) internal virtual returns (bool)
{
if ((owner == address(0)) || (spender == address(0)))
return false;
mDataAllowed[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
| 17,080 |
92 | // Helper to convert an amount from a _baseAsset to a _quoteAsset | function __calcConversionAmount(
address _baseAsset,
uint256 _baseAssetAmount,
uint256 _baseAssetRate,
address _quoteAsset,
uint256 _quoteAssetRate
| function __calcConversionAmount(
address _baseAsset,
uint256 _baseAssetAmount,
uint256 _baseAssetRate,
address _quoteAsset,
uint256 _quoteAssetRate
| 66,813 |
163 | // CLUSTER LOCK INTERFACE //Covers locking amount of DHV for staking cluster token./_cluster Address of cluster token./_amount Amount of staked cluster./_user Address of user who staked cluster tokens. | function coverCluster(
address _cluster,
address _user,
uint256 _amount,
uint256 _pid
| function coverCluster(
address _cluster,
address _user,
uint256 _amount,
uint256 _pid
| 49,594 |
2 | // Restricts withdraw, swap feature till liquidity is added to the pool | /* modifier activePool() {
require(totalShares > 0, "Zero Liquidity");
_;
}*/
| /* modifier activePool() {
require(totalShares > 0, "Zero Liquidity");
_;
}*/
| 5,315 |
17 | // The AO sets NameTAOPosition address _nameTAOPositionAddress The address of NameTAOPosition / | function setNameTAOPositionAddress(address _nameTAOPositionAddress) public onlyTheAO {
require (_nameTAOPositionAddress != address(0));
nameTAOPositionAddress = _nameTAOPositionAddress;
_nameTAOPosition = INameTAOPosition(_nameTAOPositionAddress);
}
| function setNameTAOPositionAddress(address _nameTAOPositionAddress) public onlyTheAO {
require (_nameTAOPositionAddress != address(0));
nameTAOPositionAddress = _nameTAOPositionAddress;
_nameTAOPosition = INameTAOPosition(_nameTAOPositionAddress);
}
| 30,030 |
21 | // Amount sent to contract in USDC (swap value); | uint256 usdcPrincipal;
| uint256 usdcPrincipal;
| 14,474 |
67 | // uniswap v2 |
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
|
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
| 37,729 |
116 | // Set the referrer, if no referrer has been set yet, and the player and referrer are not the same address. | _setReferrer(playerAddr, referrerAddr);
| _setReferrer(playerAddr, referrerAddr);
| 12,587 |
20 | // Mapping from token ID to owner | mapping (uint256 => address) private tokenOwner;
| mapping (uint256 => address) private tokenOwner;
| 9,391 |
6 | // Transfer tokens from one address to another and then execute a callback on `to`. from The address which you want to send tokens from to The address which you want to transfer to amount The amount of tokens to be transferredreturn A boolean that indicates if the operation was successful. / | function transferFromAndCall(
address from,
address to,
uint256 amount
| function transferFromAndCall(
address from,
address to,
uint256 amount
| 19,274 |
209 | // If pausing, set paused price; else if unpausing, clear pausedPrice | if(collateralPricePaused == false){
pausedPrice = _new_price;
} else {
| if(collateralPricePaused == false){
pausedPrice = _new_price;
} else {
| 22,166 |
18 | // return current price of cToken in underlying / | function getPriceInToken()
external view
| function getPriceInToken()
external view
| 39,985 |
85 | // modifier that throws if trading has not started yet / | modifier hasStartedTrading() {
require(tradingStarted);
_;
}
| modifier hasStartedTrading() {
require(tradingStarted);
_;
}
| 26,879 |
6 | // gets the number of comments directly under a specific content | function getCommentCount(uint256 contentIndex) external view returns
| function getCommentCount(uint256 contentIndex) external view returns
| 45,949 |
5 | // Calculates the funding rate based on prices/realPriceX128 spot price of token/virtualPriceX128 futures price of token | function getFundingRate(uint256 realPriceX128, uint256 virtualPriceX128)
internal
pure
returns (int256 fundingRateX128)
| function getFundingRate(uint256 realPriceX128, uint256 virtualPriceX128)
internal
pure
returns (int256 fundingRateX128)
| 15,806 |
1 | // Spot check assumptions | assertEq(snapshots.epoch(), 1, "Next snapshot should be 1");
assertEq(snapshots.getRawSignatureSnapshot(3).length, 0, "foo");
| assertEq(snapshots.epoch(), 1, "Next snapshot should be 1");
assertEq(snapshots.getRawSignatureSnapshot(3).length, 0, "foo");
| 3,895 |
6 | // Remove the donor from the donators array | uint256 donorIndex;
for (uint256 i = 0; i < campaign.donators.length; i++) {
if (campaign.donators[i] == _donor) {
donorIndex = i;
break;
}
| uint256 donorIndex;
for (uint256 i = 0; i < campaign.donators.length; i++) {
if (campaign.donators[i] == _donor) {
donorIndex = i;
break;
}
| 24,081 |
37 | // Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to. / | function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
| function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
| 1,350 |
87 | // Counter to keep track of how many of forced requests are open so we can limit the work that needs to be done by the owner | uint32 numPendingForcedTransactions;
| uint32 numPendingForcedTransactions;
| 3,486 |
124 | // make sure we can actually claim it and that we are paying the correct amount | require(canClaim);
require(amount == lowestClaimPrice);
| require(canClaim);
require(amount == lowestClaimPrice);
| 50,800 |
174 | // for mainnet | uint256 private constant EPOCH_PERIOD = 7200; // 2 hours
| uint256 private constant EPOCH_PERIOD = 7200; // 2 hours
| 29,635 |
91 | // All hero starts in the novice dungeon, also hero can only be recruited in novice dungoen. | uint public noviceDungeonId = 31; // < dungeon ID 31 = Abyss
| uint public noviceDungeonId = 31; // < dungeon ID 31 = Abyss
| 56,661 |
180 | // require(addresses[i].isContract(), "Role address need contract only"); | if (setTo[i]) {
grantRole(roleType, addresses[i]);
} else {
| if (setTo[i]) {
grantRole(roleType, addresses[i]);
} else {
| 48,822 |
13 | // check all items before actions[i], does not equal to action[i] | require(_actions[i] != address(0), "O4");
for(uint256 j = 0; j < i; j++) {
require(_actions[i] != _actions[j], "O5");
}
| require(_actions[i] != address(0), "O4");
for(uint256 j = 0; j < i; j++) {
require(_actions[i] != _actions[j], "O5");
}
| 56,148 |
309 | // Gets the configuration flags of the reserve from a memory object self The reserve configurationreturn The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled / | {
return (
(self.data & ~ACTIVE_MASK) != 0,
(self.data & ~FROZEN_MASK) != 0,
(self.data & ~BORROWING_MASK) != 0,
(self.data & ~STABLE_BORROWING_MASK) != 0
);
}
| {
return (
(self.data & ~ACTIVE_MASK) != 0,
(self.data & ~FROZEN_MASK) != 0,
(self.data & ~BORROWING_MASK) != 0,
(self.data & ~STABLE_BORROWING_MASK) != 0
);
}
| 15,332 |
37 | // Allow the owner to set a transaction proxy which can perform value exchanges on behalf of this contract. (unrelated to the requestProxy which is not whiteList) | function enableProxy(address _proxy)
onlyOwner
public
| function enableProxy(address _proxy)
onlyOwner
public
| 27,779 |
105 | // The second when mining ends. | uint256 public bonusEndTime;
| uint256 public bonusEndTime;
| 972 |
79 | // The number of checkpoints for each account | mapping(address => uint32) public numCheckpoints;
| mapping(address => uint32) public numCheckpoints;
| 67,893 |
12 | // Close professional office/_id The professional office id | function setProfessionalOfficeClosed(uint32 _id) external onlyWhitelistAdmin onlyExistingOffice(_id) {
_changeOfficeStatus(_id, STATUS_CLOSED);
emit ProfessionalOfficeActivated(_id, offices[_id].name);
}
| function setProfessionalOfficeClosed(uint32 _id) external onlyWhitelistAdmin onlyExistingOffice(_id) {
_changeOfficeStatus(_id, STATUS_CLOSED);
emit ProfessionalOfficeActivated(_id, offices[_id].name);
}
| 8,959 |
10 | // Returns `user`'s Internal Balance for a set of tokens. / | function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory);
| function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory);
| 25,820 |
26 | // increment the participant's sub-tokens and sub-ether |
participantTokens[_recipient] = safeAdd(participantTokens[_recipient], totalTokens);
participantValues[_recipient] = safeAdd(participantValues[_recipient], msg.value);
|
participantTokens[_recipient] = safeAdd(participantTokens[_recipient], totalTokens);
participantValues[_recipient] = safeAdd(participantValues[_recipient], msg.value);
| 18,214 |
52 | // This function cleans outstanding orders and rebalances yield between bathTokens | function bathScrub() external {
// 4. Cancel Outstanding Orders that need to be cleared or logged for yield
cancelPartialFills();
}
| function bathScrub() external {
// 4. Cancel Outstanding Orders that need to be cleared or logged for yield
cancelPartialFills();
}
| 16,534 |
18 | // Contract Constants // Contract Variables // Constructor initializes the owner's balance and the supply/ | function BethereumERC223() {
owner = msg.sender;
}
| function BethereumERC223() {
owner = msg.sender;
}
| 34,658 |
21 | // pool index => the timestamp which the pool filled at | mapping(uint256 => uint256) public filledAtP;
| mapping(uint256 => uint256) public filledAtP;
| 52,364 |
34 | // Forward ERC20 methods to upgraded contract after the upgrade timestamp has been reached | function transfer(address _to, uint256 _value) public returns (bool success) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
| function transfer(address _to, uint256 _value) public returns (bool success) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
| 22,794 |
322 | // Returns 1 as an unsigned 60.18-decimal fixed-point number. | function scale() internal pure returns (uint256 result) {
result = SCALE;
}
| function scale() internal pure returns (uint256 result) {
result = SCALE;
}
| 22,629 |
78 | // Returns the values of {UserInfo}. / | function userInfos(address, uint256)
| function userInfos(address, uint256)
| 70,708 |
2 | // copycalldata of size calldatasize starting from 0 of call data to location at ptr | calldatacopy(ptr, 0, calldatasize)
| calldatacopy(ptr, 0, calldatasize)
| 20,346 |
11 | // Don't allow a zero index, start counting at 1 | return value+1;
| return value+1;
| 35,590 |
1,110 | // Every price request costs a fixed fee. Check that this user has enough deposited to cover the final fee. | FixedPoint.Unsigned memory finalFee = _computeFinalFees();
require(
_getFeeAdjustedCollateral(depositBoxData.rawCollateral).isGreaterThanOrEqual(finalFee),
"Cannot pay final fee"
);
_payFinalFees(address(this), finalFee);
| FixedPoint.Unsigned memory finalFee = _computeFinalFees();
require(
_getFeeAdjustedCollateral(depositBoxData.rawCollateral).isGreaterThanOrEqual(finalFee),
"Cannot pay final fee"
);
_payFinalFees(address(this), finalFee);
| 10,318 |
121 | // Tracks pending withdrawal requests. A withdrawal request is pending if `withdrawalRequestPassTimestamp != 0`. | uint256 withdrawalRequestPassTimestamp;
Unsigned withdrawalRequestAmount;
| uint256 withdrawalRequestPassTimestamp;
Unsigned withdrawalRequestAmount;
| 9,674 |
73 | // TheLostGlitches contract / | contract TheLostGlitches is ERC721Enumerable, ERC721URIStorage, Ownable {
string public PROVENANCE_HASH = "";
uint256 public MAX_GLITCHES;
uint256 public OFFSET_VALUE;
bool public METADATA_FROZEN;
bool public PROVENANCE_FROZEN;
string public baseUri;
bool public saleIsActive;
uint256 public mintPrice;
uint256 public maxPerMint;
event SetBaseUri(string indexed baseUri);
modifier whenSaleActive {
require(saleIsActive, "TheLostGlitches: Sale is not active");
_;
}
modifier whenMetadataNotFrozen {
require(!METADATA_FROZEN, "TheLostGlitches: Metadata already frozen.");
_;
}
modifier whenProvenanceNotFrozen {
require(!PROVENANCE_FROZEN, "TheLostGlitches: Provenance already frozen.");
_;
}
constructor() ERC721("The Lost Glitches", "GLITCH") {
saleIsActive = false;
MAX_GLITCHES = 10000;
mintPrice = 75000000000000000; // 0.075 ETH
maxPerMint = 20;
METADATA_FROZEN = false;
PROVENANCE_FROZEN = false;
}
// ------------------
// Explicit overrides
// ------------------
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721, ERC721Enumerable) {
super._beforeTokenTransfer(from, to, tokenId);
}
function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId) public view virtual override(ERC721URIStorage, ERC721) returns (string memory) {
return super.tokenURI(tokenId);
}
function _baseURI() internal view override returns (string memory) {
return baseUri;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Enumerable, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
// ------------------
// Utility view functions
// ------------------
function exists(uint256 _tokenId) public view returns (bool) {
return _exists(_tokenId);
}
// ------------------
// Functions for external minting
// ------------------
function mintGlitches(uint256 amount) external payable whenSaleActive {
require(amount <= maxPerMint, "TheLostGlitches: Amount exceeds max per mint");
require(totalSupply() + amount <= MAX_GLITCHES, "TheLostGlitches: Purchase would exceed cap");
require(mintPrice * amount <= msg.value, "TheLostGlitches: Ether value sent is not correct");
for(uint256 i = 0; i < amount; i++) {
uint256 mintIndex = totalSupply() + 1;
if (totalSupply() < MAX_GLITCHES) {
_safeMint(msg.sender, mintIndex);
}
}
}
// ------------------
// Functions for the owner
// ------------------
function setMaxPerMint(uint256 _maxPerMint) external onlyOwner {
maxPerMint = _maxPerMint;
}
function setMintPrice(uint256 _mintPrice) external onlyOwner {
mintPrice = _mintPrice;
}
function setBaseUri(string memory _baseUri) external onlyOwner whenMetadataNotFrozen {
baseUri = _baseUri;
emit SetBaseUri(baseUri);
}
function setTokenURI(uint256 tokenId, string memory _tokenURI) external onlyOwner whenMetadataNotFrozen {
super._setTokenURI(tokenId, _tokenURI);
}
function mintForCommunity(address _to, uint256 _numberOfTokens) external onlyOwner {
require(_to != address(0), "TheLostGlitches: Cannot mint to zero address.");
require(totalSupply() + _numberOfTokens <= MAX_GLITCHES, "TheLostGlitches: Minting would exceed cap");
for(uint256 i = 0; i < _numberOfTokens; i++) {
uint256 mintIndex = totalSupply() + 1;
if (totalSupply() < MAX_GLITCHES) {
_safeMint(_to, mintIndex);
}
}
}
function setProvenanceHash(string memory _provenanceHash) external onlyOwner whenProvenanceNotFrozen {
PROVENANCE_HASH = _provenanceHash;
}
function setOffsetValue(uint256 _offsetValue) external onlyOwner {
OFFSET_VALUE = _offsetValue;
}
function toggleSaleState() external onlyOwner {
saleIsActive = !saleIsActive;
}
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function freezeMetadata() external onlyOwner whenMetadataNotFrozen {
METADATA_FROZEN = true;
}
function freezeProvenance() external onlyOwner whenProvenanceNotFrozen {
PROVENANCE_FROZEN = true;
}
// ------------------
// Utility function for getting the tokens of a certain address
// ------------------
function tokensOfOwner(address _owner) external view returns(uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
}
| contract TheLostGlitches is ERC721Enumerable, ERC721URIStorage, Ownable {
string public PROVENANCE_HASH = "";
uint256 public MAX_GLITCHES;
uint256 public OFFSET_VALUE;
bool public METADATA_FROZEN;
bool public PROVENANCE_FROZEN;
string public baseUri;
bool public saleIsActive;
uint256 public mintPrice;
uint256 public maxPerMint;
event SetBaseUri(string indexed baseUri);
modifier whenSaleActive {
require(saleIsActive, "TheLostGlitches: Sale is not active");
_;
}
modifier whenMetadataNotFrozen {
require(!METADATA_FROZEN, "TheLostGlitches: Metadata already frozen.");
_;
}
modifier whenProvenanceNotFrozen {
require(!PROVENANCE_FROZEN, "TheLostGlitches: Provenance already frozen.");
_;
}
constructor() ERC721("The Lost Glitches", "GLITCH") {
saleIsActive = false;
MAX_GLITCHES = 10000;
mintPrice = 75000000000000000; // 0.075 ETH
maxPerMint = 20;
METADATA_FROZEN = false;
PROVENANCE_FROZEN = false;
}
// ------------------
// Explicit overrides
// ------------------
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721, ERC721Enumerable) {
super._beforeTokenTransfer(from, to, tokenId);
}
function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId) public view virtual override(ERC721URIStorage, ERC721) returns (string memory) {
return super.tokenURI(tokenId);
}
function _baseURI() internal view override returns (string memory) {
return baseUri;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Enumerable, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
// ------------------
// Utility view functions
// ------------------
function exists(uint256 _tokenId) public view returns (bool) {
return _exists(_tokenId);
}
// ------------------
// Functions for external minting
// ------------------
function mintGlitches(uint256 amount) external payable whenSaleActive {
require(amount <= maxPerMint, "TheLostGlitches: Amount exceeds max per mint");
require(totalSupply() + amount <= MAX_GLITCHES, "TheLostGlitches: Purchase would exceed cap");
require(mintPrice * amount <= msg.value, "TheLostGlitches: Ether value sent is not correct");
for(uint256 i = 0; i < amount; i++) {
uint256 mintIndex = totalSupply() + 1;
if (totalSupply() < MAX_GLITCHES) {
_safeMint(msg.sender, mintIndex);
}
}
}
// ------------------
// Functions for the owner
// ------------------
function setMaxPerMint(uint256 _maxPerMint) external onlyOwner {
maxPerMint = _maxPerMint;
}
function setMintPrice(uint256 _mintPrice) external onlyOwner {
mintPrice = _mintPrice;
}
function setBaseUri(string memory _baseUri) external onlyOwner whenMetadataNotFrozen {
baseUri = _baseUri;
emit SetBaseUri(baseUri);
}
function setTokenURI(uint256 tokenId, string memory _tokenURI) external onlyOwner whenMetadataNotFrozen {
super._setTokenURI(tokenId, _tokenURI);
}
function mintForCommunity(address _to, uint256 _numberOfTokens) external onlyOwner {
require(_to != address(0), "TheLostGlitches: Cannot mint to zero address.");
require(totalSupply() + _numberOfTokens <= MAX_GLITCHES, "TheLostGlitches: Minting would exceed cap");
for(uint256 i = 0; i < _numberOfTokens; i++) {
uint256 mintIndex = totalSupply() + 1;
if (totalSupply() < MAX_GLITCHES) {
_safeMint(_to, mintIndex);
}
}
}
function setProvenanceHash(string memory _provenanceHash) external onlyOwner whenProvenanceNotFrozen {
PROVENANCE_HASH = _provenanceHash;
}
function setOffsetValue(uint256 _offsetValue) external onlyOwner {
OFFSET_VALUE = _offsetValue;
}
function toggleSaleState() external onlyOwner {
saleIsActive = !saleIsActive;
}
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function freezeMetadata() external onlyOwner whenMetadataNotFrozen {
METADATA_FROZEN = true;
}
function freezeProvenance() external onlyOwner whenProvenanceNotFrozen {
PROVENANCE_FROZEN = true;
}
// ------------------
// Utility function for getting the tokens of a certain address
// ------------------
function tokensOfOwner(address _owner) external view returns(uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
}
| 66,790 |
327 | // Check that the current state of the pricelessPositionManager is Open. This prevents multiple calls to `expire` and `EmergencyShutdown` post expiration. | modifier onlyOpenState() {
_onlyOpenState();
_;
}
| modifier onlyOpenState() {
_onlyOpenState();
_;
}
| 11,963 |
9 | // mock the payload for sendFrom() | bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));
return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);
| bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));
return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);
| 6,236 |
108 | // Returns the current admin of `proxy`. Requirements: - This contract must be the admin of `proxy`. / | function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
// We need to manually run the static call since the getter cannot be flagged as view
// bytes4(keccak256("admin()")) == 0xf851a440
(bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440");
require(success);
return abi.decode(returndata, (address));
}
| function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
// We need to manually run the static call since the getter cannot be flagged as view
// bytes4(keccak256("admin()")) == 0xf851a440
(bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440");
require(success);
return abi.decode(returndata, (address));
}
| 8,911 |
24 | // presale failed, withdraw to calling user | if (presaleFailed) {
uint256 amount = balances[msg.sender];
balances[msg.sender] = 0;
send(msg.sender, amount);
return true;
}
| if (presaleFailed) {
uint256 amount = balances[msg.sender];
balances[msg.sender] = 0;
send(msg.sender, amount);
return true;
}
| 21,796 |
53 | // round 51 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 27,676 |
4 | // Initializes the contract setting the deployer as the initial Governor. / | constructor() {
_setGovernor(msg.sender);
emit GovernorshipTransferred(address(0), _governor());
}
| constructor() {
_setGovernor(msg.sender);
emit GovernorshipTransferred(address(0), _governor());
}
| 13,503 |
42 | // Don't forget to add 0x into it | function getWalletFromPublicKey(bytes memory _publicKey)
public
pure
returns (address wallet)
| function getWalletFromPublicKey(bytes memory _publicKey)
public
pure
returns (address wallet)
| 35,132 |
39 | // Modifier to make a function callable only when the contract has Atomic Swaps not available./ | modifier isNotAtomicSwap() {
require(!isTokenSwapAtomic, "Has to be non Atomic swap");
_;
}
| modifier isNotAtomicSwap() {
require(!isTokenSwapAtomic, "Has to be non Atomic swap");
_;
}
| 22,505 |
20 | // Transfers ownership of the contract to `_newOwner`./Callable by the founder only./Callable only by a none-zero address. | function transferOwnership(address payable _newOwner)
onlyFounder
noneZero(_newOwner)
public
returns (bool success)
| function transferOwnership(address payable _newOwner)
onlyFounder
noneZero(_newOwner)
public
returns (bool success)
| 41,496 |
279 | // Compare and take the item with the lowst chance | if(layerItem1.chance <= layerItem2.chance){
rarestLayerPositions[i] = layerItemPosition1[i];
rarestBorgAttributeNames[i] = layerItem1.borgAttributeName;
}
| if(layerItem1.chance <= layerItem2.chance){
rarestLayerPositions[i] = layerItemPosition1[i];
rarestBorgAttributeNames[i] = layerItem1.borgAttributeName;
}
| 29,475 |
151 | // console.log("[sc] deposit amount:", amount); | token.safeTransferFrom(msg.sender, address(this), amount);
totalDeposits = totalDeposits.add(amount);
updateBetterDeposit(true, amount, msg.sender);
emit Deposit(msg.sender, amount);
| token.safeTransferFrom(msg.sender, address(this), amount);
totalDeposits = totalDeposits.add(amount);
updateBetterDeposit(true, amount, msg.sender);
emit Deposit(msg.sender, amount);
| 8,469 |
9 | // 確保付的錢大於等於票的價格 | require(msg.value >= tickets[_index].price);
tickets[_index].owner = msg.sender;
| require(msg.value >= tickets[_index].price);
tickets[_index].owner = msg.sender;
| 34,600 |
230 | // register new contract for state sync | function register(address sender, address receiver) public {
require(
isOwner() || registrations[receiver] == msg.sender,
"StateSender.register: Not authorized to register"
);
registrations[receiver] = sender;
if (registrations[receiver] == address(0)) {
emit NewRegistration(msg.sender, sender, receiver);
} else {
emit RegistrationUpdated(msg.sender, sender, receiver);
}
}
| function register(address sender, address receiver) public {
require(
isOwner() || registrations[receiver] == msg.sender,
"StateSender.register: Not authorized to register"
);
registrations[receiver] = sender;
if (registrations[receiver] == address(0)) {
emit NewRegistration(msg.sender, sender, receiver);
} else {
emit RegistrationUpdated(msg.sender, sender, receiver);
}
}
| 21,286 |
63 | // Provides a descriptive tag for bot consumption This should be modified weekly to provide a summary of the actions Hash: seth keccak -- "$(wget https:raw.githubusercontent.com/makerdao/community/2dfe2a94162345e448c0353ec0e522038572366a/governance/votes/Executive%20vote%20-%20December%203%2C%202021.md -q -O - 2>/dev/null)" | string public constant override description =
"2021-12-03 MakerDAO Executive Spell | Hash: 0x9068bf87d0ec441f57ff92e2544a3df16d42a481b3e94ec2c37a443031833b84";
| string public constant override description =
"2021-12-03 MakerDAO Executive Spell | Hash: 0x9068bf87d0ec441f57ff92e2544a3df16d42a481b3e94ec2c37a443031833b84";
| 15,311 |
1 | // Raphael Pinto Gregorio/return contract owner/basic function/ return contract owner address | function getOwner() external view returns(address) {
return _owner;
}
| function getOwner() external view returns(address) {
return _owner;
}
| 42,145 |
76 | // ping to update interest up to now | _updateForgeFee(_underlyingAsset, _expiry, 0);
uint256 _totalFee = totalFee[_underlyingAsset][_expiry];
totalFee[_underlyingAsset][_expiry] = 0;
address treasuryAddress = data.treasury();
_totalFee = _safeTransfer(
yieldToken,
_underlyingAsset,
_expiry,
treasuryAddress,
| _updateForgeFee(_underlyingAsset, _expiry, 0);
uint256 _totalFee = totalFee[_underlyingAsset][_expiry];
totalFee[_underlyingAsset][_expiry] = 0;
address treasuryAddress = data.treasury();
_totalFee = _safeTransfer(
yieldToken,
_underlyingAsset,
_expiry,
treasuryAddress,
| 9,851 |
10 | // ReviewStorage The ReviewStorage contract has an. / | contract ReviewStorage {
mapping (string => bool) internal clientReviews;
string[] public indexReview;
event NewReviewHash(string _reviewHash, uint256 _createdTime);
/**
* @dev Returns whether this hash exists or not.
* @param _hashReview Verifiable hash.
*/
function getExistingReview(string _hashReview) public view returns(bool) {
if (clientReviews[_hashReview] == true) {
return true;
}
else
return false;
}
/**
* @dev Returns hash by index.
* @param _index Verifiable index.
*/
function getReviewHash(uint256 _index) public view returns(string) {
require(_index < indexReview.length, "Index hasn't exist");
return indexReview[_index];
}
/**
* @dev Returns the number of saved hashes.
*/
function totalHashes() public view returns(uint256) {
return indexReview.length;
}
}
| contract ReviewStorage {
mapping (string => bool) internal clientReviews;
string[] public indexReview;
event NewReviewHash(string _reviewHash, uint256 _createdTime);
/**
* @dev Returns whether this hash exists or not.
* @param _hashReview Verifiable hash.
*/
function getExistingReview(string _hashReview) public view returns(bool) {
if (clientReviews[_hashReview] == true) {
return true;
}
else
return false;
}
/**
* @dev Returns hash by index.
* @param _index Verifiable index.
*/
function getReviewHash(uint256 _index) public view returns(string) {
require(_index < indexReview.length, "Index hasn't exist");
return indexReview[_index];
}
/**
* @dev Returns the number of saved hashes.
*/
function totalHashes() public view returns(uint256) {
return indexReview.length;
}
}
| 33,369 |
53 | // if the sender is deleting a flow to a super app receiver | if (ISuperfluid(msg.sender).isApp(ISuperApp(flowVars.receiver))) {
newCtx = _changeFlowToApp(
flowVars.receiver,
flowVars.token, flowParams, oldFlowData,
newCtx, currentContext, FlowChangeType.DELETE_FLOW);
} else {
| if (ISuperfluid(msg.sender).isApp(ISuperApp(flowVars.receiver))) {
newCtx = _changeFlowToApp(
flowVars.receiver,
flowVars.token, flowParams, oldFlowData,
newCtx, currentContext, FlowChangeType.DELETE_FLOW);
} else {
| 6,000 |
160 | // Creates a non-upgradeable token proxy for PermitableToken.sol, initializes its eternalStorage._tokenImage address of the token image used for mirroring all functions._name token name._symbol token symbol._decimals token decimals._chainId chain id for current network./ | constructor(address _tokenImage, string memory _name, string memory _symbol, uint8 _decimals, uint256 _chainId)
public
| constructor(address _tokenImage, string memory _name, string memory _symbol, uint8 _decimals, uint256 _chainId)
public
| 51,521 |
120 | // DNSZoneCleared is emitted whenever a given node's zone information is cleared. | event DNSZoneCleared(bytes32 indexed node);
| event DNSZoneCleared(bytes32 indexed node);
| 16,957 |
22 | // ETHFLEX Contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract ETHFLEX is ERC721, Ownable {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdTracker;
string public PROVENANCE = "";
uint256[13] public RandomIds = [
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Silver ID
10000, // This will be Silver ID
10000 // This will be Gold ID
];
uint256 public selectedIdNumber;
bytes32 public requestId_;
IRandomNumberGenerator internal randomGenerator_;
uint256 public totalSaleElement;
uint256 public mintPrice;
uint256 public maxByMint;
bool public saleIsActive;
address public clientAddress = 0x4BC034c68a811Be6E30E1F2c9A38B2aBC38a326c;
address public devAddress = 0x4DaCe7eF31580837b8dA650FFCf1977cA43f6cee;
event CreateETHFLEX(address indexed minter, uint256 indexed id);
modifier checkSaleIsActive() {
require(saleIsActive == true, "Sale is not active");
_;
}
modifier onlyRandomGenerator() {
require(
msg.sender == address(randomGenerator_),
"Only random generator"
);
_;
}
constructor() ERC721("ETHERFLEX", "ETHFLEX") {
saleIsActive = false;
totalSaleElement = 5555;
mintPrice = 1 * 10**17; // 0.1 ETH
maxByMint = 10;
}
/**
* Set Mint Price
*/
function setRandomGenerator(uint256 randomGenerator) external onlyOwner {
randomGenerator_ = IRandomNumberGenerator(randomGenerator);
}
/**
* Get Random Number
*/
function getRandomIdFromChainlink() external onlyOwner {
require(
selectedIdNumber < 13,
"Random number generation is already completed"
);
requestId_ = randomGenerator_.getRandomNumber();
}
function checkRandomNumber(uint256 _randomNumber)
internal
view
returns (bool)
{
for (uint256 i; i < selectedIdNumber; i++) {
if (_randomNumber == RandomIds[i]) {
return false;
}
}
return true;
}
function numbersDrawn(bytes32 _requestId, uint256 _randomNumber)
external
onlyRandomGenerator
{
require(_requestId == requestId_, "Not correct request");
uint256 random = _randomNumber % totalSaleElement;
require(
checkRandomNumber(random),
"This random number is exist already."
);
RandomIds[selectedIdNumber] = random;
selectedIdNumber = selectedIdNumber.add(1);
}
/**
* Set Mint Price
*/
function setMintPrice(uint256 newMintPrice) external onlyOwner {
mintPrice = newMintPrice;
}
/**
* Set Max By Mint
*/
function setMaxByMint(uint256 newMaxByMint) external onlyOwner {
maxByMint = newMaxByMint;
}
/**
* Set Sale Status
*/
function setSaleStatus(bool saleStatus) external onlyOwner {
saleIsActive = saleStatus;
}
/**
* Set Base URI
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
/**
* Set Base PROVENANCE
*/
function setProvenance(string memory _provenance) external onlyOwner {
PROVENANCE = _provenance;
}
/**
* Get Total Supply
*/
function _totalSupply() internal view returns (uint256) {
return _tokenIdTracker.current();
}
/**
* Get Total Mint
*/
function totalMint() public view returns (uint256) {
return _totalSupply();
}
/**
* Check if certain token id is exists.
*/
function exists(uint256 _tokenId) public view returns (bool) {
return _exists(_tokenId);
}
/**
* Get Tokens Of Owner
*/
function getTokensOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
uint256[] memory tokenIdList = new uint256[](tokenCount);
for (uint256 i = 0; i < tokenCount; i++) {
tokenIdList[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIdList;
}
/**
* Mint An Element
*/
function _mintAnElement(address _to) internal {
uint256 id = _totalSupply();
_tokenIdTracker.increment();
_safeMint(_to, id);
emit CreateETHFLEX(_to, id);
}
/**
* Mint ETHFLEX By User
*/
function mintByUser(address _to, uint256 _amount)
public
payable
checkSaleIsActive
{
uint256 totalSupply = _totalSupply();
require(totalSupply <= totalSaleElement, "Presale End");
require(
totalSupply + _amount <= totalSaleElement,
"Max Limit To Presale"
);
require(_amount <= maxByMint, "Exceeds Amount");
require(mintPrice.mul(_amount) <= msg.value, "Low Price To Mint");
for (uint256 i = 0; i < _amount; i += 1) {
_mintAnElement(_to);
}
}
/**
* Mint ETHFLEX By Owner
*/
function mintByOwner(address _to, uint256 _amount) external onlyOwner {
uint256 totalSupply = _totalSupply();
require(totalSupply <= totalSaleElement, "Presale End");
require(
totalSupply + _amount <= totalSaleElement,
"Max Limit To Presale"
);
for (uint256 i = 0; i < _amount; i += 1) {
_mintAnElement(_to);
}
}
/**
* Withdraw
*/
function withdrawAll() public onlyOwner {
uint256 totalBalance = address(this).balance;
uint256 devAmount = totalBalance.mul(470).div(10000);
uint256 clientAmount = totalBalance.sub(devAmount);
(bool withdrawDev, ) = devAddress.call{value: devAmount}("");
require(withdrawDev, "Withdraw Failed To Dev");
(bool withdrawClient, ) = clientAddress.call{value: clientAmount}("");
require(withdrawClient, "Withdraw Failed To Client.");
}
}
| contract ETHFLEX is ERC721, Ownable {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdTracker;
string public PROVENANCE = "";
uint256[13] public RandomIds = [
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Brown ID
10000, // This will be Silver ID
10000, // This will be Silver ID
10000 // This will be Gold ID
];
uint256 public selectedIdNumber;
bytes32 public requestId_;
IRandomNumberGenerator internal randomGenerator_;
uint256 public totalSaleElement;
uint256 public mintPrice;
uint256 public maxByMint;
bool public saleIsActive;
address public clientAddress = 0x4BC034c68a811Be6E30E1F2c9A38B2aBC38a326c;
address public devAddress = 0x4DaCe7eF31580837b8dA650FFCf1977cA43f6cee;
event CreateETHFLEX(address indexed minter, uint256 indexed id);
modifier checkSaleIsActive() {
require(saleIsActive == true, "Sale is not active");
_;
}
modifier onlyRandomGenerator() {
require(
msg.sender == address(randomGenerator_),
"Only random generator"
);
_;
}
constructor() ERC721("ETHERFLEX", "ETHFLEX") {
saleIsActive = false;
totalSaleElement = 5555;
mintPrice = 1 * 10**17; // 0.1 ETH
maxByMint = 10;
}
/**
* Set Mint Price
*/
function setRandomGenerator(uint256 randomGenerator) external onlyOwner {
randomGenerator_ = IRandomNumberGenerator(randomGenerator);
}
/**
* Get Random Number
*/
function getRandomIdFromChainlink() external onlyOwner {
require(
selectedIdNumber < 13,
"Random number generation is already completed"
);
requestId_ = randomGenerator_.getRandomNumber();
}
function checkRandomNumber(uint256 _randomNumber)
internal
view
returns (bool)
{
for (uint256 i; i < selectedIdNumber; i++) {
if (_randomNumber == RandomIds[i]) {
return false;
}
}
return true;
}
function numbersDrawn(bytes32 _requestId, uint256 _randomNumber)
external
onlyRandomGenerator
{
require(_requestId == requestId_, "Not correct request");
uint256 random = _randomNumber % totalSaleElement;
require(
checkRandomNumber(random),
"This random number is exist already."
);
RandomIds[selectedIdNumber] = random;
selectedIdNumber = selectedIdNumber.add(1);
}
/**
* Set Mint Price
*/
function setMintPrice(uint256 newMintPrice) external onlyOwner {
mintPrice = newMintPrice;
}
/**
* Set Max By Mint
*/
function setMaxByMint(uint256 newMaxByMint) external onlyOwner {
maxByMint = newMaxByMint;
}
/**
* Set Sale Status
*/
function setSaleStatus(bool saleStatus) external onlyOwner {
saleIsActive = saleStatus;
}
/**
* Set Base URI
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
/**
* Set Base PROVENANCE
*/
function setProvenance(string memory _provenance) external onlyOwner {
PROVENANCE = _provenance;
}
/**
* Get Total Supply
*/
function _totalSupply() internal view returns (uint256) {
return _tokenIdTracker.current();
}
/**
* Get Total Mint
*/
function totalMint() public view returns (uint256) {
return _totalSupply();
}
/**
* Check if certain token id is exists.
*/
function exists(uint256 _tokenId) public view returns (bool) {
return _exists(_tokenId);
}
/**
* Get Tokens Of Owner
*/
function getTokensOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
uint256[] memory tokenIdList = new uint256[](tokenCount);
for (uint256 i = 0; i < tokenCount; i++) {
tokenIdList[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIdList;
}
/**
* Mint An Element
*/
function _mintAnElement(address _to) internal {
uint256 id = _totalSupply();
_tokenIdTracker.increment();
_safeMint(_to, id);
emit CreateETHFLEX(_to, id);
}
/**
* Mint ETHFLEX By User
*/
function mintByUser(address _to, uint256 _amount)
public
payable
checkSaleIsActive
{
uint256 totalSupply = _totalSupply();
require(totalSupply <= totalSaleElement, "Presale End");
require(
totalSupply + _amount <= totalSaleElement,
"Max Limit To Presale"
);
require(_amount <= maxByMint, "Exceeds Amount");
require(mintPrice.mul(_amount) <= msg.value, "Low Price To Mint");
for (uint256 i = 0; i < _amount; i += 1) {
_mintAnElement(_to);
}
}
/**
* Mint ETHFLEX By Owner
*/
function mintByOwner(address _to, uint256 _amount) external onlyOwner {
uint256 totalSupply = _totalSupply();
require(totalSupply <= totalSaleElement, "Presale End");
require(
totalSupply + _amount <= totalSaleElement,
"Max Limit To Presale"
);
for (uint256 i = 0; i < _amount; i += 1) {
_mintAnElement(_to);
}
}
/**
* Withdraw
*/
function withdrawAll() public onlyOwner {
uint256 totalBalance = address(this).balance;
uint256 devAmount = totalBalance.mul(470).div(10000);
uint256 clientAmount = totalBalance.sub(devAmount);
(bool withdrawDev, ) = devAddress.call{value: devAmount}("");
require(withdrawDev, "Withdraw Failed To Dev");
(bool withdrawClient, ) = clientAddress.call{value: clientAmount}("");
require(withdrawClient, "Withdraw Failed To Client.");
}
}
| 16,979 |
31 | // Set the new length of the splits. | _splitCountOf[_projectId][_domain][_group] = _splits.length;
| _splitCountOf[_projectId][_domain][_group] = _splits.length;
| 26,991 |
72 | // Destroys `amount` tokens from sender, reducing thetotal supply. | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function burn(uint256 amount) external virtual{
_burn(msg.sender,amount);
}
| * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function burn(uint256 amount) external virtual{
_burn(msg.sender,amount);
}
| 77,772 |
11 | // Blacklisted addresses. | address[] blacklist;
| address[] blacklist;
| 13,468 |
37 | // uint256 collatteralValueInBYN; |
getBeyondTokenValue();
(, /*collatteralValueInBYN*/, , , collatteralRatioUpdated) = checkUserCollatteral(_beneficiary);
uint256 amountInBYN = (_value.mul(1 ether)).div(getBeyondTokenValue());
uint256 collatteralValueInBYN = (amountInBYN.mul((collatteralRatio.mul(1 ether)).div(100))).div(1 ether);
require (collatteralRatioUpdated >= collatteral[_beneficiary].currentCollatteralRatio,"settle your collatterla ratio first");
|
getBeyondTokenValue();
(, /*collatteralValueInBYN*/, , , collatteralRatioUpdated) = checkUserCollatteral(_beneficiary);
uint256 amountInBYN = (_value.mul(1 ether)).div(getBeyondTokenValue());
uint256 collatteralValueInBYN = (amountInBYN.mul((collatteralRatio.mul(1 ether)).div(100))).div(1 ether);
require (collatteralRatioUpdated >= collatteral[_beneficiary].currentCollatteralRatio,"settle your collatterla ratio first");
| 794 |
28 | // Allows anyone to enter the lottery (payable - accepts ETH) | function enter() public payable {
// if it's open
require(lottery_state == LOTTERY_STATE.OPEN);
// and they pay the entry fee
require(msg.value >= getEntranceFee(), "Not enough ETH!");
// Store the entry
players.push(payable(msg.sender));
}
| function enter() public payable {
// if it's open
require(lottery_state == LOTTERY_STATE.OPEN);
// and they pay the entry fee
require(msg.value >= getEntranceFee(), "Not enough ETH!");
// Store the entry
players.push(payable(msg.sender));
}
| 46,731 |
27 | // Versioned/Iulian Rotaru/Initialized for multiple versions | contract Versioned {
//
// _ _
// ___| |_ __ _| |_ ___
// / __| __/ _` | __/ _ \
// \__ \ || (_| | || __/
// |___/\__\__,_|\__\___|
//
// Stores the current implementation version
uint256 version;
// Stores the initializing state for each version
bool private _initializing;
//
// _ _ __ _
// _ __ ___ ___ __| (_)/ _(_) ___ _ __ ___
// | '_ ` _ \ / _ \ / _` | | |_| |/ _ \ '__/ __|
// | | | | | | (_) | (_| | | _| | __/ | \__ \
// |_| |_| |_|\___/ \__,_|_|_| |_|\___|_| |___/
//
// Allows to be called only if version number is current version + 1
modifier initVersion(uint256 _version) {
require(!_initializing, 'V1');
require(_version == version + 1, 'V2');
version = _version;
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
//
// _ _
// _____ _| |_ ___ _ __ _ __ __ _| |___
// / _ \ \/ / __/ _ \ '__| '_ \ / _` | / __|
// | __/> <| || __/ | | | | | (_| | \__ \
// \___/_/\_\\__\___|_| |_| |_|\__,_|_|___/
//
/// @dev Retrieves current implementation version
/// @return Implementatiomn version
function getVersion() public view returns (uint256) {
return version;
}
}
| contract Versioned {
//
// _ _
// ___| |_ __ _| |_ ___
// / __| __/ _` | __/ _ \
// \__ \ || (_| | || __/
// |___/\__\__,_|\__\___|
//
// Stores the current implementation version
uint256 version;
// Stores the initializing state for each version
bool private _initializing;
//
// _ _ __ _
// _ __ ___ ___ __| (_)/ _(_) ___ _ __ ___
// | '_ ` _ \ / _ \ / _` | | |_| |/ _ \ '__/ __|
// | | | | | | (_) | (_| | | _| | __/ | \__ \
// |_| |_| |_|\___/ \__,_|_|_| |_|\___|_| |___/
//
// Allows to be called only if version number is current version + 1
modifier initVersion(uint256 _version) {
require(!_initializing, 'V1');
require(_version == version + 1, 'V2');
version = _version;
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
//
// _ _
// _____ _| |_ ___ _ __ _ __ __ _| |___
// / _ \ \/ / __/ _ \ '__| '_ \ / _` | / __|
// | __/> <| || __/ | | | | | (_| | \__ \
// \___/_/\_\\__\___|_| |_| |_|\__,_|_|___/
//
/// @dev Retrieves current implementation version
/// @return Implementatiomn version
function getVersion() public view returns (uint256) {
return version;
}
}
| 50,744 |
57 | // If phase exists return corresponding bonus for the given date else return 0 (percent) | function getBonusPercent(uint256 datetime) private view returns (uint256) {
for (uint i = 0; i < totalPhases; i++) {
if (datetime >= phases[i].startTime && datetime <= phases[i].endTime) {
return phases[i].bonusPercent;
}
}
return 0;
}
| function getBonusPercent(uint256 datetime) private view returns (uint256) {
for (uint i = 0; i < totalPhases; i++) {
if (datetime >= phases[i].startTime && datetime <= phases[i].endTime) {
return phases[i].bonusPercent;
}
}
return 0;
}
| 43,078 |
6 | // Default function; Gets called when Ether is deposited, and forwards it to the parent address / | receive() external payable {
// throws on failure
modirAddress.transfer(msg.value);
// Fire off the deposited event if we can forward it
////emit ForwarderDeposited(msg.sender, msg.value, msg.data);
}
| receive() external payable {
// throws on failure
modirAddress.transfer(msg.value);
// Fire off the deposited event if we can forward it
////emit ForwarderDeposited(msg.sender, msg.value, msg.data);
}
| 4,725 |
137 | // Collection metadata URI | string private _baseURIExtended;
| string private _baseURIExtended;
| 41,827 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.