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 |
|---|---|---|---|---|
27 | // The mint price | uint256 public constant MINT_PRICE = 0.01 ether;
| uint256 public constant MINT_PRICE = 0.01 ether;
| 59,892 |
5 | // Ensure current collateral amount differs from the new collateral amount. | if (newCollateralAmountD18 == currentCollateralAmount) revert InvalidCollateralAmount();
| if (newCollateralAmountD18 == currentCollateralAmount) revert InvalidCollateralAmount();
| 25,588 |
6 | // Creamos el evento para notificar a los demas que el autor decidio cerrar el fondeotemporalmente | event changeState(
address editor,
bool change);
| event changeState(
address editor,
bool change);
| 1,649 |
8 | // during construction, the "nonce" field hold the salt. if we assert it is zero, then we allow only a single wallet per owner. | if (userOp.initCode.length == 0) {
_validateAndUpdateNonce(userOp);
}
| if (userOp.initCode.length == 0) {
_validateAndUpdateNonce(userOp);
}
| 27,184 |
7 | // address addressForLoanAssetExchangeB = uniswapFactoryB.getExchange(RESERVE_ADDRESS); Instantiate Exchange A | exchangeAforLoanAsset = IUniswapExchange(addressForLoanAssetExchangeA);
| exchangeAforLoanAsset = IUniswapExchange(addressForLoanAssetExchangeA);
| 30,136 |
39 | // Check maxAmount raised | if (raised >= maxAmount || sclToken.totalSupply() >= maxSupply) {
stage = Stages.Ended;
}
| if (raised >= maxAmount || sclToken.totalSupply() >= maxSupply) {
stage = Stages.Ended;
}
| 35,706 |
24 | // max contribution in wei | uint256 public privateIcoMax = 350 ether;
uint256 public preIcoMax = 10000 ether;
uint256 public ico1Max = 10000 ether;
uint256 public ico2Max = 10000 ether;
uint256 public ico3Max = 10000 ether;
uint256 public ico4Max = 10000 ether;
| uint256 public privateIcoMax = 350 ether;
uint256 public preIcoMax = 10000 ether;
uint256 public ico1Max = 10000 ether;
uint256 public ico2Max = 10000 ether;
uint256 public ico3Max = 10000 ether;
uint256 public ico4Max = 10000 ether;
| 4,751 |
206 | // Internal function to clear current approval of a given token ID_tokenId uint256 ID of the token to be transferred/ | function _clearApproval(address _owner, uint256 _tokenId) private {
require(ownerOf(_tokenId) == _owner);
tokenApprovals[_tokenId] = 0;
Approval(_owner, 0, _tokenId);
}
| function _clearApproval(address _owner, uint256 _tokenId) private {
require(ownerOf(_tokenId) == _owner);
tokenApprovals[_tokenId] = 0;
Approval(_owner, 0, _tokenId);
}
| 65,859 |
48 | // used to notify a gauge/bribe of a given reward, this can create griefing attacks by extending rewards | function notifyRewardAmount(address token, uint amount) external lock {
require(amount > 0);
if (rewardRate[token] == 0) _writeRewardPerTokenCheckpoint(token, 0, block.timestamp);
(rewardPerTokenStored[token], lastUpdateTime[token]) = _updateRewardPerToken(token);
if (block.timestam... | function notifyRewardAmount(address token, uint amount) external lock {
require(amount > 0);
if (rewardRate[token] == 0) _writeRewardPerTokenCheckpoint(token, 0, block.timestamp);
(rewardPerTokenStored[token], lastUpdateTime[token]) = _updateRewardPerToken(token);
if (block.timestam... | 33,178 |
1 | // all token send to owner when create | _totalSupply = _maxSupply;
_balances[owner()] = _totalSupply;
emit Transfer(address(0), owner(), _totalSupply);
| _totalSupply = _maxSupply;
_balances[owner()] = _totalSupply;
emit Transfer(address(0), owner(), _totalSupply);
| 29,799 |
29 | // _initial Bool indicating if the window is an initial dispute window or a standard dispute windowreturn The current dispute window if it exists / | function getCurrentDisputeWindow(bool _initial) public view returns (IDisputeWindow) {
return getDisputeWindowByTimestamp(augur.getTimestamp(), _initial);
}
| function getCurrentDisputeWindow(bool _initial) public view returns (IDisputeWindow) {
return getDisputeWindowByTimestamp(augur.getTimestamp(), _initial);
}
| 36,662 |
3 | // Returned when a function is called in the wrong contract state. / | error WrongState(uint256 currentState, uint256 requiredState);
| error WrongState(uint256 currentState, uint256 requiredState);
| 14,867 |
205 | // one byte prefix | require(item.len == 33);
uint result;
uint memPtr = item.memPtr + 1;
assembly {
result := mload(memPtr)
}
| require(item.len == 33);
uint result;
uint memPtr = item.memPtr + 1;
assembly {
result := mload(memPtr)
}
| 39,655 |
56 | // Checks if the account should be allowed to repay a borrow in the given market cToken The market to verify the repay against payer The account which would repay the asset borrower The account which would borrowed the asset repayAmount The amount of the underlying asset the account would repayreturn 0 if the repay is ... | function repayBorrowAllowed(
address cToken,
address payer,
address borrower,
| function repayBorrowAllowed(
address cToken,
address payer,
address borrower,
| 25,272 |
32 | // Get the balance of multiple account/token pairs _owners The addresses of the token holders _idsID of the TokensreturnThe _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) / | function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
| function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
| 22,485 |
292 | // do one lookup of the rate & time to minimize gas | RateAndUpdatedTime memory rateEntry = _getRateAndUpdatedTime(currencyKeys[i]);
rates[i] = rateEntry.rate;
if (!anyRateInvalid && currencyKeys[i] != sUSD) {
anyRateInvalid = flagList[i] || _rateIsStaleWithTime(_rateStalePeriod, rateEntry.time);
}
| RateAndUpdatedTime memory rateEntry = _getRateAndUpdatedTime(currencyKeys[i]);
rates[i] = rateEntry.rate;
if (!anyRateInvalid && currencyKeys[i] != sUSD) {
anyRateInvalid = flagList[i] || _rateIsStaleWithTime(_rateStalePeriod, rateEntry.time);
}
| 34,167 |
7 | // UTILITY FUNCTIONS// Get operating status of contract return A bool that is the current operating status / | function isOperational() external view returns (bool) {
return operational;
}
| function isOperational() external view returns (bool) {
return operational;
}
| 16,930 |
7 | // submited by -xu https:github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.solSafeMath: overflow/underflow checksMath operations with safety checks that throw on error | library SafeMath {
// @notice Multiplies two numbers, throws on overflow.
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
// @notice Integer division of two numbers, truncating the quoti... | library SafeMath {
// @notice Multiplies two numbers, throws on overflow.
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
// @notice Integer division of two numbers, truncating the quoti... | 6,309 |
68 | // / ERC721Metadata//A descriptive name for a collection of NFTs in this contract | function name() external view returns (string _name){
return _ERC721name;
}
| function name() external view returns (string _name){
return _ERC721name;
}
| 5,486 |
133 | // Increase the _amount of tokens that an owner has allowed to a _spender.This method should be used instead of approve() to avoid the double approval vulnerabilitydescribed above. _spender The address which will spend the funds. _addedValue The _amount of tokens to increase the allowance by. / | function increaseAllowance(address _spender, uint256 _addedValue)
public
returns (bool)
| function increaseAllowance(address _spender, uint256 _addedValue)
public
returns (bool)
| 25,461 |
39 | // Returns whether operator restriction can be set in the given execution context. | function _canSetOperatorRestriction() internal virtual returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| function _canSetOperatorRestriction() internal virtual returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| 3,818 |
139 | // Check if _iToken is listed / | function _checkiTokenListed(address _iToken) private view {
require(iTokens.contains(_iToken), "Token has not been listed");
}
| function _checkiTokenListed(address _iToken) private view {
require(iTokens.contains(_iToken), "Token has not been listed");
}
| 57,799 |
42 | // DATA TYPES // 猫咪的主要结构体,加密猫里的每个猫都要用这个结构体表示。务必确保这个结构体使用 2 个 256 位的字数。/ 由于以太坊自己包装跪着,这个结构体中顺序很重要(改动就不满足 2 个 256 要求了) | struct Kitty {
// 猫咪的基因是 256 位,格式是 sooper-sekret 不知道这是什么格式??
uint256 genes;
// 出生的时间戳
uint64 birthTime;
// 这只猫可以再次进行繁育活动的最小时间戳 公猫和母猫都用这个时间戳 冷却时间?!
uint64 cooldownEndBlock;
// 下面 ID 用于记录猫咪的父母,对于第 0 代猫咪,设置为 0
// 采用 32 位数字,最大仅有 4 亿多点,目前够用了 截止目前 2021-09-26... | struct Kitty {
// 猫咪的基因是 256 位,格式是 sooper-sekret 不知道这是什么格式??
uint256 genes;
// 出生的时间戳
uint64 birthTime;
// 这只猫可以再次进行繁育活动的最小时间戳 公猫和母猫都用这个时间戳 冷却时间?!
uint64 cooldownEndBlock;
// 下面 ID 用于记录猫咪的父母,对于第 0 代猫咪,设置为 0
// 采用 32 位数字,最大仅有 4 亿多点,目前够用了 截止目前 2021-09-26... | 43,986 |
109 | // Get the bounds for a draft batch based on the active balances of the guardians_termId Term ID of the active balances that will be used to compute the boundaries_selectedGuardians Number of guardians already selected for the draft_batchRequestedGuardians Number of guardians to be selected in the given batch of the dr... | function getSearchBatchBounds(
HexSumTree.Tree storage tree,
uint64 _termId,
uint256 _selectedGuardians,
uint256 _batchRequestedGuardians,
uint256 _roundRequestedGuardians
)
internal
view
returns (uint256 low, uint256 high)
| function getSearchBatchBounds(
HexSumTree.Tree storage tree,
uint64 _termId,
uint256 _selectedGuardians,
uint256 _batchRequestedGuardians,
uint256 _roundRequestedGuardians
)
internal
view
returns (uint256 low, uint256 high)
| 19,395 |
38 | // gas saving | team_accumuluated_eth=team_accumuluated_eth.sub(amount);
reward_in_pool_eth=reward_in_pool_eth.sub(amount);
uint half = amount.div(2);
team_address.transfer(amount.sub(half));
team_address2.transfer(half);
emit ClaimTeamFeeEth(amount);
| team_accumuluated_eth=team_accumuluated_eth.sub(amount);
reward_in_pool_eth=reward_in_pool_eth.sub(amount);
uint half = amount.div(2);
team_address.transfer(amount.sub(half));
team_address2.transfer(half);
emit ClaimTeamFeeEth(amount);
| 56,223 |
30 | // assignment of successors / | function setSuccessors(
Successors calldata _newSuccessors
)
external
correctStatus(
DeathConfirmationState.StillAlive,
msg.sender,
"first confirm that you are still alive"
)
| function setSuccessors(
Successors calldata _newSuccessors
)
external
correctStatus(
DeathConfirmationState.StillAlive,
msg.sender,
"first confirm that you are still alive"
)
| 6,059 |
246 | // send token to buyer (assumes approval has been made, if not then this will fail) | koda.safeTransferFrom(creator, _buyer, tokenId);
| koda.safeTransferFrom(creator, _buyer, tokenId);
| 18,137 |
47 | // Set correct size of returned array solium-disable-next-line security/no-inline-assembly | assembly {
mstore(array, moduleCount)
}
| assembly {
mstore(array, moduleCount)
}
| 6,661 |
125 | // - ERC20 functionality - //Transfer tokens to a specified address.to The address to transfer to.value The amount to be transferred. return True on success, false otherwise./ | function transfer(address to, uint256 value)
external
validRecipient(to)
rebaseAtTheEnd
returns (bool)
| function transfer(address to, uint256 value)
external
validRecipient(to)
rebaseAtTheEnd
returns (bool)
| 39,819 |
44 | // The number of votes required in order for a voter to become a proposer. | function proposalThreshold() public view returns (uint96) {
uint96 totalVotingPower =
staking.getPriorTotalVotingPower(
safe32(
block.number - 1,
"GovernorAlpha::proposalThreshold: block number overflow"
),
b... | function proposalThreshold() public view returns (uint96) {
uint96 totalVotingPower =
staking.getPriorTotalVotingPower(
safe32(
block.number - 1,
"GovernorAlpha::proposalThreshold: block number overflow"
),
b... | 34,222 |
26 | // Add to index. | doc.index = uint16(documentsIndex.push(_id).sub(1));
| doc.index = uint16(documentsIndex.push(_id).sub(1));
| 11,372 |
145 | // Overrides ERC1155MintBurn to change the batch birth events to creator transfers, and to set _supply | function _batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data
| function _batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data
| 10,629 |
14 | // Mint a new Item receiver account address to receive the new item / | function _awardItem(address receiver) private returns (uint256) {
_tokenIds.increment();
uint256 newId = _tokenIds.current();
_safeMint(receiver, newId);
return newId;
}
| function _awardItem(address receiver) private returns (uint256) {
_tokenIds.increment();
uint256 newId = _tokenIds.current();
_safeMint(receiver, newId);
return newId;
}
| 1,118 |
69 | // Transfer tokens from the caller toPayee's address value Transfer amountreturn True if successful / | function transfer(address to, uint256 value)
external
override
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(to)
returns (bool)
| function transfer(address to, uint256 value)
external
override
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(to)
returns (bool)
| 3,194 |
11 | // -- Admin -- | function modifyParameters(
bytes32 parameter,
uint256 val
| function modifyParameters(
bytes32 parameter,
uint256 val
| 17,629 |
85 | // call returns 0 on error. | case 0 { revert(0, returndatasize) }
| case 0 { revert(0, returndatasize) }
| 37,012 |
200 | // Emergency functions |
function execute(address _target, bytes memory _data)
public
payable
returns (bytes memory response)
|
function execute(address _target, bytes memory _data)
public
payable
returns (bytes memory response)
| 2,674 |
30 | // check prefix present | uint expectedPrefixLength = (bytes(nameDataPrefix)).length;
if (_data.length < expectedPrefixLength) {
throw;
}
| uint expectedPrefixLength = (bytes(nameDataPrefix)).length;
if (_data.length < expectedPrefixLength) {
throw;
}
| 42,343 |
74 | // Handles the receipt of an NFT The ERC721 smart contract calls this function on the recipient after a `transfer`. This function MAY throw to revert and reject the transfer. Return of other than the magic value MUST result in the transaction being reverted. Note: the contract address is always the message sender._oper... | 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);
| 819 |
15 | // new bid | bids[version][index] = Bid(col, row, msg.value, msg.sender);
emit EtheriaBidCreated(version, index, msg.value, msg.sender);
| bids[version][index] = Bid(col, row, msg.value, msg.sender);
emit EtheriaBidCreated(version, index, msg.value, msg.sender);
| 55,338 |
8 | // Save current values for inclusion in log | address oldImplementation = controllerImplementation;
address oldPendingImplementation = pendingControllerImplementation;
controllerImplementation = pendingControllerImplementation;
pendingControllerImplementation = address(0);
emit NewImplementation(oldImplementation, control... | address oldImplementation = controllerImplementation;
address oldPendingImplementation = pendingControllerImplementation;
controllerImplementation = pendingControllerImplementation;
pendingControllerImplementation = address(0);
emit NewImplementation(oldImplementation, control... | 34,456 |
151 | // Linear interpolation: start + (end - start)(step/duration) For 150 steps, duration = 149, start / end can be in any formatas long as <= 1049. start The starting value end The ending value step Number of blocks into interpolation duration Total range / | function lerp(
uint256 start,
uint256 end,
uint256 step,
uint256 duration
| function lerp(
uint256 start,
uint256 end,
uint256 step,
uint256 duration
| 13,517 |
0 | // Soul Pass Mapping | mapping (uint256 => bool) public soulPassClaimed;
address soulPass;
constructor(
address SoulPassContract
| mapping (uint256 => bool) public soulPassClaimed;
address soulPass;
constructor(
address SoulPassContract
| 81,905 |
68 | // !!! can be called by any user or contract >>> since we are making a withdrawal to our own contract/address only there is no possible attack using re-entrancy vulnerability/ | function withdrawAllToWithdrawalAddress() external returns (bool success) {
// http://solidity.readthedocs.io/en/develop/security-considerations.html#sending-and-receiving-ether
// about <address>.send(uint256 amount) and <address>.transfer(uint256 amount)
// see: http://solidity.readthedoc... | function withdrawAllToWithdrawalAddress() external returns (bool success) {
// http://solidity.readthedocs.io/en/develop/security-considerations.html#sending-and-receiving-ether
// about <address>.send(uint256 amount) and <address>.transfer(uint256 amount)
// see: http://solidity.readthedoc... | 26,845 |
50 | // 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;
}
| 448 |
29 | // Transfer the total prize to the user | safeTransfer(payable(msg.sender), totalPrize);
emit PrizeClaimed(msg.sender, totalPrize);
| safeTransfer(payable(msg.sender), totalPrize);
emit PrizeClaimed(msg.sender, totalPrize);
| 29,828 |
22 | // This function evaluates if a role is allowed to dismiss another role.dismissalRoles bitset encoding the indexes of the role that is trying to dismiss,nomineeRole index of the role to dismiss, return true if @dismissalRoles can dismiss @nomineeRole according to the binding policy, otherwise false./ | function checkDismissesCandidates(uint dismissalRoles, uint8 nomineeRole) public pure returns(bool) {
uint nomineeRoleMask = uint(1) << nomineeRole;
uint dismissalsMask = 0;
if (nomineeRoleMask & 4 == 4) // CarrierCandidate
dismissalsMask = 16; // dismiss... | function checkDismissesCandidates(uint dismissalRoles, uint8 nomineeRole) public pure returns(bool) {
uint nomineeRoleMask = uint(1) << nomineeRole;
uint dismissalsMask = 0;
if (nomineeRoleMask & 4 == 4) // CarrierCandidate
dismissalsMask = 16; // dismiss... | 18,994 |
99 | // In this case we're transferring underlying tokens, we want to convert the internal asset transfer amount to store in cash balances | assetTransferAmountInternal = assetToken.convertToInternal(assetTransferAmountExternal);
| assetTransferAmountInternal = assetToken.convertToInternal(assetTransferAmountExternal);
| 64,850 |
21 | // Multiplies two unsigned integers, reverts on overflow. / | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
... | 24,017 |
141 | // deposit on behalf of `user`, must be called on fresh deposit only user deposit user amount amount to deposit / | function depositFor(address user, uint256 amount)
external
override
nonReentrant
onlyRole(DEPOSIT_ROLE)
returns (bool)
| function depositFor(address user, uint256 amount)
external
override
nonReentrant
onlyRole(DEPOSIT_ROLE)
returns (bool)
| 52,812 |
60 | // check approve | require(IERC20Upgradeable(_tokenAddr).allowance(msg.sender, address(this)) >= _amount, "JAave: allowance failed buying tranche A");
SafeERC20Upgradeable.safeTransferFrom(IERC20Upgradeable(_tokenAddr), msg.sender, address(this), _amount);
| require(IERC20Upgradeable(_tokenAddr).allowance(msg.sender, address(this)) >= _amount, "JAave: allowance failed buying tranche A");
SafeERC20Upgradeable.safeTransferFrom(IERC20Upgradeable(_tokenAddr), msg.sender, address(this), _amount);
| 31,700 |
50 | // add liquidity | swapAndLiquify(liquidityPoolTokens);
| swapAndLiquify(liquidityPoolTokens);
| 29,697 |
2 | // Returns a DID of the supplychainfinance Returns a unique DID (Decentralized Identifier) for the supplychainfinance.return string representing the DID of the supplychainfinance / | function DID() public view returns (string memory) {
return string(abi.encodePacked('did:demo:supplychainfinance:', _Case_ID));
}
| function DID() public view returns (string memory) {
return string(abi.encodePacked('did:demo:supplychainfinance:', _Case_ID));
}
| 21,252 |
18 | // geting price with 6 decimals | return uint256((uint256(answer) * tokensforadolar)/10**8);
| return uint256((uint256(answer) * tokensforadolar)/10**8);
| 53,570 |
13 | // DATATYPES / | struct Person {
string name;
}
| struct Person {
string name;
}
| 3,420 |
264 | // Reward limit | function setRewardLimit(
string memory _githubRepository,
uint256 _rewardLimit
| function setRewardLimit(
string memory _githubRepository,
uint256 _rewardLimit
| 16,940 |
35 | // require(amount >= minTransfer && balanceEnough(amount)); | require(amount >= minTransfer);
transferBalance(this, to, amount);
Transfer(this, to, amount);
| require(amount >= minTransfer);
transferBalance(this, to, amount);
Transfer(this, to, amount);
| 39,646 |
15 | // Verify that minting is open. | require(getTokenMintStartTime(id) <= block.timestamp && getTokenMintStartTime(id) != 0, "minting has not started");
require(getTokenMintEndTime(id) >= block.timestamp, "minting has ended");
| require(getTokenMintStartTime(id) <= block.timestamp && getTokenMintStartTime(id) != 0, "minting has not started");
require(getTokenMintEndTime(id) >= block.timestamp, "minting has ended");
| 37,249 |
7 | // Functions laying out certain behavior to protect from bots | function setMaxBuyAmount(uint256 maxBuyAmount) external onlyOwner {
_maxBuyAmount = maxBuyAmount;
}
| function setMaxBuyAmount(uint256 maxBuyAmount) external onlyOwner {
_maxBuyAmount = maxBuyAmount;
}
| 3,751 |
50 | // Public function to update an ilk's pip and flip if the ilk has been updated. | function update(bytes32 ilk) external {
require(JoinLike(ilkData[ilk].join).vat() == address(vat), "IlkRegistry/invalid-ilk");
require(JoinLike(ilkData[ilk].join).live() == 1, "IlkRegistry/ilk-not-live-use-remove-instead");
(address _pip,) = spot.ilks(ilk);
require(_pip != address(0... | function update(bytes32 ilk) external {
require(JoinLike(ilkData[ilk].join).vat() == address(vat), "IlkRegistry/invalid-ilk");
require(JoinLike(ilkData[ilk].join).live() == 1, "IlkRegistry/ilk-not-live-use-remove-instead");
(address _pip,) = spot.ilks(ilk);
require(_pip != address(0... | 31,322 |
5 | // input ptr | let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| 29,682 |
4 | // interact with the contract at the specified address that has the price feed information view function ensures that state will not modify. | function getVersion() public view returns(uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
| function getVersion() public view returns(uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
| 34,404 |
131 | // Deauthorized `_contract` by contract id _cid The contract id / | function deauthorizeContractById(uint256 _cid)
public
onlyOwner
authorizedContractIdValid(_cid)
| function deauthorizeContractById(uint256 _cid)
public
onlyOwner
authorizedContractIdValid(_cid)
| 35,238 |
52 | // Approve Dai tokens as collateral | dai.approve(cDaiAddress, totalAmount);
| dai.approve(cDaiAddress, totalAmount);
| 36,280 |
37 | // Contracts that should be able to recover tokens SylTi This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.This will prevent any accidental loss of tokens. / | contract CanReclaimToken is Ownable {
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20Basic The address of the token contract
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
}
}
| contract CanReclaimToken is Ownable {
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20Basic The address of the token contract
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
}
}
| 27,855 |
433 | // Decodes and returns a 22 bits signed integer shifted by an offset from a 256 bit word. / | function decodeInt22(bytes32 word, uint256 offset) internal pure returns (int256) {
int256 value = int256(uint256(word >> offset) & _MASK_22);
// In case the decoded value is greater than the max positive integer that can be represented with 22 bits,
// we know it was originally a negative i... | function decodeInt22(bytes32 word, uint256 offset) internal pure returns (int256) {
int256 value = int256(uint256(word >> offset) & _MASK_22);
// In case the decoded value is greater than the max positive integer that can be represented with 22 bits,
// we know it was originally a negative i... | 13,522 |
447 | // Create empty record to begin executor IDs at 1 | executorsNextIndex = 1;
| executorsNextIndex = 1;
| 47,191 |
170 | // Enable or disable approval for a third party ("operator") to manage all of owner's assets - on behalfExecutes setApprovalForAll(_operator, _approved) on behalf of the owner who EIP-712 signed the transaction, i.e. as if transaction sender is the EIP712 signerSets the `_operator` as the token operator for `_owner` to... | function permitForAll(address _owner, address _operator, bool _approved, uint256 _exp, uint8 v, bytes32 r, bytes32 s) public {
// verify permits are enabled
require(isFeatureEnabled(FEATURE_OPERATOR_PERMITS), "operator permits are disabled");
// derive signer of the EIP712 PermitForAll message, and
// update ... | function permitForAll(address _owner, address _operator, bool _approved, uint256 _exp, uint8 v, bytes32 r, bytes32 s) public {
// verify permits are enabled
require(isFeatureEnabled(FEATURE_OPERATOR_PERMITS), "operator permits are disabled");
// derive signer of the EIP712 PermitForAll message, and
// update ... | 50,420 |
9 | // See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. / | function transfer(address recipient, uint256 amount) public virtual override returns (bool);
| function transfer(address recipient, uint256 amount) public virtual override returns (bool);
| 3,649 |
62 | // Burns a specific amount of tokens._value The amount of token to be burned./ | function burn(uint256 _value) internal {
_burn(msg.sender, _value);
}
| function burn(uint256 _value) internal {
_burn(msg.sender, _value);
}
| 21,781 |
13 | // Withdraw | function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
| function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
| 16,905 |
0 | // Standar ERC Token Interface | contract ERC20Interface {
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function approve(address spender, uint tokens) public returns (bool success);
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public v... | contract ERC20Interface {
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function approve(address spender, uint tokens) public returns (bool success);
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public v... | 24,675 |
275 | // _updateLockedBond stores the new `amount` into the BOND locked history | function _updateLockedBond(uint256 amount) internal {
LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage();
if (ds.bondStakedHistory.length == 0 || ds.bondStakedHistory[ds.bondStakedHistory.length - 1].timestamp < block.timestamp) {
ds.bondStakedHistory.push(LibBarnStorage.C... | function _updateLockedBond(uint256 amount) internal {
LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage();
if (ds.bondStakedHistory.length == 0 || ds.bondStakedHistory[ds.bondStakedHistory.length - 1].timestamp < block.timestamp) {
ds.bondStakedHistory.push(LibBarnStorage.C... | 78,295 |
107 | // call the staking smart contract to init the epoch | epochs[epochId] = _getPoolSize(epochId);
| epochs[epochId] = _getPoolSize(epochId);
| 48,178 |
4 | // Modifier which checks if respondent is already completed survey or not. / | modifier onlyValidRespondent() {
require((!isRespondentExists[msg.sender] && (surveyor != msg.sender)), "Sender not authorized.");
_;
}
| modifier onlyValidRespondent() {
require((!isRespondentExists[msg.sender] && (surveyor != msg.sender)), "Sender not authorized.");
_;
}
| 16,507 |
3 | // Send given amount of Eth to dest from sender.This is a convenience function, which is equivalent to calling sendTxToL1 with empty calldataForL1. destination recipient address on L1return unique identifier for this L2-to-L1 transaction. / | function withdrawEth(address destination)
external
payable
returns (uint256);
| function withdrawEth(address destination)
external
payable
returns (uint256);
| 39,318 |
10 | // Used during the upgrade process to verify valid Tellor Contracts / | function verify() external pure returns (uint256) {
return 9999;
}
| function verify() external pure returns (uint256) {
return 9999;
}
| 63,263 |
26 | // Swap tokens for ETH and pay amount of ETH as tip, using permit for approval router Uniswap V2-compliant Router contract trade Trade details permit Permit details / | function swapExactTokensForETHWithPermitAndTipAmount(
IUniRouter router,
Trade calldata trade,
Permit calldata permit
| function swapExactTokensForETHWithPermitAndTipAmount(
IUniRouter router,
Trade calldata trade,
Permit calldata permit
| 7,874 |
1 | // Get no. of token holders. / | function getNumTokenHolders() external view returns (uint256);
| function getNumTokenHolders() external view returns (uint256);
| 5,021 |
322 | // maxDeleverage is how much we want to increase by | function _normalLeverage(
uint256 maxLeverage,
uint256 lent,
uint256 borrowed,
uint256 collatRatio
| function _normalLeverage(
uint256 maxLeverage,
uint256 lent,
uint256 borrowed,
uint256 collatRatio
| 29,600 |
9 | // `editInfo` Allows owner to change hotel's dataUri._dataUri New dataUri pointer of this hotel / | function editInfo(string _dataUri) onlyFromIndex public {
_editInfoImpl(_dataUri);
}
| function editInfo(string _dataUri) onlyFromIndex public {
_editInfoImpl(_dataUri);
}
| 40,991 |
276 | // NftBox contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract NftBox is ERC721, Ownable {
using SafeMath for uint256;
uint256 public apePrice; //80000000000000000 = 0.08 ETH
uint public maxApePurchase;
uint256 public MAX_APES;
bool public saleIsActive = true;
address[] private minters;
constructor (string memory name, string memory symbo... | contract NftBox is ERC721, Ownable {
using SafeMath for uint256;
uint256 public apePrice; //80000000000000000 = 0.08 ETH
uint public maxApePurchase;
uint256 public MAX_APES;
bool public saleIsActive = true;
address[] private minters;
constructor (string memory name, string memory symbo... | 19,008 |
26 | // Get the contract constant _decimals / | function decimals() constant returns (uint8 decimals) {
return _decimals;
}
| function decimals() constant returns (uint8 decimals) {
return _decimals;
}
| 34,666 |
98 | // | * @dev Implementation of the {IBEP20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {BEP20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* h... | * @dev Implementation of the {IBEP20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {BEP20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* h... | 14,790 |
58 | // calculate remaining elements in proof | remaining = _proof.length - j;
| remaining = _proof.length - j;
| 45,178 |
92 | // bad contributor of presale | mapping(address => bool) preSaleCancelledList;
| mapping(address => bool) preSaleCancelledList;
| 49,782 |
2 | // ZkBobPermit2Mixin / | abstract contract ZkBobPermit2Mixin is ZkBobPool {
IPermit2 public immutable permit2;
constructor(address _permit2) {
require(Address.isContract(_permit2), "ZkBobPool: not a contract");
permit2 = IPermit2(_permit2);
}
// @inheritdoc ZkBobPool
function _transferFromByPermit(address ... | abstract contract ZkBobPermit2Mixin is ZkBobPool {
IPermit2 public immutable permit2;
constructor(address _permit2) {
require(Address.isContract(_permit2), "ZkBobPool: not a contract");
permit2 = IPermit2(_permit2);
}
// @inheritdoc ZkBobPool
function _transferFromByPermit(address ... | 35,155 |
10 | // decrease a user's productivity./Note the best practice will be restrict the callee to prove of productivity's contract address./ return true to confirm that the productivity removed success. | function decreaseProductivity(address user, uint value) external returns (uint);
| function decreaseProductivity(address user, uint value) external returns (uint);
| 82,348 |
9 | // ------------------------------------------------------------------------------------------ Number ranges------------------------------------------------------------------------------------------ | function getCurrentPoNumber() override public view returns (uint poNumber)
| function getCurrentPoNumber() override public view returns (uint poNumber)
| 6,603 |
48 | // only team just can activate | require(
msg.sender == creator,
"only team just can activate"
);
| require(
msg.sender == creator,
"only team just can activate"
);
| 38,518 |
41 | // Internal function to clear current approval and transfer the ownership of a given land ID_from address which you want to send lands from_to address which you want to transfer the land to_landId uint256 ID of the land to be transferred/ | function clearApprovalAndTransfer(address _from, address _to, uint256 _landId) internal {
require(owns(_from, _landId));
require(_to != address(0));
require(_to != ownerOf(_landId));
clearApproval(_from, _landId);
removeLand(_from, _landId);
addLand(_to, _landId);
... | function clearApprovalAndTransfer(address _from, address _to, uint256 _landId) internal {
require(owns(_from, _landId));
require(_to != address(0));
require(_to != ownerOf(_landId));
clearApproval(_from, _landId);
removeLand(_from, _landId);
addLand(_to, _landId);
... | 20,824 |
18 | // Add a listing to an existing board. / | function _addListingToBoard(
uint boardId,
uint strike,
uint skew
| function _addListingToBoard(
uint boardId,
uint strike,
uint skew
| 16,747 |
8 | // Owner can update token information here. It is often useful to conceal the actual token association, untilthe token operations, like central issuance or reissuance have been completed. This function allows the token owner to rename the token after the operationshave been completed and then point the audience to use ... | function setTokenInformation(string _name, string _symbol) public onlyOwner {
name = _name;
symbol = _symbol;
emit UpdatedTokenInformation(name, symbol);
}
| function setTokenInformation(string _name, string _symbol) public onlyOwner {
name = _name;
symbol = _symbol;
emit UpdatedTokenInformation(name, symbol);
}
| 11,886 |
55 | // List must contain the node | require(contains(self, _id), "node not in list");
if (self.size > 1) {
| require(contains(self, _id), "node not in list");
if (self.size > 1) {
| 43,361 |
66 | // Turn Power Off/ access control: only admin/ state machine: only when online/ state scope: only modify _status/ token transfer: none | function powerOff() external override onlyOwner {
require(_status == IPowerSwitch.State.Online, "PowerSwitch: cannot power off");
_status = IPowerSwitch.State.Offline;
emit PowerOff();
}
| function powerOff() external override onlyOwner {
require(_status == IPowerSwitch.State.Online, "PowerSwitch: cannot power off");
_status = IPowerSwitch.State.Offline;
emit PowerOff();
}
| 24,676 |
171 | // Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
| function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
| 353 |
94 | // ids_offset == 0xa0 | eq(
calldataload(
add(
elementPtr,
ConduitBatch1155Transfer_ids_head_offset
)
... | eq(
calldataload(
add(
elementPtr,
ConduitBatch1155Transfer_ids_head_offset
)
... | 20,520 |
17 | // sets the collection manager and emits an event sets the collection manager and emits an event can only be called by the contract owner _collectionManager - address of the collection manager / | function setCollectionManager(address _collectionManager) external onlyOwner {
collectionManager = IRootCollection(_collectionManager);
emit RootCollectionUpdated(_collectionManager);
}
| function setCollectionManager(address _collectionManager) external onlyOwner {
collectionManager = IRootCollection(_collectionManager);
emit RootCollectionUpdated(_collectionManager);
}
| 11,295 |
14 | // Increases the total supply | _totalSupply = _totalSupply.add(amount);
| _totalSupply = _totalSupply.add(amount);
| 22,486 |
53 | // Sender's hint was not a valid insert position Use sender's hint to find a valid insert position | (prevId, nextId) = findInsertPosition(self, _key, prevId, nextId);
| (prevId, nextId) = findInsertPosition(self, _key, prevId, nextId);
| 23,552 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.