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 |
|---|---|---|---|---|
14 | // ID to use for the next proposal | uint64 _nextProposalID;
IVybeStake private _stake;
Vybe private _VYBE;
| uint64 _nextProposalID;
IVybeStake private _stake;
Vybe private _VYBE;
| 44,929 |
48 | // return Max balance. / | function maxBalance() public view returns(int) {
return int(MIN_BANKROLL / 2);
}
| function maxBalance() public view returns(int) {
return int(MIN_BANKROLL / 2);
}
| 43,525 |
4 | // current vote by address, see VoteLayout above | mapping(address => uint256) addressVotes;
bytes32[] choices;
string description;
| mapping(address => uint256) addressVotes;
bytes32[] choices;
string description;
| 14,561 |
4 | // Token adapter for Chi Gastoken by 1inch. Implementation of TokenAdapter interface. 1inch.exchange <[email protected]> / | contract ChiTokenAdapter is TokenAdapter {
address private constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
IOneSplit private constant ONE_SPLIT = IOneSplit(0xC586BeF4a0992C495Cf22e1aeEE4E446CECDee0E);
/**
* @return TokenMetadata struct with ERC20-style token info.
* @dev Imple... | contract ChiTokenAdapter is TokenAdapter {
address private constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
IOneSplit private constant ONE_SPLIT = IOneSplit(0xC586BeF4a0992C495Cf22e1aeEE4E446CECDee0E);
/**
* @return TokenMetadata struct with ERC20-style token info.
* @dev Imple... | 29,264 |
0 | // Settable fake exchange rate is defined here to avoid pair logic complexity. It determines how much tokens can be received for 1 ETH. | uint256 public exchangeRate = 1;
event SwapExactETHForTokensExecuted(
uint256 amountOutMin,
address[] path,
address to,
uint256 deadline
);
| uint256 public exchangeRate = 1;
event SwapExactETHForTokensExecuted(
uint256 amountOutMin,
address[] path,
address to,
uint256 deadline
);
| 14,908 |
21 | // Transfers the ownership of an NFT from one address to another address. Throws unless `msg.sender` is the current owner, an authorized operator, or theapproved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` isthe zero address. Throws if `_tokenId` is not a valid NFT. When transfer i... | function safeTransferFrom(
| function safeTransferFrom(
| 27,268 |
21 | // Get batch of token balances.return Batch of token balances. / | function batchBalanceOf(address[] memory tokens, address[] memory tokenHolders) public view returns (uint256[] memory) {
uint256[] memory batchBalanceOfResponse = new uint256[](tokenHolders.length * tokens.length);
for (uint256 i = 0; i < tokenHolders.length; i++) {
for (uint256 j = 0; ... | function batchBalanceOf(address[] memory tokens, address[] memory tokenHolders) public view returns (uint256[] memory) {
uint256[] memory batchBalanceOfResponse = new uint256[](tokenHolders.length * tokens.length);
for (uint256 i = 0; i < tokenHolders.length; i++) {
for (uint256 j = 0; ... | 27,006 |
132 | // Creates a Chainlink request for each oracle in the oracles array. This example does not include request parameters. Reference any documentationassociated with the Job IDs used to determine the required parameters per-request. / | function requestRateUpdate()
external
ensureAuthorizedRequester()
| function requestRateUpdate()
external
ensureAuthorizedRequester()
| 73,527 |
34 | // Divides value a by value b (result is rounded up or away from 0). / | function preciseDivCeil(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "Cant divide by 0");
return a > 0 ? a.mul(PRECISE_UNIT).sub(1).div(b).add(1) : 0;
}
| function preciseDivCeil(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "Cant divide by 0");
return a > 0 ? a.mul(PRECISE_UNIT).sub(1).div(b).add(1) : 0;
}
| 27,179 |
54 | // Buddy | if (hasBuddy) {
for (uint256 i = renderPathIndex["buddy"].startIndex; i <= renderPathIndex["buddy"].endIndex; i++) {
output = string.concat(output, makePath(i, tokenId));
}
| if (hasBuddy) {
for (uint256 i = renderPathIndex["buddy"].startIndex; i <= renderPathIndex["buddy"].endIndex; i++) {
output = string.concat(output, makePath(i, tokenId));
}
| 25,059 |
120 | // xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - ids and amounts must have the same length.- If to refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return theacceptance magic value. / | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"... | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"... | 1,478 |
24 | // Freelist minting function. This function allows eligible users to claim free tokens as part of a special promotion.Users must provide a valid Merkle proof to show they are included in the freelist.The minting can only be done during the specified freelist period. _merkleProof Merkle proof for the user's address. _qt... | function freeMint(
bytes32[] calldata _merkleProof,
uint256 _qty
| function freeMint(
bytes32[] calldata _merkleProof,
uint256 _qty
| 7,865 |
218 | // Stop running VAULT/icoIsStopped - status if this ICO is stopped | function stopThisIco(bool icoIsStopped) isOwner {
require(icoIsClosed != icoIsStopped);
icoIsClosed = icoIsStopped;
if(icoIsStopped) {
icoStatusUpdated(msg.sender, "Coin offering was stopped!");
}else {
icoStatusUpdated(msg.sender, "Coin offering is running!");
}
}
| function stopThisIco(bool icoIsStopped) isOwner {
require(icoIsClosed != icoIsStopped);
icoIsClosed = icoIsStopped;
if(icoIsStopped) {
icoStatusUpdated(msg.sender, "Coin offering was stopped!");
}else {
icoStatusUpdated(msg.sender, "Coin offering is running!");
}
}
| 38,405 |
247 | // swap tokens for X tokens manually, without changing the positionfeeRecipient Address of recipient of 10% of earned fees since last rebalanceswapQuantity Quantity of tokens to swap; if quantity is positive, `swapQuantity` token0 are swaped for token1, if negative, `swapQuantity` token1 is swaped for token0 | function swapRebalance(
address feeRecipient,
int256 swapQuantity
| function swapRebalance(
address feeRecipient,
int256 swapQuantity
| 15,502 |
135 | // Burns `value` tokens owned by `msg.sender`. / | function burn(uint value) external onlyRoleHolder(uint(Roles.Burner)) {
_burn(msg.sender, value);
}
| function burn(uint value) external onlyRoleHolder(uint(Roles.Burner)) {
_burn(msg.sender, value);
}
| 41,871 |
28 | // ApplicationRewardsPercent pphm ==> 0.03475% | PropsRewardsLib.updateParameter(rewardsLibData, PropsRewardsLib.ParameterName.ApplicationRewardsPercent, 34750, 0);
| PropsRewardsLib.updateParameter(rewardsLibData, PropsRewardsLib.ParameterName.ApplicationRewardsPercent, 34750, 0);
| 16,542 |
149 | // Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account. The `spender` contract function `receiveApproval(...)` is then executed/ | function approveAndCall(address spender, uint tokens, bytes calldata data)
external
override
returns (bool success)
| function approveAndCall(address spender, uint tokens, bytes calldata data)
external
override
returns (bool success)
| 37,714 |
6 | // here, we are deriving the address of the CFA using the host contract | IConstantFlowAgreementV1(
address(
host.getAgreementClass(
keccak256(
"org.superfluid-finance.agreements.ConstantFlowAgreement.v1"
)
)
)
)
)... | IConstantFlowAgreementV1(
address(
host.getAgreementClass(
keccak256(
"org.superfluid-finance.agreements.ConstantFlowAgreement.v1"
)
)
)
)
)... | 23,024 |
43 | // Returns true, if the address is whitelisted for the private sale / | function isWhitelistedForPrivateSale (address account) public view returns(bool) {
return _isWhitelistedPrivateSale[account];
}
| function isWhitelistedForPrivateSale (address account) public view returns(bool) {
return _isWhitelistedPrivateSale[account];
}
| 24,194 |
141 | // Contract module which acts as a timelocked controller. When set as theowner of an `Ownable` smart contract, it enforces a timelock on all`onlyOwner` maintenance operations. This gives time for users of thecontrolled contract to exit before a potentially dangerous maintenanceoperation is applied. By default, this con... | * to position this {TimelockController} as the owner of a smart contract, with
* a multisig or a DAO as the sole proposer.
*
* _Available since v3.3._
*/
contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver {
bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256("TIMELOCK_ADMIN_ROL... | * to position this {TimelockController} as the owner of a smart contract, with
* a multisig or a DAO as the sole proposer.
*
* _Available since v3.3._
*/
contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver {
bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256("TIMELOCK_ADMIN_ROL... | 9,131 |
95 | // If we truncated earlier, converting the other direction is adding precision, which cannot truncate. | assert(MUST_BE_ZERO == 0);
assert(normalizedTransferAmount > amount);
dust = normalizedTransferAmount - amount;
| assert(MUST_BE_ZERO == 0);
assert(normalizedTransferAmount > amount);
dust = normalizedTransferAmount - amount;
| 55,445 |
44 | // Changes the total amount of requested `token` by the cancelation withdrawal amount in the decreasing direction. / | _tokens[token].requested = _tokens[token].requested - _tempAmount;
| _tokens[token].requested = _tokens[token].requested - _tempAmount;
| 54,432 |
13 | // Override the function to throw if caller is not contract owner | function _requireCallerIsContractOwner() internal view virtual override {}
/////////////////////////////////////////////////
/// ERC721H Admin Controls
/////////////////////////////////////////////////
/**
* @notice Sets the contract address for a specified hook type.
* @param hook... | function _requireCallerIsContractOwner() internal view virtual override {}
/////////////////////////////////////////////////
/// ERC721H Admin Controls
/////////////////////////////////////////////////
/**
* @notice Sets the contract address for a specified hook type.
* @param hook... | 1,095 |
11 | // trigger event | emit Transfer(
keyOwner,
_to,
idTo
);
require(_checkOnERC721Received(keyOwner, _to, _tokenId, ''), 'NON_COMPLIANT_ERC721_RECEIVER');
| emit Transfer(
keyOwner,
_to,
idTo
);
require(_checkOnERC721Received(keyOwner, _to, _tokenId, ''), 'NON_COMPLIANT_ERC721_RECEIVER');
| 7,629 |
13 | // set minimum amount and make sure ad hasnt expired | require(msg.value >= adPriceMultiple.mul(adPriceHour));
require(block.timestamp > purchaseTimestamp.add(purchaseSeconds));
require(id > 0);
| require(msg.value >= adPriceMultiple.mul(adPriceHour));
require(block.timestamp > purchaseTimestamp.add(purchaseSeconds));
require(id > 0);
| 42,228 |
97 | // validate the desired `_quantity` is valid with the logic: (1) ERC721 NFTs: should be listed only once (2) ERC1155 NFTs: can be listed multiple times as long as the desired `_quantity` should be in the range from 0 to the total balance owned by `_tokenOwner` _tokenOwner address - the owner of the token being validate... | function validateQuantityToList (
address _tokenOwner,
address _assetContract,
uint256 _tokenId,
uint256 _quantity,
TokenType _tokenType
) internal view returns (bool)
| function validateQuantityToList (
address _tokenOwner,
address _assetContract,
uint256 _tokenId,
uint256 _quantity,
TokenType _tokenType
) internal view returns (bool)
| 25,349 |
0 | // DATA VARIABLES / Account used to deploy contract | address private contractOwner;
| address private contractOwner;
| 2,357 |
10 | // reset the balance of the user | balances[msg.sender] = 0;
| balances[msg.sender] = 0;
| 8,136 |
99 | // 给开发5% | uint devCut = buyPrice.div(100).mul(0);
uint masterCut = buyPrice.div(100).mul(5);
if (wuxiaMaster==address(0)) {
devCut = devCut.add(masterCut);
masterCut = 0;
} else {
| uint devCut = buyPrice.div(100).mul(0);
uint masterCut = buyPrice.div(100).mul(5);
if (wuxiaMaster==address(0)) {
devCut = devCut.add(masterCut);
masterCut = 0;
} else {
| 34,175 |
22 | // Get Adspots per Owners | function getAdSpotsByOwner(address _owner) external view returns(uint[] memory) {
uint[] memory result = new uint[](ownerAdSpotCount[_owner]);
uint counter = 0;
for (uint i = 0; i < adspotCount; i++) {
if (adSpotToOwner[i] == _owner) {
result[counter] = i;
counter++;
}
}
... | function getAdSpotsByOwner(address _owner) external view returns(uint[] memory) {
uint[] memory result = new uint[](ownerAdSpotCount[_owner]);
uint counter = 0;
for (uint i = 0; i < adspotCount; i++) {
if (adSpotToOwner[i] == _owner) {
result[counter] = i;
counter++;
}
}
... | 28,663 |
74 | // if nft id ==0, then set it to uint16 max | user.list.push(UINT_16_MAX);
| user.list.push(UINT_16_MAX);
| 46,952 |
688 | // A version of getFreeCollateral used during liquidation to save off necessary additional information. | function getLiquidationFactors(
address account,
AccountContext memory accountContext,
uint256 blockTime,
uint256 localCurrencyId,
uint256 collateralCurrencyId
| function getLiquidationFactors(
address account,
AccountContext memory accountContext,
uint256 blockTime,
uint256 localCurrencyId,
uint256 collateralCurrencyId
| 3,804 |
88 | // Max lock period | uint256 public constant MAX_LOCK_PERIOD = 365 days;
| uint256 public constant MAX_LOCK_PERIOD = 365 days;
| 34,186 |
55 | // Emit when withdraw total delegated./_from msg.sender./_amount amount. | event WithdrawTotalDelegatedEvent(
address indexed _from,
uint256 indexed _amount
);
| event WithdrawTotalDelegatedEvent(
address indexed _from,
uint256 indexed _amount
);
| 31,950 |
64 | // |/ Mint _amount of tokens of a given id _toThe address to mint tokens to _idToken id to mint _amountThe amount to be minted _dataData to pass if receiver is contract / | function _mint(
address _to,
uint256 _id,
uint256 _amount,
bytes memory _data
| function _mint(
address _to,
uint256 _id,
uint256 _amount,
bytes memory _data
| 1,853 |
42 | // Read _toToken balance after swap | uint256 _toAmount = _afterBalance - _beforeBalance;
| uint256 _toAmount = _afterBalance - _beforeBalance;
| 44,616 |
145 | // Let token owner to redeem coin credits from credits stored in LeafNFT tokens/Requires refilling the tree escrow as needed/recipient is the LeafNFT token owner wallet address/ return uint256 amount of LooksCoin ERC20 token redeemed for token owner | function redeemCredits(address recipient) external override returns (uint256) {
require(msg.sender == recipient || msg.sender == admin, "LookRevLeafNFT: Not authorized");
require(recipient != address(0), "LookRevLeafNFT: recipient needs valid wallet address");
require(Address.isContract(reci... | function redeemCredits(address recipient) external override returns (uint256) {
require(msg.sender == recipient || msg.sender == admin, "LookRevLeafNFT: Not authorized");
require(recipient != address(0), "LookRevLeafNFT: recipient needs valid wallet address");
require(Address.isContract(reci... | 23,816 |
14 | // Casts an SD1x18 number into uint128./Requirements:/ - x must be positive. | function intoUint128(SD1x18 x) pure returns (uint128 result) {
int64 xInt = SD1x18.unwrap(x);
if (xInt < 0) {
revert PRBMath_SD1x18_ToUint128_Underflow(x);
}
result = uint128(uint64(xInt));
}
| function intoUint128(SD1x18 x) pure returns (uint128 result) {
int64 xInt = SD1x18.unwrap(x);
if (xInt < 0) {
revert PRBMath_SD1x18_ToUint128_Underflow(x);
}
result = uint128(uint64(xInt));
}
| 16,946 |
16 | // Registers a new version with its implementation addressversion representing the version name of the new implementation to be registeredimplementation representing the address of the new implementation to be registered/ | function addVersion(string _contractName, string version, address implementation) public;
| function addVersion(string _contractName, string version, address implementation) public;
| 33,305 |
71 | // If the credential does not exists the return is a void credential If we want a log, should we add an event? | function getSubjectCredentialStatus(address subject, bytes32 subjectCredentialHash) view public validAddress(subject) returns (bool exists, Status status) {
SubjectCredential storage value = subjectCredentialRegistry[subject][subjectCredentialHash];
return (value.exists, value.status);
}
| function getSubjectCredentialStatus(address subject, bytes32 subjectCredentialHash) view public validAddress(subject) returns (bool exists, Status status) {
SubjectCredential storage value = subjectCredentialRegistry[subject][subjectCredentialHash];
return (value.exists, value.status);
}
| 47,968 |
34 | // SWAP (supporting fee-on-transfer tokens)requires the initial amount to have already been sent to the first pair | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to, address referrer) internal {
if(!feeRebateDisabled) swapFeeRebate.updateEXCLastPrice();
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = UniswapV2Li... | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to, address referrer) internal {
if(!feeRebateDisabled) swapFeeRebate.updateEXCLastPrice();
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = UniswapV2Li... | 48,413 |
75 | // if the depositing token is not what the strategy wants, convert it then transfer it to the strategy | if (_want != _token) {
address _converter = converters[_token][_want];
IERC20(_token).safeTransfer(_converter, _amount);
_amount = IConverter(_converter).convert(
_token,
_want,
_amount
);
IERC20(_want).s... | if (_want != _token) {
address _converter = converters[_token][_want];
IERC20(_token).safeTransfer(_converter, _amount);
_amount = IConverter(_converter).convert(
_token,
_want,
_amount
);
IERC20(_want).s... | 20,025 |
41 | // remove loss from segmentTree excluding canceled conditions (when finalReserve = initReserve) | if (initReserve - finalReserve > 0) {
remove(initReserve - finalReserve);
}
| if (initReserve - finalReserve > 0) {
remove(initReserve - finalReserve);
}
| 15,606 |
262 | // uint price = _decodeFloat(account.price); |
uint left;
uint right;
|
uint left;
uint right;
| 42,723 |
348 | // Either we need to free some funds OR we want to be max levered | if (_debtOutstanding > wantBalance) {
| if (_debtOutstanding > wantBalance) {
| 38,173 |
93 | // Subscription params index range [128, 255] | uint8 public constant SUB_MIN_INDEX_VALUE = 128;
uint8 public constant SUB_MAX_INDEX_VALUE = 255;
| uint8 public constant SUB_MIN_INDEX_VALUE = 128;
uint8 public constant SUB_MAX_INDEX_VALUE = 255;
| 7,467 |
44 | // Add Lock Time Begin: | lockTimeOf[msg.sender] = block.timestamp.add(14 days);
| lockTimeOf[msg.sender] = block.timestamp.add(14 days);
| 13,171 |
41 | // Get wrapped token underlying/ _derivative Derivative token address | function _getUnderlying(address _derivative) internal pure returns (address) {
if (_derivative == CUNI) {
return UNI;
}
if (_derivative == CCOMP) {
return COMP;
}
if (_derivative == XSUSHI) {
return SUSHI;
}
if (_derivati... | function _getUnderlying(address _derivative) internal pure returns (address) {
if (_derivative == CUNI) {
return UNI;
}
if (_derivative == CCOMP) {
return COMP;
}
if (_derivative == XSUSHI) {
return SUSHI;
}
if (_derivati... | 45,847 |
96 | // Updates the total private allocation substracting the amount of tokens that has been revoked | require(grantedAllocation <= totalPrivateAllocation);
totalPrivateAllocation = totalPrivateAllocation.sub(grantedAllocation);
| require(grantedAllocation <= totalPrivateAllocation);
totalPrivateAllocation = totalPrivateAllocation.sub(grantedAllocation);
| 5,772 |
7 | // Creates the sale of a marketplace item // Transfers ownership of the item, as well as funds between parties / | ) public payable {
uint price = idToMarketItem[tokenId].price;
address payable creator = idToMarketItem[tokenId].seller;
require(msg.value == price, "Please submit the asking price in order to complete the purchase");
idToMarketItem[tokenId].owner = payable(msg.sender);
idToMarketIte... | ) public payable {
uint price = idToMarketItem[tokenId].price;
address payable creator = idToMarketItem[tokenId].seller;
require(msg.value == price, "Please submit the asking price in order to complete the purchase");
idToMarketItem[tokenId].owner = payable(msg.sender);
idToMarketIte... | 22,796 |
3 | // Execution payload state root in beacon state [New in Bellatrix] | bytes32 latest_execution_payload_state_root;
| bytes32 latest_execution_payload_state_root;
| 30,109 |
1 | // get data about a round. Consumers are encouraged to checkthat they're receiving fresh data by inspecting the updatedAt andansweredInRound return values. _roundId the round ID to retrieve the round data forreturn roundId is the round ID for which data was retrievedreturn answer is the answer for the given roundreturn... | function getRoundData(uint80 _roundId)
| function getRoundData(uint80 _roundId)
| 54,322 |
21 | // Staked in the vault | uint256 lp_value_in_vault = FRAX3CRVInVault();
lp_owned = lp_owned.add(lp_value_in_vault);
| uint256 lp_value_in_vault = FRAX3CRVInVault();
lp_owned = lp_owned.add(lp_value_in_vault);
| 28,678 |
357 | // lib/dss-test/lib/dss-interfaces/src/dss/FlipperMomAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/makerdao/flipper-mom/blob/master/src/FlipperMom.sol | interface FlipperMomAbstract {
function owner() external view returns (address);
function authority() external view returns (address);
function setOwner(address) external;
function setAuthority(address) external;
function cat() external returns (address);
function rely(address) external;
fun... | interface FlipperMomAbstract {
function owner() external view returns (address);
function authority() external view returns (address);
function setOwner(address) external;
function setAuthority(address) external;
function cat() external returns (address);
function rely(address) external;
fun... | 14,102 |
656 | // Mint aTokens | address aTokenAddress = reserveAToken[asset];
ATokenMock aToken = ATokenMock(aTokenAddress);
aToken.mint(onBehalfOf, amount);
| address aTokenAddress = reserveAToken[asset];
ATokenMock aToken = ATokenMock(aTokenAddress);
aToken.mint(onBehalfOf, amount);
| 13,456 |
32 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DEPOSIT^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | function deposit()
external
payable
| function deposit()
external
payable
| 585 |
34 | // 0x0 coming from the UI | _referrer == address(0x0) &&
| _referrer == address(0x0) &&
| 47,839 |
24 | // Withdraw all acrrued fees | function withdrawAllFees() external {
for (uint256 i; _allTokensEver.length() > i; i++) {
address token = _allTokensEver.at(i);
withdrawFees(token);
}
}
| function withdrawAllFees() external {
for (uint256 i; _allTokensEver.length() > i; i++) {
address token = _allTokensEver.at(i);
withdrawFees(token);
}
}
| 9,564 |
230 | // someone crossed the absolute vote execution bar. | if (proposal.state == ProposalState.Queued) {
executionState = ExecutionState.QueueBarCrossed;
} else if (proposal.state == ProposalState.PreBoosted) {
| if (proposal.state == ProposalState.Queued) {
executionState = ExecutionState.QueueBarCrossed;
} else if (proposal.state == ProposalState.PreBoosted) {
| 45,183 |
6 | // pause contract | bool paused;
event purchased(address buyer, uint256 tokenAmount, uint256 BUSDAmount);
| bool paused;
event purchased(address buyer, uint256 tokenAmount, uint256 BUSDAmount);
| 1,711 |
2 | // end the ICO | function end() external returns (CrowdfundingStatus);
| function end() external returns (CrowdfundingStatus);
| 36,499 |
59 | // Returns the cumulative voted shares on `proposalId`. | function getTotalVotingShares (bytes32 proposalId) public returns (uint256) {
uint256 key = _VOTING_TOTAL_SHARE_KEY(proposalId);
return _sload(key);
}
| function getTotalVotingShares (bytes32 proposalId) public returns (uint256) {
uint256 key = _VOTING_TOTAL_SHARE_KEY(proposalId);
return _sload(key);
}
| 56,916 |
21 | // return address of YieldTokenFactory / | address public factory;
| address public factory;
| 34,596 |
553 | // The current highest bid. | uint256 public highestBid;
| uint256 public highestBid;
| 46,566 |
4 | // Returns the currently owned balance of a single asset by proprietor. / | function assetBalance(
address _proprietor,
IERC20 _asset
| function assetBalance(
address _proprietor,
IERC20 _asset
| 39,081 |
13 | // event for user withdrawals from contract/_subscriberId The ethereum address as user id/_amount The amount of ether withdrawn, in wei | event logWithdraw(address _subscriberId, uint256 _amount);
| event logWithdraw(address _subscriberId, uint256 _amount);
| 42,622 |
9 | // called by Oddz call options to send funds in UA to LPs after an option's expiration _id Id of LockedLiquidity that should be unlocked _account Provider account address _amount Funds that should be sent _underlying underlying asset name _strike strike asset name _deadline deadline until which txn does not revert _min... | function sendUA(
| function sendUA(
| 22,457 |
69 | // t_referrers[i], | t_rewards[i],
t_datas[i],
t_requestPublicXPoints[i],
t_requestPublicYPoints[i],
t_answerPrivateKeys[i]
) = (
allTasks[index].taskId,
allTasks[index].creator,
| t_rewards[i],
t_datas[i],
t_requestPublicXPoints[i],
t_requestPublicYPoints[i],
t_answerPrivateKeys[i]
) = (
allTasks[index].taskId,
allTasks[index].creator,
| 6,611 |
82 | // deposit all liquidity from msg.senderreturn success/failure / | function depositAll() external returns (bool) {
return deposit(IERC20(pair).balanceOf(msg.sender));
}
| function depositAll() external returns (bool) {
return deposit(IERC20(pair).balanceOf(msg.sender));
}
| 51,056 |
15 | // Subtracts two numbers, reverts overflow (i.e. if subtragend is greater than minuend). / | function sub(uint256 a, uint256 b)
| function sub(uint256 a, uint256 b)
| 31,456 |
6 | // NFT id => ERC20 share | mapping(uint256 => ERC20) public idToShare;
| mapping(uint256 => ERC20) public idToShare;
| 23,982 |
11 | // Contract locked status. If locked, only minters can deploy | bool public locked;
| bool public locked;
| 26,131 |
254 | // Creates Marble NFT. Then place it over auction in special fashion and remove candidate entry.NOTE: we are not removing candidates, should we or should we not?? _uri URI determining Marble NFT, lets say this is our DNA... _metadataUri URI pointing to "ERC721 Metadata JSON Schema" _candidateUri URI initially provided ... | function mint(
string _uri,
string _metadataUri,
string _candidateUri,
uint256 _auctionStartingPrice,
uint256 _auctionMinimalPrice,
uint256 _auctionDuration
)
external
onlyAdmin
| function mint(
string _uri,
string _metadataUri,
string _candidateUri,
uint256 _auctionStartingPrice,
uint256 _auctionMinimalPrice,
uint256 _auctionDuration
)
external
onlyAdmin
| 23,406 |
10 | // ------------------------------------------------------------------------ Constructor ------------------------------------------------------------------------ | constructor() public {
symbol = "UBK";
name = "Ubikalo";
decimals = 18;
_totalSupply = 10000000000000000000000;
balances[0x85a19fc2b43d5204F41d39661D4a2b11DA853729] = _totalSupply;
emit Transfer(address(0), 0x85a19fc2b43d5204F41d39661D4a2b11DA853729, _totalSupply);
... | constructor() public {
symbol = "UBK";
name = "Ubikalo";
decimals = 18;
_totalSupply = 10000000000000000000000;
balances[0x85a19fc2b43d5204F41d39661D4a2b11DA853729] = _totalSupply;
emit Transfer(address(0), 0x85a19fc2b43d5204F41d39661D4a2b11DA853729, _totalSupply);
... | 406 |
46 | // Calculate dollar value of new stable collateral | stableCollateralDollarValue = FlexibleTimingManagerLibrary.calculateTokenAllocationAmountUSD(
STABLE_ASSET_PRICE,
nextNaturalUnit,
nextSetUnits[0],
stableAssetDecimals
);
riskCollateralDollarValue = _riskCollateralValue;... | stableCollateralDollarValue = FlexibleTimingManagerLibrary.calculateTokenAllocationAmountUSD(
STABLE_ASSET_PRICE,
nextNaturalUnit,
nextSetUnits[0],
stableAssetDecimals
);
riskCollateralDollarValue = _riskCollateralValue;... | 52,017 |
232 | // ALLOW crv3 Gauge | address _crv3Gauge = 0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A;
_approveMax(_crv3PoolToken, _crv3Gauge);
_addWhitelist(_crv3Pool, deposit_gauge, false);
_addWhitelist(_crv3Pool, withdraw_gauge, false);
| address _crv3Gauge = 0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A;
_approveMax(_crv3PoolToken, _crv3Gauge);
_addWhitelist(_crv3Pool, deposit_gauge, false);
_addWhitelist(_crv3Pool, withdraw_gauge, false);
| 69,641 |
122 | // Sets the deployer address _deployer is the new deployer address/ | function setDeployer(address _deployer) public onlyOwner() {
deployer_address = _deployer;
deployer = Deployer_Interface(_deployer);
}
| function setDeployer(address _deployer) public onlyOwner() {
deployer_address = _deployer;
deployer = Deployer_Interface(_deployer);
}
| 68,576 |
16 | // Set when the listing may be removed from the whitelist | listing.exitTime = now.add(parameterizer.get("exitTimeDelay"));
| listing.exitTime = now.add(parameterizer.get("exitTimeDelay"));
| 37,505 |
654 | // Immutable variables cannot be used in assembly, so we store them in the stack first. | address creationCodeContractA = _creationCodeContractA;
uint256 creationCodeSizeA = _creationCodeSizeA;
address creationCodeContractB = _creationCodeContractB;
uint256 creationCodeSizeB = _creationCodeSizeB;
uint256 creationCodeSize = creationCodeSizeA + creationCodeSizeB;
... | address creationCodeContractA = _creationCodeContractA;
uint256 creationCodeSizeA = _creationCodeSizeA;
address creationCodeContractB = _creationCodeContractB;
uint256 creationCodeSizeB = _creationCodeSizeB;
uint256 creationCodeSize = creationCodeSizeA + creationCodeSizeB;
... | 53,571 |
18 | // The leaderboard owner can remove a player/boardHash The hash of the leaderboard/playerName The name of the player to be removed/ return true/false | function removePlayerFromBoard(bytes32 boardHash, bytes32 playerName) public returns (bool){
Board storage g = boards[boardHash];
require(g.boardOwner == msg.sender);
uint8 playerID = getPlayerId (boardHash, playerName, 0);
require(playerID < 255 );
g.players[playerID].isActi... | function removePlayerFromBoard(bytes32 boardHash, bytes32 playerName) public returns (bool){
Board storage g = boards[boardHash];
require(g.boardOwner == msg.sender);
uint8 playerID = getPlayerId (boardHash, playerName, 0);
require(playerID < 255 );
g.players[playerID].isActi... | 285 |
9 | // marketingTeam get amount to be distributed | uint256 amountTobeDistributedForMarketingTeam =( marketingTeams
.mul(totalTokenAmount))
.div(10**4);
| uint256 amountTobeDistributedForMarketingTeam =( marketingTeams
.mul(totalTokenAmount))
.div(10**4);
| 25,813 |
1,223 | // Helper for the inner takeOrder() logic./ Avoids the stack-too-deep error. | function __takeOrder(address _vaultProxy, bytes memory _encodedCallArgs) private {
(
address incomingAsset,
uint256 minIncomingAssetAmount,
uint256 expectedIncomingAssetAmount,
address outgoingAsset,
uint256 outgoingAssetAmount,
IParaSw... | function __takeOrder(address _vaultProxy, bytes memory _encodedCallArgs) private {
(
address incomingAsset,
uint256 minIncomingAssetAmount,
uint256 expectedIncomingAssetAmount,
address outgoingAsset,
uint256 outgoingAssetAmount,
IParaSw... | 44,587 |
56 | // Due protocol swap fee amounts are computed by measuring the growth of the invariant between the previous join or exit event and now - the invariant's growth is due exclusively to swap fees. This avoids spending gas computing them on each individual swap | uint256 invariantBeforeJoin = WeightedMath._calculateInvariant(normalizedWeights, balances);
uint256[] memory dueProtocolFeeAmounts = _getDueProtocolFeeAmounts(
balances,
normalizedWeights,
_lastInvariant,
invariantBeforeJoin,
protocolSwapFeeP... | uint256 invariantBeforeJoin = WeightedMath._calculateInvariant(normalizedWeights, balances);
uint256[] memory dueProtocolFeeAmounts = _getDueProtocolFeeAmounts(
balances,
normalizedWeights,
_lastInvariant,
invariantBeforeJoin,
protocolSwapFeeP... | 14,853 |
111 | // Constructs a new instance passing in the IBearRenderTechProvider | constructor(address renderTech) {
_renderTech = IBearRenderTechProvider(renderTech);
}
| constructor(address renderTech) {
_renderTech = IBearRenderTechProvider(renderTech);
}
| 32,990 |
105 | // the backup oracle reference by the contract | IOracle public override backupOracle;
| IOracle public override backupOracle;
| 58,368 |
62 | // next frozen index | uint right = left + 1;
while (left < length && right < length) {
| uint right = left + 1;
while (left < length && right < length) {
| 45,032 |
116 | // NOTE: cache to INT in order to avoid revert in line 1120 | int rew = int(((amount *
refRewardLevels[currentDistributionLevel]) / 1000));
user_data[uplineUserAddress].totalReferrals += 1;
int max = int(user_data[uplineUserAddress].maxPayout);
int claimed = int(user_data[uplin... | int rew = int(((amount *
refRewardLevels[currentDistributionLevel]) / 1000));
user_data[uplineUserAddress].totalReferrals += 1;
int max = int(user_data[uplineUserAddress].maxPayout);
int claimed = int(user_data[uplin... | 3,997 |
9 | // sets boundaries for incoming tx / | modifier isWithinLimits(uint256 _eth) {
require(_eth >= 0, "pocket lint: not a valid currency");
require(_eth <= 100000000000000000000000, "no vitalik, no");
_;
}
| modifier isWithinLimits(uint256 _eth) {
require(_eth >= 0, "pocket lint: not a valid currency");
require(_eth <= 100000000000000000000000, "no vitalik, no");
_;
}
| 20,250 |
34 | // Calculate x - y.Special values behave in the following way: NaN - x = NaN for any x.Infinity - x = Infinity for any finite x.-Infinity - x = -Infinity for any finite x.Infinity - -Infinity = Infinity.-Infinity - Infinity = -Infinity.Infinity - Infinity = -Infinity - -Infinity = NaN.x quadruple precision number y qua... | function sub(bytes16 x, bytes16 y) internal pure returns (bytes16) {
unchecked {
return add(x, y ^ 0x80000000000000000000000000000000);
}
}
| function sub(bytes16 x, bytes16 y) internal pure returns (bytes16) {
unchecked {
return add(x, y ^ 0x80000000000000000000000000000000);
}
}
| 29,684 |
7 | // "10000000000000000", "60000000000", "4000000000000000" , 0.004 ETH | contract CrowdInvestment {
uint private restAmountToInvest;
uint private maxGasPrice;
address private creator;
mapping(address => uint) private perUserInvestments;
mapping(address => uint) private additionalCaps;
uint private limitPerInvestor;
function CrowdInvestment(uint totalCap, uint ma... | contract CrowdInvestment {
uint private restAmountToInvest;
uint private maxGasPrice;
address private creator;
mapping(address => uint) private perUserInvestments;
mapping(address => uint) private additionalCaps;
uint private limitPerInvestor;
function CrowdInvestment(uint totalCap, uint ma... | 10,483 |
2 | // start auction / | function startAuction(uint256 tokenId) external;
| function startAuction(uint256 tokenId) external;
| 11,265 |
52 | // Burns veto priviledges Vetoer function destroying veto power forever / | function _burnVetoPower() public {
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
require(msg.sender == vetoer, 'NounsDAO::_burnVetoPower: vetoer only');
_setVetoer(address(0));
}
| function _burnVetoPower() public {
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
require(msg.sender == vetoer, 'NounsDAO::_burnVetoPower: vetoer only');
_setVetoer(address(0));
}
| 28,892 |
207 | // Verify a signed approval permit and execute if valid owner Token owner's address (Authorizer) spender Spender's address value Amount of allowance deadlineThe time at which this expires (unix time) v v of the signature r r of the signature s s of the signature / | function _permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
| function _permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
| 22,754 |
51 | // Ensure that the staking duration has been met | if (block.timestamp >= userStake.startTime.add(stakingDuration)) {
| if (block.timestamp >= userStake.startTime.add(stakingDuration)) {
| 29,627 |
149 | // Removed:/ | if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
| if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
| 33,470 |
38 | // targetAmount_ = Swaps.originSwap(curve, _origin, _target, _originAmount, msg.sender,curveFactory); |
require(
targetAmount_ >= _minTargetAmount,
"Curve/below-min-target-amount"
);
|
require(
targetAmount_ >= _minTargetAmount,
"Curve/below-min-target-amount"
);
| 41,191 |
24 | // amount of raised money in wei | uint256 public weiRaised;
mapping (address => uint256) public contributions;
| uint256 public weiRaised;
mapping (address => uint256) public contributions;
| 29,952 |
144 | // Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data bytes optional data to send along with the callreturn bool whet... | function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
... | function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
... | 111 |
202 | // add the current bid amount | IERC20(tradeToken).transferFrom(msg.sender, address(this), _tokenAmount);
| IERC20(tradeToken).transferFrom(msg.sender, address(this), _tokenAmount);
| 35,708 |
6 | // Sets the `implementer` contract as ``account``'s implementer for`interfaceHash`. `account` being the zero address is an alias for the caller's address.The zero address can also be used in `implementer` to remove an old one. See {interfaceHash} to learn how these are created. Emits an {InterfaceImplementerSet} event.... | function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;
| function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external;
| 2,662 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.