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 |
|---|---|---|---|---|
107 | // Throws if the sender is not the owner. / | function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
| function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
| 3,106 |
1 | // nest地址 | address constant NEST_TOKEN_ADDRESS = address(0x04abEdA201850aC0124161F037Efd70c74ddC74C);
| address constant NEST_TOKEN_ADDRESS = address(0x04abEdA201850aC0124161F037Efd70c74ddC74C);
| 52,128 |
3 | // Send a message through the Commun Room if in possession/ of a connection/_message The message to be sent/ return hash of the message and the connection | function send(string calldata _message) external returns (bytes32);
| function send(string calldata _message) external returns (bytes32);
| 44,837 |
41 | // function {_configHashMatches} Check the passed config against the stored config hashmetaId_ The drop Id being approved salt_ Salt for create2 erc20Config_ ERC20 configuration signedMessage_ The signed message object lockerFee_ The fee for the unicrypt locker deploymentFee_ The fee for deployment, if any deployer_ Ad... | function _configHashMatches(
string calldata metaId_,
bytes32 salt_,
ERC20Config calldata erc20Config_,
SignedDropMessageDetails calldata signedMessage_,
uint256 lockerFee_,
uint256 deploymentFee_,
address deployer_
) internal pure returns (bool matches_) {
| function _configHashMatches(
string calldata metaId_,
bytes32 salt_,
ERC20Config calldata erc20Config_,
SignedDropMessageDetails calldata signedMessage_,
uint256 lockerFee_,
uint256 deploymentFee_,
address deployer_
) internal pure returns (bool matches_) {
| 31,333 |
156 | // Returns the downcasted uint56 from uint256, reverting onoverflow (when the input is greater than largest uint56). Counterpart to Solidity's `uint56` operator. Requirements: - input must fit into 56 bits _Available since v4.7._ / | function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
| function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
| 936 |
143 | // Storage of map keys and values | MapEntry[] _entries;
| MapEntry[] _entries;
| 2,387 |
6 | // Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow. / | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 4,632 |
9 | // Reverts transaction if isInitialized is false. Used by child contracts to ensure contract is initialized before functions can be called. / | function _requireIsInitialized() internal view {
require(isInitialized == true, ERROR_NOT_INITIALIZED);
}
| function _requireIsInitialized() internal view {
require(isInitialized == true, ERROR_NOT_INITIALIZED);
}
| 3,065 |
15 | // Returns the token decimals. / | function decimals() external view returns (uint8);
| function decimals() external view returns (uint8);
| 7,571 |
240 | // Constraint expression for public_memory_addr_zero: column17_row2. | let val := /*column17_row2*/ mload(0x26a0)
| let val := /*column17_row2*/ mload(0x26a0)
| 19,583 |
1 | // IERC165 supports an interfaceId/interfaceId The interfaceId to check/ return true if the interfaceId is supported | function supportsInterface(bytes4 interfaceId) public pure override returns (bool) {
return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId;
}
| function supportsInterface(bytes4 interfaceId) public pure override returns (bool) {
return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId;
}
| 21,206 |
93 | // If denominator is zero then by the precodition numerator is also zero and therefore prod is zero. We get div(_, 0), which evaluates to 0. | partialAmount := div(prod0, denominator)
| partialAmount := div(prod0, denominator)
| 643 |
52 | // ICO finished Event | event TokenSaleFinished(string desc, address indexed contributors, uint256 icoTotalAmount, uint256 totalSoldToken, uint256 leftAmount);
| event TokenSaleFinished(string desc, address indexed contributors, uint256 icoTotalAmount, uint256 totalSoldToken, uint256 leftAmount);
| 11,793 |
20 | // Calculates current pledge state borrower Address of borrower debt Index of borrowers's debtreturn Amount of unpaid debt, amount of interest payment / | function getDebtRequiredPayments(address borrower, uint256 debt) public view returns(uint256, uint256) {
| function getDebtRequiredPayments(address borrower, uint256 debt) public view returns(uint256, uint256) {
| 52,788 |
157 | // gives estiomate of future APR with a change of debt limit. Useful for governance to decide debt limits | function estimatedFutureAPR(uint256 newDebtLimit) public view returns (uint256) {
uint256 oldDebtLimit = vault.strategies(address(this)).totalDebt;
uint256 change;
if (oldDebtLimit < newDebtLimit) {
change = newDebtLimit - oldDebtLimit;
return _estimateDebtLimitIncrea... | function estimatedFutureAPR(uint256 newDebtLimit) public view returns (uint256) {
uint256 oldDebtLimit = vault.strategies(address(this)).totalDebt;
uint256 change;
if (oldDebtLimit < newDebtLimit) {
change = newDebtLimit - oldDebtLimit;
return _estimateDebtLimitIncrea... | 3,118 |
74 | // Returns the Name for a given token ID.Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query / | function tokenName(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token");
uint256 niftyType = _getNiftyTypeId(tokenId);
return _niftyTypeName[niftyType];
}
| function tokenName(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token");
uint256 niftyType = _getNiftyTypeId(tokenId);
return _niftyTypeName[niftyType];
}
| 26,024 |
117 | // transfers between UniswapRouter and UniswapPair are tax and lock free | address uniswapV2Router=address(_uniswapV2Router);
bool isLiquidityTransfer = ((sender == _uniswapV2PairAddress && recipient == uniswapV2Router)
|| (recipient == _uniswapV2PairAddress && sender == uniswapV2Router));
| address uniswapV2Router=address(_uniswapV2Router);
bool isLiquidityTransfer = ((sender == _uniswapV2PairAddress && recipient == uniswapV2Router)
|| (recipient == _uniswapV2PairAddress && sender == uniswapV2Router));
| 29,441 |
119 | // round 49 | ark(i, q, 9386595745626044000666050847309903206827901310677406022353307960932745699524);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 9386595745626044000666050847309903206827901310677406022353307960932745699524);
sbox_partial(i, q);
mix(i, q);
| 27,733 |
62 | // SKILL |
function buySkill(
uint256 _id,
uint256 _target,
uint256 _expectedPrice,
uint32 _expectedEffect
|
function buySkill(
uint256 _id,
uint256 _target,
uint256 _expectedPrice,
uint32 _expectedEffect
| 13,455 |
1 | // variable visibility (private, internal, public) | uint256 a;
| uint256 a;
| 19,860 |
13 | // a method that returns a struct/ return a Struct struct | function structOutput() public pure returns(Struct memory s) {
bytes[] memory byteArray = new bytes[](2);
byteArray[0] = "0x123";
byteArray[1] = "0x321";
return Struct({
someBytes: "0x123",
anInteger: 5,
aDynamicArrayOfBytes: byteArray,
... | function structOutput() public pure returns(Struct memory s) {
bytes[] memory byteArray = new bytes[](2);
byteArray[0] = "0x123";
byteArray[1] = "0x321";
return Struct({
someBytes: "0x123",
anInteger: 5,
aDynamicArrayOfBytes: byteArray,
... | 41,844 |
80 | // Event emitted when the `licenseUri` is set for the collection. licenseUri the new URI / | event LicenseUriSet(string licenseUri);
| event LicenseUriSet(string licenseUri);
| 9,095 |
278 | // mint by ETH -> convert to WETH | if (msg.value > 0) {
IWETH(WETH).deposit{value: msg.value}();
| if (msg.value > 0) {
IWETH(WETH).deposit{value: msg.value}();
| 39,158 |
78 | // IInitializableAToken Interface for the initialize function on AToken Aave / | interface IInitializableAToken {
/**
* @dev Emitted when an aToken is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated lending pool
* @param treasury The address of the treasury
* @param incentivesController The address of ... | interface IInitializableAToken {
/**
* @dev Emitted when an aToken is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated lending pool
* @param treasury The address of the treasury
* @param incentivesController The address of ... | 50,903 |
12 | // Time between proposals | uint256 public transferProposalCooldown = 1 days;
| uint256 public transferProposalCooldown = 1 days;
| 26,865 |
9 | // create the MarketMaker and the CC token put all the CC token in the Market Maker reserve/_name string name for CC token that is created./_symbol string symbol for CC token that is created./_decimals uint8 percison for CC token that is created./_totalSupply uint256 total supply of the CC token that is created./_token... | function createCurrency(string _name,
string _symbol,
uint8 _decimals,
uint256 _totalSupply,
string _tokenURI) public
| function createCurrency(string _name,
string _symbol,
uint8 _decimals,
uint256 _totalSupply,
string _tokenURI) public
| 17,615 |
230 | // verify that redeem will not overflow for this locker | require((scores[_locker] * reputationReward)/scores[_locker] == reputationReward,
"score is too high");
totalScore = totalScore.add(score);
emit Lock(_locker, lockingId, _amount, _period);
| require((scores[_locker] * reputationReward)/scores[_locker] == reputationReward,
"score is too high");
totalScore = totalScore.add(score);
emit Lock(_locker, lockingId, _amount, _period);
| 29,959 |
65 | // The arbitrator accepts a dispute as being valid. Accept a dispute with ID `_disputeID` _disputeID ID of the dispute to be accepted / | function acceptDispute(bytes32 _disputeID) external override onlyArbitrator {
Dispute memory dispute = _resolveDispute(_disputeID);
// Slash
uint256 tokensToReward = _slashIndexer(dispute.indexer, dispute.fisherman);
// Give the fisherman their deposit back
if (dispute.depo... | function acceptDispute(bytes32 _disputeID) external override onlyArbitrator {
Dispute memory dispute = _resolveDispute(_disputeID);
// Slash
uint256 tokensToReward = _slashIndexer(dispute.indexer, dispute.fisherman);
// Give the fisherman their deposit back
if (dispute.depo... | 16,256 |
3 | // pre-deteremine the flip outcome | uint256 blockValue = uint256(blockhash(block.number-1));
uint256 coinFlip = blockValue / FACTOR;
bool side = coinFlip == 1 ? true : false;
| uint256 blockValue = uint256(blockhash(block.number-1));
uint256 coinFlip = blockValue / FACTOR;
bool side = coinFlip == 1 ? true : false;
| 4,222 |
176 | // Reward Control Contract address / | RewardControlInterface public rewardControl;
| RewardControlInterface public rewardControl;
| 17,425 |
25 | // This can happen | _last_point.bias = 0;
| _last_point.bias = 0;
| 19,588 |
26 | // Upgrade the validator by setting the current validator as the proposed validator. Must have a proposed validator. Only owner can call. / | function upgradeValidator()
external
onlyOwner()
| function upgradeValidator()
external
onlyOwner()
| 22,860 |
54 | // Apply the interest remaining so we get up to the netInterestSharePrice | (interestRemaining, principalRemaining) = applyToTrancheBySharePrice(
interestRemaining,
principalRemaining,
desiredNetInterestSharePrice,
expectedPrincipalSharePrice,
seniorTranche
);
| (interestRemaining, principalRemaining) = applyToTrancheBySharePrice(
interestRemaining,
principalRemaining,
desiredNetInterestSharePrice,
expectedPrincipalSharePrice,
seniorTranche
);
| 44,871 |
238 | // Called during round initialization to set the total active stake for the round. Only callable by the RoundsManager / | function setCurrentRoundTotalActiveStake() external onlyRoundsManager {
currentRoundTotalActiveStake = nextRoundTotalActiveStake;
}
| function setCurrentRoundTotalActiveStake() external onlyRoundsManager {
currentRoundTotalActiveStake = nextRoundTotalActiveStake;
}
| 35,251 |
30 | // method to transfer unipilot earned fees to Index Fund | function transferFeesToIF(
bool isReadjustLiquidity,
uint256 fees0,
uint256 fees1
| function transferFeesToIF(
bool isReadjustLiquidity,
uint256 fees0,
uint256 fees1
| 26,598 |
97 | // final bonus rate | sharesToAdd = deposit.addBP(bonusRangeBP[currentBonusIndex]);
| sharesToAdd = deposit.addBP(bonusRangeBP[currentBonusIndex]);
| 4,974 |
96 | // Implementation template Do something | } else if (sig == bytes4(keccak256(bytes("handlerFunction_2()")))) {
| } else if (sig == bytes4(keccak256(bytes("handlerFunction_2()")))) {
| 15,688 |
74 | // function to calculate amount of tokens received after sending collateral / | function calculateTokenReceived(address contractAddress, uint256 _collateToSell) public view returns(uint256)
| function calculateTokenReceived(address contractAddress, uint256 _collateToSell) public view returns(uint256)
| 582 |
539 | // Verify only the transfer quantity is subtracted | require(
newBalance == existingBalance.sub(_quantity),
"Invalid post transfer balance"
);
| require(
newBalance == existingBalance.sub(_quantity),
"Invalid post transfer balance"
);
| 32,540 |
32 | // Attribution to the awesome delta.financial contracts/ | function marketParticipationAgreement() public pure returns (string memory) {
return "I understand that I'm interacting with a smart contract. I understand that tokens committed are subject to the token issuer and local laws where applicable. I reviewed code of the smart contract and understand it fully. I ... | function marketParticipationAgreement() public pure returns (string memory) {
return "I understand that I'm interacting with a smart contract. I understand that tokens committed are subject to the token issuer and local laws where applicable. I reviewed code of the smart contract and understand it fully. I ... | 33,377 |
0 | // the token to distribute | ERC20 internal _token;
| ERC20 internal _token;
| 12,836 |
238 | // Future Borrow Rate with the amount to borrow counted as already borrowed | uint _borrowRate = interestModule.getBorrowRate(address(this), underlyingBalance().sub(_amount), totalBorrowed.add(_amount), totalReserve);
uint _minFees = minBorrowLength.mul(_amount.mul(_borrowRate)).div(mantissaScale);
return _minFees > 0 ? _minFees : 1;
| uint _borrowRate = interestModule.getBorrowRate(address(this), underlyingBalance().sub(_amount), totalBorrowed.add(_amount), totalReserve);
uint _minFees = minBorrowLength.mul(_amount.mul(_borrowRate)).div(mantissaScale);
return _minFees > 0 ? _minFees : 1;
| 75,048 |
230 | // Getter for number of future registeredreturn the number of future registered / | function futureVaultCount() external view returns (uint256);
| function futureVaultCount() external view returns (uint256);
| 20,555 |
243 | // get output price. return how many quote asset you will get with the input base amount _dir ADD_TO_AMM for short, REMOVE_FROM_AMM for long, opposite direction from `getInput`. _baseAssetAmount base asset amountreturn quote asset amount / | function getOutputPrice(Dir _dir, Decimal.decimal memory _baseAssetAmount)
public
view
override
returns (Decimal.decimal memory)
| function getOutputPrice(Dir _dir, Decimal.decimal memory _baseAssetAmount)
public
view
override
returns (Decimal.decimal memory)
| 2,513 |
44 | // zero out the 32 bytes slice we are about to returnwe need to do it because Solidity does not garbage collect | mstore(tempBytes, 0)
mstore(0x40, add(tempBytes, 0x20))
| mstore(tempBytes, 0)
mstore(0x40, add(tempBytes, 0x20))
| 4,443 |
185 | // Contracts | IMAL public MAL;
ISTAKING public STAKING;
IERC721 public APES;
event TreasuriesMinted(address indexed mintedBy, uint256 indexed tokensNumber);
| IMAL public MAL;
ISTAKING public STAKING;
IERC721 public APES;
event TreasuriesMinted(address indexed mintedBy, uint256 indexed tokensNumber);
| 38,809 |
26 | // before = 4 bytes domain | return _tokenId.index(4, 32);
| return _tokenId.index(4, 32);
| 14,690 |
20 | // Return an empty array | return new uint256[](0);
| return new uint256[](0);
| 46,884 |
467 | // Mint tokens to recipient | _transferTokensMint(_recipient, amount);
| _transferTokensMint(_recipient, amount);
| 34,987 |
213 | // invalid pid, set default pid:1 | _winPID = 1;
| _winPID = 1;
| 7,719 |
1 | // check if specific token has atomic pricing (has atomic oracle wrapper) / | function isAtomicPricing() external view returns (bool);
| function isAtomicPricing() external view returns (bool);
| 22,568 |
169 | // xyz token path | address[] memory xyzPath = new address[](4);
xyzPath[0] = address(xyz);
xyzPath[1] = address(usdc);
xyzPath[2] = address(weth);
xyzPath[3] = address(want);
| address[] memory xyzPath = new address[](4);
xyzPath[0] = address(xyz);
xyzPath[1] = address(usdc);
xyzPath[2] = address(weth);
xyzPath[3] = address(want);
| 37,394 |
0 | // Utility functions and data used in AaveV2 actions | contract InstHelper is MainnetInstAddresses{
IManager public constant mcdManager =
IManager(MCD_MANAGER);
IInstaIndex public constant instaAccountBuilder =
IInstaIndex(INST_ACCOUNT_BUILDER);
IInstaMakerDAOMerkleDistributor public constant rewardDistributor =
IInstaMakerDAOMerkl... | contract InstHelper is MainnetInstAddresses{
IManager public constant mcdManager =
IManager(MCD_MANAGER);
IInstaIndex public constant instaAccountBuilder =
IInstaIndex(INST_ACCOUNT_BUILDER);
IInstaMakerDAOMerkleDistributor public constant rewardDistributor =
IInstaMakerDAOMerkl... | 27,368 |
140 | // Read next variable bytes starting from offset, buffSource bytes array offsetThe position from where we read the bytes valuereturnThe read variable bytes array value and updated offset/ | function NextVarBytes(bytes memory buff, uint256 offset) internal pure returns(bytes memory, uint256) {
uint len;
(len, offset) = NextVarUint(buff, offset);
require(offset + len <= buff.length && offset < offset + len, "NextVarBytes, offset exceeds maximum");
bytes memory tempBytes;
... | function NextVarBytes(bytes memory buff, uint256 offset) internal pure returns(bytes memory, uint256) {
uint len;
(len, offset) = NextVarUint(buff, offset);
require(offset + len <= buff.length && offset < offset + len, "NextVarBytes, offset exceeds maximum");
bytes memory tempBytes;
... | 29,014 |
226 | // Send quoted Ether amount to recipient and revert with reason on failure. | (bool ok, ) = recipient.call.value(etherAmount)("");
if (!ok) {
assembly {
returndatacopy(0, 0, returndatasize)
revert(0, returndatasize)
}
| (bool ok, ) = recipient.call.value(etherAmount)("");
if (!ok) {
assembly {
returndatacopy(0, 0, returndatasize)
revert(0, returndatasize)
}
| 35,739 |
0 | // ICryptopiaERC721/Non-fungible token (ERC721) /HFB - <frank@cryptopia.com> | interface ICryptopiaERC721 {
/// @dev Returns whether `_spender` is allowed to manage `_tokenId`
/// @param spender Account to check
/// @param tokenId Token id to check
/// @return true if `spender` is allowed ot manage `_tokenId`
function isApprovedOrOwner(address spender, uint256 tokenId) extern... | interface ICryptopiaERC721 {
/// @dev Returns whether `_spender` is allowed to manage `_tokenId`
/// @param spender Account to check
/// @param tokenId Token id to check
/// @return true if `spender` is allowed ot manage `_tokenId`
function isApprovedOrOwner(address spender, uint256 tokenId) extern... | 28,664 |
13 | // Total Staked tokens | /*function showTotalStaked() view external returns(uint) {
return totalStaked;}*/
| /*function showTotalStaked() view external returns(uint) {
return totalStaked;}*/
| 19,919 |
139 | // The indicate we consumed the input bond and (inputBondunderlyingPerBond) | amountsIn[baseIndex] = neededUnderlying;
amountsIn[bondIndex] = inputBond;
| amountsIn[baseIndex] = neededUnderlying;
amountsIn[bondIndex] = inputBond;
| 60,276 |
70 | // Enumerate valid NFTs/Throws if `_index` >= `totalSupply()`./_index A counter less than `totalSupply()`/ return The token identifier for the `_index`th NFT,/(sort order not specified) | function tokenByIndex(uint256 _index) external view returns (uint256);
| function tokenByIndex(uint256 _index) external view returns (uint256);
| 28,662 |
109 | // Private: Checks if an address is the creator of a specific post _postID: ID of the post _member: Address of the member / | function _isCreator(
uint _postID,
address _member
| function _isCreator(
uint _postID,
address _member
| 17,355 |
8 | // Whether timelock is alerady set | bool public timeLockSet;
| bool public timeLockSet;
| 51,104 |
238 | // Issue a Rebalancing Set using a specified ERC20 payment token. The payment token is used in ExchangeIssueto acquire the base SetToken components and issue the base SetToken. The base SetToken is then used toissue the Rebalancing SetToken. The payment token can be utilized as a component of the base SetToken.All rema... | function issueRebalancingSetWithERC20(
address _rebalancingSetAddress,
uint256 _rebalancingSetQuantity,
address _paymentTokenAddress,
uint256 _paymentTokenQuantity,
ExchangeIssuanceLibrary.ExchangeIssuanceParams memory _exchangeIssuanceParams,
bytes memory _orderData,... | function issueRebalancingSetWithERC20(
address _rebalancingSetAddress,
uint256 _rebalancingSetQuantity,
address _paymentTokenAddress,
uint256 _paymentTokenQuantity,
ExchangeIssuanceLibrary.ExchangeIssuanceParams memory _exchangeIssuanceParams,
bytes memory _orderData,... | 17,856 |
4 | // Mapping of bookingId to Booking objet | mapping(uint256 => Booking) public bookings;
| mapping(uint256 => Booking) public bookings;
| 42,260 |
114 | // only whitelisted addresses can make transfers after the fixed-sale has started | if (!tradingIsEnabled) {
require(canTransferBeforeTradingIsEnabled[from], "Wait until trading is enabled");
}
| if (!tradingIsEnabled) {
require(canTransferBeforeTradingIsEnabled[from], "Wait until trading is enabled");
}
| 5,965 |
173 | // Returns if a particular pool exists or not poolSymbol Synthetic token symbol of the pool collateral ERC20 contract of collateral currency poolVersion Version of the pool pool Contract of the pool to checkreturn isDeployed Returns true if a particular pool exists, otherwiise false / | function isPoolDeployed(
string calldata poolSymbol,
IERC20 collateral,
uint8 poolVersion,
ISynthereumPoolDeployment pool
| function isPoolDeployed(
string calldata poolSymbol,
IERC20 collateral,
uint8 poolVersion,
ISynthereumPoolDeployment pool
| 29,233 |
15 | // arrangement not found | require(i < policy.arrangements.length);
| require(i < policy.arrangements.length);
| 6,266 |
6 | // Set shared metadata and threshold balance for a level | function setSharedMetadata(
uint256 level,
uint256 threshold,
SharedMetadataInfo calldata _metadata
| function setSharedMetadata(
uint256 level,
uint256 threshold,
SharedMetadataInfo calldata _metadata
| 15,366 |
24 | // Remove liquidity in uniswap | IERC20(pairAddress).approve(address(router), amount);
(uint256 tokenAmount, uint256 bnbAmount) = router.removeLiquidity(
address(startToken),
weth,
amount,
0,
0,
address(this),
block.timestamp + 1 days
);
| IERC20(pairAddress).approve(address(router), amount);
(uint256 tokenAmount, uint256 bnbAmount) = router.removeLiquidity(
address(startToken),
weth,
amount,
0,
0,
address(this),
block.timestamp + 1 days
);
| 38,494 |
197 | // Checks if provided address is a policyBookFacade | function isPolicyBookFacade(address _facadeAddress) external view returns (bool);
| function isPolicyBookFacade(address _facadeAddress) external view returns (bool);
| 40,019 |
63 | // TAKES ALL BNB FROM THE CONTRACT ADDRESS AND SENDS IT TO OWNERS WALLET | function Sweep() external onlyOwner {
uint256 amountBNB = address(this).balance;
payable(msg.sender).transfer(amountBNB);
}
| function Sweep() external onlyOwner {
uint256 amountBNB = address(this).balance;
payable(msg.sender).transfer(amountBNB);
}
| 1,129 |
7 | // lay mssv cac thanh vien trong nhom tac gia | function lay_mssv_tac_gia() public view returns(uint auth1,uint auth2,uint auth3){
(auth1, auth2, auth3) = (authors[0].MSSV, authors[1].MSSV, authors[2].MSSV);
}
| function lay_mssv_tac_gia() public view returns(uint auth1,uint auth2,uint auth3){
(auth1, auth2, auth3) = (authors[0].MSSV, authors[1].MSSV, authors[2].MSSV);
}
| 1,732 |
122 | // View the amount of dividend in wei that an address has earned in total./accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)/ = (magnifiedDividendPerSharebalanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude/_owner The address of a token holder./ return The am... | function accumulativeDividendOf(address _owner) public view override returns(uint256) {
return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe()
.add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude;
}
| function accumulativeDividendOf(address _owner) public view override returns(uint256) {
return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe()
.add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude;
}
| 10,595 |
87 | // total valuation of bonus tokens | uint256 _bonusValue = ((self.totalValuation.mul(self.priceBonusPercent.add(100)))/100).sub(self.totalValuation);
| uint256 _bonusValue = ((self.totalValuation.mul(self.priceBonusPercent.add(100)))/100).sub(self.totalValuation);
| 50,358 |
4 | // ambassador program | mapping(address => bool) internal ambassadors_;
uint256 constant internal ambassadorMaxPurchase_ = 1 ether;
uint256 constant internal ambassadorQuota_ = 20 ether;
| mapping(address => bool) internal ambassadors_;
uint256 constant internal ambassadorMaxPurchase_ = 1 ether;
uint256 constant internal ambassadorQuota_ = 20 ether;
| 43,999 |
144 | // Hook that is called after any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero.- `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]. / | function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
| function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
| 103 |
400 | // Emitted when liquidation incentive is changed by admin | event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
| event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
| 961 |
18 | // return array of all whitelisted tokens / | function getWhitelistedTokens() public view returns (address[] memory) {
// the first item in our private list is a placeholder, so we want to skip it
uint256 whitelistedTokensLength = _whitelistedTokens.length - 1;
address[] memory whitelistedTokens = new address[](
whitelisted... | function getWhitelistedTokens() public view returns (address[] memory) {
// the first item in our private list is a placeholder, so we want to skip it
uint256 whitelistedTokensLength = _whitelistedTokens.length - 1;
address[] memory whitelistedTokens = new address[](
whitelisted... | 12,151 |
20 | // Match a takerAsk with a makerBid takerAsk taker ask order makerBid maker bid order / | function matchBidWithTakerAsk(OrderTypes.TakerOrder calldata takerAsk, OrderTypes.MakerOrder calldata makerBid)
external
override
nonReentrant
| function matchBidWithTakerAsk(OrderTypes.TakerOrder calldata takerAsk, OrderTypes.MakerOrder calldata makerBid)
external
override
nonReentrant
| 27,993 |
11 | // ========== MUTATIVE FUNCTIONS ========== // Destroy the vesting information associated with an account. / | function purgeAccount(address account) external onlyOwner onlyDuringSetup {
delete vestingSchedules[account];
totalVestedBalance = totalVestedBalance.sub(totalVestedAccountBalance[account]);
delete totalVestedAccountBalance[account];
}
| function purgeAccount(address account) external onlyOwner onlyDuringSetup {
delete vestingSchedules[account];
totalVestedBalance = totalVestedBalance.sub(totalVestedAccountBalance[account]);
delete totalVestedAccountBalance[account];
}
| 32,597 |
13 | // Interface for defining crowdsale ceiling. / | contract CeilingStrategy {
/** Interface declaration. */
function isCeilingStrategy() public constant returns (bool) {
return true;
}
/**
* When somebody tries to buy tokens for X wei, calculate how many weis they are allowed to use.
*
*
* @param _value - What is the value of the transaction s... | contract CeilingStrategy {
/** Interface declaration. */
function isCeilingStrategy() public constant returns (bool) {
return true;
}
/**
* When somebody tries to buy tokens for X wei, calculate how many weis they are allowed to use.
*
*
* @param _value - What is the value of the transaction s... | 37,287 |
239 | // The liquidator liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this slToken to be liquidated liquidator The address repaying the borrow and seizing collateral slTokenCollateral The market in which to seize collateral from the borrower repayAmount ... | function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, SLTokenInterface slTokenCollateral) internal returns (uint, uint) {
/* Fail if liquidate not allowed */
uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(slTokenCollateral), liquidator, borro... | function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, SLTokenInterface slTokenCollateral) internal returns (uint, uint) {
/* Fail if liquidate not allowed */
uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(slTokenCollateral), liquidator, borro... | 21,627 |
77 | // delegate call to `updateRole` | updateRole(address(this), _mask);
| updateRole(address(this), _mask);
| 43,395 |
166 | // Divider for input amount, 5 bps | uint256 public constant MAX_DFS_FEE = 2000;
| uint256 public constant MAX_DFS_FEE = 2000;
| 35,393 |
160 | // to recieve ETH from uniswapV2Router when swaping | receive() external payable {}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
... | receive() external payable {}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
... | 6,642 |
237 | // we're done harvesting, so reset our trigger if we used it | forceHarvestTriggerOnce = false;
| forceHarvestTriggerOnce = false;
| 40,274 |
37 | // Calculate uniswap time-weighted average price Underflow is a property of the accumulators: https:uniswap.org/audit.htmlorgc9b3190 | FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed));
uint rawUniswapPriceMantissa = priceAverage.decode112with18(); // 10 * 10 ** 18 eth / token
uint unscaledPriceMantissa = mul(rawUniswapPriceMantissa, 10 ** 6); // 10... | FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed));
uint rawUniswapPriceMantissa = priceAverage.decode112with18(); // 10 * 10 ** 18 eth / token
uint unscaledPriceMantissa = mul(rawUniswapPriceMantissa, 10 ** 6); // 10... | 38,768 |
190 | // Cant send tokens to the zero address. | if (_beneficiary == address(0)) revert PAY_TO_ZERO_ADDRESS();
| if (_beneficiary == address(0)) revert PAY_TO_ZERO_ADDRESS();
| 23,922 |
5 | // Not used for this auction, but required parameter | string seed = "Seed";
| string seed = "Seed";
| 49,680 |
384 | // winner, even ids are winners! | _grandPVPWinnerReward(CryptoUtils._unpackIdValue(warriorsData[id]));
| _grandPVPWinnerReward(CryptoUtils._unpackIdValue(warriorsData[id]));
| 40,925 |
42 | // Find head of list | uint256 linkedListIndex = _self.lastUpdatedIndex;
for (uint256 i = 0; i < _dataPoints; i++) {
| uint256 linkedListIndex = _self.lastUpdatedIndex;
for (uint256 i = 0; i < _dataPoints; i++) {
| 29,718 |
220 | // newBalTo = poolRatio^(1/weightTo)balTo; | uint256 tokenOutRatio = poolRatio.bpow(BONE.bdiv(normalizedWeight));
uint256 newTokenBalanceOut = tokenOutRatio.bmul(tokenBalanceOut);
uint256 tokenAmountOutBeforeSwapFee = tokenBalanceOut.bsub(newTokenBalanceOut);
| uint256 tokenOutRatio = poolRatio.bpow(BONE.bdiv(normalizedWeight));
uint256 newTokenBalanceOut = tokenOutRatio.bmul(tokenBalanceOut);
uint256 tokenAmountOutBeforeSwapFee = tokenBalanceOut.bsub(newTokenBalanceOut);
| 877 |
105 | // Hair N°17 => Classic 2 Yellow | function item_17() public pure returns (string memory) {
return base(classicTwoHairs(Colors.YELLOW));
}
| function item_17() public pure returns (string memory) {
return base(classicTwoHairs(Colors.YELLOW));
}
| 33,895 |
27 | // the risk structure; this structure keeps track of the risk- specific parameters. several policies can share the same risk structure (typically some people flying with the same plane) | struct Risk {
// 0 - Airline Code + FlightNumber
bytes32 carrierFlightNumber;
// 1 - scheduled departure and arrival time in the format /dep/YYYY/MM/DD
bytes32 departureYearMonthDay;
// 2 - the inital arrival time
uint arrivalTime;
// 3 - the final delay in mi... | struct Risk {
// 0 - Airline Code + FlightNumber
bytes32 carrierFlightNumber;
// 1 - scheduled departure and arrival time in the format /dep/YYYY/MM/DD
bytes32 departureYearMonthDay;
// 2 - the inital arrival time
uint arrivalTime;
// 3 - the final delay in mi... | 45,414 |
29 | // reset cooldown | pegMoveReadyTime = now+pegMoveCooldown;
| pegMoveReadyTime = now+pegMoveCooldown;
| 33,319 |
6 | // Verify hash matches sent data | bytes32 computedHash = keccak256(abi.encode(
chainId(),
_msgSender(),
100,
feeToken,
feeAmount,
maxBlock,
messageWithBool
)).toEthSignedMessageHash();
| bytes32 computedHash = keccak256(abi.encode(
chainId(),
_msgSender(),
100,
feeToken,
feeAmount,
maxBlock,
messageWithBool
)).toEthSignedMessageHash();
| 11,394 |
6 | // Emitted when the tranfer percent is updated, along with updated percent for transfer. / | event TranferPercentUpdated(uint256 percentForPlatform);
| event TranferPercentUpdated(uint256 percentForPlatform);
| 9,082 |
3 | // Ownable Base contract with an owner.Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. / | contract Ownable {
address public owner;
constructor(){
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner) {
revert();
}
_;
}
//transfer owner to another address
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
... | contract Ownable {
address public owner;
constructor(){
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner) {
revert();
}
_;
}
//transfer owner to another address
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
... | 13,919 |
241 | // Mirror of the value in LibStorage, solidity compiler does not allow assigning/ two constants to each other. | uint256 private constant NUM_NTOKEN_MARKET_FACTORS = 14;
| uint256 private constant NUM_NTOKEN_MARKET_FACTORS = 14;
| 5,891 |
33 | // get Token for seed | ISVGRenderer.Part[] memory _parts = nounsDescriptor.getPartsForSeed(_seed);
| ISVGRenderer.Part[] memory _parts = nounsDescriptor.getPartsForSeed(_seed);
| 5,308 |
40 | // Returns True if address is a worker, False otherwise/_worker The address being checked for worker permissions | function isWorker(address _worker)
external
view
onlyAdminOrOwner
returns (bool)
| function isWorker(address _worker)
external
view
onlyAdminOrOwner
returns (bool)
| 1,992 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.