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 |
|---|---|---|---|---|
242 | // TIGERMasterFarmer is the master of TIGER. He can make TIGER and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once TIGER is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hop... | contract TIGERMasterFarmer is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 rewardDebtA... | contract TIGERMasterFarmer is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 rewardDebtA... | 17,552 |
21 | // Decrease the amount of tokens that an owner allowed to a spender.approve should be called when allowed_[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol spender The address which will spend the funds. su... | function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
| function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
| 3,238 |
10 | // adds a new checkpoint Requirements: - the caller must have the ROLE_SEEDER role / | function _addCheckpoint(address target, uint256 timestamp) private {
require(data[target] <= timestamp, "ERR_WRONG_ORDER");
data[target] = timestamp;
emit CheckpointUpdated(target, timestamp);
}
| function _addCheckpoint(address target, uint256 timestamp) private {
require(data[target] <= timestamp, "ERR_WRONG_ORDER");
data[target] = timestamp;
emit CheckpointUpdated(target, timestamp);
}
| 21,129 |
27 | // Returns the the implementation contract of the proxy contract by its identifier. It returns ZERO if there is no registered address with the given id It reverts if the registered address with the given id is not `InitializableImmutableAdminUpgradeabilityProxy` id The idreturn The address of the implementation contrac... | function _getProxyImplementation(bytes32 id) internal returns (address) {
address proxyAddress = _addresses[id];
if (proxyAddress == address(0)) {
return address(0);
} else {
address payable payableProxyAddress = payable(proxyAddress);
return InitializableImmutableAdminUpgradeabilityProx... | function _getProxyImplementation(bytes32 id) internal returns (address) {
address proxyAddress = _addresses[id];
if (proxyAddress == address(0)) {
return address(0);
} else {
address payable payableProxyAddress = payable(proxyAddress);
return InitializableImmutableAdminUpgradeabilityProx... | 36,035 |
506 | // The DFG TOKEN! | INBUNIERC20 public dfg;
| INBUNIERC20 public dfg;
| 40,336 |
5 | // Estimate the reward amount./_gasPrice The gas price for which we want to retrieve the estimation./ return The reward to be included when either posting a new request, or upgrading the reward of a previously posted one. | function _witnetEstimateReward(uint256 _gasPrice)
internal view
virtual
returns (uint256)
| function _witnetEstimateReward(uint256 _gasPrice)
internal view
virtual
returns (uint256)
| 13,935 |
60 | // Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint the amount of tokens to be transferred / | function transferFrom(address _from, address _to, uint _value) public returns (bool) {
bytes memory empty;
return transferFrom(_from, _to, _value, empty);
}
| function transferFrom(address _from, address _to, uint _value) public returns (bool) {
bytes memory empty;
return transferFrom(_from, _to, _value, empty);
}
| 14,777 |
1 | // Calculates due protocol fees originating from accumulated swap fees and yield of non-exempt tokens, paysthem by minting BPT, and returns the actual supply and current balances. We also return the current invariant computed using the amplification factor at the last join or exit, which canbe useful to skip computatio... | function _payProtocolFeesBeforeJoinExit(
| function _payProtocolFeesBeforeJoinExit(
| 10,062 |
112 | // Gets attributes of NFT | function _getAttributesOfToken(uint256 _tokenId) internal returns(NFT) {
NFT storage lsnftObj = allNFTs[_tokenId];
return lsnftObj;
}
| function _getAttributesOfToken(uint256 _tokenId) internal returns(NFT) {
NFT storage lsnftObj = allNFTs[_tokenId];
return lsnftObj;
}
| 25,183 |
26 | // PERMIT WITHDRAW TODO Need to handle case in where withdraw action replaced argument. | if (store.actionArgsHash == ZERO_BYTES32) {
store.actionArgsHash = _getActionArgsHash(actions, args, beforeSlipped);
}
| if (store.actionArgsHash == ZERO_BYTES32) {
store.actionArgsHash = _getActionArgsHash(actions, args, beforeSlipped);
}
| 14,339 |
194 | // player address mapped to query id does not exist // keep oraclize honest by retrieving the serialNumber from random.org result // map random result to player // produce integer bounded to 1-100 inclusivevia sha3 result from random.org and proof (IPFS address of TLSNotary proof) / | playerDieResult[myid] = uint(sha3(playerRandomResult[myid], proof)) % 100 + 1;
| playerDieResult[myid] = uint(sha3(playerRandomResult[myid], proof)) % 100 + 1;
| 40,187 |
8 | // === Find the length of an unsigned integer | function lengthOfUint(uint256 _num) private pure returns (uint256 length) {
while (_num != 0) {
length++;
_num /= 10;
}
}
| function lengthOfUint(uint256 _num) private pure returns (uint256 length) {
while (_num != 0) {
length++;
_num /= 10;
}
}
| 30,661 |
12 | // Owner of account approves the transfer of an amount to another account | mapping(address => mapping(address => uint256)) allowed;
| mapping(address => mapping(address => uint256)) allowed;
| 52,039 |
1,098 | // If holder number decreases, probability decreases. |
uint32 finish_probabilityIncreaseStep_transaction;
uint32 finish_probabilityIncreaseStep_holder;
|
uint32 finish_probabilityIncreaseStep_transaction;
uint32 finish_probabilityIncreaseStep_holder;
| 4,797 |
192 | // get the rate between the pool token and the reserve token | Fraction memory poolRate = poolTokenRate(_poolToken, _reserveToken);
| Fraction memory poolRate = poolTokenRate(_poolToken, _reserveToken);
| 14,086 |
22 | // Allows the user to deposit funds, where the sender address and max allowed value have to be signed together with the cyclenumber by the casino. The method verifies the signature and makes sure, the deposit was made in time, before updatingthe storage variables. value the number of tokens to deposit allowedMax the ma... | function deposit(uint value, uint allowedMax, uint8 v, bytes32 r, bytes32 s) public depositPhase {
require(verifySignature(msg.sender, allowedMax, v, r, s));
if (addDeposit(msg.sender, value, numHolders, allowedMax))
numHolders = safeAdd(numHolders, 1);
totalStakes = safeSub(safeAdd(totalStakes, val... | function deposit(uint value, uint allowedMax, uint8 v, bytes32 r, bytes32 s) public depositPhase {
require(verifySignature(msg.sender, allowedMax, v, r, s));
if (addDeposit(msg.sender, value, numHolders, allowedMax))
numHolders = safeAdd(numHolders, 1);
totalStakes = safeSub(safeAdd(totalStakes, val... | 40,573 |
71 | // We don't want to support a payable function as we are not doing ICO and instead doing private/ | returns(bool) {
require(_totalWeiAmount > 0 && publicSaleSupply >= _totalWeiAmount);
publicSaleSupply = publicSaleSupply.sub(_totalWeiAmount);
require(transferFrom(owner,_to, _totalWeiAmount));
TokensBought(_to, _totalWeiAmount, _currency, _txHash);
return true;
}
| returns(bool) {
require(_totalWeiAmount > 0 && publicSaleSupply >= _totalWeiAmount);
publicSaleSupply = publicSaleSupply.sub(_totalWeiAmount);
require(transferFrom(owner,_to, _totalWeiAmount));
TokensBought(_to, _totalWeiAmount, _currency, _txHash);
return true;
}
| 37,266 |
19 | // Set endpoint specific parameters for a given endpoint | function setEndpointParams(bytes32 endpoint, bytes32[] memory endpointParams) public {
// Provider must be initiated
require(isProviderInitiated(msg.sender), "Error: Provider is not yet initialized");
// Can't set endpoint params on an unset provider
require(!getCurveUnset(msg.sender... | function setEndpointParams(bytes32 endpoint, bytes32[] memory endpointParams) public {
// Provider must be initiated
require(isProviderInitiated(msg.sender), "Error: Provider is not yet initialized");
// Can't set endpoint params on an unset provider
require(!getCurveUnset(msg.sender... | 17,878 |
173 | // skip if stage is below "currentStage" (as they have no available tokens) | if(stageId < currentStage) {
| if(stageId < currentStage) {
| 8,759 |
50 | // uint256 currentBalance = balanceOf(_beneficiary); | uint256 totalBalance = value.torelease;
if (block.timestamp < value.cliff) {
return 0;
} else if (block.timestamp >= value.start.add(value.duration)) {
| uint256 totalBalance = value.torelease;
if (block.timestamp < value.cliff) {
return 0;
} else if (block.timestamp >= value.start.add(value.duration)) {
| 58,329 |
18 | // Decrease the allowance by a given amount spender Spender's address subtractedValue Amount of decrease in allowancereturn True if successful / | function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
| function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
| 22,275 |
277 | // Converts to a Message _message The messagereturn The newly typed message / | function tryAsMessage(bytes29 _message) internal pure returns (bytes29) {
if (isValidMessageLength(_message)) {
return _message.castTo(uint40(Types.Message));
}
return TypedMemView.nullView();
}
| function tryAsMessage(bytes29 _message) internal pure returns (bytes29) {
if (isValidMessageLength(_message)) {
return _message.castTo(uint40(Types.Message));
}
return TypedMemView.nullView();
}
| 13,992 |
10 | // https:etherscan.io/address/0xC011A72400E58ecD99Ee497CF89E3775d4bd732F | Proxy public constant proxysynthetix_i = Proxy(0xC011A72400E58ecD99Ee497CF89E3775d4bd732F);
| Proxy public constant proxysynthetix_i = Proxy(0xC011A72400E58ecD99Ee497CF89E3775d4bd732F);
| 50,691 |
22 | // when toToken == eth, call this function to get eth/to The account address to receive ETH/minAmount The minimum amount to withdraw | function withdrawWETH(address to, uint256 minAmount) external payable {
uint256 withdrawAmount = IWETH(_WETH_).balanceOf(address(this));
require(withdrawAmount >= minAmount, "D3PROXY_WETH_NOT_ENOUGH");
_withdrawWETH(to, withdrawAmount);
}
| function withdrawWETH(address to, uint256 minAmount) external payable {
uint256 withdrawAmount = IWETH(_WETH_).balanceOf(address(this));
require(withdrawAmount >= minAmount, "D3PROXY_WETH_NOT_ENOUGH");
_withdrawWETH(to, withdrawAmount);
}
| 17,083 |
131 | // 2% Fund + 10% Dividends | f2mContract.pushDividends.value(toF2mAmount)();
| f2mContract.pushDividends.value(toF2mAmount)();
| 19,040 |
31 | // _burn(_owner, _tokenId); | _burn(_tokenId);
emit TokenBurned(_tokenId);
| _burn(_tokenId);
emit TokenBurned(_tokenId);
| 1,662 |
35 | // The Compound redeem executions data._key is the execution Id._value is the execution data. / | mapping(uint256 => Execution) public executions;
| mapping(uint256 => Execution) public executions;
| 18,188 |
363 | // Array of Bassets currently active | Basset[] bassets;
| Basset[] bassets;
| 19,285 |
55 | // Mint amount of token to specified account by an operator address / | function mint(address account, uint256 amount) external returns (bool);
| function mint(address account, uint256 amount) external returns (bool);
| 18,670 |
160 | // check if tokenId has a specified image link | if (bytes(staticIpfsImageLink[_tokenId]).length > 0) {
return Strings.strConcat(projects[tokenIdToProjectId[_tokenId]].projectBaseIpfsURI, staticIpfsImageLink[_tokenId]);
}
| if (bytes(staticIpfsImageLink[_tokenId]).length > 0) {
return Strings.strConcat(projects[tokenIdToProjectId[_tokenId]].projectBaseIpfsURI, staticIpfsImageLink[_tokenId]);
}
| 19,317 |
66 | // Copied from 0x LibMath///Calculates partial value given a numerator and denominator rounded down./Reverts if rounding error is >= 0.1%/numerator Numerator./denominator Denominator./target Value to calculate partial of./ return Partial value of target rounded down. | function safeGetPartialAmountFloor(
uint256 numerator,
uint256 denominator,
uint256 target
)
internal
pure
returns (uint256 partialAmount)
{
require(
| function safeGetPartialAmountFloor(
uint256 numerator,
uint256 denominator,
uint256 target
)
internal
pure
returns (uint256 partialAmount)
{
require(
| 30,475 |
193 | // Only the savings managaer (pulled from Nexus) can execute this / | modifier onlySavingsManager() {
require(msg.sender == _savingsManager(), "Only savings manager can execute");
_;
}
| modifier onlySavingsManager() {
require(msg.sender == _savingsManager(), "Only savings manager can execute");
_;
}
| 49,671 |
77 | // Gets the cost of appealing a specified dispute._disputeID The ID of the dispute. return cost The appeal cost. / | function appealCost(uint256 _disputeID) public view returns (uint256 cost) {
Dispute storage dispute = disputes[_disputeID];
if (dispute.nbVotes >= courts[dispute.subcourtID].jurorsForCourtJump) {
// Jump to parent subcourt.
if (dispute.subcourtID == 0)
// Alr... | function appealCost(uint256 _disputeID) public view returns (uint256 cost) {
Dispute storage dispute = disputes[_disputeID];
if (dispute.nbVotes >= courts[dispute.subcourtID].jurorsForCourtJump) {
// Jump to parent subcourt.
if (dispute.subcourtID == 0)
// Alr... | 696 |
5 | // Used to validate if a user has been borrowing from any reserve self The configuration objectreturn True if the user has been borrowing any reserve, false otherwise / | function isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {
return self.data & BORROWING_MASK != 0;
}
| function isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {
return self.data & BORROWING_MASK != 0;
}
| 6,933 |
1 | // Chainlink rinkeby devrel node. | oracle = 0xc57B33452b4F7BB189bB5AfaE9cc4aBa1f7a4FD8;
jobId = "6b88e0402e5d415eb946e528b8e0c7ba";
fee = 0.1 * 10**18; // (Varies by network and job) .1 Link
| oracle = 0xc57B33452b4F7BB189bB5AfaE9cc4aBa1f7a4FD8;
jobId = "6b88e0402e5d415eb946e528b8e0c7ba";
fee = 0.1 * 10**18; // (Varies by network and job) .1 Link
| 49,891 |
22 | // For Debugging | event Debug(string notes,uint opt1,uint opt2);
using SafeMath for uint;
address public governor;
uint public priceInWei;
uint8 public decimal;
uint public closeTime;
uint public startTime;
uint public minBuy;
| event Debug(string notes,uint opt1,uint opt2);
using SafeMath for uint;
address public governor;
uint public priceInWei;
uint8 public decimal;
uint public closeTime;
uint public startTime;
uint public minBuy;
| 52,918 |
126 | // Update reward per block Only callable by owner. _rewardPerBlock: the reward per block / | function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner {
require(block.number < startBlock, "Pool has started");
rewardPerBlock = _rewardPerBlock;
emit NewRewardPerBlock(_rewardPerBlock);
}
| function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner {
require(block.number < startBlock, "Pool has started");
rewardPerBlock = _rewardPerBlock;
emit NewRewardPerBlock(_rewardPerBlock);
}
| 7,242 |
124 | // Populates the return values with information about the loaded safe deposit box. | end_time = _deposit.end_time;
principal = _deposit.principal;
reward = _deposit.reward;
premature_withdrawal_enabled = _deposit.premature_withdrawal_enabled;
| end_time = _deposit.end_time;
principal = _deposit.principal;
reward = _deposit.reward;
premature_withdrawal_enabled = _deposit.premature_withdrawal_enabled;
| 44,899 |
353 | // Calculates final amounts in, accounting for the exit fee | (uint exitFee,
uint amountIn) = SmartPoolManager.exitswapExternAmountOut(
IConfigurableRightsPool(address(this)),
bPool,
tokenOut,
tokenAmountOut,
maxPoo... | (uint exitFee,
uint amountIn) = SmartPoolManager.exitswapExternAmountOut(
IConfigurableRightsPool(address(this)),
bPool,
tokenOut,
tokenAmountOut,
maxPoo... | 26,821 |
10 | // Length getters and modifiers | function getMyAgreementsCount() public view returns(uint myAgreementsCount) {
return userToAgreements[msg.sender].length;
}
| function getMyAgreementsCount() public view returns(uint myAgreementsCount) {
return userToAgreements[msg.sender].length;
}
| 51,819 |
35 | // Helper function to convert bool to string | function boolToString(bool _value) internal pure returns (string memory) {
return _value ? "true" : "false";
}
| function boolToString(bool _value) internal pure returns (string memory) {
return _value ? "true" : "false";
}
| 15,480 |
13 | // Enable depositing | function enableDepositing() external onlyOwner {
require(!isShutdown, "StablzLPIntegration: Enabling deposits is not allowed due to the integration being shutdown");
isDepositingEnabled = true;
emit DepositingEnabled();
}
| function enableDepositing() external onlyOwner {
require(!isShutdown, "StablzLPIntegration: Enabling deposits is not allowed due to the integration being shutdown");
isDepositingEnabled = true;
emit DepositingEnabled();
}
| 18,039 |
52 | // Returns the downcasted int192 from int256, reverting onoverflow (when the input is less than smallest int192 orgreater than largest int192). Counterpart to Solidity's `int192` operator. Requirements: - input must fit into 192 bits / | function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
| function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
| 5,947 |
67 | // Throws if called by any account that does not have operator role. / | modifier onlyOperator() {
require(isOperator(msg.sender), "not operator");
_;
}
| modifier onlyOperator() {
require(isOperator(msg.sender), "not operator");
_;
}
| 20,344 |
37 | // Gets blocknumber for mined timestamp _requestId to look up _timestamp is the timestamp to look up blocknumberreturn uint of the blocknumber which the dispute was mined / | function getMinedBlockNum(uint256 _requestId, uint256 _timestamp)
| function getMinedBlockNum(uint256 _requestId, uint256 _timestamp)
| 18,351 |
26 | // default Vesting parameter values | uint256 private _cliff = 2592000; // 30 days period
uint256 private _duration = 93312000; // for 3 years
bool private _revoked = false;
IERC20 public LCXToken;
event TokenReleased(address indexed account, uint256 amount);
event VestingRevoked(address indexed account);
| uint256 private _cliff = 2592000; // 30 days period
uint256 private _duration = 93312000; // for 3 years
bool private _revoked = false;
IERC20 public LCXToken;
event TokenReleased(address indexed account, uint256 amount);
event VestingRevoked(address indexed account);
| 20,993 |
142 | // mint Fucntion is to mint the NFTS for public/ | function mint(uint256 _count) public payable {
uint256 Supply = totalSupply();
require(!isBlacklisted[msg.sender], "caller is backlisted");
require(hasSaleStarted == true, "Sale hasn't started");
require(Supply <= MAX_SUPPLY, "Sold out");
require(Supply + _count <= MAX_SUP... | function mint(uint256 _count) public payable {
uint256 Supply = totalSupply();
require(!isBlacklisted[msg.sender], "caller is backlisted");
require(hasSaleStarted == true, "Sale hasn't started");
require(Supply <= MAX_SUPPLY, "Sold out");
require(Supply + _count <= MAX_SUP... | 14,094 |
104 | // deposits the entire balance to yv2 vault | IYVaultV2(yVault).deposit(underlyingBalance);
| IYVaultV2(yVault).deposit(underlyingBalance);
| 49,907 |
85 | // it is player2's turn | require(stacks[_counterStack].owner==msg.sender);
| require(stacks[_counterStack].owner==msg.sender);
| 65,318 |
177 | // Define owner address | address ownerAddress = 0xa27999aEE6d546004fA37CfDf372a922aB1C7Eff;
| address ownerAddress = 0xa27999aEE6d546004fA37CfDf372a922aB1C7Eff;
| 49,412 |
4 | // metadata root uri | string private _rootURI;
| string private _rootURI;
| 25,652 |
129 | // function exists(uint256 tokenId) external view returns (bool exists); |
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId)
external
view
returns (address operator);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address owner, address operator)
exter... |
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId)
external
view
returns (address operator);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address owner, address operator)
exter... | 14,715 |
101 | // require(pair != uniswapV2Pair, "The pair cannot be removed from _automateMMs"); | uniswapV2Pair = pair;
_automateMMs[address(uniswapV2Pair)] = true;
_isExcludedMaxTransactionAmount[address(uniswapV2Pair)] = true;
_isExcludedmaxAmount[address(uniswapV2Pair)] = true;
| uniswapV2Pair = pair;
_automateMMs[address(uniswapV2Pair)] = true;
_isExcludedMaxTransactionAmount[address(uniswapV2Pair)] = true;
_isExcludedmaxAmount[address(uniswapV2Pair)] = true;
| 6,782 |
212 | // Mapping from token ID to ownership details An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. | mapping(uint256 => TokenOwnership) private _ownerships;
| mapping(uint256 => TokenOwnership) private _ownerships;
| 20,841 |
39 | // Shuffle array | shuffleLotteryTickets(1);
address winner = lotteryEntries[0];
| shuffleLotteryTickets(1);
address winner = lotteryEntries[0];
| 52,314 |
12 | // Status of the work order contract. / | enum Status { Pending, InProgress, Completed, Paid }
/** Provide (PRVD) token. */
ProvideToken public token;
/** Provide platform robot. */
address public prvd;
/** Provide platform wallet where fees owed to Provide are remitted. */
address public prvdWallet;
/** Provide platform wallet where paymen... | enum Status { Pending, InProgress, Completed, Paid }
/** Provide (PRVD) token. */
ProvideToken public token;
/** Provide platform robot. */
address public prvd;
/** Provide platform wallet where fees owed to Provide are remitted. */
address public prvdWallet;
/** Provide platform wallet where paymen... | 2,545 |
54 | // make a refund | investor.transfer(refundValue + msg.value);
| investor.transfer(refundValue + msg.value);
| 28,203 |
3 | // Prevents new contracts from being added or changes to disbursement if permanently locked | bool public isLocked = false;
mapping(bytes32 => uint256) public lastClaim;
event RewardPaid(address indexed user, uint256 reward);
| bool public isLocked = false;
mapping(bytes32 => uint256) public lastClaim;
event RewardPaid(address indexed user, uint256 reward);
| 7,575 |
8 | // datacoord = userId_assurId | function addLovers(bytes32 love_hash, string lovemsg, string loveurl) payable {
require(bytes(lovemsg).length < 250);
require(bytes(loveurl).length < 100);
require(msg.value >= price);
mapLoveItems[love_hash] = LoveItem(msg.sender, block.number, block.timestamp, lovemsg, loveur... | function addLovers(bytes32 love_hash, string lovemsg, string loveurl) payable {
require(bytes(lovemsg).length < 250);
require(bytes(loveurl).length < 100);
require(msg.value >= price);
mapLoveItems[love_hash] = LoveItem(msg.sender, block.number, block.timestamp, lovemsg, loveur... | 10,090 |
166 | // Withdraw all funds to get max funds | masterchef.emergencyWithdraw(pid);
uint256 newWantBal = want.balanceOf(address(this));
if (newWantBal > amountToFree) {
| masterchef.emergencyWithdraw(pid);
uint256 newWantBal = want.balanceOf(address(this));
if (newWantBal > amountToFree) {
| 74,239 |
31 | // list of valid claim | mapping (address => uint) public countClaimsToken;
uint256 public priceToken = 950000;
uint256 public priceClaim = 0.0005 ether;
uint256 public numberClaimToken = 200 * (10**uint256(decimals));
uint256 public startTimeDay = 50400;
uint256 public endTimeDay = 51300;
event OwnerChanged(addre... | mapping (address => uint) public countClaimsToken;
uint256 public priceToken = 950000;
uint256 public priceClaim = 0.0005 ether;
uint256 public numberClaimToken = 200 * (10**uint256(decimals));
uint256 public startTimeDay = 50400;
uint256 public endTimeDay = 51300;
event OwnerChanged(addre... | 54,402 |
45 | // Getter for allowance: amount spender will be allowed to spend on behalf of owner owner - owner of the tokens spender - entity allowed to spend the tokensreturn uint - remaining amount spender is allowed to transfer / | function allowance(address owner, address spender) external view override returns (uint) {
return _allowance[owner][spender];
}
| function allowance(address owner, address spender) external view override returns (uint) {
return _allowance[owner][spender];
}
| 6,592 |
49 | // Check that taker pays properly | require(tables[_tableIndex].deposit == msg.value * maxCase);
Table storage table = tables[_tableIndex];
table.taker = msg.sender;
table.payment = msg.value;
table.guessedNum = _guessedNum;
table.takingTime = now;
emit TableChanged(_tableIndex);
| require(tables[_tableIndex].deposit == msg.value * maxCase);
Table storage table = tables[_tableIndex];
table.taker = msg.sender;
table.payment = msg.value;
table.guessedNum = _guessedNum;
table.takingTime = now;
emit TableChanged(_tableIndex);
| 25,009 |
31 | // Process sequencer transactions first. | numSequencerTransactions += uint32(curContext.numSequencedTransactions);
| numSequencerTransactions += uint32(curContext.numSequencedTransactions);
| 23,254 |
13 | // 3. Withdraw all the rewards. | masterChef.leaveStaking(0);
uint256 reward = farmingToken.myBalance();
if (reward == 0) return;
| masterChef.leaveStaking(0);
uint256 reward = farmingToken.myBalance();
if (reward == 0) return;
| 9,196 |
0 | // CHECK maybe implement account verification instead of data structure?address of user => is allowed to mint | mapping(address => bool) private _allowlist;
| mapping(address => bool) private _allowlist;
| 24,617 |
125 | // Transfers collateral from the debtor to the current contract, as custodian.agreementId bytes32 The debt agreement's ID collateralizer address The owner of the asset being collateralized / | function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
| function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
| 21,326 |
52 | // Modifier that prevents a date change once a drop has started. / | modifier dropNotStarted(uint8 index, uint date) {
// the drop we're updating can't be starting within the hour.
require(drops[index].date == 0 || drops[index].date > block.timestamp + 3600, "Drop starting too soon");
// the _date value must be two hours out from now
require(date > bl... | modifier dropNotStarted(uint8 index, uint date) {
// the drop we're updating can't be starting within the hour.
require(drops[index].date == 0 || drops[index].date > block.timestamp + 3600, "Drop starting too soon");
// the _date value must be two hours out from now
require(date > bl... | 64,553 |
129 | // Initialize new implementation within proxy-context storage: | (bool _wasInitialized,) = _newImplementation.delegatecall(
abi.encodeWithSignature(
"initialize(bytes)",
_initData
)
);
require(_wasInitialized, "WitnetProxy: unable to initialize");
| (bool _wasInitialized,) = _newImplementation.delegatecall(
abi.encodeWithSignature(
"initialize(bytes)",
_initData
)
);
require(_wasInitialized, "WitnetProxy: unable to initialize");
| 19,844 |
47 | // Turn off tax for this block | token.disableReflectionForCurrentBlock();
| token.disableReflectionForCurrentBlock();
| 34,416 |
7 | // (pID => name => bool) list of names a player owns.(used so you can change your display name amoungst any name you own) | mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_;
| mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_;
| 3,944 |
40 | // Get available tokens/ | function getMyBalance() public view returns(uint) {
return balanceOf(msg.sender);
}
| function getMyBalance() public view returns(uint) {
return balanceOf(msg.sender);
}
| 28,278 |
192 | // wipe | inSync = false;
yTokenValueCache = 0;
loansValueCache = 0;
| inSync = false;
yTokenValueCache = 0;
loansValueCache = 0;
| 19,491 |
11 | // validate order | Order untrustedOrder = Order(_order);
| Order untrustedOrder = Order(_order);
| 15,198 |
20 | // get last byte (31st) from block hash as result | result = result_hash[31];
address[] storage winners = bettings[result];
winners_count = winners.length;
if (winners_count > 0) {
uint256 credit = this.balance / winners_count;
for (uint256 i = 0; i < winners_count; i++) {
credits[winners[i]] = cred... | result = result_hash[31];
address[] storage winners = bettings[result];
winners_count = winners.length;
if (winners_count > 0) {
uint256 credit = this.balance / winners_count;
for (uint256 i = 0; i < winners_count; i++) {
credits[winners[i]] = cred... | 36,829 |
33 | // Iterate through the list and withdraw all | for (uint256 i = 0; i < depositIds.length; i++) {
if (depositIds[i] != 0) {
withdrawPosition(depositIds[i], type(uint256).max);
}
| for (uint256 i = 0; i < depositIds.length; i++) {
if (depositIds[i] != 0) {
withdrawPosition(depositIds[i], type(uint256).max);
}
| 12,288 |
116 | // Sets the user_contract address _userContract is the new userContract address/ | function setUserContract(address _userContract) public onlyOwner() {
user_contract = _userContract;
}
| function setUserContract(address _userContract) public onlyOwner() {
user_contract = _userContract;
}
| 72,677 |
123 | // Helper to verify a full merkle proof starting from some seedHash (usually commit). "offset" is the location of the proof beginning in the calldata. | function verifyMerkleProof(uint seedHash, uint offset) pure private returns (bytes32 blockHash, bytes32 uncleHash) {
// (Safe) assumption - nobody will write into RAM during this method invocation.
uint scratchBuf1; assembly { scratchBuf1 := mload(0x40) }
uint uncleHeaderLengt... | function verifyMerkleProof(uint seedHash, uint offset) pure private returns (bytes32 blockHash, bytes32 uncleHash) {
// (Safe) assumption - nobody will write into RAM during this method invocation.
uint scratchBuf1; assembly { scratchBuf1 := mload(0x40) }
uint uncleHeaderLengt... | 28,915 |
81 | // Removes the stakes of the operator with pubkeyHash `pubkeyHash` / | function _removeOperatorStake(bytes32 pubkeyHash) internal returns(uint32) {
// gas saving by caching length here
uint256 pubkeyHashToStakeHistoryLengthMinusOne = pubkeyHashToStakeHistory[pubkeyHash].length - 1;
// determine current stakes
OperatorStake memory currentStakes =
... | function _removeOperatorStake(bytes32 pubkeyHash) internal returns(uint32) {
// gas saving by caching length here
uint256 pubkeyHashToStakeHistoryLengthMinusOne = pubkeyHashToStakeHistory[pubkeyHash].length - 1;
// determine current stakes
OperatorStake memory currentStakes =
... | 34,102 |
21 | // Returns the Artist of the collection/ | function getArtist() public view returns (address payable) {
return artist;
}
| function getArtist() public view returns (address payable) {
return artist;
}
| 43,120 |
188 | // Fees are deducted at resolution, so remove them if we're still bidding or trading. | return resolved ? _deposited : _deposited.multiplyDecimalRound(_feeMultiplier);
| return resolved ? _deposited : _deposited.multiplyDecimalRound(_feeMultiplier);
| 2,763 |
13 | // set new strategist address to receive strat fees | function setStrategist(address _strategist) external {
require(msg.sender == strategist, "!strategist");
strategist = _strategist;
emit SetStrategist(_strategist);
}
| function setStrategist(address _strategist) external {
require(msg.sender == strategist, "!strategist");
strategist = _strategist;
emit SetStrategist(_strategist);
}
| 11,453 |
40 | // Mapping of modules to fee types to fee percentage. A module can have multiple feeTypes Fee is denominated in precise unit percentages (100% = 1e18, 1% = 1e16) | mapping(address => mapping(uint256 => uint256)) public fees;
| mapping(address => mapping(uint256 => uint256)) public fees;
| 20,003 |
275 | // Claim the remaining unclaimed rewards for a user, and send them to that user.Reverts if the provided Merkle proof is invalid. userAddress of the user.cumulativeAmountThe total all-time rewards this user has earned.merkleProof The Merkle proof for the user and cumulative amount. return The number of rewards tokens cl... | function _claimRewards(
address user,
uint256 cumulativeAmount,
bytes32[] calldata merkleProof
)
internal
returns (uint256)
| function _claimRewards(
address user,
uint256 cumulativeAmount,
bytes32[] calldata merkleProof
)
internal
returns (uint256)
| 77,499 |
31 | // revert("Chain not valid"); | swapRouter = IRouter02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| swapRouter = IRouter02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| 19,234 |
34 | // Trigger the event for a new purchase | PurchaseMade(msg.sender, paymentCode, msg.value);
| PurchaseMade(msg.sender, paymentCode, msg.value);
| 38,354 |
69 | // Do not pay into PriceOracle. / | function() external payable {
revert();
}
| function() external payable {
revert();
}
| 10,416 |
21 | // Function that connext will call on destination chain. Call arbitray contract depending on callData. Transfer tokens to rescuer, if call fails/transferId Connext transferId | /// @param amount Amount of {asset} that was transfered on this contract before call
/// @param asset Address of token that was transfered
/// @param originSender Address of caller on source chain
/// @param origin Id(not chain id) of source chain
/// @param callData If called as a result of MultiTB... | /// @param amount Amount of {asset} that was transfered on this contract before call
/// @param asset Address of token that was transfered
/// @param originSender Address of caller on source chain
/// @param origin Id(not chain id) of source chain
/// @param callData If called as a result of MultiTB... | 16,984 |
223 | // Get chain idreturn The the chain id / | function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
| function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
| 9,619 |
128 | // The address has not chosen explicitly, so use the default for its type. | if (Address.isContract(_account)) {
| if (Address.isContract(_account)) {
| 33,939 |
6 | // Allows the proxy owner to upgrade the current version of the proxy.implementation representing the address of the new implementation to be set./ | function upgradeTo(address implementation) public onlyProxyOwner {
require(block.timestamp < expiration(), "after expiration date");
super.upgradeTo(implementation);
}
| function upgradeTo(address implementation) public onlyProxyOwner {
require(block.timestamp < expiration(), "after expiration date");
super.upgradeTo(implementation);
}
| 19,532 |
116 | // We always update the nonce of the creating account, even if the creation fails. | _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);
| _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);
| 79,354 |
186 | // Remove a future platform from the registry _futurePlatformName the name of the future platform to remove from the registry / | function removeFuturePlatform(string memory _futurePlatformName) external;
| function removeFuturePlatform(string memory _futurePlatformName) external;
| 49,011 |
32 | // LIBRARY UPGRADE step 3: stop receiving messages from the old version | function setDefaultReceiveVersion(uint16 _newDefaultReceiveVersion) external onlyOwner validVersion(_newDefaultReceiveVersion) {
require(_newDefaultReceiveVersion != DEFAULT_VERSION, "LayerZero: default receive version must > 0");
defaultReceiveVersion = _newDefaultReceiveVersion;
defaultRec... | function setDefaultReceiveVersion(uint16 _newDefaultReceiveVersion) external onlyOwner validVersion(_newDefaultReceiveVersion) {
require(_newDefaultReceiveVersion != DEFAULT_VERSION, "LayerZero: default receive version must > 0");
defaultReceiveVersion = _newDefaultReceiveVersion;
defaultRec... | 1,715 |
33 | // Give the tokens to the withdrawer | stakingToken.safeTransfer(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
| stakingToken.safeTransfer(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
| 32,028 |
90 | // return the address of the wallet that will hold the tokens. / | function tokenWallet() public view returns (address) {
return _tokenWallet;
}
| function tokenWallet() public view returns (address) {
return _tokenWallet;
}
| 6,856 |
128 | // Remove the ask on a piece of media / | function removeAsk(uint256 tokenId) external;
| function removeAsk(uint256 tokenId) external;
| 25,813 |
73 | // Shortcuts for before cliff and after vesting cases. | if (time < cliff) return 0;
if (time >= vesting) return tokens;
| if (time < cliff) return 0;
if (time >= vesting) return tokens;
| 21,181 |
15 | // Initiate transfer of the admin rolenewAdmin The address of the new admin | function transferAdministration(address newAdmin) external onlyAdmin {
if (newAdmin == address(0)) revert InvalidAccount();
if (newAdmin == admin) revert InvalidAccount();
pendingAdmin = newAdmin;
emit AdministrationTransferStarted(admin, newAdmin);
}
| function transferAdministration(address newAdmin) external onlyAdmin {
if (newAdmin == address(0)) revert InvalidAccount();
if (newAdmin == admin) revert InvalidAccount();
pendingAdmin = newAdmin;
emit AdministrationTransferStarted(admin, newAdmin);
}
| 24,124 |
9 | // Burnable introduces a burner role, which could be used to destroy/tokens. The burner address could be changed by himself. | contract Burnable is Controlled {
address public burner;
/// @notice The function with this modifier could be called by a controller
/// as well as by a burner. But burner could use the onlt his/her address as
/// a target.
modifier onlyControllerOrBurner(address target) {
assert(msg.sender == controller... | contract Burnable is Controlled {
address public burner;
/// @notice The function with this modifier could be called by a controller
/// as well as by a burner. But burner could use the onlt his/her address as
/// a target.
modifier onlyControllerOrBurner(address target) {
assert(msg.sender == controller... | 11,842 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.