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 |
|---|---|---|---|---|
2 | // addressProvider represents the connection to other fMint contracts. | IFantomMintAddressProvider public addressProvider;
| IFantomMintAddressProvider public addressProvider;
| 23,197 |
103 | // return latest rate of knc/eth | function latestAnswer() external view returns (uint256);
| function latestAnswer() external view returns (uint256);
| 47,181 |
113 | // Public function proxy to forward single parameters as a struct. | function claim(uint16 _x, uint16 _y, uint16 _width, uint16 _height)
claimAllowed(_width, _height)
coordsValid(_x, _y, _width, _height)
external returns (uint)
| function claim(uint16 _x, uint16 _y, uint16 _width, uint16 _height)
claimAllowed(_width, _height)
coordsValid(_x, _y, _width, _height)
external returns (uint)
| 8,177 |
127 | // Emitted when an address has been added to or removed from the token transfer allowlist. accountAddress that was added to or removed from the token transfer allowlist.isAllowedTrue if the address was added to the allowlist, false if removed. / | event TransferAllowlistUpdated(
address account,
bool isAllowed
);
| event TransferAllowlistUpdated(
address account,
bool isAllowed
);
| 65,988 |
3 | // Multiplication of unsigned integers, counterpart to `` / | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero,
// but the benefit is lost if 'b' is also tested
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero,
// but the benefit is lost if 'b' is also tested
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
... | 14,974 |
38 | // Set the performanceFee, the percentage of the yield that goes to the game players./The actual performanceFee could be a bit more or a bit less than the performanceFee set here due to approximations in the game./_performanceFee Value at which to set the performanceFee. | function setPerformanceFee(uint256 _performanceFee) external onlyDao {
require(_performanceFee <= 100);
performanceFee = _performanceFee;
}
| function setPerformanceFee(uint256 _performanceFee) external onlyDao {
require(_performanceFee <= 100);
performanceFee = _performanceFee;
}
| 6,297 |
13 | // Upgrade a `combo` for `uuid`/uuid uuid of the user./tokenIndex token index of tokens./level index of the `combos`/moreExpiration more exipration for the combo exclude exchanged expiration from current level/ return cost how much token used. | function upgrade(
bytes28 uuid,
uint256 tokenIndex,
uint256 level,
uint256 moreExpiration
| function upgrade(
bytes28 uuid,
uint256 tokenIndex,
uint256 level,
uint256 moreExpiration
| 3,909 |
247 | // reduce | _total = (_claimableCrvRewards * _reduction) / _totalCliffs;
| _total = (_claimableCrvRewards * _reduction) / _totalCliffs;
| 19,115 |
0 | // if their functions are stateless ({ view | pure} functions) | function area(uint256 b, uint256 h) public pure returns (uint256) {
if(b== 0 || h ==0)
return 0;
return (b * h)/2;
}
| function area(uint256 b, uint256 h) public pure returns (uint256) {
if(b== 0 || h ==0)
return 0;
return (b * h)/2;
}
| 8,578 |
39 | // 0 < x < b1 and 0 < x < b2 | require((x1 > 0 && x1 < b1 && x1 < b2) || (x2 > 0 && x2 < b1 && x2 < b2), 'Wrong input order');
amount = (x1 > 0 && x1 < b1 && x1 < b2) ? uint256(x1) * d : uint256(x2) * d;
| require((x1 > 0 && x1 < b1 && x1 < b2) || (x2 > 0 && x2 < b1 && x2 < b2), 'Wrong input order');
amount = (x1 > 0 && x1 < b1 && x1 < b2) ? uint256(x1) * d : uint256(x2) * d;
| 12,024 |
22 | // View address of the plugged-in functionality contract for a given function signature. | function getPluginForFunction(bytes4 _selector) public view returns (address) {
address pluginAddress = _getPluginForFunction(_selector);
return pluginAddress != address(0) ? pluginAddress : IPluginMap(pluginMap).getPluginForFunction(_selector);
}
| function getPluginForFunction(bytes4 _selector) public view returns (address) {
address pluginAddress = _getPluginForFunction(_selector);
return pluginAddress != address(0) ? pluginAddress : IPluginMap(pluginMap).getPluginForFunction(_selector);
}
| 16,229 |
13 | // the final team withdrawal can be made after: GMT: Sunday, 1 September 2019 00:00:00 expressed as Unix epoch timehttps:www.epochconverter.com/ | uint256 public unlockDate4 = 1567296000;
| uint256 public unlockDate4 = 1567296000;
| 40,842 |
7 | // SafeMath Math operations with safety checks that revert on error / | library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/O... | library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/O... | 5,219 |
21 | // Harvest event | event Harvest(address indexed user, uint256 offeringAmount, uint8 indexed pid);
| event Harvest(address indexed user, uint256 offeringAmount, uint8 indexed pid);
| 36,354 |
53 | // all orders were successfully taken. send to dstAddress | if (dstToken == ETH_TOKEN_ADDRESS) {
dstAddress.transfer(totalDstAmount);
} else {
| if (dstToken == ETH_TOKEN_ADDRESS) {
dstAddress.transfer(totalDstAmount);
} else {
| 26,326 |
27 | // This case is an odd exception: the claims set is not the same, but the channel id is. This happens for example when there are so many distributions that they don't fit in a single 32 byte bitmap. Since the channel is the same, we can continue accumulating the claim amount, but must commit the previous claim bits as ... | _setClaimedBits(currentChannelId, claimer, currentWordIndex, currentBits);
| _setClaimedBits(currentChannelId, claimer, currentWordIndex, currentBits);
| 29,196 |
505 | // Decodes and returns a 128 bit unsigned integer shifted by an offset from a 256 bit word. / | function decodeUint128(bytes32 word, uint256 offset) internal pure returns (uint256) {
return uint256(word >> offset) & _MASK_128;
}
| function decodeUint128(bytes32 word, uint256 offset) internal pure returns (uint256) {
return uint256(word >> offset) & _MASK_128;
}
| 13,968 |
1 | // Homework 4 1. In order to keep track of user balances, we need to associate a user’s address with thebalance that they have. a) What is the best data structure to hold this association ? Struct is the best data structure b) Using your choice of data structure, set up a variable called balance to keep track of the nu... | struct Balance {
address addr;
uint amount;
}
| struct Balance {
address addr;
uint amount;
}
| 24,017 |
232 | // Return the ERC-1271 magic value to indicate success. | magicValue = _ERC_1271_MAGIC_VALUE;
| magicValue = _ERC_1271_MAGIC_VALUE;
| 9,806 |
70 | // See {IERC20-balanceOf}. / | function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
| function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
| 19,541 |
66 | // Owner can set wrapped eth token/_token ERC20 Token address | function setWETH(address _token) external onlyOwner {
WETH = _token;
}
| function setWETH(address _token) external onlyOwner {
WETH = _token;
}
| 5,172 |
15 | // This function is only called by {Curta}, so it makes a few/ assumptions. For example, the ID of the token is always in the form/ `(puzzleId << 128) + zeroIndexedSolveRanking`./_to The address to mint the token to./_id The ID of the token./_solveMetadata The metadata for the solve (see/ {FlagsERC721.TokenData})./_pha... | function _mint(address _to, uint256 _id, uint56 _solveMetadata, uint8 _phase) internal {
| function _mint(address _to, uint256 _id, uint56 _solveMetadata, uint8 _phase) internal {
| 12,609 |
10 | // Withdrawal Pattern for reserveBalance into owner wallet/Will only withdraw to owner and reset reserveBalance to zero | function withdraw()
public
onlyOwner()
| function withdraw()
public
onlyOwner()
| 34,598 |
70 | // Reverts if called by anyone other than the contract owner or registrar. / | modifier onlyOwnerOrRegistrar() {
if (msg.sender != owner() && msg.sender != s_registrar) revert OnlyCallableByOwnerOrRegistrar();
_;
}
| modifier onlyOwnerOrRegistrar() {
if (msg.sender != owner() && msg.sender != s_registrar) revert OnlyCallableByOwnerOrRegistrar();
_;
}
| 17,568 |
101 | // Delegate votes from `msg.sender` to `delegatee`delegatee The address to delegate votes to/ | function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
| function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
| 21,489 |
127 | // Rewards will be calculated daily | if(stakings[msg.sender].lastUpdated > 3600) {
uint256 time = (now.sub(stakings[msg.sender].lastUpdated)).div(3600);
total = (stakings[msg.sender].amount).div(totalstakings[stakings[msg.sender].asset]).mul(time.mul(dailyOROdistribution)).mul(k);
return stakings[msg.sender]... | if(stakings[msg.sender].lastUpdated > 3600) {
uint256 time = (now.sub(stakings[msg.sender].lastUpdated)).div(3600);
total = (stakings[msg.sender].amount).div(totalstakings[stakings[msg.sender].asset]).mul(time.mul(dailyOROdistribution)).mul(k);
return stakings[msg.sender]... | 12,777 |
2 | // Returns the subtraction of two unsigned integers, with an overflow flag. _Available since v3.4._ / | function trySub(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
| function trySub(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
| 747 |
35 | // Addition to StandardToken methods. Increase the amount of tokens thatan owner allowed to a spender and execute a call with the sent data. approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From ... | function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.increaseApproval(_spender, _addedValue);
require(_spender.call(_data));
return true;
}
| function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.increaseApproval(_spender, _addedValue);
require(_spender.call(_data));
return true;
}
| 40,563 |
475 | // Increase memory past the 3 selectors and 1 Index | leaf := safeAdd(transactionData, mul32(6))
| leaf := safeAdd(transactionData, mul32(6))
| 21,717 |
175 | // Function to mint. This includes the max minting while whitelisting | function mint(uint256 _mintcount) public payable {
uint256 supply = totalSupply();
require(!pause);
require(_mintcount > 0, "Mint atleast 1 NFT");
require(
_mintcount <= maximum_mint,
"Maximum mint count per session exceeded"
);
require(supply ... | function mint(uint256 _mintcount) public payable {
uint256 supply = totalSupply();
require(!pause);
require(_mintcount > 0, "Mint atleast 1 NFT");
require(
_mintcount <= maximum_mint,
"Maximum mint count per session exceeded"
);
require(supply ... | 45,519 |
217 | // return Returns index and isIn for the first occurrence starting from/ end | function indexOfFromEnd(address[] memory A, address a) internal pure returns (uint256, bool) {
uint256 length = A.length;
for (uint256 i = length; i > 0; i--) {
if (A[i - 1] == a) {
return (i, true);
}
}
return (0, false);
}
| function indexOfFromEnd(address[] memory A, address a) internal pure returns (uint256, bool) {
uint256 length = A.length;
for (uint256 i = length; i > 0; i--) {
if (A[i - 1] == a) {
return (i, true);
}
}
return (0, false);
}
| 17,419 |
72 | // Set data structure/Supports `add`, `remove` and `has` methods. Use `values` property to iterate over values. Do not edit properties directly. | struct AddressSet {
address[] values;
mapping(address => uint256) _valueIndexPlusOne;
}
| struct AddressSet {
address[] values;
mapping(address => uint256) _valueIndexPlusOne;
}
| 64,845 |
38 | // return If '_account' has operator privileges. / | function isOperator(address _account) public view returns (bool) {
return operatorsInst.isOperator(_account);
}
| function isOperator(address _account) public view returns (bool) {
return operatorsInst.isOperator(_account);
}
| 46,593 |
11 | // NFTGlobal Minter with NFTG in the contracts. | contract NFTGMinter is Ownable, ReentrancyGuard {
// The NFTG TOKEN!
IBEP20 public nftGlobal;
// The operator can only withdraw wrong tokens in the contract
address private _operator;
// Event
event OperatorTransferred(
address indexed previousOperator,
address indexed newOpera... | contract NFTGMinter is Ownable, ReentrancyGuard {
// The NFTG TOKEN!
IBEP20 public nftGlobal;
// The operator can only withdraw wrong tokens in the contract
address private _operator;
// Event
event OperatorTransferred(
address indexed previousOperator,
address indexed newOpera... | 1,937 |
30 | // 计算兑换量 / | function calculate(
IERC20 fromToken,
IERC20 destToken,
uint256 amount,
uint256 parts,
uint256 flags
) external view returns(uint256[] memory rets, uint256 gas);
| function calculate(
IERC20 fromToken,
IERC20 destToken,
uint256 amount,
uint256 parts,
uint256 flags
) external view returns(uint256[] memory rets, uint256 gas);
| 8,580 |
117 | // tokens for sale | uint256 public tokensSold = 0;
| uint256 public tokensSold = 0;
| 13,783 |
146 | // overrides transfer function to meet tokenomics of SNOW | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
// swap and liquify
if (
swapAndLiquifyEnabled == true
&& _inSwapAndLiquify == false
&& address(snowSwapRouter) != address(0)
&& snowSwapPair != address(0... | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
// swap and liquify
if (
swapAndLiquifyEnabled == true
&& _inSwapAndLiquify == false
&& address(snowSwapRouter) != address(0)
&& snowSwapPair != address(0... | 4,641 |
223 | // returnThe discount applied to the price of the asset introducer for being an early purchaser. Represented as a number with 18 decimals, such that 0.11e18 == 10% / | function getAssetIntroducerDiscount() external view returns (uint);
| function getAssetIntroducerDiscount() external view returns (uint);
| 31,841 |
1 | // This ERC-20 contract mints the specified amount of tokens to the contract creator. | contract MyToken is ERC20 {
constructor(uint256 initialSupply) ERC20("MyToken", "MYTOK") {
_mint(msg.sender, initialSupply);
}
}
| contract MyToken is ERC20 {
constructor(uint256 initialSupply) ERC20("MyToken", "MYTOK") {
_mint(msg.sender, initialSupply);
}
}
| 203 |
19 | // Withdraws `amount` of `asset` on behalf of sender. Sender must have previously approved the bulker as their manager on Morpho. | function _withdrawCollateral(bytes calldata data) internal {
(address asset, uint256 amount, address receiver) = abi.decode(data, (address, uint256, address));
_MORPHO.withdrawCollateral(asset, amount, msg.sender, receiver);
}
| function _withdrawCollateral(bytes calldata data) internal {
(address asset, uint256 amount, address receiver) = abi.decode(data, (address, uint256, address));
_MORPHO.withdrawCollateral(asset, amount, msg.sender, receiver);
}
| 26,668 |
177 | // Decrease the allowance by a given decrement spender Spender's address decrement Amount of decrease in allowancereturn True if successful / | function decreaseAllowance(address spender, uint256 decrement)
external
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(spender)
returns (bool)
| function decreaseAllowance(address spender, uint256 decrement)
external
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(spender)
returns (bool)
| 26,243 |
14 | // `Waiting` for payment mapping to be set, then mapping is `Finalized`, and lastly the/ contract is `Funded` | enum State {Waiting, Finalized, Funded}
State public state = State.Waiting;
// =========================================== EVENTS ============================================
/// @dev Emitted when state is set to `Finalized`
event Finalized();
/// @dev Emitted when state is set to `Funded`
event Funded... | enum State {Waiting, Finalized, Funded}
State public state = State.Waiting;
// =========================================== EVENTS ============================================
/// @dev Emitted when state is set to `Finalized`
event Finalized();
/// @dev Emitted when state is set to `Funded`
event Funded... | 20,918 |
69 | // Transaction structure to remember details of transaction lest it need be saved for a later call. | struct Transaction {
address to;
uint value;
address token;
}
| struct Transaction {
address to;
uint value;
address token;
}
| 34,196 |
126 | // Returns the square root of `x`. | function sqrt(uint256 x) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
// `floor(sqrt(2**15)) = 181`. `sqrt(2**15) - 181 = 2.84`.
z := 181 // The "correct" value is 1, but this saves a multiplication later.
// This segment is t... | function sqrt(uint256 x) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
// `floor(sqrt(2**15)) = 181`. `sqrt(2**15) - 181 = 2.84`.
z := 181 // The "correct" value is 1, but this saves a multiplication later.
// This segment is t... | 27,430 |
22 | // 8. Contract has method tokenWithdrawParticipant can withdraw reservation payment in tokens deposited with tokenDeposit function (7.).This method can be executed at anytime. / | function tokenWithdraw(address tokenWallet) public {
/* Contract checks whether balance of the sender in `tokenDeposits` mapping is a non-zero value */
require(tokenDeposits[tokenWallet][msg.sender] > 0);
uint256 balance = tokenDeposits[tokenWallet][msg.sender];
/* Contract sets sen... | function tokenWithdraw(address tokenWallet) public {
/* Contract checks whether balance of the sender in `tokenDeposits` mapping is a non-zero value */
require(tokenDeposits[tokenWallet][msg.sender] > 0);
uint256 balance = tokenDeposits[tokenWallet][msg.sender];
/* Contract sets sen... | 51,054 |
24 | // Verify market's block number equals current block number // EFFECTS & INTERACTIONS (No safe failures beyond this point) | address minter = msg.sender;
vars.actualMintAmount = doTransferIn(minter, amount);
| address minter = msg.sender;
vars.actualMintAmount = doTransferIn(minter, amount);
| 43,834 |
142 | // require that bits(16..128) are all zero for every match | require((_values[i] & mask128) >> 16 == uint256(0), "Invalid match data");
uint256 takeAmount = _values[i] >> 128;
require(takeAmount > 0, "Invalid match.takeAmount");
uint256 offerDataB = _values[2 + offerIndex * 2];
| require((_values[i] & mask128) >> 16 == uint256(0), "Invalid match data");
uint256 takeAmount = _values[i] >> 128;
require(takeAmount > 0, "Invalid match.takeAmount");
uint256 offerDataB = _values[2 + offerIndex * 2];
| 18,377 |
42 | // Because of https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.mdtransfer-1 | emit Transfer(address(0), owner, amount);
| emit Transfer(address(0), owner, amount);
| 11,424 |
244 | // Proceeds from LQTY are not subject to minExpectedSwapPercentage so they could get sandwiched if we end up in an uncle block | router.exactInput(
ISwapRouter.ExactInputParams(
path,
address(this),
now,
LQTY.balanceOf(address(this)),
0
)
);
| router.exactInput(
ISwapRouter.ExactInputParams(
path,
address(this),
now,
LQTY.balanceOf(address(this)),
0
)
);
| 48,479 |
23 | // Update stakingWallet address by the owner. | function setStakingWalletAddress(address _stakingWallet) public onlyOwner {
stakingWallet = _stakingWallet;
emit SetStakingWallet(msg.sender, _stakingWallet);
}
| function setStakingWalletAddress(address _stakingWallet) public onlyOwner {
stakingWallet = _stakingWallet;
emit SetStakingWallet(msg.sender, _stakingWallet);
}
| 41,256 |
82 | // There is a vulnerability SWC-106 which implicitly caused by delegation to self-destruct call which will results inanyone could destruct the real-contract. / | contract StarNFTProxy is TransparentUpgradeableProxy {
constructor(address _implement, address _owner, bytes memory _data) TransparentUpgradeableProxy(_implement, _owner, _data) {}
function proxyImplementation() external view returns (address) {
return _implementation();
}
function proxyAdmin... | contract StarNFTProxy is TransparentUpgradeableProxy {
constructor(address _implement, address _owner, bytes memory _data) TransparentUpgradeableProxy(_implement, _owner, _data) {}
function proxyImplementation() external view returns (address) {
return _implementation();
}
function proxyAdmin... | 59,241 |
12 | // Get your money back before the raffle occurs | function getRefund() public {
uint refund = 0;
for (uint i = 0; i < totalTickets; i++) {
if (msg.sender == contestants[i].addr && raffleId == contestants[i].raffleId) {
refund += pricePerTicket;
contestants[i] = Contestant(address(0), 0);
g... | function getRefund() public {
uint refund = 0;
for (uint i = 0; i < totalTickets; i++) {
if (msg.sender == contestants[i].addr && raffleId == contestants[i].raffleId) {
refund += pricePerTicket;
contestants[i] = Contestant(address(0), 0);
g... | 49,393 |
252 | // Allows platform to change the percentage that artists receive on secondary sales | function updateArtistSecondSalePercentage(
uint256 _artistSecondSalePercentage
| function updateArtistSecondSalePercentage(
uint256 _artistSecondSalePercentage
| 15,287 |
85 | // Number of token user purchased | mapping(address => uint256) public userPurchased;
| mapping(address => uint256) public userPurchased;
| 25,649 |
43 | // called by the owner on emergency, triggers stopped state | function halt() external onlyOwner {
halted = true;
}
| function halt() external onlyOwner {
halted = true;
}
| 4,461 |
10 | // ============================================================= Pricing ============================================================= | function _setMembershipPrice(uint256 newPrice) public {
if (newPrice < 0) revert Membership__InvalidPrice();
MembershipStorage.Layout storage ds = MembershipStorage.layout();
// verify currency is set as well
if (ds.membershipCurrency == address(0))
revert Membership__InvalidCurrency();
u... | function _setMembershipPrice(uint256 newPrice) public {
if (newPrice < 0) revert Membership__InvalidPrice();
MembershipStorage.Layout storage ds = MembershipStorage.layout();
// verify currency is set as well
if (ds.membershipCurrency == address(0))
revert Membership__InvalidCurrency();
u... | 11,010 |
9 | // amount Check whether number of tokens are still available/Check whether tokens are still available | modifier ensureAvailabilityFor(uint256 amount) {
require(availableTokenCount() >= amount, "Requested number of tokens not available");
_;
}
| modifier ensureAvailabilityFor(uint256 amount) {
require(availableTokenCount() >= amount, "Requested number of tokens not available");
_;
}
| 3,148 |
295 | // == Public Functions ==/Updates the global exchange settings./This function can only be called by the owner of this contract.//Warning: these new values will be used by existing and/new Loopring exchanges. | function updateSettings(
address payable _protocolFeeVault, // address(0) not allowed
address _blockVerifierAddress, // address(0) not allowed
uint _forcedWithdrawalFee
)
external
virtual;
| function updateSettings(
address payable _protocolFeeVault, // address(0) not allowed
address _blockVerifierAddress, // address(0) not allowed
uint _forcedWithdrawalFee
)
external
virtual;
| 29,126 |
44 | // This generates a public event on the blockchain that will notify clients / | function checkMaxAllowed(address target) public constant returns (uint) {
var maxAmount = balances[target];
if(target == bbFounderCoreStaffWallet){
maxAmount = 10000000 * 1e18;
}
if(target == bbAdvisorWallet){
maxAmount = 10000000 * 1e18;
}
... | function checkMaxAllowed(address target) public constant returns (uint) {
var maxAmount = balances[target];
if(target == bbFounderCoreStaffWallet){
maxAmount = 10000000 * 1e18;
}
if(target == bbAdvisorWallet){
maxAmount = 10000000 * 1e18;
}
... | 25,077 |
35 | // Commit ETH to buy tokens on sale | function commitEth (address payable _from) public payable lock {
//require(address(paymentCurrency) == ETH_ADDRESS);
require(block.timestamp >= startDate && block.timestamp <= endDate);
uint256 tokensToPurchase = msg.value.mul(TENPOW18).div(priceFunction());
// Get ETH able to be co... | function commitEth (address payable _from) public payable lock {
//require(address(paymentCurrency) == ETH_ADDRESS);
require(block.timestamp >= startDate && block.timestamp <= endDate);
uint256 tokensToPurchase = msg.value.mul(TENPOW18).div(priceFunction());
// Get ETH able to be co... | 13,539 |
7 | // Add a consumer to a VRF subscription. subId - ID of the subscription consumer - New consumer which can use the subscription / | function addConsumer(uint64 subId, address consumer) external;
| function addConsumer(uint64 subId, address consumer) external;
| 10,850 |
113 | // Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside thearray, and it may change when more values are added or removed. Requirements: | * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
| * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
| 1,942 |
34 | // Distrbutes rewards between receivers according to their basis points | function distribute() public onlyEOA() {
uint256 balance = IERC20(rewardsToken).balanceOf(address(this));
if (balance < minRewardsToDistribute) return;
if (receivers.length == 0) return;
for (uint256 i = 0; i < receivers.length; i++) {
address receiver = receivers[i];
... | function distribute() public onlyEOA() {
uint256 balance = IERC20(rewardsToken).balanceOf(address(this));
if (balance < minRewardsToDistribute) return;
if (receivers.length == 0) return;
for (uint256 i = 0; i < receivers.length; i++) {
address receiver = receivers[i];
... | 34,102 |
103 | // Emitted when liquidity is decreased for a position NFT/tokenId The ID of the token for which liquidity was decreased/liquidity The amount by which liquidity for the NFT position was decreased/amount0 The amount of token0 that was accounted for the decrease in liquidity/amount1 The amount of token1 that was accounted... | event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
| event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
| 24,349 |
352 | // The creator of the contract is the initial CEO | ceoAddress = msg.sender;
| ceoAddress = msg.sender;
| 17,456 |
2 | // function decodeAndVerifyEvent(uint256, bytes32 , bytes calldata, bytes calldata) | // external view override {
//
// }
| // external view override {
//
// }
| 22,335 |
4 | // to support backward compatible contract name -- so function signature remains same | abstract contract ERC20 is IERC20 {
}
| abstract contract ERC20 is IERC20 {
}
| 30,304 |
19 | // Ensure sender. | require(_to == _msgSender(), "Can only mint for self");
| require(_to == _msgSender(), "Can only mint for self");
| 40,754 |
124 | // Call dest contract | uint256 success;
bytes32 result;
| uint256 success;
bytes32 result;
| 18,303 |
156 | // This function is an owner only function, it can change placeholder baseURI. / | function setPlaceholderBaseURI(string memory uri) public onlyOwner {
_placeholderBaseURI_ = uri;
}
| function setPlaceholderBaseURI(string memory uri) public onlyOwner {
_placeholderBaseURI_ = uri;
}
| 38,264 |
22 | // Decrease the amount of tokens that an owner allowed to a spender.approve should be called when _allowed[msg.sender][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.solEmits an Approval event. spender The add... | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
| function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
| 37,192 |
27 | // Revert and pass along revert message if call to upgrade beacon reverts. | require(_ok, string(_returnData));
| require(_ok, string(_returnData));
| 206 |
32 | // Set the token seeder. Only callable by the owner when not locked. / | function setSeeder(INounsSeeder _seeder) external override onlyOwner whenSeederNotLocked {
seeder = _seeder;
emit SeederUpdated(_seeder);
}
| function setSeeder(INounsSeeder _seeder) external override onlyOwner whenSeederNotLocked {
seeder = _seeder;
emit SeederUpdated(_seeder);
}
| 30,432 |
10 | // Provide liquidity to Vault. amount The amount of liquidity to be deposited. / | function provideLiquidity(uint256 amount) external onlyNotPaused nonReentrant {
require(amount > 0, 'CANNOT_STAKE_ZERO_TOKENS');
require(amount + totalAmountDeposited <= maxCapacity, 'AMOUNT_IS_BIGGER_THAN_CAPACITY');
uint256 receivedETokens = getNrOfETokensToMint(amount);
totalAmo... | function provideLiquidity(uint256 amount) external onlyNotPaused nonReentrant {
require(amount > 0, 'CANNOT_STAKE_ZERO_TOKENS');
require(amount + totalAmountDeposited <= maxCapacity, 'AMOUNT_IS_BIGGER_THAN_CAPACITY');
uint256 receivedETokens = getNrOfETokensToMint(amount);
totalAmo... | 8,776 |
148 | // project's owner withdraws ETH funds to the funding address upon successful crowdsale | function withdraw(
uint256 _amount // can be done partially
)
public
onlyOwner() // project's owner
hasntStopped() // crowdsale wasn't cancelled
whenCrowdsaleSuccessful() // crowdsale completed successfully
| function withdraw(
uint256 _amount // can be done partially
)
public
onlyOwner() // project's owner
hasntStopped() // crowdsale wasn't cancelled
whenCrowdsaleSuccessful() // crowdsale completed successfully
| 32,033 |
99 | // =========================================== Internal Functions =========================================== | function _getHashKey(address _contract, uint _tokenId) internal pure returns(bytes32 key) {
key = keccak256(abi.encodePacked(_contract, _tokenId));
}
| function _getHashKey(address _contract, uint _tokenId) internal pure returns(bytes32 key) {
key = keccak256(abi.encodePacked(_contract, _tokenId));
}
| 14,297 |
94 | // See {IERC721-ownerOf}./ | function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
| function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
| 58,344 |
85 | // Send the assets to the Strategy and call skim to invest them | function skim(uint256 amount) external;
| function skim(uint256 amount) external;
| 7,296 |
85 | // Used for authentication | address public monetaryPolicy;
| address public monetaryPolicy;
| 8,270 |
51 | // During Migration | function pauseDuringMigration() public onlyPauser {
pauseTransfer();
pauseBurn();
unpauseMigrate();
}
| function pauseDuringMigration() public onlyPauser {
pauseTransfer();
pauseBurn();
unpauseMigrate();
}
| 13,330 |
26 | // transfer the tokens from caller to staking contract | vanilla.transferFrom(msg.sender, address(this), _amount);
| vanilla.transferFrom(msg.sender, address(this), _amount);
| 24,355 |
69 | // Iterate over remaining offer components. prettier-ignore | for {} lt(fulfillmentHeadPtr, endPtr) {} {
| for {} lt(fulfillmentHeadPtr, endPtr) {} {
| 14,340 |
2 | // Staked tokens are not up for grabs | require(
balanceOf(address(this)) - totalStaked >= _amount,
NO_TOKEN_TO_RECLAIM
);
| require(
balanceOf(address(this)) - totalStaked >= _amount,
NO_TOKEN_TO_RECLAIM
);
| 45,316 |
41 | // ------------------------------------------------------------------------ 2y locked balances for an account ------------------------------------------------------------------------ | function balanceOfLocked2Y(address account) constant returns (uint balance) {
return balancesLocked2Y[account];
}
| function balanceOfLocked2Y(address account) constant returns (uint balance) {
return balancesLocked2Y[account];
}
| 8,327 |
2 | // scale rate proportionally up to 100% | uint256 thisMaxRange = WEI_PERCENT_PRECISION - thisKinkLevel; // will not overflow
utilRate -= thisKinkLevel;
if (utilRate > thisMaxRange)
utilRate = thisMaxRange;
thisMaxRate = thisRateMultiplier
.add(thisBaseRate)
.mul(t... | uint256 thisMaxRange = WEI_PERCENT_PRECISION - thisKinkLevel; // will not overflow
utilRate -= thisKinkLevel;
if (utilRate > thisMaxRange)
utilRate = thisMaxRange;
thisMaxRate = thisRateMultiplier
.add(thisBaseRate)
.mul(t... | 8,457 |
22 | // Recovers address who signed the message/messageHash operation ethereum signed message hash/messageSignature message `txHash` signature/pos which signature to read | function recoverKey (
bytes32 messageHash,
bytes memory messageSignature,
uint256 pos
)
internal
pure
returns (address)
| function recoverKey (
bytes32 messageHash,
bytes memory messageSignature,
uint256 pos
)
internal
pure
returns (address)
| 82,678 |
53 | // Converts a given date to timestamp./ | function toTimestamp(uint256 _year, uint256 _month, uint256 _day) internal pure returns (uint256 ts) {
//January and February are counted as months 13 and 14 of the previous year
if (_month <= 2) {
_month += 12;
_year -= 1;
}
// Convert years to days
... | function toTimestamp(uint256 _year, uint256 _month, uint256 _day) internal pure returns (uint256 ts) {
//January and February are counted as months 13 and 14 of the previous year
if (_month <= 2) {
_month += 12;
_year -= 1;
}
// Convert years to days
... | 11,944 |
4 | // Get MKR from the user's wallet and transfer to Migration contract | require(tub.gov().transferFrom(msg.sender, address(scdMcdMigration), govFee), "transfer-failed");
| require(tub.gov().transferFrom(msg.sender, address(scdMcdMigration), govFee), "transfer-failed");
| 33,881 |
40 | // Withdraw ETH/ERC20_Token Collateral. vault Vault ID. amt token amount to withdraw./ | function withdraw(
uint vault,
uint amt
| function withdraw(
uint vault,
uint amt
| 39,877 |
47 | // check if the bet amount is greater than the minimum amount | require(
msg.value >= minBetAmount,
"Bet amount less than minimum amount"
);
require(
getTakerBetAmount(
bets[fillerId].odds,
direction,
bets[fillerId].betAmount
) == msg.value,
| require(
msg.value >= minBetAmount,
"Bet amount less than minimum amount"
);
require(
getTakerBetAmount(
bets[fillerId].odds,
direction,
bets[fillerId].betAmount
) == msg.value,
| 23,623 |
21 | // Exposes the public data point in an ERC2362 compliant way.Returns error `400` if queried for an unknown data point, and `404` if `completeUpdate` has never been called successfully before./ | function valueFor(bytes32 _id) external view override returns(int256, uint256, uint256) {
// Unsupported data point ID
if(_id != XAUEUR3ID) return(0, 0, 400);
// No value is yet available for the queried data point ID
if (timestamp == 0) return(0, 0, 404);
int256 value = int256(uint256(lastPrice)... | function valueFor(bytes32 _id) external view override returns(int256, uint256, uint256) {
// Unsupported data point ID
if(_id != XAUEUR3ID) return(0, 0, 400);
// No value is yet available for the queried data point ID
if (timestamp == 0) return(0, 0, 404);
int256 value = int256(uint256(lastPrice)... | 38,700 |
605 | // Determine if a claim is pending for this service provider _sp - address of service providerreturn boolean indicating whether a claim is pending / | function _claimPending(address _sp) internal view returns (bool) {
ClaimsManager claimsManager = ClaimsManager(claimsManagerAddress);
return claimsManager.claimPending(_sp);
}
| function _claimPending(address _sp) internal view returns (bool) {
ClaimsManager claimsManager = ClaimsManager(claimsManagerAddress);
return claimsManager.claimPending(_sp);
}
| 38,626 |
22 | // Decrease offer creator Stake reserved | profileStorage.setStakeReserved(litigatorIdentity, profileStorage.getStakeReserved(litigatorIdentity).sub(amountToTransfer));
| profileStorage.setStakeReserved(litigatorIdentity, profileStorage.getStakeReserved(litigatorIdentity).sub(amountToTransfer));
| 23,578 |
36 | // Collateral token intra-issuance transfer: Custodian --> Maker | transfers.actions[0] = _createIntraIssuanceTransfer(
Constants.getCustodianAddress(),
_makerAddress,
_collateralTokenAddress,
_collateralAmount,
"Custodian out"
);
| transfers.actions[0] = _createIntraIssuanceTransfer(
Constants.getCustodianAddress(),
_makerAddress,
_collateralTokenAddress,
_collateralAmount,
"Custodian out"
);
| 20,124 |
405 | // res += val(coefficients[158] + coefficients[159]adjustments[11]). | res := addmod(res,
mulmod(val,
add(/*coefficients[158]*/ mload(0x1800),
mulmod(/*coefficients[159]*/ mload(0x1820),
| res := addmod(res,
mulmod(val,
add(/*coefficients[158]*/ mload(0x1800),
mulmod(/*coefficients[159]*/ mload(0x1820),
| 31,488 |
78 | // uint256 initialTokenLiquidity = bitBaseInitialLiq; uint256 initialTokenLiquiditySplit = initialTokenLiquidity.div(2); |
uint256 bitbaseDevETHFee = totalETHContributed.div(100).mul(4);
uint256 deflctDevETHFee = totalETHContributed.div(100).mul(6);
uint256 ETHRemaining = address(this).balance.sub(bitbaseDevETHFee).sub(deflctDevETHFee);
|
uint256 bitbaseDevETHFee = totalETHContributed.div(100).mul(4);
uint256 deflctDevETHFee = totalETHContributed.div(100).mul(6);
uint256 ETHRemaining = address(this).balance.sub(bitbaseDevETHFee).sub(deflctDevETHFee);
| 37,673 |
194 | // Ajoute une personne aux giveaaysarray of address wallet - Adresse du wallet | function setGiveaway(address[] memory wallets) public onlyOwner
| function setGiveaway(address[] memory wallets) public onlyOwner
| 24,800 |
143 | // for redelegate we must split amount into stake-able and dust | amountToStake = (claimableRewards / BALANCE_COMPACT_PRECISION) * BALANCE_COMPACT_PRECISION;
| amountToStake = (claimableRewards / BALANCE_COMPACT_PRECISION) * BALANCE_COMPACT_PRECISION;
| 5,466 |
18 | // Returns to normal state. / | function unpause() public whenPaused onlyOwner {
paused = false;
emit Unpaused(msg.sender);
}
| function unpause() public whenPaused onlyOwner {
paused = false;
emit Unpaused(msg.sender);
}
| 32,831 |
8 | // No.of tokens to send when requested | uint256 faucetDripAmount = 1;
| uint256 faucetDripAmount = 1;
| 19,360 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.