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 | // Used to set address for new implementation contract/_newImplementation Address of new implementation contract | function setImplementation(address _newImplementation) external {
if (msg.sender != IController(operator).owner()) {
revert Unauthorized();
}
implementation = _newImplementation;
emit ImpelemntationChanged(_newImplementation);
}
| function setImplementation(address _newImplementation) external {
if (msg.sender != IController(operator).owner()) {
revert Unauthorized();
}
implementation = _newImplementation;
emit ImpelemntationChanged(_newImplementation);
}
| 9,620 |
102 | // Check is user in group//_groupName user array/_user user array// return status | function isUserInGroup(bytes32 _groupName, address _user) public view returns (bool) {
return isRegisteredUser(_user) && address2member[_user].groupName2index[_groupName] != 0;
}
| function isUserInGroup(bytes32 _groupName, address _user) public view returns (bool) {
return isRegisteredUser(_user) && address2member[_user].groupName2index[_groupName] != 0;
}
| 4,615 |
15 | // ================================= amount of shares for each address (scaled number) | mapping(address => uint256) private tokenBalanceLedger_;
mapping(address => int256) private payoutsTo_;
mapping(address => Stats) private stats;
| mapping(address => uint256) private tokenBalanceLedger_;
mapping(address => int256) private payoutsTo_;
mapping(address => Stats) private stats;
| 7,637 |
35 | // Handles updating the config for this bidder | function setConfig(Config calldata cfg) external onlyOwner {
if (cfg.receiver == address(0)) {
revert InvalidReceiver();
}
config = cfg;
emit ConfigUpdate(cfg);
}
| function setConfig(Config calldata cfg) external onlyOwner {
if (cfg.receiver == address(0)) {
revert InvalidReceiver();
}
config = cfg;
emit ConfigUpdate(cfg);
}
| 2,869 |
360 | // already joined | if (marketToJoin.accountMembership[borrower] == true) {
return Error.NO_ERROR;
}
| if (marketToJoin.accountMembership[borrower] == true) {
return Error.NO_ERROR;
}
| 26,056 |
20 | // | * @dev Mints tokens from `_start` to `_end` and emits one {ConsecutiveTransfer}
* event as defined in EIP2309 (https://eips.ethereum.org/EIPS/eip-2309).
*
* Emits {ConsecutiveTransfer} event.
*/
function _initEIP2309(uint256 _start, uint256 _end) internal virtual {
emit ConsecutiveTransfer(_start, _end, address(0), address(this));
}
| * @dev Mints tokens from `_start` to `_end` and emits one {ConsecutiveTransfer}
* event as defined in EIP2309 (https://eips.ethereum.org/EIPS/eip-2309).
*
* Emits {ConsecutiveTransfer} event.
*/
function _initEIP2309(uint256 _start, uint256 _end) internal virtual {
emit ConsecutiveTransfer(_start, _end, address(0), address(this));
}
| 8,690 |
41 | // Utility function to check if a value is inside an array / | function _isInArray(uint256 _value, uint256[] memory _array) internal pure returns(bool) {
uint256 length = _array.length;
for (uint256 i = 0; i < length; ++i) {
if (_array[i] == _value) {
return true;
}
}
return false;
}
| function _isInArray(uint256 _value, uint256[] memory _array) internal pure returns(bool) {
uint256 length = _array.length;
for (uint256 i = 0; i < length; ++i) {
if (_array[i] == _value) {
return true;
}
}
return false;
}
| 33,793 |
60 | // Private Sale | if (now >= startPrivateSaleStage && now < endPrivateSaleStage && totalPrivateSaleStage < maxPrivateSaleStage){
tokens = weiAmount.mul(ratePrivateSaleStage);
if (maxPrivateSaleStage.sub(totalPrivateSaleStage) < tokens){
tokens = maxPrivateSaleStage.sub(totalPrivateSaleStage);
weiAmount = tokens.div(ratePrivateSaleStage);
backAmount = msg.value.sub(weiAmount);
}
| if (now >= startPrivateSaleStage && now < endPrivateSaleStage && totalPrivateSaleStage < maxPrivateSaleStage){
tokens = weiAmount.mul(ratePrivateSaleStage);
if (maxPrivateSaleStage.sub(totalPrivateSaleStage) < tokens){
tokens = maxPrivateSaleStage.sub(totalPrivateSaleStage);
weiAmount = tokens.div(ratePrivateSaleStage);
backAmount = msg.value.sub(weiAmount);
}
| 8,181 |
6 | // Register a name. subdomainLabel The subdomain label to register. Emits a {SubDomainRegistered} event. / | function register(string calldata subdomainLabel) external payable;
| function register(string calldata subdomainLabel) external payable;
| 35,138 |
44 | // Checks if the account should be allowed to redeem tokens in the given market pToken The market to verify the redeem against redeemer The account which would redeem the tokens redeemTokens The number of pTokens to exchange for the underlying asset in the marketreturn 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) / | function redeemAllowed(address pToken, address redeemer, uint redeemTokens) external override returns (uint) {
uint allowed = redeemAllowedInternal(pToken, redeemer, redeemTokens);
if (allowed != uint(Error.NO_ERROR)) {
return allowed;
}
// Keep the flywheel moving
updatePieSupplyIndex(pToken);
distributeSupplierPie(pToken, redeemer, false);
return uint(Error.NO_ERROR);
}
| function redeemAllowed(address pToken, address redeemer, uint redeemTokens) external override returns (uint) {
uint allowed = redeemAllowedInternal(pToken, redeemer, redeemTokens);
if (allowed != uint(Error.NO_ERROR)) {
return allowed;
}
// Keep the flywheel moving
updatePieSupplyIndex(pToken);
distributeSupplierPie(pToken, redeemer, false);
return uint(Error.NO_ERROR);
}
| 7,239 |
158 | // View function to see pending wasabis on frontend. | function pendingwasabi(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accwasabiPerShare = pool.accwasabiPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 wasabiReward = multiplier.mul(wasabiPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accwasabiPerShare = accwasabiPerShare.add(wasabiReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accwasabiPerShare).div(1e12).sub(user.rewardDebt);
}
| function pendingwasabi(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accwasabiPerShare = pool.accwasabiPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 wasabiReward = multiplier.mul(wasabiPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accwasabiPerShare = accwasabiPerShare.add(wasabiReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accwasabiPerShare).div(1e12).sub(user.rewardDebt);
}
| 21,079 |
17 | // Emergency function in case of oracle manipulation | function resetNextEpochValueRequests() external onlyGTokenAdmin{
uint reqToResetCount = nextEpochValuesRequestCount;
require(reqToResetCount > 0, "NO_REQUEST_TO_RESET");
delete nextEpochValues;
nextEpochValuesRequestCount = 0;
nextEpochValuesLastRequest = 0;
for(uint i; i < reqToResetCount; i++){
requests[lastRequestId - i].active = false;
}
emit NextEpochValuesReset(
gToken.currentEpoch(),
reqToResetCount
);
}
| function resetNextEpochValueRequests() external onlyGTokenAdmin{
uint reqToResetCount = nextEpochValuesRequestCount;
require(reqToResetCount > 0, "NO_REQUEST_TO_RESET");
delete nextEpochValues;
nextEpochValuesRequestCount = 0;
nextEpochValuesLastRequest = 0;
for(uint i; i < reqToResetCount; i++){
requests[lastRequestId - i].active = false;
}
emit NextEpochValuesReset(
gToken.currentEpoch(),
reqToResetCount
);
}
| 23,214 |
5 | // Set operator | operator = _operator;
| operator = _operator;
| 32,945 |
31 | // burn the amount | totalSupply -= amount;
| totalSupply -= amount;
| 45,636 |
11 | // Interface for Dai Stablecoin (DAI) `permit()` primitive. | interface IDaiPermit {
function permit(
address holder,
address spender,
uint256 nonce,
uint256 expiry,
bool allowed,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
| interface IDaiPermit {
function permit(
address holder,
address spender,
uint256 nonce,
uint256 expiry,
bool allowed,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
| 27,906 |
60 | // The User can't submit after tournament closure and the tournament must have begun | require((tournament.open==true));
require(tournament.etherPrize>0);
Stake storage user_stake = tournament.stakes[_staker][_tournamentID];
require(user_stake.amount==0); // Users can only stake once
require(_value>0); // Users must stake at least 1 ROTO
require(_staker != roto && _staker != owner); //RotoHive can't stake in tournament
| require((tournament.open==true));
require(tournament.etherPrize>0);
Stake storage user_stake = tournament.stakes[_staker][_tournamentID];
require(user_stake.amount==0); // Users can only stake once
require(_value>0); // Users must stake at least 1 ROTO
require(_staker != roto && _staker != owner); //RotoHive can't stake in tournament
| 43,330 |
175 | // Computes the amount of token0 for a given amount of liquidity and a price range/sqrtRatioAX96 A sqrt price representing the first tick boundary/sqrtRatioBX96 A sqrt price representing the second tick boundary/liquidity The liquidity being valued/ return amount0 The amount of token0 | function getAmount0ForLiquidity(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity
| function getAmount0ForLiquidity(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity
| 7,787 |
320 | // Internal function to ensure that an offer was originally supplied bythe caller. index uint256 The desired index of the offer in the relevant array. / | function _requireOnlyOfferOriginator(uint256 index) internal view {
// ensure that the offer was originally supplied by the caller.
require(
_offers[index].offerer == msg.sender,
"Only the originator of the offer may perform this operation."
);
}
| function _requireOnlyOfferOriginator(uint256 index) internal view {
// ensure that the offer was originally supplied by the caller.
require(
_offers[index].offerer == msg.sender,
"Only the originator of the offer may perform this operation."
);
}
| 11,700 |
32 | // Unsafe version of _executeVote that assumes you have already checked if the vote can be executed and exists/ | function _unsafeExecuteVote(uint256 _voteId) internal {
Vote storage vote_ = votes[_voteId];
vote_.executed = true;
bytes memory input = new bytes(0); // TODO: Consider input for voting scripts
runScript(vote_.executionScript, input, new address[](0));
emit ExecuteVote(_voteId);
}
| function _unsafeExecuteVote(uint256 _voteId) internal {
Vote storage vote_ = votes[_voteId];
vote_.executed = true;
bytes memory input = new bytes(0); // TODO: Consider input for voting scripts
runScript(vote_.executionScript, input, new address[](0));
emit ExecuteVote(_voteId);
}
| 32,801 |
23 | // Handle gas reimbursement | if (_isGasFee) {
GasReceipt memory gasReceipt = abi.decode(signedData, (GasReceipt));
_transferGasFee(_owner, gasReceipt);
}
| if (_isGasFee) {
GasReceipt memory gasReceipt = abi.decode(signedData, (GasReceipt));
_transferGasFee(_owner, gasReceipt);
}
| 20,191 |
1 | // The values being non-zero value makes deployment a bit more expensive, but in exchange the refund on every call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full refund coming into effect. | uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() internal {
_status = _NOT_ENTERED;
}
| uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() internal {
_status = _NOT_ENTERED;
}
| 3,777 |
6 | // Sets the recipient of revenues. | function setBeneficiary(address payable _beneficiary) public onlyOwner {
beneficiary = _beneficiary;
}
| function setBeneficiary(address payable _beneficiary) public onlyOwner {
beneficiary = _beneficiary;
}
| 8,306 |
291 | // What is their percentage (as a high precision int) of the total debt? | uint256 debtPercentage = amount.divideDecimalRoundPrecise(
newTotalDebtIssued
);
| uint256 debtPercentage = amount.divideDecimalRoundPrecise(
newTotalDebtIssued
);
| 9,706 |
17 | // 竞价cfx转给平台,平台把cfx进行质押 | totalBalance = totalBalance.add(_price);
_depositStaking(_price);
shop.have_buyer += 1;
shop.price = _price;
| totalBalance = totalBalance.add(_price);
_depositStaking(_price);
shop.have_buyer += 1;
shop.price = _price;
| 5,229 |
111 | // sumCollateral += tokensToDenommTokenBalance | vars.sumCollateral = mul_ScalarTruncateAddUInt(
vars.tokensToDenom,
vars.mTokenBalance,
vars.sumCollateral
);
| vars.sumCollateral = mul_ScalarTruncateAddUInt(
vars.tokensToDenom,
vars.mTokenBalance,
vars.sumCollateral
);
| 31,377 |
24 | // set Default Royalty._feeNumerator 500 = 5% Royalty | function setDefaultRoyalty(address _receiver, uint96 _feeNumerator)
external
virtual
onlyMgr
| function setDefaultRoyalty(address _receiver, uint96 _feeNumerator)
external
virtual
onlyMgr
| 15,972 |
23 | // 代理 | mapping(address => mapping(address => uint)) approved;
| mapping(address => mapping(address => uint)) approved;
| 10,126 |
184 | // calculate the exponential decay coefficient for a given interval oldTimestamp timestamp of previous update newTimestamp current timestampreturn 64x64 fixed point representation of exponential decay coefficient / | function _decay(uint256 oldTimestamp, uint256 newTimestamp)
internal
pure
returns (int128)
| function _decay(uint256 oldTimestamp, uint256 newTimestamp)
internal
pure
returns (int128)
| 14,079 |
268 | // Calc new tick(upper or lower) for imbalanced token | if (zeroGreaterOne) {
uint160 nextSqrtPrice0 = SqrtPriceMath.getNextSqrtPriceFromAmount0RoundingUp(
sqrtPriceX96,
cache.liquidity,
cache.amount0Desired,
false
);
cache.tickUpper = PoolVariables.floor(TickMath.getTickAtSqrtRatio(nextSqrtPrice0), tickSpacing);
} else {
| if (zeroGreaterOne) {
uint160 nextSqrtPrice0 = SqrtPriceMath.getNextSqrtPriceFromAmount0RoundingUp(
sqrtPriceX96,
cache.liquidity,
cache.amount0Desired,
false
);
cache.tickUpper = PoolVariables.floor(TickMath.getTickAtSqrtRatio(nextSqrtPrice0), tickSpacing);
} else {
| 14,899 |
17 | // FRAX | allocations[2] = canFRAX.balanceOf(address(this)); // Free FRAX
| allocations[2] = canFRAX.balanceOf(address(this)); // Free FRAX
| 41,952 |
356 | // Toggle minting open to all state/isOpen if the new state is open or not | function setMintingOpenToAll(bool isOpen) external;
| function setMintingOpenToAll(bool isOpen) external;
| 44,399 |
30 | // Creates `_amount` token to `_to`. Must only be called by the owner (PaiMaster). | function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| 46,612 |
6 | // PaymentToken A relatively straight forward ERC20 token with the following additions:- Ownable, transferrable, renouncable- Mintable by owner, capped- Approvals can initially be disabled and later enabled by the owner / | contract PaymentToken is ERC20, ERC20Capped, Ownable {
bool private _approveAllowed;
event ApprovalsAllowed();
constructor(string memory name_, string memory symbol_, uint256 cap_, bool approveAllowed_) ERC20(name_, symbol_) ERC20Capped(cap_) {
_approveAllowed = approveAllowed_;
}
/**
* @dev Throws if approvals aren't allowed
*/
modifier onlyIfApproveAllowed() {
require(_approveAllowed, "Approve currently isn't allowed");
_;
}
/**
* @dev Public mint function
* see ERC20.sol:_mint() for details.
*/
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
/**
* @dev Enable approvals
* Throw if they already are allowed
*/
function allowApprovals() public onlyOwner {
require(!_approveAllowed, "Approve is already allowed");
_approveAllowed = true;
emit ApprovalsAllowed();
}
/**
* @dev override for methods in bases
*/
function _mint(address account, uint256 amount) internal virtual override(ERC20, ERC20Capped) {
super._mint(account, amount);
}
/**
* @dev override for methods in bases
*/
function _approve(address owner, address spender, uint256 amount) internal virtual override onlyIfApproveAllowed {
super._approve(owner, spender, amount);
}
}
| contract PaymentToken is ERC20, ERC20Capped, Ownable {
bool private _approveAllowed;
event ApprovalsAllowed();
constructor(string memory name_, string memory symbol_, uint256 cap_, bool approveAllowed_) ERC20(name_, symbol_) ERC20Capped(cap_) {
_approveAllowed = approveAllowed_;
}
/**
* @dev Throws if approvals aren't allowed
*/
modifier onlyIfApproveAllowed() {
require(_approveAllowed, "Approve currently isn't allowed");
_;
}
/**
* @dev Public mint function
* see ERC20.sol:_mint() for details.
*/
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
/**
* @dev Enable approvals
* Throw if they already are allowed
*/
function allowApprovals() public onlyOwner {
require(!_approveAllowed, "Approve is already allowed");
_approveAllowed = true;
emit ApprovalsAllowed();
}
/**
* @dev override for methods in bases
*/
function _mint(address account, uint256 amount) internal virtual override(ERC20, ERC20Capped) {
super._mint(account, amount);
}
/**
* @dev override for methods in bases
*/
function _approve(address owner, address spender, uint256 amount) internal virtual override onlyIfApproveAllowed {
super._approve(owner, spender, amount);
}
}
| 24,837 |
72 | // Lock the rNEX in the contract | rNEX.transferFrom(msg.sender, address(this), _amount);
| rNEX.transferFrom(msg.sender, address(this), _amount);
| 29,864 |
10 | // Method to claim junk and accidentally sent tokens | function rescueTokens(
IERC20 _token,
address payable _to,
uint256 _amount
| function rescueTokens(
IERC20 _token,
address payable _to,
uint256 _amount
| 10,109 |
67 | // Get Position.Info for specified ticks | (uint128 liquidity, , , uint128 tokensOwed0, uint128 tokensOwed1) =
pool.positions(positionKey);
| (uint128 liquidity, , , uint128 tokensOwed0, uint128 tokensOwed1) =
pool.positions(positionKey);
| 21,573 |
78 | // Gets the token ID at a given index of all the tokens in this contract Reverts if the index is greater or equal to the total number of tokens _index uint256 representing the index to be accessed of the tokens listreturn uint256 token ID at the given index of the tokens list / | function tokenByIndex(uint256 _index) public view returns (uint256) {
require(_index < totalSupply());
return allTokens[_index];
}
| function tokenByIndex(uint256 _index) public view returns (uint256) {
require(_index < totalSupply());
return allTokens[_index];
}
| 14,346 |
4 | // Check if the deadline has passed and the target has been reached | if (block.timestamp >= campaign.deadline && campaign.amountCollected >= campaign.target) {
| if (block.timestamp >= campaign.deadline && campaign.amountCollected >= campaign.target) {
| 10,383 |
76 | // Can"t be called by the user or other contract: for private use only/Running lottery to select random worker nodes from the provided list. Used by both `createCognitiveJob`/ and `_checksJobQueue` functions. | function _selectWorkersWithLottery(
IWorkerNode[] _idleWorkers, /// Pre-defined pool of Idle WorkerNodes to select from
uint _numberWorkersRequired /// Number of workers required by cognitive job, match with number of batches
)
private
returns (
IWorkerNode[] assignedWorkers /// Resulting sublist of the selected WorkerNodes
| function _selectWorkersWithLottery(
IWorkerNode[] _idleWorkers, /// Pre-defined pool of Idle WorkerNodes to select from
uint _numberWorkersRequired /// Number of workers required by cognitive job, match with number of batches
)
private
returns (
IWorkerNode[] assignedWorkers /// Resulting sublist of the selected WorkerNodes
| 23,112 |
182 | // The SPACEBAR TOKEN! | pSpaceBar public space;
| pSpaceBar public space;
| 20,766 |
30 | // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs so rarely, perform the swap anyway to avoid the gas cost of adding an 'if' statement |
MapEntry storage lastEntry = map._entries[lastIndex];
MapEntry storage toRemove = map._entries[toDeleteIndex];
|
MapEntry storage lastEntry = map._entries[lastIndex];
MapEntry storage toRemove = map._entries[toDeleteIndex];
| 21,170 |
617 | // Mint new tokens / | function _mintNew(address extension, address[] memory to, uint256[] memory amounts, string[] memory uris) internal returns(uint256[] memory tokenIds) {
if (to.length > 1) {
// Multiple receiver. Give every receiver the same new token
tokenIds = new uint256[](1);
require(uris.length <= 1 && (amounts.length == 1 || to.length == amounts.length), "Invalid input");
} else {
// Single receiver. Generating multiple tokens
tokenIds = new uint256[](amounts.length);
require(uris.length == 0 || amounts.length == uris.length, "Invalid input");
}
// Assign tokenIds
for (uint i = 0; i < tokenIds.length; i++) {
_tokenCount++;
tokenIds[i] = _tokenCount;
// Track the extension that minted the token
_tokensExtension[_tokenCount] = extension;
}
if (extension != address(this)) {
_checkMintPermissions(to, tokenIds, amounts);
}
if (to.length == 1 && tokenIds.length == 1) {
// Single mint
_mint(to[0], tokenIds[0], amounts[0], new bytes(0));
} else if (to.length > 1) {
// Multiple receivers. Receiving the same token
if (amounts.length == 1) {
// Everyone receiving the same amount
for (uint i = 0; i < to.length; i++) {
_mint(to[i], tokenIds[0], amounts[0], new bytes(0));
}
} else {
// Everyone receiving different amounts
for (uint i = 0; i < to.length; i++) {
_mint(to[i], tokenIds[0], amounts[i], new bytes(0));
}
}
} else {
_mintBatch(to[0], tokenIds, amounts, new bytes(0));
}
for (uint i = 0; i < tokenIds.length; i++) {
if (i < uris.length && bytes(uris[i]).length > 0) {
_tokenURIs[tokenIds[i]] = uris[i];
}
}
return tokenIds;
}
| function _mintNew(address extension, address[] memory to, uint256[] memory amounts, string[] memory uris) internal returns(uint256[] memory tokenIds) {
if (to.length > 1) {
// Multiple receiver. Give every receiver the same new token
tokenIds = new uint256[](1);
require(uris.length <= 1 && (amounts.length == 1 || to.length == amounts.length), "Invalid input");
} else {
// Single receiver. Generating multiple tokens
tokenIds = new uint256[](amounts.length);
require(uris.length == 0 || amounts.length == uris.length, "Invalid input");
}
// Assign tokenIds
for (uint i = 0; i < tokenIds.length; i++) {
_tokenCount++;
tokenIds[i] = _tokenCount;
// Track the extension that minted the token
_tokensExtension[_tokenCount] = extension;
}
if (extension != address(this)) {
_checkMintPermissions(to, tokenIds, amounts);
}
if (to.length == 1 && tokenIds.length == 1) {
// Single mint
_mint(to[0], tokenIds[0], amounts[0], new bytes(0));
} else if (to.length > 1) {
// Multiple receivers. Receiving the same token
if (amounts.length == 1) {
// Everyone receiving the same amount
for (uint i = 0; i < to.length; i++) {
_mint(to[i], tokenIds[0], amounts[0], new bytes(0));
}
} else {
// Everyone receiving different amounts
for (uint i = 0; i < to.length; i++) {
_mint(to[i], tokenIds[0], amounts[i], new bytes(0));
}
}
} else {
_mintBatch(to[0], tokenIds, amounts, new bytes(0));
}
for (uint i = 0; i < tokenIds.length; i++) {
if (i < uris.length && bytes(uris[i]).length > 0) {
_tokenURIs[tokenIds[i]] = uris[i];
}
}
return tokenIds;
}
| 44,257 |
0 | // carpooling description | uint64 carpoolingId;
address payable public owner;
address payable public conflictOwner;
string public origin;
string public destination;
uint8 public nSlot;
uint8 public nAvailableSlot;
uint256 public price;
uint256 public startTime;
| uint64 carpoolingId;
address payable public owner;
address payable public conflictOwner;
string public origin;
string public destination;
uint8 public nSlot;
uint8 public nAvailableSlot;
uint256 public price;
uint256 public startTime;
| 4,425 |
96 | // A globally callable function to update the accounting state of the system. Global state and state for the caller are updated.return [0] balance of the locked poolreturn [1] balance of the unlocked poolreturn [2] caller's staking share secondsreturn [3] global staking share secondsreturn [4] Rewards caller has accumulated, optimistically assumes max time-bonus.return [5] block timestamp / | function updateAccounting()
public
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
| function updateAccounting()
public
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
| 3,877 |
10 | // Reverts if called by any account other than the manager. / | modifier onlyManager() {
_require(getManager() == msg.sender, Errors.CALLER_IS_NOT_OWNER);
_;
}
| modifier onlyManager() {
_require(getManager() == msg.sender, Errors.CALLER_IS_NOT_OWNER);
_;
}
| 15,771 |
189 | // Use the local pay call. | _pay(1, feeAmount, _beneficiary, _memo, false);
| _pay(1, feeAmount, _beneficiary, _memo, false);
| 16,978 |
20 | // ------------------------------------------------------------------------ Transfer Token ------------------------------------------------------------------------ | function transfer(address _to, uint _value) unfreezed(_to) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success) {
require(_to != 0x0);
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint _value) unfreezed(_to) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success) {
require(_to != 0x0);
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 32,538 |
34 | // Return the number of USDC and MAI tokens on stake at QiDao's Farm return usdcAmountNumber of USDC tokens on stakereturn maiAmountNumber of MAI tokens on stake / | function stakedTokens() external view returns (UsdcQuantity usdcAmount, MaiQuantity maiAmount);
| function stakedTokens() external view returns (UsdcQuantity usdcAmount, MaiQuantity maiAmount);
| 31,132 |
7 | // : Mints new BankTokens_cosmosSender: The sender's Cosmos address in bytes. _ethereumRecipient: The intended recipient's Ethereum address. _cosmosTokenAddress: The currency type _symbol: comsos token symbol _amount: number of comsos tokens to be minted / | function mintBridgeTokens(
bytes memory _cosmosSender,
address payable _intendedRecipient,
address _bridgeTokenAddress,
string memory _symbol,
uint256 _amount
)
public
onlyCosmosBridge
| function mintBridgeTokens(
bytes memory _cosmosSender,
address payable _intendedRecipient,
address _bridgeTokenAddress,
string memory _symbol,
uint256 _amount
)
public
onlyCosmosBridge
| 41,338 |
18 | // Claims the one-time reward for being referred after farming enough tokens | function claimTokensFromBeingReferred() public {
require(msg.sender == tx.origin, "no contracts");
require(referredBy[msg.sender] != address(0), "not referred by anyone");
require(claimedReferredTokens[msg.sender] == false, "already claimed");
uint256 totalClaimedAmount = bar.getTotalNumTokensClaimed(msg.sender);
require(totalClaimedAmount >= MIN_CLAIM_FOR_REFERRAL, "insufficient tokens claimed");
address referrer = referredBy[msg.sender];
claimedReferredTokens[msg.sender] = true;
pendingReferralRewards[referrer] += 1;
_safeBoogieTransfer(msg.sender, REFERRAL_REWARD);
}
| function claimTokensFromBeingReferred() public {
require(msg.sender == tx.origin, "no contracts");
require(referredBy[msg.sender] != address(0), "not referred by anyone");
require(claimedReferredTokens[msg.sender] == false, "already claimed");
uint256 totalClaimedAmount = bar.getTotalNumTokensClaimed(msg.sender);
require(totalClaimedAmount >= MIN_CLAIM_FOR_REFERRAL, "insufficient tokens claimed");
address referrer = referredBy[msg.sender];
claimedReferredTokens[msg.sender] = true;
pendingReferralRewards[referrer] += 1;
_safeBoogieTransfer(msg.sender, REFERRAL_REWARD);
}
| 13,253 |
3 | // Convert bytes to uint256 _bSource bytes should have length of 32returnuint256/ | function bytesToUint256(bytes memory _bs) internal pure returns (uint256 value) {
require(_bs.length == 32, "bytes length is not 32.");
assembly {
// load 32 bytes from memory starting from position _bs + 32
value := mload(add(_bs, 0x20))
}
require(value <= 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, "Value exceeds the range");
}
| function bytesToUint256(bytes memory _bs) internal pure returns (uint256 value) {
require(_bs.length == 32, "bytes length is not 32.");
assembly {
// load 32 bytes from memory starting from position _bs + 32
value := mload(add(_bs, 0x20))
}
require(value <= 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, "Value exceeds the range");
}
| 4,488 |
0 | // __________________________________________________ Estructuras y Variables En primer lugar creamos una estructura para definir la información que vamos a cargar en cada medida | struct medida {
uint ID; //En cada medida vamos a relacionar el ID, que lleva el orden en el cual fueron subidas las medidas
string hash_medidor; //Vamos a subir el hash del medidor para identificar cambios en la integridad del medidor
uint energia; //Vamos a subir el ultimo valor de energía medido
string tiempo; //La medida de energía va acompañada de una estampa de tiempo
address pk_medidor; //Por ultimo vamos a relacionar la medida con la clave publica del medidor que la envio a la Blockchain
}
| struct medida {
uint ID; //En cada medida vamos a relacionar el ID, que lleva el orden en el cual fueron subidas las medidas
string hash_medidor; //Vamos a subir el hash del medidor para identificar cambios en la integridad del medidor
uint energia; //Vamos a subir el ultimo valor de energía medido
string tiempo; //La medida de energía va acompañada de una estampa de tiempo
address pk_medidor; //Por ultimo vamos a relacionar la medida con la clave publica del medidor que la envio a la Blockchain
}
| 28,119 |
23 | // Holder to grant information mapping. | mapping (address => Grant) public grants;
| mapping (address => Grant) public grants;
| 41,087 |
26 | // Begins the group creation frequency update process./Can be called only by the contract owner./_newGroupCreationFrequency New group creation frequency | function beginGroupCreationFrequencyUpdate(
uint256 _newGroupCreationFrequency
| function beginGroupCreationFrequencyUpdate(
uint256 _newGroupCreationFrequency
| 35,572 |
15 | // sending contract should be allowed by token owner to make this transfer | require(tokens <= allowed[sender][msg.sender]);
| require(tokens <= allowed[sender][msg.sender]);
| 20,425 |
181 | // description | '","description":"',
metadata.description,
| '","description":"',
metadata.description,
| 19,558 |
144 | // burn NFT token/ | function burn (
uint256 _tokenId
) public virtual
| function burn (
uint256 _tokenId
) public virtual
| 12,433 |
95 | // From Uniswap Router - Swap tokens for WETH | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory uniswapPairPath = new address[](2);
uniswapPairPath[0] = address(this);
uniswapPairPath[1] = IUniswapV2Router02(uniswapV2Router).WETH();
_approve(address(this), uniswapV2Router, tokenAmount);
IUniswapV2Router02(uniswapV2Router)
.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
uniswapPairPath,
address(this),
block.timestamp
);
}
| function swapTokensForEth(uint256 tokenAmount) private {
address[] memory uniswapPairPath = new address[](2);
uniswapPairPath[0] = address(this);
uniswapPairPath[1] = IUniswapV2Router02(uniswapV2Router).WETH();
_approve(address(this), uniswapV2Router, tokenAmount);
IUniswapV2Router02(uniswapV2Router)
.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
uniswapPairPath,
address(this),
block.timestamp
);
}
| 46,365 |
5 | // External Viewable / | function getNewOshiriPrice() external view returns (uint256) {
return newOshiriPrice;
}
| function getNewOshiriPrice() external view returns (uint256) {
return newOshiriPrice;
}
| 7,704 |
80 | // Constructor that gives msg.sender all of existing tokens./ | constructor () public ERC20("VRES Coin", "VRS") {
_mint(msg.sender, INITIAL_SUPPLY);
}
| constructor () public ERC20("VRES Coin", "VRS") {
_mint(msg.sender, INITIAL_SUPPLY);
}
| 38,146 |
7 | // Mint edition to a wallet _to wallet receiving the edition(s). _mintAmount number of editions to mint. / | function mint(address _to, uint256 _mintAmount) public payable {
require(paused != 1,"Sales are paused");
uint256 supply = totalSupply();
require(
supply + _mintAmount - whitelistedToken.length <= pauseLimit,
"Not enough mintable editions !"
);
require(
msg.value >= cost * _mintAmount,
"Insufficient transaction amount."
);
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(_to, supply + i);
tokenIdsToWallet[_to].push() = supply + i;
}
if( totalSupply() - whitelistedToken.length == pauseLimit)
pause(1);
}
| function mint(address _to, uint256 _mintAmount) public payable {
require(paused != 1,"Sales are paused");
uint256 supply = totalSupply();
require(
supply + _mintAmount - whitelistedToken.length <= pauseLimit,
"Not enough mintable editions !"
);
require(
msg.value >= cost * _mintAmount,
"Insufficient transaction amount."
);
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(_to, supply + i);
tokenIdsToWallet[_to].push() = supply + i;
}
if( totalSupply() - whitelistedToken.length == pauseLimit)
pause(1);
}
| 4,863 |
6 | // theCyber is a decentralized club. It does not support equity memberships, payment of dues, or payouts to the members. Instead, it is meant to enable dapps that allow members to communicate with one another or that provide arbitrary incentives or special access to the club's members. To become a member of theCyber, you must be added by an existing member. Furthermore, existing memberships can be revoked if a given member becomes inactive for too long. Total membership is capped and unique addresses are required. |
event NewMember(uint8 indexed memberId, bytes32 memberName, address indexed memberAddress);
event NewMemberName(uint8 indexed memberId, bytes32 newMemberName);
event NewMemberKey(uint8 indexed memberId, string newMemberKey);
event MembershipTransferred(uint8 indexed memberId, address newMemberAddress);
event MemberProclaimedInactive(uint8 indexed memberId, uint8 indexed proclaimingMemberId);
event MemberHeartbeated(uint8 indexed memberId);
event MembershipRevoked(uint8 indexed memberId, uint8 indexed revokingMemberId);
event BroadcastMessage(uint8 indexed memberId, string message);
event DirectMessage(uint8 indexed memberId, uint8 indexed toMemberId, string message);
|
event NewMember(uint8 indexed memberId, bytes32 memberName, address indexed memberAddress);
event NewMemberName(uint8 indexed memberId, bytes32 newMemberName);
event NewMemberKey(uint8 indexed memberId, string newMemberKey);
event MembershipTransferred(uint8 indexed memberId, address newMemberAddress);
event MemberProclaimedInactive(uint8 indexed memberId, uint8 indexed proclaimingMemberId);
event MemberHeartbeated(uint8 indexed memberId);
event MembershipRevoked(uint8 indexed memberId, uint8 indexed revokingMemberId);
event BroadcastMessage(uint8 indexed memberId, string message);
event DirectMessage(uint8 indexed memberId, uint8 indexed toMemberId, string message);
| 24,947 |
327 | // Pitch 128 | index |= 128;
| index |= 128;
| 14,585 |
26 | // Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address. / | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
unchecked {
| function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
unchecked {
| 785 |
48 | // Split | if(_pCard1 == _pCard2) {
if(_insurance == true)
_dMsg = " --> Player's Turn. Want Insurance? Player can Split.";
else
_dMsg = " --> Player's Turn. Player can Split.";
_split = true;
}
| if(_pCard1 == _pCard2) {
if(_insurance == true)
_dMsg = " --> Player's Turn. Want Insurance? Player can Split.";
else
_dMsg = " --> Player's Turn. Player can Split.";
_split = true;
}
| 34,096 |
18 | // flightsuretydata.fund(msg.value); | consensysreturn = registerAirlineConsensys(airlineStatus,true);
flightsuretydata.registerAirline(id,consensysreturn,newairline,fundMoney);
return(success,M);
AIRLINE_COUNT++;
| consensysreturn = registerAirlineConsensys(airlineStatus,true);
flightsuretydata.registerAirline(id,consensysreturn,newairline,fundMoney);
return(success,M);
AIRLINE_COUNT++;
| 25,074 |
21 | // during cliff | uint256 releasedAmount = _released[plan.uniqueId];
if (currentTime <= plan.startTime.add(plan.cliffDuration)) {
if (plan.initialAmount > releasedAmount) {
return plan.initialAmount.sub(releasedAmount);
} else {
| uint256 releasedAmount = _released[plan.uniqueId];
if (currentTime <= plan.startTime.add(plan.cliffDuration)) {
if (plan.initialAmount > releasedAmount) {
return plan.initialAmount.sub(releasedAmount);
} else {
| 56,109 |
6 | // With valid proof | aliceProof
);
| aliceProof
);
| 49,316 |
6 | // Security flaw here, OK for POC on testnet | mint(msg.sender, msg.value);
emit Staked(msg.sender, msg.value, stakers[msg.sender].time);
| mint(msg.sender, msg.value);
emit Staked(msg.sender, msg.value, stakers[msg.sender].time);
| 36,438 |
11 | // Function to set the token URI Prefix for all tokens. prefix string URI to assign / | function setTokenURIPrefix(string calldata prefix) external;
| function setTokenURIPrefix(string calldata prefix) external;
| 49,387 |
74 | // Approve or remove `operator` as an operator for the caller.Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event. / | function setApprovalForAll(address operator, bool _approved) external;
| function setApprovalForAll(address operator, bool _approved) external;
| 49 |
174 | // Solidity in-memory arrays can't be increased in size, but can be decreased in size by writing to the length. Since we can't know the number of RLP items without looping over the entire input, we'd have to loop twice to accurately size this array. It's easier to simply set a reasonable maximum list length and decrease the size before we finish. | RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);
uint256 itemCount = 0;
uint256 offset = listOffset;
while (offset < _in.length) {
require(itemCount < MAX_LIST_LENGTH, "Provided RLP list exceeds max list length.");
(uint256 itemOffset, uint256 itemLength, ) = _decodeLength(
RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })
| RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);
uint256 itemCount = 0;
uint256 offset = listOffset;
while (offset < _in.length) {
require(itemCount < MAX_LIST_LENGTH, "Provided RLP list exceeds max list length.");
(uint256 itemOffset, uint256 itemLength, ) = _decodeLength(
RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })
| 71,582 |
5 | // Check if the hash of provided secret matches | if (sha256(secret) != hist.secretHash){
return PARAMETER_ERROR;
}
| if (sha256(secret) != hist.secretHash){
return PARAMETER_ERROR;
}
| 26,543 |
47 | // Get the address of token for rewards in this mining pool/ return The rewards token address | function rewardsToken() external view returns (address);
| function rewardsToken() external view returns (address);
| 35,355 |
1 | // Returns the addition of two unsigned integers, reverting with custom message on overflow. Counterpart to Solidity's `+` operator. Requirements:- Addition cannot overflow. / | function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
| function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
| 22,926 |
404 | // A minimum normalized weight imposes a maximum weight ratio. We need this due to limitations in the implementation of the power function, as these ratios are often exponents. | uint256 internal constant _MIN_WEIGHT = 0.01e18;
| uint256 internal constant _MIN_WEIGHT = 0.01e18;
| 52,455 |
345 | // Create positoin | event Mint(address sender, uint256 tokenId, uint128 liquidity);
| event Mint(address sender, uint256 tokenId, uint128 liquidity);
| 10,640 |
147 | // if sILV is requested | if (_useSILV) {
| if (_useSILV) {
| 31,457 |
48 | // Returns the downcasted uint40 from uint256, reverting onoverflow (when the input is greater than largest uint40). Counterpart to Solidity's `uint40` operator. Requirements: - input must fit into 40 bits _Available since v4.7._ / | function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(value);
}
| function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(value);
}
| 27,320 |
100 | // Triggered whenever approve(address _spender, uint256 _value) is called. | event Approval(address indexed _owner, address indexed _spender, uint256 _value);
| event Approval(address indexed _owner, address indexed _spender, uint256 _value);
| 37,680 |
54 | // Grants the right to burn tokens to the address specified. This function can be called by the owner only. addr The destination address / | function grantBurner (address addr) public onlyOwner {
require(!_authorizedBurners[addr], "Address authorized already");
_authorizedBurners[addr] = true;
emit OnBurnerGranted(addr);
}
| function grantBurner (address addr) public onlyOwner {
require(!_authorizedBurners[addr], "Address authorized already");
_authorizedBurners[addr] = true;
emit OnBurnerGranted(addr);
}
| 50,174 |
4 | // Deposit collateral and allow minting eUSD for oneself.Emits a `DepositAsset` event. Requirements:- `assetAmount` Must be higher than 1e18.- `mintAmount` Send 0 if doesn't mint eUSD / | function depositAssetToMint(uint256 assetAmount, uint256 mintAmount) external virtual {
require(assetAmount >= 1 ether, "Deposit should not be less than 1 stETH.");
collateralAsset.safeTransferFrom(msg.sender, address(this), assetAmount);
totalDepositedAsset += assetAmount;
depositedAsset[msg.sender] += assetAmount;
depositedTime[msg.sender] = block.timestamp;
if (mintAmount > 0) {
_mintEUSD(msg.sender, msg.sender, mintAmount, getAssetPrice());
}
emit DepositAsset(msg.sender, address(collateralAsset), assetAmount, block.timestamp);
}
| function depositAssetToMint(uint256 assetAmount, uint256 mintAmount) external virtual {
require(assetAmount >= 1 ether, "Deposit should not be less than 1 stETH.");
collateralAsset.safeTransferFrom(msg.sender, address(this), assetAmount);
totalDepositedAsset += assetAmount;
depositedAsset[msg.sender] += assetAmount;
depositedTime[msg.sender] = block.timestamp;
if (mintAmount > 0) {
_mintEUSD(msg.sender, msg.sender, mintAmount, getAssetPrice());
}
emit DepositAsset(msg.sender, address(collateralAsset), assetAmount, block.timestamp);
}
| 8,241 |
14 | // CREATE2 new instance: | _instance := create2(0, ptr, 0x37, _salt)
| _instance := create2(0, ptr, 0x37, _salt)
| 46,245 |
2 | // The app is at the second level, it may interact with other final level apps if whitelisted | uint256 constant internal APP_LEVEL_SECOND = 1 << 1;
| uint256 constant internal APP_LEVEL_SECOND = 1 << 1;
| 11,087 |
14 | // Verifies signature and mints a non-fungible token. | function mint(
address user,
string memory tokenURI,
uint8 v,
bytes32 r,
bytes32 s
)
external
override
| function mint(
address user,
string memory tokenURI,
uint8 v,
bytes32 r,
bytes32 s
)
external
override
| 26,283 |
1 | // NOTE: set governance to 0x0 in order to disable minting | function setGovernance(address _governance) external {
require(msg.sender == governance, "SVC001: !governance");
governance = _governance;
}
| function setGovernance(address _governance) external {
require(msg.sender == governance, "SVC001: !governance");
governance = _governance;
}
| 27,023 |
37 | // Get a deterministics vault./ | function getVault(bytes32 _key) internal view returns (address) {
bytes32 public constant vaultCodeHash = bytes32(0xfa3da1081bc86587310fce8f3a5309785fc567b9b20875900cb289302d6bfa97);
return address(
uint256(
keccak256(
abi.encodePacked(
byte(0xff),
address(this),
_key,
vaultCodeHash
)
)
)
);
}
| function getVault(bytes32 _key) internal view returns (address) {
bytes32 public constant vaultCodeHash = bytes32(0xfa3da1081bc86587310fce8f3a5309785fc567b9b20875900cb289302d6bfa97);
return address(
uint256(
keccak256(
abi.encodePacked(
byte(0xff),
address(this),
_key,
vaultCodeHash
)
)
)
);
}
| 25,153 |
2 | // Enable or disable the whitelist _enabled bool of whBNBer to enable the whitelist. / | function enableWhitelist(bool _enabled) public onlyOwner {
whitelistEnabled = _enabled;
}
| function enableWhitelist(bool _enabled) public onlyOwner {
whitelistEnabled = _enabled;
}
| 41,982 |
104 | // Return Weth address/ | function getWethAddr() internal pure returns (address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Mainnet WETH Address
// return 0xd0A1E359811322d97991E03f863a0C30C2cF029C; // Kovan WETH Address
}
| function getWethAddr() internal pure returns (address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Mainnet WETH Address
// return 0xd0A1E359811322d97991E03f863a0C30C2cF029C; // Kovan WETH Address
}
| 32,111 |
9 | // The AccountRegistry constructor configures the signing logic implementation and creates an account for the user who deployed the contract. The owner is also set as the original registryAdmin, who has the privilege to create accounts outside of the normal invitation flow. _signingLogic The address of the deployed SigningLogic contract _registry The address of the deployed account registry / | constructor(
SigningLogicInterface _signingLogic,
AccountRegistryInterface _registry
| constructor(
SigningLogicInterface _signingLogic,
AccountRegistryInterface _registry
| 12,284 |
62 | // Returns array with owner addresses, which confirmed transaction./transactionId Transaction ID./ return Returns array of owner addresses. | function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
| function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
| 57,801 |
303 | // Public sale minting | function mint(uint lootId) public payable nonReentrant {
require(saleIsActive, "Sale must be active to mint");
require(publicPrice <= msg.value, "Ether value sent is not correct");
require(lootId > 8000 && lootId < 12000, "Token ID invalid");
require(!_exists(lootId), "This token has already been minted");
_safeMint(msg.sender, lootId);
}
| function mint(uint lootId) public payable nonReentrant {
require(saleIsActive, "Sale must be active to mint");
require(publicPrice <= msg.value, "Ether value sent is not correct");
require(lootId > 8000 && lootId < 12000, "Token ID invalid");
require(!_exists(lootId), "This token has already been minted");
_safeMint(msg.sender, lootId);
}
| 19,014 |
574 | // Don't allow a zero index, start counting at 1 | return value + 1;
| return value + 1;
| 1,420 |
0 | // The contract creator and dev fee addresses are defined here | address contractCreator = 0x606A19ea257aF8ED76D160Ad080782C938660A33;
address devFeeAddress = 0xAe406d5900DCe1bB7cF3Bc5e92657b5ac9cBa34B;
| address contractCreator = 0x606A19ea257aF8ED76D160Ad080782C938660A33;
address devFeeAddress = 0xAe406d5900DCe1bB7cF3Bc5e92657b5ac9cBa34B;
| 44,171 |
16 | // no-op | function deposit() external override {}
/// @notice returns total balance of PCV in the Deposit
function balance() public view virtual override returns (uint256) {
return token.balanceOf(address(this));
}
| function deposit() external override {}
/// @notice returns total balance of PCV in the Deposit
function balance() public view virtual override returns (uint256) {
return token.balanceOf(address(this));
}
| 59,299 |
4 | // This contract is intended for testing / | contract RouletteDev is Roulette {
constructor(
address _bet_token,
address _vrfCoordinator,
address _link,
bytes32 _keyHash,
uint _fee
) Roulette(_bet_token, _vrfCoordinator, _link, _keyHash, _fee) public {}
/**
* Modfies current liquidity intentionally
* DO NOT USE IN PRODUCTION,
* IT IS INTENDED FOR TESTING
*/
function forceAddLiquidity(uint256 amount) external {
current_liquidity += amount;
}
function forceRemoveLiquidity(uint256 amount) external {
current_liquidity -= amount;
bet_token.call(abi.encodeWithSignature("burn(address,uint)", address(this), amount));
}
/**
* Withdraw LINK from this contract
*
* DO NOT USE THIS IN PRODUCTION AS IT CAN BE CALLED BY ANY ADDRESS.
* THIS IS PURELY FOR EXAMPLE PURPOSES.
*/
function withdrawLink() external onlyOwner {
require(LINK.transfer(msg.sender, LINK.balanceOf(address(this))), "Unable to transfer");
}
} | contract RouletteDev is Roulette {
constructor(
address _bet_token,
address _vrfCoordinator,
address _link,
bytes32 _keyHash,
uint _fee
) Roulette(_bet_token, _vrfCoordinator, _link, _keyHash, _fee) public {}
/**
* Modfies current liquidity intentionally
* DO NOT USE IN PRODUCTION,
* IT IS INTENDED FOR TESTING
*/
function forceAddLiquidity(uint256 amount) external {
current_liquidity += amount;
}
function forceRemoveLiquidity(uint256 amount) external {
current_liquidity -= amount;
bet_token.call(abi.encodeWithSignature("burn(address,uint)", address(this), amount));
}
/**
* Withdraw LINK from this contract
*
* DO NOT USE THIS IN PRODUCTION AS IT CAN BE CALLED BY ANY ADDRESS.
* THIS IS PURELY FOR EXAMPLE PURPOSES.
*/
function withdrawLink() external onlyOwner {
require(LINK.transfer(msg.sender, LINK.balanceOf(address(this))), "Unable to transfer");
}
} | 14,636 |
83 | // Creates a vesting contract that vests its balance of any ERC20 token to thebeneficiary, gradually in a linear fashion until start + duration. By then allof the balance will have vested. token address of the token to vest beneficiary address of the beneficiary to whom vested tokens are transferred cliffDuration duration in seconds of the cliff in which tokens will begin to vest start the time (as Unix time) at which point vesting starts duration duration in seconds of the period in which the tokens will vest / | constructor(
IERC20 token,
address beneficiary,
uint256 start,
| constructor(
IERC20 token,
address beneficiary,
uint256 start,
| 31,658 |
20 | // Cannot exceed the total supply of dice. | require(currentTotalSupply + amount <= MAX_SUPPLY, "Not enough mints left");
| require(currentTotalSupply + amount <= MAX_SUPPLY, "Not enough mints left");
| 60,834 |
278 | // calculates results of votes | function calculateVoterResultBatch(uint256[] calldata claimIndexes) external;
| function calculateVoterResultBatch(uint256[] calldata claimIndexes) external;
| 24,552 |
114 | // This is denominated in BaseToken, because the shares-BASE conversion might change before it's fully paid. | mapping (address => mapping (address => uint256)) private _allowedBASE;
bool private transfersPaused;
bool public rebasesPaused;
mapping(address => bool) private transferPauseExemptList;
function setRebasesPaused(bool _rebasesPaused)
public
onlyOwner
| mapping (address => mapping (address => uint256)) private _allowedBASE;
bool private transfersPaused;
bool public rebasesPaused;
mapping(address => bool) private transferPauseExemptList;
function setRebasesPaused(bool _rebasesPaused)
public
onlyOwner
| 9,751 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.