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 |
|---|---|---|---|---|
5 | // also not for you | constructor() ERC721("SphinxSociety", "SPHINX") {}
| constructor() ERC721("SphinxSociety", "SPHINX") {}
| 7,652 |
170 | // Called by users to mint from the main sale. / | function mint(uint256 numToMint) external payable {
require(
_saleIsActive,
"Sale not active"
);
// Mint tokens, checking for sufficient payment and supply.
_mintInner(numToMint, 0);
}
| function mint(uint256 numToMint) external payable {
require(
_saleIsActive,
"Sale not active"
);
// Mint tokens, checking for sufficient payment and supply.
_mintInner(numToMint, 0);
}
| 19,351 |
65 | // Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer ... | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| 18,581 |
0 | // Query structure | struct Request {
address caller; // the Ethereum address which has requested for the query result
bool isPending; // the status of the query treatment (true if the result is still unknown)
bytes32 badgeConditionGroupID; // the ID of the condition group to min... | struct Request {
address caller; // the Ethereum address which has requested for the query result
bool isPending; // the status of the query treatment (true if the result is still unknown)
bytes32 badgeConditionGroupID; // the ID of the condition group to min... | 54,364 |
1 | // struct of HTLC user burn lock parameters | struct HTLCUserBurnLockParams {
bytes32 xHash; /// hash of HTLC random number
bytes32 smgID; /// ID of storeman group which user has selected
uint tokenPairID; /// token pair id on cross chain
uint value; /// exchang... | struct HTLCUserBurnLockParams {
bytes32 xHash; /// hash of HTLC random number
bytes32 smgID; /// ID of storeman group which user has selected
uint tokenPairID; /// token pair id on cross chain
uint value; /// exchang... | 21,631 |
288 | // call _receiver `onFlashLoan` | require(
_receiver.onFlashLoan(msg.sender, token, _amount, _flashFee, _params) == keccak256("ERC3156FlashBorrower.onFlashLoan"),
"8"
);
| require(
_receiver.onFlashLoan(msg.sender, token, _amount, _flashFee, _params) == keccak256("ERC3156FlashBorrower.onFlashLoan"),
"8"
);
| 61,578 |
17 | // Allow a user to claim any available staking rewards and interest rewards. / | function getReward() public override nonReentrant updateReward(msg.sender) {
address baseTradegenAddress = ADDRESS_RESOLVER.getContractAddress("BaseTradegen");
address interestRewardsPoolEscrowAddress = ADDRESS_RESOLVER.getContractAddress("InterestRewardsPoolEscrow");
uint stakingReward = st... | function getReward() public override nonReentrant updateReward(msg.sender) {
address baseTradegenAddress = ADDRESS_RESOLVER.getContractAddress("BaseTradegen");
address interestRewardsPoolEscrowAddress = ADDRESS_RESOLVER.getContractAddress("InterestRewardsPoolEscrow");
uint stakingReward = st... | 37,022 |
24 | // BL | ambassadorsMaxPremine[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0.28 ether / BETA_DIVISOR;
ambassadorsPrerequisite[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0xFEA0904ACc8Df0F3288b6583f60B86c36Ea52AcD;
| ambassadorsMaxPremine[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0.28 ether / BETA_DIVISOR;
ambassadorsPrerequisite[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0xFEA0904ACc8Df0F3288b6583f60B86c36Ea52AcD;
| 81,422 |
9 | // set last cummulative supply time share lpTokenAddress: contract address newSupplyLPTimeShare: timestamp value / | function setLastCummulativeSupplyLPTimeShare(
| function setLastCummulativeSupplyLPTimeShare(
| 48,281 |
5 | // When the token is transfered the protocol becomes the operator | if (isRentable) {
IOperable(nftAddress).setOperator(nftId, msg.sender);
}
| if (isRentable) {
IOperable(nftAddress).setOperator(nftId, msg.sender);
}
| 5,299 |
75 | // Owner can withdraw funds not exceeding balance minus potential win amounts by open bets. | function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require(withdrawAmount <= IERC20(GAME_TOKEN).balanceOf(address(this)) - lockedInBets, "Withdrawal exceeds limit");
IERC20(GAME_TOKEN).safeTransfer(beneficiary, withdrawAmount);
}
| function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require(withdrawAmount <= IERC20(GAME_TOKEN).balanceOf(address(this)) - lockedInBets, "Withdrawal exceeds limit");
IERC20(GAME_TOKEN).safeTransfer(beneficiary, withdrawAmount);
}
| 48,013 |
147 | // |/ A distinct Uniform Resource Identifier (URI) for a given token. URIs are defined in RFC 3986. URIs are assumed to be deterministically generated based on token ID Token IDs are assumed to be represented in their hex format in URIsreturn URI string / | function uri(uint256 _id) public view returns (string memory) {
return
string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json"));
}
| function uri(uint256 _id) public view returns (string memory) {
return
string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json"));
}
| 22,039 |
89 | // IModule Set Protocol Interface for interacting with Modules. / | interface IModule {
/**
* Called by a SetToken to notify that this module was removed from the Set token. Any logic can be included
* in case checks need to be made or state needs to be cleared.
*/
function removeModule() external;
}
| interface IModule {
/**
* Called by a SetToken to notify that this module was removed from the Set token. Any logic can be included
* in case checks need to be made or state needs to be cleared.
*/
function removeModule() external;
}
| 21,914 |
9 | // Get the size of the target. | uint256 size;
| uint256 size;
| 15,768 |
5 | // deposit the value specified form the caller to the donor contract | function deposit() payable public {}
//fetch the value balance of the contract
function getBalance() public view returns (uint256) {
return address(this).balance;
}
| function deposit() payable public {}
//fetch the value balance of the contract
function getBalance() public view returns (uint256) {
return address(this).balance;
}
| 38,290 |
60 | // return metadata, full name of the currency provided by this oracle(ej: Argentine Peso) Defined by the RCN RateOracle interface / | function name() external view returns (string memory) {
return iname;
}
| function name() external view returns (string memory) {
return iname;
}
| 13,755 |
20 | // spájanie pozemkov (iba ich majiteľ) | function mergeEstate(uint _id1, uint _id2, string memory _plotNumber, uint _area) public {
uint i = checkLetter(_id1);
uint j = checkEstate(_id1);
uint x = checkLetter(_id2);
uint y = checkEstate(_id2);
if(owners[i].add == tx.origin && owners[x].add == tx.origin && compareStr... | function mergeEstate(uint _id1, uint _id2, string memory _plotNumber, uint _area) public {
uint i = checkLetter(_id1);
uint j = checkEstate(_id1);
uint x = checkLetter(_id2);
uint y = checkEstate(_id2);
if(owners[i].add == tx.origin && owners[x].add == tx.origin && compareStr... | 8,538 |
8 | // Cancel order cancels order by setting nonce to max value. After this all"buy" functions would fail on this order order order struct / | function cancel(Order calldata order) external {
require(
order.signer == _msgSender() &&
recoverSigner(order.rootSign, order.root) == _msgSender(),
"Cancel: wrong sender"
);
bytes32 orderHash = getOrderHash(order);
nonce[orderHash] = order.totalAm... | function cancel(Order calldata order) external {
require(
order.signer == _msgSender() &&
recoverSigner(order.rootSign, order.root) == _msgSender(),
"Cancel: wrong sender"
);
bytes32 orderHash = getOrderHash(order);
nonce[orderHash] = order.totalAm... | 16,305 |
49 | // how many voters have voted for a given proposal? | function howManyVoters(bytes32 _rootHash) constant public returns (uint)
| function howManyVoters(bytes32 _rootHash) constant public returns (uint)
| 25,857 |
26 | // todo change this logic to handle the float exponential on reward factor | return
(((_stake.amount * rewardCalculationFactor) / 100) -
_stake.amount) / 31536000;
| return
(((_stake.amount * rewardCalculationFactor) / 100) -
_stake.amount) / 31536000;
| 22,455 |
63 | // Update token balance of the manager | balances[_issuer] = balances[_issuer].add(issuerTotal);
balances[manager] = balances[manager].add(managerFee);
if (protocolFee > 0) {
| balances[_issuer] = balances[_issuer].add(issuerTotal);
balances[manager] = balances[manager].add(managerFee);
if (protocolFee > 0) {
| 47,808 |
0 | // IRariFundManager IRariFundManager is a simple interface for RariFundManager used by RariGovernanceTokenDistributor. / | interface IRariFundManager {
/**
* @dev Contract of the RariFundToken.
*/
function rariFundToken() external returns (IRariFundToken);
/**
* @notice Returns the fund's total investor balance (all RFT holders' funds but not unclaimed fees) of all currencies in USD (scaled by 1e18).
* @dev... | interface IRariFundManager {
/**
* @dev Contract of the RariFundToken.
*/
function rariFundToken() external returns (IRariFundToken);
/**
* @notice Returns the fund's total investor balance (all RFT holders' funds but not unclaimed fees) of all currencies in USD (scaled by 1e18).
* @dev... | 9,108 |
18 | // 检验发送者账户余额是否足够 |
require(balanceOf[msg.sender] >= tokens);
|
require(balanceOf[msg.sender] >= tokens);
| 32,707 |
57 | // vault | function b0() public view returns (uint b) {
IERC20 u = IERC20(token0);
b = u.balanceOf(address(this)).add(deposited0).add(dummy0);
}
| function b0() public view returns (uint b) {
IERC20 u = IERC20(token0);
b = u.balanceOf(address(this)).add(deposited0).add(dummy0);
}
| 47,356 |
112 | // Factory to deploy Kali DAO. | contract KaliDAOfactory {
event DAOdeployed(KaliDAO indexed kaliDAO, string name);
address payable public immutable kaliMaster;
IRicardianLLC public immutable ricardianLLC;
constructor(address payable kaliMaster_, IRicardianLLC ricardianLLC_) {
kaliMaster = kaliMaster_;
ricardianLLC ... | contract KaliDAOfactory {
event DAOdeployed(KaliDAO indexed kaliDAO, string name);
address payable public immutable kaliMaster;
IRicardianLLC public immutable ricardianLLC;
constructor(address payable kaliMaster_, IRicardianLLC ricardianLLC_) {
kaliMaster = kaliMaster_;
ricardianLLC ... | 32,388 |
168 | // If no URI exists for the specific id requested, fallback to the default ERC-1155 URI. | if (bytes(tokenURI[tokenId]).length == 0) {
return super.uri(tokenId);
}
| if (bytes(tokenURI[tokenId]).length == 0) {
return super.uri(tokenId);
}
| 46,788 |
38 | // Interface of Price oracle Implements methods of price oracle used in the crowdsale OnGrid Systems / | contract PriceOracleIface {
uint256 public ethPriceInCents;
function getUsdCentsFromWei(uint256 _wei) public view returns (uint256) {
}
}
| contract PriceOracleIface {
uint256 public ethPriceInCents;
function getUsdCentsFromWei(uint256 _wei) public view returns (uint256) {
}
}
| 57,860 |
26 | // sell | if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) /... | if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) /... | 3,221 |
8 | // @inheritdoc IERC165 | function supportsInterface(bytes4 interfaceId) public view override(ERC721, IERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view override(ERC721, IERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
| 25,027 |
33 | // Toggle Wl1 minting | function toggleWlOneMinting ()
public
onlyOwner
virtual
| function toggleWlOneMinting ()
public
onlyOwner
virtual
| 46,060 |
45 | // Burn tokens from address token holder address amount uint256 amount of tokens to burn userData bytes extra information provided by the token holder operatorData bytes extra information provided by the operator (if any) / | function _burn(
address operator,
address from,
uint256 amount,
bool invokeHook,
bytes memory userData,
bytes memory operatorData
)
internal
| function _burn(
address operator,
address from,
uint256 amount,
bool invokeHook,
bytes memory userData,
bytes memory operatorData
)
internal
| 25,243 |
39 | // The oracle will have given you an ID for the VRF keypair they have committed to (let's call it keyHash), and have told you the minimum LINK price for VRF service. Make sure your contract has sufficient LINK, and call requestRandomness(keyHash, fee, seed), where seed is the input you want to generate randomness from.... | abstract contract VRFConsumerBase is VRFRequestIDBase {
using SafeMathChainlink for uint256;
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it.
*
* @dev The VRFCoordinator expects a calling contract to have a method with
* @dev this signature, and w... | abstract contract VRFConsumerBase is VRFRequestIDBase {
using SafeMathChainlink for uint256;
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it.
*
* @dev The VRFCoordinator expects a calling contract to have a method with
* @dev this signature, and w... | 41,777 |
75 | // Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burningOperator MUST be msg.senderWhen minting/creating tokens, the `_from` field MUST be set to `0x0`When burning/destroying tokens, the `_to` field MUST be set to `0x0`The total amoun... | event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
| event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
| 23,109 |
29 | // hellhog | if (_trait != 22) {
return abi.encodePacked(V, BEGINNING, string(backs[_trait]), END, F_E);
} else {
| if (_trait != 22) {
return abi.encodePacked(V, BEGINNING, string(backs[_trait]), END, F_E);
} else {
| 35,733 |
135 | // limit timed activity only if timed flag is active | if (_timedActive) {
require(isOpen(), "TimedCrowdsale: not open");
}
| if (_timedActive) {
require(isOpen(), "TimedCrowdsale: not open");
}
| 8,136 |
9 | // Function to transfer tokens._to Address of the recipient. _amount Amount to send. return True if the operation was successful. / | function transfer(address _to, uint256 _amount) public returns (bool) {
_transfer(msg.sender, _to, _amount);
return true;
}
| function transfer(address _to, uint256 _amount) public returns (bool) {
_transfer(msg.sender, _to, _amount);
return true;
}
| 49,695 |
61 | // we cant define a return value for fallbacktherefore, we must do the call in in-line assemblyso we can use the return() opcode to returndynamic data from the storage contract | address store = address(_getStorageContract());
bytes memory cdata = abi.encodePacked(_msgData(), _msgSender());
uint256 value = msg.value;
| address store = address(_getStorageContract());
bytes memory cdata = abi.encodePacked(_msgData(), _msgSender());
uint256 value = msg.value;
| 48,575 |
156 | // Sets up the centralized accessList contract_accessList the address of accessList contract. return A boolean that indicates if the operation was successful./ | function setupAccessList(address _accessList)
public
| function setupAccessList(address _accessList)
public
| 57,360 |
55 | // check which snap balance has a smaller difference in block numbers | if (
array2[j].blockNumber - array1[i - 1].blockNumber <
array1[i].blockNumber - array2[j].blockNumber
) {
| if (
array2[j].blockNumber - array1[i - 1].blockNumber <
array1[i].blockNumber - array2[j].blockNumber
) {
| 19,808 |
20 | // 0xF | OffChainFailure,
OffChainSuccess,
AwatingOffChainProcess,
OffChainProcessStarted,
OffChainServiceUnreachable,
OffChainActionRequired,
OffChainExpiry_LimitReached,
RESERVEDxF7,
DuplicateOffChainRequest,
RESERVEDxF9,
| OffChainFailure,
OffChainSuccess,
AwatingOffChainProcess,
OffChainProcessStarted,
OffChainServiceUnreachable,
OffChainActionRequired,
OffChainExpiry_LimitReached,
RESERVEDxF7,
DuplicateOffChainRequest,
RESERVEDxF9,
| 10,676 |
2 | // Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin rolebearer except when using {AccessControl-_setupRole}. / | event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
| event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
| 33,706 |
182 | // Determine if someone is in the whitelsit | modifier onlyWhitelist(address a)
| modifier onlyWhitelist(address a)
| 10,420 |
22 | // Royalty support for various other standards | function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
function royaltyInfo(uint256 token... | function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
function royaltyInfo(uint256 token... | 13,117 |
108 | // Apply pending rewards to trove's state | Troves[_borrower].coll = Troves[_borrower].coll.add(pendingETHReward);
Troves[_borrower].debt = Troves[_borrower].debt.add(pendingLUSDDebtReward);
_updateTroveRewardSnapshots(_borrower);
| Troves[_borrower].coll = Troves[_borrower].coll.add(pendingETHReward);
Troves[_borrower].debt = Troves[_borrower].debt.add(pendingLUSDDebtReward);
_updateTroveRewardSnapshots(_borrower);
| 36,364 |
40 | // init contract interface | setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2);
setAirdropGameInterface(0x465efa69a42273e3e368cfe3b6483ab97b3c33eb);
setBossWannaCryInterface(0x7ea4af9805b8a0a58ce67c4b6b14cce0a1834491... | setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2);
setAirdropGameInterface(0x465efa69a42273e3e368cfe3b6483ab97b3c33eb);
setBossWannaCryInterface(0x7ea4af9805b8a0a58ce67c4b6b14cce0a1834491... | 16,076 |
71 | // Allow the token holder to upgrade some of their tokens to a new contract. | function upgrade(uint _value) public {
UpgradeState state = getUpgradeState();
require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading);
// Validate input value.
require(_value != 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
... | function upgrade(uint _value) public {
UpgradeState state = getUpgradeState();
require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading);
// Validate input value.
require(_value != 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
... | 13,280 |
35 | // ------------------------------------------------------------------------ Token functions ------------------------------------------------------------------------ | function transfer(Data storage self, address to, uint tokens) public returns (bool success) {
// Owner and minter can move tokens before the tokens are transferable
require(self.transferable || (self.mintable && (msg.sender == self.owner || msg.sender == self.minter)));
require(!self.accoun... | function transfer(Data storage self, address to, uint tokens) public returns (bool success) {
// Owner and minter can move tokens before the tokens are transferable
require(self.transferable || (self.mintable && (msg.sender == self.owner || msg.sender == self.minter)));
require(!self.accoun... | 19,920 |
67 | // Transfer Staking Info | user_staking_amount[newUser] = user_staking_amount[oldUser];
user_staking_period_index[newUser] = user_staking_period_index[oldUser];
user_staking_periods[newUser] = user_staking_periods[oldUser];
| user_staking_amount[newUser] = user_staking_amount[oldUser];
user_staking_period_index[newUser] = user_staking_period_index[oldUser];
user_staking_periods[newUser] = user_staking_periods[oldUser];
| 43,355 |
123 | // Transfer remaining balance to msg.sender | msg.sender.transfer(value);
| msg.sender.transfer(value);
| 11,503 |
35 | // Emit GenerativeSeriesDeployed / | function emitGenerativeSeriesDeployed(address contractAddress) external;
| function emitGenerativeSeriesDeployed(address contractAddress) external;
| 42,263 |
40 | // MANAGER ONLY. Removes a pending module from the SetToken. / | function removePendingModule(address _module) external onlyManager {
require(!isLocked, "Only when unlocked");
require(moduleStates[_module] == ISetToken.ModuleState.PENDING, "Module must be pending");
moduleStates[_module] = ISetToken.ModuleState.NONE;
emit PendingModuleRemoved(_module);
}
| function removePendingModule(address _module) external onlyManager {
require(!isLocked, "Only when unlocked");
require(moduleStates[_module] == ISetToken.ModuleState.PENDING, "Module must be pending");
moduleStates[_module] = ISetToken.ModuleState.NONE;
emit PendingModuleRemoved(_module);
}
| 36,063 |
60 | // when minting is whitelist-only, mint 1 tokenId to an address specified by the whitelisted sender_value value to refund, must exactly match what was specified in the Merkle tree_proof the Merkle proof to prove the sender and refund value/ | function claimRefund(uint256 _value, bytes32[] memory _proof) external payable {
require(!refundClaimed[msg.sender], "refund already claimed");
require(refundMerkleRoot != "", "whitelist merkleRoot missing");
require(verifyMerkleProof(msg.sender, _value, _proof), "failed to verify merkle proof");
re... | function claimRefund(uint256 _value, bytes32[] memory _proof) external payable {
require(!refundClaimed[msg.sender], "refund already claimed");
require(refundMerkleRoot != "", "whitelist merkleRoot missing");
require(verifyMerkleProof(msg.sender, _value, _proof), "failed to verify merkle proof");
re... | 27,248 |
2,148 | // 1076 | entry "unidiosyncratically" : ENG_ADVERB
| entry "unidiosyncratically" : ENG_ADVERB
| 21,912 |
164 | // for statistic | package.Total = package.Total.add(amount);
if(package.Type == FinancialType.CRFI){
uInfo.nowInvestFinCRFI = uInfo.nowInvestFinCRFI.add(amount);
SInfo.nowInvestCRFI = SInfo.nowInvestCRFI.add(amount);
SInfo.totalWeightCRFI = SInfo.totalWeightCRFI.add(amount.mul(package.Weight) / Decimal);
} ... | package.Total = package.Total.add(amount);
if(package.Type == FinancialType.CRFI){
uInfo.nowInvestFinCRFI = uInfo.nowInvestFinCRFI.add(amount);
SInfo.nowInvestCRFI = SInfo.nowInvestCRFI.add(amount);
SInfo.totalWeightCRFI = SInfo.totalWeightCRFI.add(amount.mul(package.Weight) / Decimal);
} ... | 23,016 |
4 | // See {IGovernor-COUNTING_MODE}. / solhint-disable-next-line func-name-mixedcase | function COUNTING_MODE() public pure virtual override returns (string memory) {
return "support=bravo&quorum=for,abstain";
}
| function COUNTING_MODE() public pure virtual override returns (string memory) {
return "support=bravo&quorum=for,abstain";
}
| 1,826 |
625 | // Cancel a decrease stake request during the lockup Either called by the service provider via DelegateManager or governance _account - address of service provider / | function cancelDecreaseStakeRequest(address _account) external
| function cancelDecreaseStakeRequest(address _account) external
| 56,130 |
48 | // convenience to manage a growing array | function insertPlayer(address value) internal {
if(numPlayers == players.length) {
players.length += 1;
}
players[numPlayers++] = value;
}
| function insertPlayer(address value) internal {
if(numPlayers == players.length) {
players.length += 1;
}
players[numPlayers++] = value;
}
| 16,547 |
950 | // Returns the average supply between now and the previous mint time using the integral of the total supply. | uint256 avgTotalSupply = integralTotalSupply.sub(lastClaimIntegralSupply).div(timeSinceLastClaim);
if (avgTotalSupply == 0) return 0;
uint256 incentivesToClaim = nTokenBalance.mul(incentiveRate).div(avgTotalSupply);
| uint256 avgTotalSupply = integralTotalSupply.sub(lastClaimIntegralSupply).div(timeSinceLastClaim);
if (avgTotalSupply == 0) return 0;
uint256 incentivesToClaim = nTokenBalance.mul(incentiveRate).div(avgTotalSupply);
| 37,651 |
4 | // Returns the address of the owner of the NFT. NFTs assigned to the zero address areconsidered invalid, and queries about them do throw. _tokenId The identifier for an NFT.return Address of _tokenId owner. / | function ownerOf(uint256 _tokenId) external view returns (address);
function mint(address _to, uint256 _tokenId) external ;
| function ownerOf(uint256 _tokenId) external view returns (address);
function mint(address _to, uint256 _tokenId) external ;
| 39,033 |
22 | // Initializes a loan with Loan Core. Compared to initializeLoan, this verifies the specific items in a bundle. Only works with bundles implementing the IVaultFactory interface.The caller must be a borrower or lender, or approved by a borrower or lender. The external signer must be a borrower or lender, or approved by ... | function initializeLoanWithItems(
LoanLibrary.LoanTerms calldata loanTerms,
address borrower,
address lender,
Signature calldata sig,
uint160 nonce,
LoanLibrary.Predicate[] calldata itemPredicates
| function initializeLoanWithItems(
LoanLibrary.LoanTerms calldata loanTerms,
address borrower,
address lender,
Signature calldata sig,
uint160 nonce,
LoanLibrary.Predicate[] calldata itemPredicates
| 49,959 |
41 | // Add two integers | function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
| function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
| 75,234 |
22 | // find where to insert the new score | if (waffles[leaderboardWaffleIds[i]].votes < votes) {
for (uint j = LEADERBOARD_WAFFLE_COUNT; i < j; j--) {
leaderboardWaffleIds[j] = leaderboardWaffleIds[j - 1];
}
| if (waffles[leaderboardWaffleIds[i]].votes < votes) {
for (uint j = LEADERBOARD_WAFFLE_COUNT; i < j; j--) {
leaderboardWaffleIds[j] = leaderboardWaffleIds[j - 1];
}
| 11,282 |
36 | // Ensure the user is not trying to purchase more tokens than are available | require(totalSupply + tokens <= maxSupply, "Maximum supply reached");
| require(totalSupply + tokens <= maxSupply, "Maximum supply reached");
| 13,611 |
8 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
| function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
| 25,641 |
32 | // We should have reverted in preExecCheck. But safer is better. | require(length > 0, Errors.INVALID_HINT_COLLECTED);
bool isDelegateCall = transaction.flag.isDelegateCall();
for (uint256 i = 0; i < length; ++i) {
bytes32 role = preResults[i].role;
address authAddress = preResults[i].authorizer;
require(authorizerSet[isDe... | require(length > 0, Errors.INVALID_HINT_COLLECTED);
bool isDelegateCall = transaction.flag.isDelegateCall();
for (uint256 i = 0; i < length; ++i) {
bytes32 role = preResults[i].role;
address authAddress = preResults[i].authorizer;
require(authorizerSet[isDe... | 22,921 |
274 | // Use "this" in order that the havven account is the sender. That this is an explicit transfer also initialises fee entitlement information. | return _transfer(this, account, value);
| return _transfer(this, account, value);
| 25,698 |
263 | // Add setting deprecation _settingId The ID of the setting _creatorNameId The nameId that created the setting _creatorTAOId The taoId that created the setting _associatedTAOId The taoId that the setting affects _newSettingId The new settingId value to route _newSettingContractAddress The address of the new setting con... | function addDeprecation(uint256 _settingId, address _creatorNameId, address _creatorTAOId, address _associatedTAOId, uint256 _newSettingId, address _newSettingContractAddress) public inWhitelist returns (bytes32, bytes32) {
require (_storeSettingDeprecation(_settingId, _creatorNameId, _creatorTAOId, _associatedTAOId... | function addDeprecation(uint256 _settingId, address _creatorNameId, address _creatorTAOId, address _associatedTAOId, uint256 _newSettingId, address _newSettingContractAddress) public inWhitelist returns (bytes32, bytes32) {
require (_storeSettingDeprecation(_settingId, _creatorNameId, _creatorTAOId, _associatedTAOId... | 32,481 |
45 | // Adds liquidity to Uniswap V2 Pair and returns liquidity shares to the "to" address. | (amountA, amountB, liquidity) = addExactShortLiquidity(
router_,
optionToken.redeemToken(),
underlyingToken,
outputRedeems_,
amountBMax_,
amountBMin_,
to_,
deadline_
);... | (amountA, amountB, liquidity) = addExactShortLiquidity(
router_,
optionToken.redeemToken(),
underlyingToken,
outputRedeems_,
amountBMax_,
amountBMin_,
to_,
deadline_
);... | 32,057 |
15 | // Returns total supply of issued tokens / | function totalSupply() constant returns (uint256 totalSupply) {
return supply;
}
| function totalSupply() constant returns (uint256 totalSupply) {
return supply;
}
| 51,639 |
159 | // Returns whether an address is allowed to withdraw their funds. To beimplemented by derived contracts. payee The destination address of the funds. / | function withdrawalAllowed(address payee) public view returns (bool);
| function withdrawalAllowed(address payee) public view returns (bool);
| 9,045 |
146 | // Emitted when a relay is removed (deregistered). unstakeTime is the time when unstake will be callable. | event RelayRemoved(address indexed relay, uint256 unstakeTime);
| event RelayRemoved(address indexed relay, uint256 unstakeTime);
| 13,732 |
19 | // Emitted if the account is invalid for transaction. | event InvalidAccount(address indexed addr, bytes msg);
| event InvalidAccount(address indexed addr, bytes msg);
| 3,694 |
145 | // ========= update public variables ========= | totalRewardsKTYclaimed = totalRewardsKTYclaimed.add(_KTY);
totalRewardsSDAOclaimed = totalRewardsSDAOclaimed.add(_SDAO);
totalLockedLP = totalLockedLP.sub(_LP);
uint256 _currentMonth = getCurrentMonth();
if (_currentMonth < 5) {
for (uint i = _currentMonth; i < 6; i... | totalRewardsKTYclaimed = totalRewardsKTYclaimed.add(_KTY);
totalRewardsSDAOclaimed = totalRewardsSDAOclaimed.add(_SDAO);
totalLockedLP = totalLockedLP.sub(_LP);
uint256 _currentMonth = getCurrentMonth();
if (_currentMonth < 5) {
for (uint i = _currentMonth; i < 6; i... | 79,373 |
11 | // Otherwise we mint the proportion that this increases the value held by this contract | mintAmount = (localReserveSupply * _amount) / totalValue;
| mintAmount = (localReserveSupply * _amount) / totalValue;
| 27,638 |
121 | // capable of changing PCV Deposit and Global Rate Limited Minter in the PSM | bytes32 internal constant PSM_ADMIN_ROLE = keccak256("PSM_ADMIN_ROLE");
| bytes32 internal constant PSM_ADMIN_ROLE = keccak256("PSM_ADMIN_ROLE");
| 48,413 |
13 | // Get a snapshot of the account's balances, and the cached exchange rate This is used by joetroller to more efficiently perform liquidity checks. account Address of the account to snapshotreturn (possible error, token balance, borrow balance, exchange rate mantissa) / | function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);
| function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);
| 26,088 |
152 | // A method to retrieve the stake for a stakeholder._stakeholder The stakeholder to retrieve the stake for. return uint256 The amount of wei staked./ | function stakeOf(address _stakeholder) public view returns(uint256) {
return stakes[_stakeholder];
}
| function stakeOf(address _stakeholder) public view returns(uint256) {
return stakes[_stakeholder];
}
| 31,788 |
561 | // Converts an internal underlying cash value to its asset cash value/ar exchange rate object between asset and underlying/underlyingBalance amount to convert to asset cash, denominated in internal token precision | function convertFromUnderlying(AssetRateParameters memory ar, int256 underlyingBalance)
internal
pure
returns (int256)
| function convertFromUnderlying(AssetRateParameters memory ar, int256 underlyingBalance)
internal
pure
returns (int256)
| 16,064 |
16 | // Transfer votes | trackVotes(_msgSender(), recipient, uint96(amount));
| trackVotes(_msgSender(), recipient, uint96(amount));
| 848 |
0 | // See {ERC721-Transfer}. | event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
| event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
| 11,310 |
13 | // Contract that contains the functions to interact with the ZlotsJackpotHoldingContract | contract ZlotsJackpotHoldingContract {
function payOutWinner(address winner) public;
function getJackpot() public view returns (uint);
}
| contract ZlotsJackpotHoldingContract {
function payOutWinner(address winner) public;
function getJackpot() public view returns (uint);
}
| 8,194 |
26 | // SUSHI/Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`. | function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(t... | function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(t... | 47,361 |
108 | // Swap the depositToken for targetToken | temp.tokensToSwap = _getTokenAmount(address(poolInfo.depositToken), temp.poolAmount);
require(temp.tokensToSwap > 0, "bad token swap");
address[] memory uniswapPath = new address[](3);
uniswapPath[0] = address(poolInfo.depositToken);
uniswapPath[1] = address(w... | temp.tokensToSwap = _getTokenAmount(address(poolInfo.depositToken), temp.poolAmount);
require(temp.tokensToSwap > 0, "bad token swap");
address[] memory uniswapPath = new address[](3);
uniswapPath[0] = address(poolInfo.depositToken);
uniswapPath[1] = address(w... | 28,450 |
34 | // Absolve a validator from a benign misbehaviour. | function absolveFirstBenign(address validator) public has_benign_misbehaved(validator) {
validatorsStatus[validator].firstBenign[msg.sender] = 0;
AddressVotes.remove(validatorsStatus[validator].benignMisbehaviour, msg.sender);
}
| function absolveFirstBenign(address validator) public has_benign_misbehaved(validator) {
validatorsStatus[validator].firstBenign[msg.sender] = 0;
AddressVotes.remove(validatorsStatus[validator].benignMisbehaviour, msg.sender);
}
| 31,845 |
26 | // Internally used struct capturing wallet order nonce invalidations created via `invalidateOrderNonce` / | struct NonceInvalidation {
bool exists;
uint64 timestampInMs;
uint256 effectiveBlockNumber;
}
| struct NonceInvalidation {
bool exists;
uint64 timestampInMs;
uint256 effectiveBlockNumber;
}
| 2,628 |
18 | // Increase the amount of tokens that an owner allowed to a spender. 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 MonolithDAO Token.sol spender The address which will spend the funds. add... | function increaseApproval(address spender, uint256 addedValue) public returns (bool){
allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
| function increaseApproval(address spender, uint256 addedValue) public returns (bool){
allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
| 53,043 |
46 | // make new pool token/token request call for dapp | * Emit {NewPoolTOKENrequest} evt.
*
*
* Requirements:
* payable only Is InOwners and no paused and pool not exist require and extra charge _depfee
*
* lock type: nonReentrant
*/
function newPoolTOKENrequest(
address tka,
address tkb,
uint256 amount... | * Emit {NewPoolTOKENrequest} evt.
*
*
* Requirements:
* payable only Is InOwners and no paused and pool not exist require and extra charge _depfee
*
* lock type: nonReentrant
*/
function newPoolTOKENrequest(
address tka,
address tkb,
uint256 amount... | 30,814 |
58 | // Checks if the sale is open.return isOpen True if the crowdsale is open, false otherwise. / | function isOpen() public view returns (bool) {
return block.timestamp >= uint256(marketInfo.startTime) && block.timestamp <= uint256(marketInfo.endTime);
}
| function isOpen() public view returns (bool) {
return block.timestamp >= uint256(marketInfo.startTime) && block.timestamp <= uint256(marketInfo.endTime);
}
| 25,124 |
18 | // Return InstaEvent Address./ | // function getEventAddr() internal pure returns (address) {
// return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address
// }
| // function getEventAddr() internal pure returns (address) {
// return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address
// }
| 15,240 |
150 | // Check the paused status of the contract | if (Pausable.paused()) {
return FAILURE_PAUSED;
}
| if (Pausable.paused()) {
return FAILURE_PAUSED;
}
| 22,126 |
4 | // Tracks how many Loopy Cups have been purchased with CHILL | uint256 public cupsPurchasedWithChill = 0;
| uint256 public cupsPurchasedWithChill = 0;
| 58,495 |
176 | // Returns the list of enabled modules. | function enabledModules() external view returns (address[] memory _modules);
| function enabledModules() external view returns (address[] memory _modules);
| 3,638 |
69 | // New version address should be other than 0x0. | if (_newVersion == 0x0) {
return false;
}
| if (_newVersion == 0x0) {
return false;
}
| 34,494 |
149 | // Verify the Oracle Request sender The sender of the request payment The amount of payment given (specified in wei) callbackAddress The callback address for the response callbackFunctionId The callback function ID for the response nonce The nonce sent by the requester / | function _verifyOracleRequest(
address sender,
uint256 payment,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 nonce,
uint256 dataVersion
)
private
returns (
| function _verifyOracleRequest(
address sender,
uint256 payment,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 nonce,
uint256 dataVersion
)
private
returns (
| 68,912 |
51 | // Gets the current supply interest rate based on the given asset, total cash and total borrows The return value should be scaled by 1e18, thus a return value of `(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% per block. asset The asset to get the interest rate of cash The total cash of the asse... | function getSupplyRate(
address asset,
uint256 cash,
uint256 borrows
) public view returns (uint256, uint256);
| function getSupplyRate(
address asset,
uint256 cash,
uint256 borrows
) public view returns (uint256, uint256);
| 73,966 |
187 | // Initialize TokenPorter contract./_tokenAddr Address of metToken contract/_auctionsAddr Address of auctions contract | function initTokenPorter(address _tokenAddr, address _auctionsAddr) public onlyOwner {
require(_tokenAddr != 0x0);
require(_auctionsAddr != 0x0);
auctions = Auctions(_auctionsAddr);
token = METToken(_tokenAddr);
}
| function initTokenPorter(address _tokenAddr, address _auctionsAddr) public onlyOwner {
require(_tokenAddr != 0x0);
require(_auctionsAddr != 0x0);
auctions = Auctions(_auctionsAddr);
token = METToken(_tokenAddr);
}
| 27,619 |
27 | // Solidity automatically throws when dividing by 0 | struct percent {
uint num;
uint den;
}
| struct percent {
uint num;
uint den;
}
| 68,994 |
499 | // A map from an account owner to a destination address to a tokenID to an amount to a storageID to a new recipient address | mapping (address => mapping (address => mapping (uint16 => mapping (uint => mapping (uint32 => address))))) withdrawalRecipient;
| mapping (address => mapping (address => mapping (uint16 => mapping (uint => mapping (uint32 => address))))) withdrawalRecipient;
| 24,571 |
45 | // Must be divisible by 10x the number of digits over 3. / | require((_personalCap % (10**(placeholder - 3))) == 0);
| require((_personalCap % (10**(placeholder - 3))) == 0);
| 1,139 |
256 | // round 14 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16442329894745639881165035015179028112772410105963688121820543219662832524136)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16442329894745639881165035015179028112772410105963688121820543219662832524136)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 24,055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.