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 |
|---|---|---|---|---|
127 | // Updates balance of winner with entire game pot | balances[_winner] += _pot;
| balances[_winner] += _pot;
| 36,149 |
41 | // Set the symbol for display purposes | symbol = "BIANG";
| symbol = "BIANG";
| 58,231 |
231 | // Checks whether _spender is approved to spend tokens on _owners behalf or owner itself/_spender address Address of spender/_owner address Address of owner/_tokenId address tokenId of interest/ return Returns whether _spender is approved to spend tokens | function isApprovedOrOwner(
address _spender,
address _owner,
uint256 _tokenId
| function isApprovedOrOwner(
address _spender,
address _owner,
uint256 _tokenId
| 29,840 |
171 | // No need to challenge again if a handle is already being challenged. | require(
challengeExpiryOf[_handle] == 0,
"Projects::challenge: HANDLE_ALREADY_BEING_CHALLENGED"
);
| require(
challengeExpiryOf[_handle] == 0,
"Projects::challenge: HANDLE_ALREADY_BEING_CHALLENGED"
);
| 74,599 |
10 | // update state | weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
| weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
| 4,167 |
20 | // DAO treasury address | address public treasury;
| address public treasury;
| 17,691 |
38 | // No.of Staking Blocks | uint256 public noOfStakingBlocks;
| uint256 public noOfStakingBlocks;
| 41,805 |
1 | // if `xy < 2 ^ 256` | if (xyhi == 0) {
return xylo / z;
}
| if (xyhi == 0) {
return xylo / z;
}
| 13,906 |
14 | // Copy remaining bytes | uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
| uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
| 11,604 |
0 | // Maximum percentage factor (100.00%) | uint256 internal constant PERCENTAGE_FACTOR = 1e4;
| uint256 internal constant PERCENTAGE_FACTOR = 1e4;
| 8,594 |
89 | // approve fractionalized NFT Factory to withdraw NFT | nftContract.approve(address(tokenVaultFactory), tokenId);
| nftContract.approve(address(tokenVaultFactory), tokenId);
| 38,305 |
26 | // 3x1 ^ 2 | let t5 := addmod(add(t3, t3), t3, N)
| let t5 := addmod(add(t3, t3), t3, N)
| 18,563 |
11 | // Contract "ERC20Basic"Purpose: Defining ERC20 standard with basic functionality like - CheckBalance and Transfer including Transfer event / | contract ERC20Basic {
//Give realtime totalSupply of IAC token
uint256 public totalSupply;
//Get IAC token balance for provided address
function balanceOf(address who) view public returns (uint256);
//Transfer IAC token to provided address
function transfer(address _to, uint256 _value) public returns(boo... | contract ERC20Basic {
//Give realtime totalSupply of IAC token
uint256 public totalSupply;
//Get IAC token balance for provided address
function balanceOf(address who) view public returns (uint256);
//Transfer IAC token to provided address
function transfer(address _to, uint256 _value) public returns(boo... | 42,483 |
34 | // 1501016 means 1.51018 |
rounds.push(Round(
150 * 10**(16 + usdtDecimals - misDecimals),
1619161200, // start
72 * 3600,
20000 * 10**usdtDecimals,
50000 * 10**usdtDecimals,
270000 * 10**usdtDecimals // token supply in usdt
));
rounds.push(Round(
|
rounds.push(Round(
150 * 10**(16 + usdtDecimals - misDecimals),
1619161200, // start
72 * 3600,
20000 * 10**usdtDecimals,
50000 * 10**usdtDecimals,
270000 * 10**usdtDecimals // token supply in usdt
));
rounds.push(Round(
| 29,736 |
16 | // Unpauses all allocation claims (token payouts). | * See {Pausable-_unpause}.
*
* Requirements:
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() public {
require(hasRole(PAUSER_ROLE, _msgSender()), "Must have pauser role to unpause");
_unpause();
}
| * See {Pausable-_unpause}.
*
* Requirements:
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() public {
require(hasRole(PAUSER_ROLE, _msgSender()), "Must have pauser role to unpause");
_unpause();
}
| 32,905 |
15 | // function EIP712_EXCHANGE_DOMAIN_NAME() | bytes4 constant internal EIP_712_EXCHANGE_DOMAIN_NAME_SELECTOR = 0x63c4e8cc;
| bytes4 constant internal EIP_712_EXCHANGE_DOMAIN_NAME_SELECTOR = 0x63c4e8cc;
| 34,227 |
3 | // address usdtAddress = 0xA4001E78DBF93b929D1d558901c14D8154F31542; usdtInterface usdtContract = usdtInterface(usdtAddress); |
IERC20 usdtContract;
|
IERC20 usdtContract;
| 30,454 |
3 | // Gets all facet addresses and their four byte function selectors./ return facets_ Facet | function facets() external view returns (Facet[] memory facets_);
| function facets() external view returns (Facet[] memory facets_);
| 8,404 |
3 | // Release principal | msg.sender.transfer(futureRelease.amount);
| msg.sender.transfer(futureRelease.amount);
| 14,672 |
7 | // low level token purchase DO NOT OVERRIDE / | function buyTokens() public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_deliverTokens(tokens);
emit TokenPurchase(msg.sender, weiAmount, tokens);
_forwardFunds();
}
| function buyTokens() public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_deliverTokens(tokens);
emit TokenPurchase(msg.sender, weiAmount, tokens);
_forwardFunds();
}
| 14,383 |
17 | // seeds that are used to associate unique traits to each degen. all seeds are unique across combinations of degen id + rarity + generation. we use bitmaps for efficient storage and lookup. | library Seeds {
using Bitmaps for Bitmaps.Bitmap;
// stores unique seeds for each degen.
struct UniqueSeeds {
// mapping of unique seed to whether or not it's in use.
// mapping is
// generation
// \_ Rarity
// \_ inUseSeeds
mapping(uint256 => mapping(R... | library Seeds {
using Bitmaps for Bitmaps.Bitmap;
// stores unique seeds for each degen.
struct UniqueSeeds {
// mapping of unique seed to whether or not it's in use.
// mapping is
// generation
// \_ Rarity
// \_ inUseSeeds
mapping(uint256 => mapping(R... | 49,256 |
36 | // Underlying asset for the strategyreturn address Underlying asset address / | function underlying() external view returns (address);
| function underlying() external view returns (address);
| 51,330 |
21 | // Updates the treasury's fee variables, as detailed in speedBump[1]param: speedBump[1].uint16s[0] - the fee the mapp has to pay for any dispute raised, chargeable per gatewayparam: speedBump[1].uint16s[1] - the commission divider charged for every mapp to gateway transaction. param: speedBump[1].uint16s[2] - the penal... | function updateTreasuryFeeVariables() external onlyOperator() {
uint8 sb = 1;
uint256 sBTimeCreated = speedBumpTimeCreated(sb);
require(sBTimeCreated > 0, "Time created must be >0 (to stop replays of the speed bump)");
require(now > sBTimeCreated + (speedBumpCurre... | function updateTreasuryFeeVariables() external onlyOperator() {
uint8 sb = 1;
uint256 sBTimeCreated = speedBumpTimeCreated(sb);
require(sBTimeCreated > 0, "Time created must be >0 (to stop replays of the speed bump)");
require(now > sBTimeCreated + (speedBumpCurre... | 13,809 |
12 | // As per the EIP-165 spec, no interface should ever match 0xffffffff | bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
| bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
| 47,947 |
34 | // ERC721 START | event Transfer(address indexed _from, address indexed _to, uint indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
bytes4 private constant InterfaceId_ERC721 = 0x80... | event Transfer(address indexed _from, address indexed _to, uint indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
bytes4 private constant InterfaceId_ERC721 = 0x80... | 5,463 |
101 | // Returns the downcasted int64 from int256, reverting onoverflow (when the input is less than smallest int64 orgreater than largest int64). Counterpart to Solidity's `int64` operator. Requirements: - input must fit into 64 bits _Available since v3.1._ / | function toInt64(int256 value) internal pure returns (int64) {
require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
return int64(value);
}
| function toInt64(int256 value) internal pure returns (int64) {
require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
return int64(value);
}
| 8,344 |
7 | // ERC20 token address | address token;
| address token;
| 25,087 |
69 | // Calculate the average reward for the current periodstakingInfo the struct containing staking infototalReward the total reward in current periodexcludeLast whether or not exclude the last block return (uint256) number of blocks in history/ | function getCurrentPeriodAverageReward(
StakingInfo storage stakingInfo,
uint256 totalReward,
bool excludeLast
)
public
view
returns(uint256)
| function getCurrentPeriodAverageReward(
StakingInfo storage stakingInfo,
uint256 totalReward,
bool excludeLast
)
public
view
returns(uint256)
| 67,907 |
6 | // nonReentrant is a modifier to prevent reentry attack verify that msg.sender is the owner of tokenId | require(IERC721(nftContract).ownerOf(tokenId) == msg.sender, "You are not the owner");
require(price > 10, "Price must be greater than 10");
uint256 power = _erc721factory.quoOfId(tokenId).power;
uint256 level = _erc721factory.quoOfId(tokenId).lvl;
uint lastClaim = _erc721facto... | require(IERC721(nftContract).ownerOf(tokenId) == msg.sender, "You are not the owner");
require(price > 10, "Price must be greater than 10");
uint256 power = _erc721factory.quoOfId(tokenId).power;
uint256 level = _erc721factory.quoOfId(tokenId).lvl;
uint lastClaim = _erc721facto... | 53,738 |
30 | // Check loan asset | require(_loanAsset != address(0), "2");
| require(_loanAsset != address(0), "2");
| 40,415 |
447 | // Interface of the global ERC1820 Registry, as defined in theimplementers for interfaces in this registry, as well as query support. Implementers may be shared by multiple accounts, and can also implement morethan a single interface for each account. Contracts can implement interfacesfor themselves, but externally-own... | * {IERC165} interfaces can also be queried via the registry.
*
* For an in-depth explanation and source code analysis, see the EIP text.
*/
interface IERC1820Registry {
/**
* @dev Sets `newManager` as the manager for `account`. A manager of an
* account is able to set interface implementers for it.
... | * {IERC165} interfaces can also be queried via the registry.
*
* For an in-depth explanation and source code analysis, see the EIP text.
*/
interface IERC1820Registry {
/**
* @dev Sets `newManager` as the manager for `account`. A manager of an
* account is able to set interface implementers for it.
... | 11,281 |
35 | // Determines how ETH is stored/forwarded on purchases. / | function _forwardFunds() internal {
_wallet.transfer(msg.value);
}
| function _forwardFunds() internal {
_wallet.transfer(msg.value);
}
| 6,853 |
3 | // Disables a token on the caller's Credit Account/token Token to disable/This is an extenstion function that does not exist in the Credit Facade/ itself and can only be used within a multicall | function disableToken(address token) external;
| function disableToken(address token) external;
| 20,156 |
14 | // should be 0 for starters so distributionFormula detects new cycle on first day claim | uint256 public currentCycleLength;
| uint256 public currentCycleLength;
| 17,920 |
504 | // Claim tokens from the rebate pool. _allocationID Allocation from where we are claiming tokens _restake True if restake fees instead of transfer to indexer / | function claim(address _allocationID, bool _restake) external override notPaused {
_claim(_allocationID, _restake);
}
| function claim(address _allocationID, bool _restake) external override notPaused {
_claim(_allocationID, _restake);
}
| 84,512 |
28 | // Implements ITokenControllerHook |
function changeTokenController(address newController)
public
|
function changeTokenController(address newController)
public
| 51,104 |
34 | // read the confirmer from its calldata position in `packedMetadata` | shr(BIT_SHIFT_confirmer, calldataload(add(pointer, CALLDATA_OFFSET_confirmer)))
)
mstore(
| shr(BIT_SHIFT_confirmer, calldataload(add(pointer, CALLDATA_OFFSET_confirmer)))
)
mstore(
| 29,623 |
161 | // See {_canSetPlatformFeeInfo}. Emits {PlatformFeeInfoUpdated Event}; See {_setupPlatformFeeInfo}. _platformFeeRecipient Address to be set as new platformFeeRecipient._platformFeeBps Updated platformFeeBps. / | function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external override {
if (!_canSetPlatformFeeInfo()) {
revert("Not authorized");
}
| function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external override {
if (!_canSetPlatformFeeInfo()) {
revert("Not authorized");
}
| 13,098 |
14 | // Returns the owner and timestamp for a given ticker _ticker tickerreturn addressreturn uint256return uint256return stringreturn bool / | function getTickerDetails(string calldata _ticker) external view returns(address, uint256, uint256, string memory, bool);
| function getTickerDetails(string calldata _ticker) external view returns(address, uint256, uint256, string memory, bool);
| 34,896 |
15 | // first 2 nibbles are dropped while generating nibble array this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only) so converting to nibble array and then hashing it | MerklePatriciaProof._getNibbleArray(
inputDataRLPList[8].toBytes()
), // branchMask
inputDataRLPList[9].toUint() // receiptLogIndex
)
);
require(
processedExits[exitHash] == false,
"FxRootTunnel: EXIT... | MerklePatriciaProof._getNibbleArray(
inputDataRLPList[8].toBytes()
), // branchMask
inputDataRLPList[9].toUint() // receiptLogIndex
)
);
require(
processedExits[exitHash] == false,
"FxRootTunnel: EXIT... | 24,736 |
12 | // Withdraw staked tokens without caring about rewards rewards Needs to be for emergency. / | function emergencyWithdraw() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint256[] memory tokenArray = user.tokenIds;
uint256 tokensAmount = tokenArray.length;
uint256 pending = (tokensAmount * accTokenPerShare) /
PRECISION_FACTOR -
... | function emergencyWithdraw() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint256[] memory tokenArray = user.tokenIds;
uint256 tokensAmount = tokenArray.length;
uint256 pending = (tokensAmount * accTokenPerShare) /
PRECISION_FACTOR -
... | 34,030 |
76 | // Gets the BPT token price (in ETH) | uint256 bptPrice = BalancerUtils.getTimeWeightedOraclePrice(
address(BALANCER_POOL_TOKEN),
IPriceOracle.Variable.BPT_PRICE,
uint256(votingOracleWindowInSeconds)
);
| uint256 bptPrice = BalancerUtils.getTimeWeightedOraclePrice(
address(BALANCER_POOL_TOKEN),
IPriceOracle.Variable.BPT_PRICE,
uint256(votingOracleWindowInSeconds)
);
| 48,774 |
21 | // get LP balance of `recipient` | if (_supplied > 0) {
uint _supplyIndex0 = supplyIndex0[recipient];
| if (_supplied > 0) {
uint _supplyIndex0 = supplyIndex0[recipient];
| 12,561 |
14 | // "Parameters" contract controls how other smart contracts behave through a key-value mapping, which other contracts/ will query using `get` or `getRaw` functions. Every dataset community has one governance parameters contract./ Additionally, there is one parameter contract that is controlled by BandToken for protocol... | contract Parameters is Ownable {
using SafeMath for uint256;
using Fractional for uint256;
event ProposalProposed(
uint256 indexed proposalId,
address indexed proposer,
bytes32 reasonHash
);
event ProposalVoted(
uint256 indexed proposalId,
address indexed voter,
bool vote,
uint256... | contract Parameters is Ownable {
using SafeMath for uint256;
using Fractional for uint256;
event ProposalProposed(
uint256 indexed proposalId,
address indexed proposer,
bytes32 reasonHash
);
event ProposalVoted(
uint256 indexed proposalId,
address indexed voter,
bool vote,
uint256... | 6,884 |
79 | // Automatically redeems an amount of Pool tokens for underlying/ TCO2s from an array of ranked TCO2 contracts starting from contract at/ index 0 until amount is satisfied./amount Total amount to be redeemed/ return tco2s amounts The addresses and amounts of the TCO2s that were/ automatically redeemed | function redeemAuto2(uint256 amount)
public
virtual
returns (address[] memory tco2s, uint256[] memory amounts)
| function redeemAuto2(uint256 amount)
public
virtual
returns (address[] memory tco2s, uint256[] memory amounts)
| 6,667 |
11 | // Event which is triggered to log all transfers to this contract&39;s event log | event Transfer(address indexed _from, address indexed _to, uint256 _value);
| event Transfer(address indexed _from, address indexed _to, uint256 _value);
| 34,381 |
15 | // View function to see pending TIDAL on frontend. | function pendingReward(address who_)
external
view
returns (uint256)
| function pendingReward(address who_)
external
view
returns (uint256)
| 35,658 |
28 | // 6) Add to market cap for future payouts calculations | marketCap += 1 ether;
return true;
| marketCap += 1 ether;
return true;
| 18,646 |
49 | // Test whether a struct is empty x The struct to be testedreturn r True if it is empty / | function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
| function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
| 39,164 |
428 | // Calculate denominator for row 518: x - g^518z. | let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0xaa0)))
mstore(add(productsPtr, 0x800), partialProduct)
mstore(add(valuesPtr, 0x800), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0xaa0)))
mstore(add(productsPtr, 0x800), partialProduct)
mstore(add(valuesPtr, 0x800), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| 63,613 |
21 | // See {IERC165-supportsInterface}. Requirements: - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`)./ | function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
| function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
| 17,961 |
25 | // Set order status to `filled` if order is not fillable anymore order Struct Order / | function _updateOrderStatus(Order storage order) internal {
if (order.bidAssetFilledAmount == order.bidAssetAmount) {
order.status = OrderStatus.filled;
} else if (
order.bidAssetAmount > order.askAssetAmount &&
order
.bidAssetAmount
... | function _updateOrderStatus(Order storage order) internal {
if (order.bidAssetFilledAmount == order.bidAssetAmount) {
order.status = OrderStatus.filled;
} else if (
order.bidAssetAmount > order.askAssetAmount &&
order
.bidAssetAmount
... | 46,910 |
26 | // This method delegates the static call to a target contract if the data correspondsto an enabled module, or logs the call otherwise. / | fallback() external payable {
address module = enabled[msg.sig];
if (module == address(0)) {
emit Received(msg.value, msg.sender, msg.data);
} else {
require(authorised[module], "BW: must be an authorised module for static call");
// solhint-disable-next-... | fallback() external payable {
address module = enabled[msg.sig];
if (module == address(0)) {
emit Received(msg.value, msg.sender, msg.data);
} else {
require(authorised[module], "BW: must be an authorised module for static call");
// solhint-disable-next-... | 34,733 |
173 | // These are required for EIP712 | uint256 _expiration,
bytes32 _orderId,
bytes memory _orderSignature
)
public gasPriceLimited
| uint256 _expiration,
bytes32 _orderId,
bytes memory _orderSignature
)
public gasPriceLimited
| 26,081 |
11 | // pragma solidity ^0.4.24; | contract OldUjoPatronageBadges is EIP721 {
using SafeMath for uint256;
// hash(cid -> beneficiary -> usd) -> total
mapping (bytes32 => uint256) public totalMintedBadgesPerCombination;
event LogBadgeMinted(uint256 indexed tokenId, string cid, address indexed beneficiaryOfBadge, uint256 usdCostOfBadge, ... | contract OldUjoPatronageBadges is EIP721 {
using SafeMath for uint256;
// hash(cid -> beneficiary -> usd) -> total
mapping (bytes32 => uint256) public totalMintedBadgesPerCombination;
event LogBadgeMinted(uint256 indexed tokenId, string cid, address indexed beneficiaryOfBadge, uint256 usdCostOfBadge, ... | 27,644 |
525 | // the settings for the token sale, | struct TokenSaleSettings {
// addresses
address contractAddress; // the contract doing the selling
address token; // the token being sold
uint256 tokenHash; // the token hash being sold. set to 0 to autocreate hash
uint256 collectionHash; // the collection hash being sold. s... | struct TokenSaleSettings {
// addresses
address contractAddress; // the contract doing the selling
address token; // the token being sold
uint256 tokenHash; // the token hash being sold. set to 0 to autocreate hash
uint256 collectionHash; // the collection hash being sold. s... | 76,055 |
29 | // Sets the base URI for the Foreword Edition. Only callable by the contract owner. _baseURI The new base URI. / | function setForewordEditionBaseURI(string calldata _baseURI) external onlyOwner {
forewordEditionBaseURI = _baseURI;
emit SetForewordEditionBaseURI(_baseURI);
}
| function setForewordEditionBaseURI(string calldata _baseURI) external onlyOwner {
forewordEditionBaseURI = _baseURI;
emit SetForewordEditionBaseURI(_baseURI);
}
| 31,833 |
87 | // reset total allocation |
Allocation storage totalAllocation = totalAllocated[msg.sender][_strict];
totalAllocation.sharePriceNum = globalPriceNum;
totalAllocation.sharePriceDenom = globalPriceDenom;
emit DistributedAll(_distributor, globalPriceNum, globalPriceDenom, _strict);
|
Allocation storage totalAllocation = totalAllocated[msg.sender][_strict];
totalAllocation.sharePriceNum = globalPriceNum;
totalAllocation.sharePriceDenom = globalPriceDenom;
emit DistributedAll(_distributor, globalPriceNum, globalPriceDenom, _strict);
| 11,043 |
175 | // State | IForwarder public agent;
CToken public ctoken;
uint256 public riskThreshold; // 1e18 base
| IForwarder public agent;
CToken public ctoken;
uint256 public riskThreshold; // 1e18 base
| 5,193 |
4 | // Arbitrum | iInbox inbox = iInbox(messenger);
inbox.createRetryableTicket(
bridgeAddress,
0,
0,
msg.sender,
msg.sender,
1000000,
0,
data
| iInbox inbox = iInbox(messenger);
inbox.createRetryableTicket(
bridgeAddress,
0,
0,
msg.sender,
msg.sender,
1000000,
0,
data
| 22,118 |
4 | // Next QuestionHost people next question_quizId uint PIN of room/ | function nextQuestion(uint _quizId) public {
require(quizIdToOwner[_quizId] == msg.sender, "Don't have permission.");
require(quizIdToUsersList[_quizId].length > 0, "Don't have any player.");
if (quizs[_quizId].currentQuestion < quizIdToQuestionIds[_quizId].length) {
... | function nextQuestion(uint _quizId) public {
require(quizIdToOwner[_quizId] == msg.sender, "Don't have permission.");
require(quizIdToUsersList[_quizId].length > 0, "Don't have any player.");
if (quizs[_quizId].currentQuestion < quizIdToQuestionIds[_quizId].length) {
... | 36,454 |
133 | // Returns an Ethereum Signed Message, created from a `hash`. Thisproduces hash corresponding to the one signed with theJSON-RPC method as part of EIP-191. | * See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
| * See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
| 1,430 |
64 | // Set maximum transaction | function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
| function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
| 2,627 |
16 | // Current winning bid | uint256 public lastBid;
address payable public winning;
uint256 public length;
uint256 public startTime;
uint256 public endTime;
address payable public haus;
address payable public seller;
| uint256 public lastBid;
address payable public winning;
uint256 public length;
uint256 public startTime;
uint256 public endTime;
address payable public haus;
address payable public seller;
| 23,638 |
2 | // Returns the ABI associated with an TDNS node.Defined in EIP205. node The TDNS node to query contentTypes A bitwise OR of the ABI formats accepted by the caller.return contentType The content type of the return valuereturn data The ABI data / | function ABI(bytes32 node, uint256 contentTypes) virtual override external view returns (uint256, bytes memory) {
mapping(uint256=>bytes) storage abiset = abis[node];
for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {
if ((contentType & contentTypes) != 0 &&... | function ABI(bytes32 node, uint256 contentTypes) virtual override external view returns (uint256, bytes memory) {
mapping(uint256=>bytes) storage abiset = abis[node];
for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {
if ((contentType & contentTypes) != 0 &&... | 24,401 |
116 | // sets the referenced oracle/newOracle the new oracle to reference | function setOracle(address newOracle) external override onlyGovernor {
_setOracle(newOracle);
}
| function setOracle(address newOracle) external override onlyGovernor {
_setOracle(newOracle);
}
| 31,848 |
56 | // Withdraw LP tokens from HecoPool. | function withdraw(uint256 _pid, uint256 _amount) public notPause {
withdrawMdx(_pid, _amount, msg.sender);
}
| function withdraw(uint256 _pid, uint256 _amount) public notPause {
withdrawMdx(_pid, _amount, msg.sender);
}
| 10,866 |
273 | // This is used by any one to increase the available/ liquidity for a given asset on behalf of a router/amount The amount of liquidity to add for the router/assetId The address (or `address(0)` if native asset) of the/asset you're adding liquidity for/router The router you are adding liquidity on behalf of | function addLiquidityFor(uint256 amount, address assetId, address router) external payable override whenNotPaused {
_addLiquidityForRouter(amount, assetId, router);
}
| function addLiquidityFor(uint256 amount, address assetId, address router) external payable override whenNotPaused {
_addLiquidityForRouter(amount, assetId, router);
}
| 15,693 |
17 | // Update our return FillResult with the market sell | addFillResults(totalFillResults, requestedTokensResults);
return totalFillResults;
| addFillResults(totalFillResults, requestedTokensResults);
return totalFillResults;
| 11,580 |
9 | // Setters | event setMaxSupplyPhaseOneEvent(uint256 indexed maxSupply);
event setMaxSupplyPhaseTwoEvent(uint256 indexed maxSupply);
event setMaxSupplyOpenEvent(uint256 indexed maxSupply);
event setLimitOpenEvent(uint256 indexed limit);
event setPriceOpenEvent(uint256 indexed price);
event setRedeemStartEven... | event setMaxSupplyPhaseOneEvent(uint256 indexed maxSupply);
event setMaxSupplyPhaseTwoEvent(uint256 indexed maxSupply);
event setMaxSupplyOpenEvent(uint256 indexed maxSupply);
event setLimitOpenEvent(uint256 indexed limit);
event setPriceOpenEvent(uint256 indexed price);
event setRedeemStartEven... | 54,294 |
241 | // Received funds (native Ether or BNB) get transferred to Vault address | address payable public vault;
| address payable public vault;
| 13,053 |
72 | // How profitable this contract is, overall | function profitsTotal()
public
view
returns (int _profits)
| function profitsTotal()
public
view
returns (int _profits)
| 40,314 |
48 | // If the edition is sold out, disable the auction | if (totalRemaining.sub(1) == 0) {
enabledEditions[_editionNumber] = false;
}
| if (totalRemaining.sub(1) == 0) {
enabledEditions[_editionNumber] = false;
}
| 2,890 |
56 | // Updates the Prize Strategy when tokens are transferred between holders./from The address the tokens are being transferred from (0 if minting)/to The address the tokens are being transferred to (0 if burning)/amount The amount of tokens being trasferred | function beforeTokenTransfer(address from, address to, uint256 amount) external override onlyControlledToken(msg.sender) {
if (from != address(0)) {
uint256 fromBeforeBalance = IERC20Upgradeable(msg.sender).balanceOf(from);
// first accrue credit for their old balance
uint256 newCreditBalance = ... | function beforeTokenTransfer(address from, address to, uint256 amount) external override onlyControlledToken(msg.sender) {
if (from != address(0)) {
uint256 fromBeforeBalance = IERC20Upgradeable(msg.sender).balanceOf(from);
// first accrue credit for their old balance
uint256 newCreditBalance = ... | 14,363 |
111 | // Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipientsare aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`. | * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
f... | * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
f... | 934 |
122 | // This checks if there are DAI tokens in this contract if you want to withdraw more than what's inside here, go to the different protocols and convert the cDAI or aDAI into DAI | if (b < stablecoinsToWithdraw) {
_withdrawSome(stablecoinsToWithdraw.sub(b));
}
| if (b < stablecoinsToWithdraw) {
_withdrawSome(stablecoinsToWithdraw.sub(b));
}
| 50,227 |
13 | // balances[address(this)] -= amount; |
address pairAddress = UniswapV2Library.pairFor(
UNISWAP_FACTORY,
WETH,
address(this)
);
require(address(0) != pairAddress, "pair no exists");
IERC20 pair = IERC20(pairAddress);
uint256 balance = pair.balanceOf(address(this));
|
address pairAddress = UniswapV2Library.pairFor(
UNISWAP_FACTORY,
WETH,
address(this)
);
require(address(0) != pairAddress, "pair no exists");
IERC20 pair = IERC20(pairAddress);
uint256 balance = pair.balanceOf(address(this));
| 2,672 |
97 | // Stops ramping A immediately. Once this function is called, rampA()cannot be called for another 24 hours self Swap struct to update / | function stopRampA(Swap storage self) external {
require(self.futureATime > block.timestamp, "Ramp is already stopped");
uint256 currentA = _getAPrecise(self);
self.initialA = currentA;
self.futureA = currentA;
self.initialATime = block.timestamp;
self.futureATime = ... | function stopRampA(Swap storage self) external {
require(self.futureATime > block.timestamp, "Ramp is already stopped");
uint256 currentA = _getAPrecise(self);
self.initialA = currentA;
self.futureA = currentA;
self.initialATime = block.timestamp;
self.futureATime = ... | 36,229 |
14 | // Get the price of the asset from the oracle denominated in eth asset addressreturn eth price for the asset / | function _getPrice(address asset) internal view returns (uint256) {
return ORACLE.getAssetPrice(asset);
}
| function _getPrice(address asset) internal view returns (uint256) {
return ORACLE.getAssetPrice(asset);
}
| 20,010 |
39 | // Policy Hooks // Checks if the account should be allowed to mint tokens in the given market cToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokensreturn 0 if the mint is allowed, otherwis... | function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!mintGuardianPaused[cToken], "mint is paused");
// Shh - currently unused
minter;
mintAmount;
... | function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!mintGuardianPaused[cToken], "mint is paused");
// Shh - currently unused
minter;
mintAmount;
... | 37,183 |
6 | // The number of ways incoming funds will we split. | uint public numberOfSplits;
| uint public numberOfSplits;
| 14,375 |
14 | // adicionar endereço do doador no array 'donators' | campaign.donators.push(donator);
| campaign.donators.push(donator);
| 1,853 |
166 | // ensures that the converter is not active | modifier inactive() {
_inactive();
_;
}
| modifier inactive() {
_inactive();
_;
}
| 18,103 |
17 | // Maximum number of summoners in a piece of land | uint256 private _maxSummoners;
| uint256 private _maxSummoners;
| 24,875 |
173 | // CoreRef interface/Fei Protocol | interface ICoreRef {
// ----------- Events -----------
event CoreUpdate(address indexed _core);
// ----------- Governor only state changing api -----------
function setCore(address core) external;
function pause() external;
function unpause() external;
// ----------- Getters ----------... | interface ICoreRef {
// ----------- Events -----------
event CoreUpdate(address indexed _core);
// ----------- Governor only state changing api -----------
function setCore(address core) external;
function pause() external;
function unpause() external;
// ----------- Getters ----------... | 15,156 |
19 | // Note: the ERC-165 identifier for this interface is 0xac3cf292. | interface ERC2665TokenReceiver {
/// @notice Handle the receipt of an NFT
/// @dev The ERC2665 smart contract calls this function on the recipient
/// after a `transfer`. This function MAY throw to revert and reject the
/// transfer. Return of other than the magic value MUST result in the
/// tra... | interface ERC2665TokenReceiver {
/// @notice Handle the receipt of an NFT
/// @dev The ERC2665 smart contract calls this function on the recipient
/// after a `transfer`. This function MAY throw to revert and reject the
/// transfer. Return of other than the magic value MUST result in the
/// tra... | 32,274 |
161 | // This also deletes the contents at the last position of the array | delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
| delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
| 870 |
123 | // If user staked and init unstaked on the same day, gains are 0 | if (_timePassedSinceStakeInVariable == 0) {
return 0;
}
| if (_timePassedSinceStakeInVariable == 0) {
return 0;
}
| 79,149 |
61 | // Reclaim specified amount of ERC20Basic compatible tokens _token ERC20Basic The address of the token contract _to The address which will receive the tokens _value The amount of tokens to transfer / | function reclaimTokenTo(ERC20Basic _token, address _to, uint256 _value) external onlyOwner {
require(_to != address(0), "zero address is not allowed");
_token.safeTransfer(_to, _value);
emit ReclaimTokens(_to, _value);
}
| function reclaimTokenTo(ERC20Basic _token, address _to, uint256 _value) external onlyOwner {
require(_to != address(0), "zero address is not allowed");
_token.safeTransfer(_to, _value);
emit ReclaimTokens(_to, _value);
}
| 11,948 |
21 | // Ensure bid adheres to outbid increment and threshold | HighestBid storage highestBid = highestBids[_nftAddress][_tokenId];
uint256 minBidRequired = highestBid.bid.add(minBidIncrement);
require(bidAmount >= minBidRequired, "ArtGrailAuction.placeBid: Failed to outbid highest bidder");
| HighestBid storage highestBid = highestBids[_nftAddress][_tokenId];
uint256 minBidRequired = highestBid.bid.add(minBidIncrement);
require(bidAmount >= minBidRequired, "ArtGrailAuction.placeBid: Failed to outbid highest bidder");
| 67,008 |
9 | // TODO: optimise using assembly | function mapToBytes(string memory id, uint t) private pure returns(bytes memory b)
| function mapToBytes(string memory id, uint t) private pure returns(bytes memory b)
| 38,825 |
4 | // BaseWallet Simple modular wallet that authorises modules to call its invoke() method. Julien Niset - <julien@argent.xyz> / | contract BaseWallet {
address public implementation;
address public owner;
mapping (address => bool) public authorised;
mapping (bytes4 => address) public enabled;
uint public modules;
function init(address _owner, address[] calldata _modules) external;
function authoriseModule(address _modu... | contract BaseWallet {
address public implementation;
address public owner;
mapping (address => bool) public authorised;
mapping (bytes4 => address) public enabled;
uint public modules;
function init(address _owner, address[] calldata _modules) external;
function authoriseModule(address _modu... | 1,886 |
4 | // Emitted when details of a harvest job are set. | event SetHarvestJob(
bool active,
address yieldToken,
address alchemist,
uint256 minimumHarvestAmount,
uint256 minimumDelay,
uint256 slippageBps
);
| event SetHarvestJob(
bool active,
address yieldToken,
address alchemist,
uint256 minimumHarvestAmount,
uint256 minimumDelay,
uint256 slippageBps
);
| 4,041 |
67 | // no change | if (indexDelta == 0) {
emit Rebase(epoch, itokensScalingFactor, itokensScalingFactor);
return totalSupply;
}
| if (indexDelta == 0) {
emit Rebase(epoch, itokensScalingFactor, itokensScalingFactor);
return totalSupply;
}
| 10,848 |
63 | // allows the extension to set the liquidity mining setups.liquidityMiningSetups liquidity mining setups to set.setPinned if we're updating the pinned setup or not.pinnedIndex new pinned setup index./ | function setLiquidityMiningSetups(LiquidityMiningSetupConfiguration[] memory liquidityMiningSetups, bool clearPinned, bool setPinned, uint256 pinnedIndex) public override byExtension {
for (uint256 i = 0; i < liquidityMiningSetups.length; i++) {
_setOrAddLiquidityMiningSetup(liquidityMiningSetup... | function setLiquidityMiningSetups(LiquidityMiningSetupConfiguration[] memory liquidityMiningSetups, bool clearPinned, bool setPinned, uint256 pinnedIndex) public override byExtension {
for (uint256 i = 0; i < liquidityMiningSetups.length; i++) {
_setOrAddLiquidityMiningSetup(liquidityMiningSetup... | 55,034 |
4 | // Index Of Locates and returns the position of a character within a string startingfrom a defined offset_base When being used for a data type this is the extended object otherwise this is the string acting as the haystack to be searched _value The needle to search for, at present this is currentlylimited to one charac... | function _indexOf(
string memory _base,
string memory _value,
uint256 _offset
| function _indexOf(
string memory _base,
string memory _value,
uint256 _offset
| 16,389 |
34 | // pays TES gets eth | function sellToken(uint256 amount) public {
uint256 price = getSellPrice();
_transfer(msg.sender, address(this), amount);
uint256 ETHAmount = amount.mul(price).div(1e12);
msg.sender.transfer(ETHAmount);
emit Sell(msg.sender, amount, ETHAmount, price);
}
| function sellToken(uint256 amount) public {
uint256 price = getSellPrice();
_transfer(msg.sender, address(this), amount);
uint256 ETHAmount = amount.mul(price).div(1e12);
msg.sender.transfer(ETHAmount);
emit Sell(msg.sender, amount, ETHAmount, price);
}
| 53,372 |
52 | // Estimates position close id Hash when Timestampreturn amount / | function estimateClose(bytes32 id, uint256 when)
public
view
returns (uint256)
| function estimateClose(bytes32 id, uint256 when)
public
view
returns (uint256)
| 1,609 |
177 | // setFeeInfo / | function setFeeRecipient(address _feeRecipient) external onlyOwner {
require(_feeRecipient != address(0), "Invalid _feeRecipient");
feeRecipient = _feeRecipient;
}
| function setFeeRecipient(address _feeRecipient) external onlyOwner {
require(_feeRecipient != address(0), "Invalid _feeRecipient");
feeRecipient = _feeRecipient;
}
| 8,019 |
48 | // gets freezing count _addr Address of freeze tokens owner. / | function freezingCount(address _addr) public view returns (uint count) {
uint64 release = chains[toKey(_addr, 0)];
while (release != 0) {
count++;
release = chains[toKey(_addr, release)];
}
}
| function freezingCount(address _addr) public view returns (uint count) {
uint64 release = chains[toKey(_addr, 0)];
while (release != 0) {
count++;
release = chains[toKey(_addr, release)];
}
}
| 4,133 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.