Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
5 | // NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the`0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` / | function implementation() external payable ifAdmin returns (address implementation_) {
_requireZeroValue();
implementation_ = _implementation();
}
| function implementation() external payable ifAdmin returns (address implementation_) {
_requireZeroValue();
implementation_ = _implementation();
}
| 35,452 |
25 | // @todo unroll this loop | for (uint i = 0; i < a.length; i ++) {
if (a[i] != b[i]) {
return false;
}
| for (uint i = 0; i < a.length; i ++) {
if (a[i] != b[i]) {
return false;
}
| 33,342 |
2 | // sets max bet value | function setMaxBet(uint _maxBet) external onlyOwner{
require(_maxBet > minBet, 'maxBet must be bigger than minBet');
maxBet = _maxBet;
}
| function setMaxBet(uint _maxBet) external onlyOwner{
require(_maxBet > minBet, 'maxBet must be bigger than minBet');
maxBet = _maxBet;
}
| 26,340 |
0 | // This emits when additional proof is chained. / | event ChainedProof(uint256 indexed tokenId, uint256 proofIndex);
constructor(string _name,
string _symbol)
Xcert(_name, _symbol)
public
| event ChainedProof(uint256 indexed tokenId, uint256 proofIndex);
constructor(string _name,
string _symbol)
Xcert(_name, _symbol)
public
| 10,516 |
38 | // called by manager after the winner called the "winner send money to manager" function to send the transaction with the send bid to the contract | function endAuctionByManager()
public
inFinalizationTime(block.timestamp)
calledByAuctionManager()
auctionNotInState(AuctionState.Ended)
| function endAuctionByManager()
public
inFinalizationTime(block.timestamp)
calledByAuctionManager()
auctionNotInState(AuctionState.Ended)
| 48,657 |
82 | // Restore all fees | function restoreAllFee() private {
_TotalFee = _previousTotalFee;
_buyFee = _previousBuyFee;
_sellFee = _previousSellFee;
}
| function restoreAllFee() private {
_TotalFee = _previousTotalFee;
_buyFee = _previousBuyFee;
_sellFee = _previousSellFee;
}
| 3,514 |
27 | // Return the ALPACA balance amount value given the share and total amount/share The share to be converted./totalAmount The total amount, can be lockedAmount or balance of this vault | function _shareToAmount(uint256 share, uint256 totalAmount) internal view returns (uint256) {
if (totalShare == 0) return share;
// When there's no share, 1 share = 1 amount.
return share * totalAmount / totalShare;
}
| function _shareToAmount(uint256 share, uint256 totalAmount) internal view returns (uint256) {
if (totalShare == 0) return share;
// When there's no share, 1 share = 1 amount.
return share * totalAmount / totalShare;
}
| 31,946 |
36 | // Atomically increases the allowance granted to `spender` by the caller. | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public override virtual returns (bool) {
(bool result,) = _forwardCurrentCall();
if (result) {
uint256 allowanceAmount = _getStorageContract().allowance(_msgSender(), spender);
emit Approval(_msgSender(), spender, allowanceAmount);
}
return result;
}
| * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public override virtual returns (bool) {
(bool result,) = _forwardCurrentCall();
if (result) {
uint256 allowanceAmount = _getStorageContract().allowance(_msgSender(), spender);
emit Approval(_msgSender(), spender, allowanceAmount);
}
return result;
}
| 48,573 |
54 | // use token address TOMO_TOKEN_ADDRESS for TOMO/makes a trade for transaction fee/auto set maxDestAmount and minConversionRate/src Src token/srcAmount amount of src tokens/destAddress Address to send tokens to/ return amount of actual dest tokens | function payTxFeeFast(TRC20 src, uint srcAmount, address destAddress) external payable returns(uint) {
require(payFeeCallers[msg.sender] == true);
payTxFee(
src,
srcAmount,
destAddress,
MAX_QTY,
0
);
}
| function payTxFeeFast(TRC20 src, uint srcAmount, address destAddress) external payable returns(uint) {
require(payFeeCallers[msg.sender] == true);
payTxFee(
src,
srcAmount,
destAddress,
MAX_QTY,
0
);
}
| 29,832 |
4 | // Returns all information about the contract in one go | function get_info() public view returns (address, address, address, address,
uint256, uint256, uint256,
| function get_info() public view returns (address, address, address, address,
uint256, uint256, uint256,
| 42,396 |
198 | // Increment the outbound collateral, in E18, for that hour Used for buyback throttling | bbkHourlyCum[curEpochHr()] += collateral_equivalent_d18;
| bbkHourlyCum[curEpochHr()] += collateral_equivalent_d18;
| 29,521 |
1 | // the maximum allowed amount of net mint credit. `totalCreditMinted - totalCreditBurned` should be smaller than this value | uint128 public maximumOutboundCredit; // Upper limit of net minted credit
uint128 public maximumInboundCredit; // Upper limit of net burned credit
mapping(address => uint256) public creditBalance;
uint256[50] private __gap;
| uint128 public maximumOutboundCredit; // Upper limit of net minted credit
uint128 public maximumInboundCredit; // Upper limit of net burned credit
mapping(address => uint256) public creditBalance;
uint256[50] private __gap;
| 30,183 |
7 | // Set ownership of the contract to a new account (`newOwner`).Can only be called by the current owner. / | function setOwner(address newOwner) public onlyOwner {
require(newOwner != address(0), "PerpFiOwnableUpgrade: zero address");
require(newOwner != _owner, "PerpFiOwnableUpgrade: same as original");
require(newOwner != _candidate, "PerpFiOwnableUpgrade: same as candidate");
_candidate = newOwner;
}
| function setOwner(address newOwner) public onlyOwner {
require(newOwner != address(0), "PerpFiOwnableUpgrade: zero address");
require(newOwner != _owner, "PerpFiOwnableUpgrade: same as original");
require(newOwner != _candidate, "PerpFiOwnableUpgrade: same as candidate");
_candidate = newOwner;
}
| 11,732 |
274 | // Set public sale active / | function setPublicSaleActive(bool _publicSaleIsActive) external onlyOwners {
publicSaleIsActive = _publicSaleIsActive;
}
| function setPublicSaleActive(bool _publicSaleIsActive) external onlyOwners {
publicSaleIsActive = _publicSaleIsActive;
}
| 17,802 |
39 | // It's send to creator | tokenReward.transfer(creator,remanent);
emit LogContributorsPayout(creator, remanent);
| tokenReward.transfer(creator,remanent);
emit LogContributorsPayout(creator, remanent);
| 23,016 |
4 | // Computed metadata which shows to user isValidExpirationTime - value which always recalculates to to check is token expired or not / | struct ComputedMetadata {
string investorType;
string countryCode;
bool isActive;
uint verificationTime;
uint expirationPeriod;
string ipfsUri;
bool isValidExpirationTime;
//metadata related to "C+" NTTs. Is empty for "P"
string identifierSBID;
string companyName;
string companyType;
string registrationNumber;
}
| struct ComputedMetadata {
string investorType;
string countryCode;
bool isActive;
uint verificationTime;
uint expirationPeriod;
string ipfsUri;
bool isValidExpirationTime;
//metadata related to "C+" NTTs. Is empty for "P"
string identifierSBID;
string companyName;
string companyType;
string registrationNumber;
}
| 16,127 |
233 | // Withdraw COMP token to beneficiary // | function withdrawCOMP(address _beneficiary) external onlyOwner {
uint256 compBalance = IERC20(COMP_ADDR).balanceOf(address(this));
IERC20(COMP_ADDR).safeTransfer(_beneficiary, compBalance);
emit WithdrawCOMP(_beneficiary, compBalance);
}
| function withdrawCOMP(address _beneficiary) external onlyOwner {
uint256 compBalance = IERC20(COMP_ADDR).balanceOf(address(this));
IERC20(COMP_ADDR).safeTransfer(_beneficiary, compBalance);
emit WithdrawCOMP(_beneficiary, compBalance);
}
| 15,087 |
327 | // Traverse the sheets to find the effective price | uint effectBlock = block.number - uint(config.priceEffectSpan);
PriceSheet memory sheet;
for (; ; ++index) {
| uint effectBlock = block.number - uint(config.priceEffectSpan);
PriceSheet memory sheet;
for (; ; ++index) {
| 20,551 |
64 | // Locked and discounted deposits | function depositWithDiscountAndLock(
uint assets,
uint lockDuration,
address receiver
| function depositWithDiscountAndLock(
uint assets,
uint lockDuration,
address receiver
| 2,104 |
33 | // Slash provided token amount from every member in the misbehaved/ operators array and burn 100% of all the tokens./amountToSlash Token amount to slash from every misbehaved operator./misbehavedOperators Array of addresses to seize the tokens from. | function slash(uint256 amountToSlash, address[] memory misbehavedOperators)
public
| function slash(uint256 amountToSlash, address[] memory misbehavedOperators)
public
| 5,651 |
71 | // Only loans in Pending state / | modifier onlyPendingLoans(address id) {
require(status(id) == LoanStatus.Pending, "TrueRatingAgency: Loan is not currently pending");
_;
}
| modifier onlyPendingLoans(address id) {
require(status(id) == LoanStatus.Pending, "TrueRatingAgency: Loan is not currently pending");
_;
}
| 31,724 |
40 | // Ensure token minter is passing in a sufficient minting fee. | require(msg.value >= mintFee, "Hashes: Must pass sufficient mint fee.");
| require(msg.value >= mintFee, "Hashes: Must pass sufficient mint fee.");
| 7,861 |
28 | // Instantiate the Zethr contract | ZethrContract = ZTHInterface(Zethr);
| ZethrContract = ZTHInterface(Zethr);
| 27,968 |
16 | // Delay between two calls to recompute the fees for this funded function | uint256 updateDelay; // [seconds]
| uint256 updateDelay; // [seconds]
| 15,412 |
7 | // auction struct. | struct Auction {
uint id; //ID if item
uint128 price; //Price of auction
uint64 expiration; //Time in seconds before it concludes
uint64 startTime; //Time it started
address payable seller;
}
| struct Auction {
uint id; //ID if item
uint128 price; //Price of auction
uint64 expiration; //Time in seconds before it concludes
uint64 startTime; //Time it started
address payable seller;
}
| 18,105 |
368 | // actually multiply prefactors by z(x) and perm_d(x) and combine them | tmp_g1 = proof.copy_permutation_grand_product_commitment.point_mul(grand_product_part_at_z);
tmp_g1.point_sub_assign(vk.copy_permutation_commitments[STATE_WIDTH - 1].point_mul(last_permutation_part_at_z));
res.point_add_assign(tmp_g1);
| tmp_g1 = proof.copy_permutation_grand_product_commitment.point_mul(grand_product_part_at_z);
tmp_g1.point_sub_assign(vk.copy_permutation_commitments[STATE_WIDTH - 1].point_mul(last_permutation_part_at_z));
res.point_add_assign(tmp_g1);
| 22,575 |
78 | // Sender redeems cTokens in exchange for a specified amount of underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemAmount The amount of underlying to receive from redeeming cTokensreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function redeemUnderlyingInternal(uint redeemAmount) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
}
// redeemFresh emits redeem-specific logs on errors, so we don't need to
return redeemFresh(msg.sender, 0, redeemAmount);
}
| function redeemUnderlyingInternal(uint redeemAmount) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
}
// redeemFresh emits redeem-specific logs on errors, so we don't need to
return redeemFresh(msg.sender, 0, redeemAmount);
}
| 11,774 |
15 | // Perform implementation upgrade | * Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
}
| * Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
}
| 33,299 |
11 | // Decode calldata info & calldata updatedata. | (address sender, uint256 valueSent, uint256 makerOrderID) = abi.decode(
takerOrderInfo,
(address, uint256, uint256)
);
| (address sender, uint256 valueSent, uint256 makerOrderID) = abi.decode(
takerOrderInfo,
(address, uint256, uint256)
);
| 34,828 |
14 | // Returns the current successor. | * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x7b13fc932b1063ca775d428558b73e20eab6804d4d9b5a148d7cbae4488973f8`
*/
function successor() external ifAdmin returns (address) {
return _successor();
}
| * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x7b13fc932b1063ca775d428558b73e20eab6804d4d9b5a148d7cbae4488973f8`
*/
function successor() external ifAdmin returns (address) {
return _successor();
}
| 34,715 |
127 | // By storing the original value once again, a refund is triggered (see https:eips.ethereum.org/EIPS/eip-2200) | _status = _NOT_ENTERED;
| _status = _NOT_ENTERED;
| 19,150 |
85 | // backup witdraw to retrieve all funds to deployment account | function backupWithdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
require(success);
}
| function backupWithdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
require(success);
}
| 35,211 |
2 | // This emits when the ownership is transferred out of the escrow contract. | event TitleCeded(address indexed _tokenRegistry, address indexed _to, uint256 indexed _id);
| event TitleCeded(address indexed _tokenRegistry, address indexed _to, uint256 indexed _id);
| 24,033 |
142 | // avoid rounding errors and cap shares to be <= total shares | if (_amount >= _total) {
return _totalShares;
}
| if (_amount >= _total) {
return _totalShares;
}
| 56,527 |
211 | // n = Pick random i > (array length - i) | uint256 n = i + SeedPhraseUtils._next(random, 0, (hexColors.length - i));
| uint256 n = i + SeedPhraseUtils._next(random, 0, (hexColors.length - i));
| 5,577 |
13 | // Price at which a SAFE gets liquidated | uint256 liquidationPrice; // [ray]
| uint256 liquidationPrice; // [ray]
| 36,905 |
7 | // make sure this respects ec_limit and client_limit | function mint(uint256 numberOfCards) external payable {
require(checkSaleIsActive(),"sale is not open");
require(numberOfCards <= _maxPerSaleMint,"Exceeds max per Transaction Mint");
_mintPayable(numberOfCards, msg.sender, _fullPrice);
}
| function mint(uint256 numberOfCards) external payable {
require(checkSaleIsActive(),"sale is not open");
require(numberOfCards <= _maxPerSaleMint,"Exceeds max per Transaction Mint");
_mintPayable(numberOfCards, msg.sender, _fullPrice);
}
| 60,554 |
9 | // Register into the registry. | if iszero(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x04)) {
| if iszero(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x04)) {
| 13,926 |
7 | // uToken contract / | IUToken public uToken;
| IUToken public uToken;
| 21,650 |
2 | // `owner` defaults to msg.sender on construction. | constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
| constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
| 8,892 |
338 | // Encode custom data for callFunction | data
);
operations[2] = _getDepositAction(dyDxMarketId, amount.add(2));
Account.Info[] memory accountInfos = new Account.Info[](1);
accountInfos[0] = _getAccountInfo();
solo.operate(accountInfos, operations);
emit Leverage(amountDesired, amount, deficit, SOLO);
| data
);
operations[2] = _getDepositAction(dyDxMarketId, amount.add(2));
Account.Info[] memory accountInfos = new Account.Info[](1);
accountInfos[0] = _getAccountInfo();
solo.operate(accountInfos, operations);
emit Leverage(amountDesired, amount, deficit, SOLO);
| 5,132 |
43 | // @_amount: USDC amount | function deposit(uint256 _amount) public onlyController{
deposit_usdc_amount = deposit_usdc_amount + _amount;
deposit_usdc(_amount);
uint256 cur = IERC20(lp_token_addr).balanceOf(address(this));
lp_balance = lp_balance + cur;
IERC20(lp_token_addr).safeTransfer(msg.sender, cur);
}
| function deposit(uint256 _amount) public onlyController{
deposit_usdc_amount = deposit_usdc_amount + _amount;
deposit_usdc(_amount);
uint256 cur = IERC20(lp_token_addr).balanceOf(address(this));
lp_balance = lp_balance + cur;
IERC20(lp_token_addr).safeTransfer(msg.sender, cur);
}
| 1,651 |
72 | // Function to burn tokens to The address that tokens will burn. value The amount of tokens to burn.return A boolean that indicates if the operation was successful. / | function burn(address to, uint256 value) public onlyMinter returns (bool) {
_burn(to, value);
totalBurned = totalBurned.add(value);
return true;
}
| function burn(address to, uint256 value) public onlyMinter returns (bool) {
_burn(to, value);
totalBurned = totalBurned.add(value);
return true;
}
| 35,903 |
4 | // Verifies a PKCSv1.5 SHA256 signature_data is the sign of the data_s is the signature_e is the exponent_n is the public key modulus return 0 if success, >0 otherwise/ | function VerifyPKCS1v15(
bytes memory _data,
bytes memory _s,
bytes memory _e,
bytes memory _n
| function VerifyPKCS1v15(
bytes memory _data,
bytes memory _s,
bytes memory _e,
bytes memory _n
| 43,007 |
7 | // Logged when tokens were transferred from one owner to another._from address of the owner, tokens were transferred from _to address of the owner, tokens were transferred to _value number of tokens transferred / | event Transfer (address indexed _from, address indexed _to, uint256 _value);
| event Transfer (address indexed _from, address indexed _to, uint256 _value);
| 9,959 |
273 | // See {IERC721-approve} from ZCN Network. / | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(zcnIsActive, "ERC721: enabled only after ZCN network in operation");
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
| function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(zcnIsActive, "ERC721: enabled only after ZCN network in operation");
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
| 36,314 |
86 | // Verifies if claim signature is valid. _signer address of signer. _claim Signed Keccak-256 hash. _signature Signature data. / | function isValidSignature(
address _signer,
bytes32 _claim,
SignatureData memory _signature
)
public
pure
returns (bool)
| function isValidSignature(
address _signer,
bytes32 _claim,
SignatureData memory _signature
)
public
pure
returns (bool)
| 42,033 |
78 | // token value => pool token value | function value( uint amount ) public view returns ( uint ) {
return amount.mul( 1e18 ).div( redemptionValue() );
}
| function value( uint amount ) public view returns ( uint ) {
return amount.mul( 1e18 ).div( redemptionValue() );
}
| 19,421 |
17 | // index Index of transaction. Transaction ordering may have changed since adding. enabled True for enabled, false for disabled. / | function setTransactionEnabled(uint256 index, bool enabled) external onlyOwner {
require(index < transactions.length, "index must be in range of stored tx list");
transactions[index].enabled = enabled;
}
| function setTransactionEnabled(uint256 index, bool enabled) external onlyOwner {
require(index < transactions.length, "index must be in range of stored tx list");
transactions[index].enabled = enabled;
}
| 8,553 |
25 | // Same as `transferViaSignature`, but for `transferFrom`.Use case: the user wants to withdraw tokens from a smart contract or another user who allowed the user todo so. Important note: the fee is subtracted from the `value`, and `to` address receives `value - fee`. signer - the address allowed to call transferFrom, which signed all below parameters from - the account to make withdrawal from to - the address of the recipient value - the value in tokens to withdraw fee - a fee to pay to `feeRecipient` feeRecipient - account which will receive fee deadline - until when the signature is | function transferFromViaSignature (
address signer,
address from,
address to,
uint256 value,
uint256 fee,
address feeRecipient,
uint256 deadline,
uint256 sigId,
bytes sig,
| function transferFromViaSignature (
address signer,
address from,
address to,
uint256 value,
uint256 fee,
address feeRecipient,
uint256 deadline,
uint256 sigId,
bytes sig,
| 67,267 |
62 | // set amount of token sent per ticket purchase/ | function setpurchaseTokenAmount(uint256 purchaseTokenAmount) external onlyOwner returns(bool){
_purchaseTokenAmount = purchaseTokenAmount;
return true;
}
| function setpurchaseTokenAmount(uint256 purchaseTokenAmount) external onlyOwner returns(bool){
_purchaseTokenAmount = purchaseTokenAmount;
return true;
}
| 4,018 |
9 | // length of each staking period in seconds. 7 days = 604,800; 3 months = 7,862,400 | uint256 public immutable DURATION = 30 days;
| uint256 public immutable DURATION = 30 days;
| 43,680 |
84 | // mark the latest withdrawal request that was finalised | uint256 public requestsFinalisedUntil;
| uint256 public requestsFinalisedUntil;
| 38,911 |
2 | // Find the index of a string in another string needle The string to search for haystack The string to searchreturn Returns -1 if no match is found, otherwise returns the index of the match / | function indexOfStringInString(string memory needle, string memory haystack)
public
pure
returns (int256)
| function indexOfStringInString(string memory needle, string memory haystack)
public
pure
returns (int256)
| 39,897 |
5 | // Returns a transformed price by applying the structured note payout structure. oraclePrice price from the oracle to be transformed. requestTime timestamp the oraclePrice was requested at.return transformedPrice the input oracle price with the price transformation logic applied to it. / | function transformPrice(FixedPoint.Unsigned memory oraclePrice, uint256 requestTime)
public
override
view
returns (FixedPoint.Unsigned memory)
| function transformPrice(FixedPoint.Unsigned memory oraclePrice, uint256 requestTime)
public
override
view
returns (FixedPoint.Unsigned memory)
| 43,544 |
0 | // The address of Compound interest-bearing token (e.g. cDAI, cUSDT) | address public immutable cErc20;
| address public immutable cErc20;
| 33,100 |
3 | // Add general purpose keys | for (uint i = 0; i < purposes.length; i++) {
bytes32 keyToAdd_ = keys[i];
require(
purposes[i] != MANAGEMENT,
"Constructor can not add management keys"
);
_keys[keyToAdd_].purposes.push(purposes[i]);
_keys[keyToAdd_].keyType = 1;
| for (uint i = 0; i < purposes.length; i++) {
bytes32 keyToAdd_ = keys[i];
require(
purposes[i] != MANAGEMENT,
"Constructor can not add management keys"
);
_keys[keyToAdd_].purposes.push(purposes[i]);
_keys[keyToAdd_].keyType = 1;
| 11,258 |
88 | // Deauthorize MCD contracts for old flip | deauthorize(_oldFlip, _cat);
deauthorize(_oldFlip, _end);
deauthorize(_oldFlip, _flipperMom);
| deauthorize(_oldFlip, _cat);
deauthorize(_oldFlip, _end);
deauthorize(_oldFlip, _flipperMom);
| 31,041 |
506 | // Total allocation poitns. Must be the sum of all allocation points in all pools. | uint256 public totalAllocPoint;
| uint256 public totalAllocPoint;
| 3,246 |
2 | // Module callbacks / |
function onRecvPacket(Packet.Data memory packet) public virtual override returns (bytes memory acknowledgement) {
require(hasRole(IBC_ROLE, _msgSender()), "caller must have the IBC role");
return handlePacket(packet);
}
|
function onRecvPacket(Packet.Data memory packet) public virtual override returns (bytes memory acknowledgement) {
require(hasRole(IBC_ROLE, _msgSender()), "caller must have the IBC role");
return handlePacket(packet);
}
| 1,538 |
27 | // initialise adjustable parameters artistwinnercreatoraffiliatecard affiliates | setPotDistribution(20, 0, 0, 20, 100); // 2% artist, 2% affiliate, 10% card affiliate
setMinimumPriceIncreasePercent(10); // 10%
setNumberOfNFTsToAward(3);
setCardLimit(100); // safe limit tested and set at 100, can be adjusted later if gas limit changes
setMaxRentIterations(50, 25); // safe limit tested and set at 50 & 25, can be adjusted later if gas limit changes
| setPotDistribution(20, 0, 0, 20, 100); // 2% artist, 2% affiliate, 10% card affiliate
setMinimumPriceIncreasePercent(10); // 10%
setNumberOfNFTsToAward(3);
setCardLimit(100); // safe limit tested and set at 100, can be adjusted later if gas limit changes
setMaxRentIterations(50, 25); // safe limit tested and set at 50 & 25, can be adjusted later if gas limit changes
| 32,358 |
7 | // The callers of the function sets themselves as the gasPayer | function register() external payable {
require(block.number <= regBlock, "Register block expired");
require(status == State.INIT, "Contract not initialized");
require(msg.value >= collateral, "Insufficient collateral provided");
seller = msg.sender;
status = State.REGISTERED;
}
| function register() external payable {
require(block.number <= regBlock, "Register block expired");
require(status == State.INIT, "Contract not initialized");
require(msg.value >= collateral, "Insufficient collateral provided");
seller = msg.sender;
status = State.REGISTERED;
}
| 50,688 |
1 | // getTellorCurrentValue(): identical to getCurrentValue() in UsingTellor.solAllows the user to get the latest value for the requestId specified_requestId is the requestId to look up the value for return ifRetrieve bool true if it is able to retrieve a value, the value, and the value's timestamp return value the value retrieved return _timestampRetrieved the value's timestamp/ | function getTellorCurrentValue(uint256 _requestId)
external
view
override
returns (
bool ifRetrieve,
uint256 value,
uint256 _timestampRetrieved
)
| function getTellorCurrentValue(uint256 _requestId)
external
view
override
returns (
bool ifRetrieve,
uint256 value,
uint256 _timestampRetrieved
)
| 34,209 |
14 | // Current nonce has to match this one to avoid double-claiming | require(nonceMap[msg.sender] == nonce, "Invalid nonce");
_mint(msg.sender, amount);
nonceMap[msg.sender]++;
claimedTokens[msg.sender] += amount;
| require(nonceMap[msg.sender] == nonce, "Invalid nonce");
_mint(msg.sender, amount);
nonceMap[msg.sender]++;
claimedTokens[msg.sender] += amount;
| 35,368 |
43 | // stateNotCreated is enforced by the internal _askQuestion | public payable returns (bytes32) {
uint256 template_id = createTemplate(content);
return askQuestion(template_id, question, arbitrator, timeout, opening_ts, nonce);
}
| public payable returns (bytes32) {
uint256 template_id = createTemplate(content);
return askQuestion(template_id, question, arbitrator, timeout, opening_ts, nonce);
}
| 85,493 |
4 | // Set a KYC Verifier contract for this contract. _verifier Verifier contract address./ | function setKYCVerifier(KYCVerifier _verifier) external onlyOrchestrator {
require(address(_verifier) != address(0), "Verifier address must not be a zero address.");
require(Address.isContract(address(_verifier)), "Address must point to a contract.");
kycVerifier = _verifier;
emit KYCVerifierUpdated(address(_verifier));
}
| function setKYCVerifier(KYCVerifier _verifier) external onlyOrchestrator {
require(address(_verifier) != address(0), "Verifier address must not be a zero address.");
require(Address.isContract(address(_verifier)), "Address must point to a contract.");
kycVerifier = _verifier;
emit KYCVerifierUpdated(address(_verifier));
}
| 27,807 |
211 | // lib/openzeppelin-contracts/contracts/utils/Pausable.sol/ pragma solidity >=0.6.0 <0.8.0; // import "../GSN/Context.sol"; // Contract module which allows children to implement an emergency stopmechanism that can be triggered by an authorized account. This module is used through inheritance. It will make available themodifiers `whenNotPaused` and `whenPaused`, which can be applied tothe functions of your contract. Note that they will not be pausable bysimply including this module, only once the modifiers are put in place. / | abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor () internal {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
| abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor () internal {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
| 23,775 |
3 | // Throws if the sender is not a listed adapter / | modifier onlyAdapter() {
require(isAdapter[msg.sender], "Must be adapter");
_;
}
| modifier onlyAdapter() {
require(isAdapter[msg.sender], "Must be adapter");
_;
}
| 18,210 |
11 | // ---------- Events ----------- | event Vested(address indexed beneficiary, uint256 amount);
event Released(address indexed beneficiary, uint256 amount);
| event Vested(address indexed beneficiary, uint256 amount);
event Released(address indexed beneficiary, uint256 amount);
| 51,922 |
72 | // NOTE: If these parameters are changed, expectedMsgDataLength and/or TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT need to be changed accordingly | bytes calldata _report,
bytes32[] calldata _rs, bytes32[] calldata _ss, bytes32 _rawVs // signatures
)
external
| bytes calldata _report,
bytes32[] calldata _rs, bytes32[] calldata _ss, bytes32 _rawVs // signatures
)
external
| 25,929 |
15 | // 3. Emit the SubmitTransaction event - txIndex should be the index of the newly created transaction |
emit SubmitTransaction(msg.sender, txIndex, _to, _value, _data);
|
emit SubmitTransaction(msg.sender, txIndex, _to, _value, _data);
| 41,810 |
0 | // Fallback function.Implemented entirely in `_fallback`. / | function () payable external {
_fallback();
}
| function () payable external {
_fallback();
}
| 9,984 |
165 | // Implements Ownable with a two step transfer of ownership | abstract contract Ownable is IOwnable {
address private _owner;
address private _proposedOwner;
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(msg.sender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual override returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Proposes a transfer of ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_proposedOwner = newOwner;
emit OwnershipProposed(_owner, _proposedOwner);
}
/**
* @dev Accepts ownership of the contract by a proposed account.
* Can only be called by the proposed owner.
*/
function acceptOwnership() public virtual override {
require(msg.sender == _proposedOwner, "Ownable: Only proposed owner can accept ownership");
_setOwner(_proposedOwner);
_proposedOwner = address(0);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
| abstract contract Ownable is IOwnable {
address private _owner;
address private _proposedOwner;
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(msg.sender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual override returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Proposes a transfer of ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_proposedOwner = newOwner;
emit OwnershipProposed(_owner, _proposedOwner);
}
/**
* @dev Accepts ownership of the contract by a proposed account.
* Can only be called by the proposed owner.
*/
function acceptOwnership() public virtual override {
require(msg.sender == _proposedOwner, "Ownable: Only proposed owner can accept ownership");
_setOwner(_proposedOwner);
_proposedOwner = address(0);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
| 30,069 |
0 | // Base uri for generate full token uri | string private _baseURI;
event ChangeBaseURI(string indexed oldBaseURI, string indexed newBaseURI);
| string private _baseURI;
event ChangeBaseURI(string indexed oldBaseURI, string indexed newBaseURI);
| 11,939 |
37 | // Traverse all the targets and selectors to build their paired values | for (uint256 i = 0; i < targets.length; ++i) {
| for (uint256 i = 0; i < targets.length; ++i) {
| 35,369 |
68 | // Internals for overriding |
function _flashLoan(IERC20 asset, uint256 amount, bytes memory data) internal;
function _repayFlashLoan(IERC20 token, uint256 amount) internal;
function _exchange(IERC20 fromToken, IERC20 toToken, uint256 amount) internal returns(uint256);
function _pnl(IERC20 collateral, IERC20 debt) internal returns(uint256);
function _deposit(IERC20 token, uint256 amount) internal;
function _redeem(IERC20 token, uint256 amount) internal;
function _redeemAll(IERC20 token) internal;
|
function _flashLoan(IERC20 asset, uint256 amount, bytes memory data) internal;
function _repayFlashLoan(IERC20 token, uint256 amount) internal;
function _exchange(IERC20 fromToken, IERC20 toToken, uint256 amount) internal returns(uint256);
function _pnl(IERC20 collateral, IERC20 debt) internal returns(uint256);
function _deposit(IERC20 token, uint256 amount) internal;
function _redeem(IERC20 token, uint256 amount) internal;
function _redeemAll(IERC20 token) internal;
| 8,003 |
143 | // Update reward for user | _updateReward(user);
| _updateReward(user);
| 52,814 |
14 | // Send prize fund to the winner. Clears up info about last round. / | function sendPrizeToWinner() public {
require(!isRoundActive(), "Round must be finished first");
require(prizeFund > 0, "Prize fund is empty");
emit PrizeWithdrawed(lastInvestorAddress, prizeFund);
_tokenContract.transfer(lastInvestorAddress, prizeFund);
prizeFund = 0;
lastInvestedTime = 0;
lastInvestorAddress = address(0);
}
| function sendPrizeToWinner() public {
require(!isRoundActive(), "Round must be finished first");
require(prizeFund > 0, "Prize fund is empty");
emit PrizeWithdrawed(lastInvestorAddress, prizeFund);
_tokenContract.transfer(lastInvestorAddress, prizeFund);
prizeFund = 0;
lastInvestedTime = 0;
lastInvestorAddress = address(0);
}
| 1,886 |
2 | // the liquidity index. Expressed in ray | uint128 liquidityIndex;
| uint128 liquidityIndex;
| 30,214 |
86 | // Returns a flag indicating whether a specified id is in the `pools` array./ See the `getPools` getter./_poolId An id of the pool. | function isPoolActive(uint256 _poolId) public view returns(bool) {
uint256 index = poolIndex[_poolId];
return index < _pools.length && _pools[index] == _poolId;
}
| function isPoolActive(uint256 _poolId) public view returns(bool) {
uint256 index = poolIndex[_poolId];
return index < _pools.length && _pools[index] == _poolId;
}
| 22,660 |
19 | // Function modifier to require caller to be contract owner / | modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER"); _;
}
| modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER"); _;
}
| 39,252 |
315 | // if values are not the same (the removed bit was 1) set action to deposit | if (slippageAction != slippage) {
isDeposit = true;
}
| if (slippageAction != slippage) {
isDeposit = true;
}
| 65,237 |
309 | // View returning all byte-encoded sell orders return encoded bytes representing all orders ordered by (user, index)/ | function getEncodedOrders() public view returns (bytes memory elements) {
if (allUsers.size() > 0) {
address user = allUsers.first();
bool stop = false;
while (!stop) {
elements = elements.concat(getEncodedUserOrders(user));
if (user == allUsers.last) {
stop = true;
} else {
user = allUsers.next(user);
}
}
}
return elements;
}
| function getEncodedOrders() public view returns (bytes memory elements) {
if (allUsers.size() > 0) {
address user = allUsers.first();
bool stop = false;
while (!stop) {
elements = elements.concat(getEncodedUserOrders(user));
if (user == allUsers.last) {
stop = true;
} else {
user = allUsers.next(user);
}
}
}
return elements;
}
| 6,844 |
26 | // pack the public data using information that it's already on-chain | bytes memory txDataPacked = processDepositBlockData(batchNumber, accoundIDs);
| bytes memory txDataPacked = processDepositBlockData(batchNumber, accoundIDs);
| 12,830 |
279 | // 1. Pay out to Pool | poolReward = newSupply.mul(Constants.getOraclePoolRatio()).div(100);
mintToPool(poolReward);
newSupply = newSupply > poolReward ? newSupply.sub(poolReward) : 0;
| poolReward = newSupply.mul(Constants.getOraclePoolRatio()).div(100);
mintToPool(poolReward);
newSupply = newSupply > poolReward ? newSupply.sub(poolReward) : 0;
| 30,620 |
118 | // confirms if the current keeper is registered and has a minimum bond, should be used for protected functionsreturn true/false if the address is a keeper and has more than the bond / | function isMinKeeper(address keeper, uint minBond, uint completed, uint age) external returns (bool) {
gasUsed = gasleft();
return keepers[keeper]
&& bonds[keeper] >= minBond
&& workCompleted[keeper] > completed
&& now.sub(firstSeen[keeper]) > age;
}
| function isMinKeeper(address keeper, uint minBond, uint completed, uint age) external returns (bool) {
gasUsed = gasleft();
return keepers[keeper]
&& bonds[keeper] >= minBond
&& workCompleted[keeper] > completed
&& now.sub(firstSeen[keeper]) > age;
}
| 23,602 |
162 | // The following types do not show up in the marshalled format and is only used for internal tracking purposes | uint8 internal constant HASH_ONLY = 100;
| uint8 internal constant HASH_ONLY = 100;
| 61,980 |
4 | // Lets a token owner to add NickName for an owned passport. _tokenId The tokenId of the NFT which subjected to change._nickNameThe String of the NickName. / | function add_nickName(uint _tokenId, string memory _nickName) public {
require(msg.sender == ownerOf(_tokenId),"Sorry, you don't own this token");
tokenIdentityOf[_tokenId]._nickName = _nickName;
}
| function add_nickName(uint _tokenId, string memory _nickName) public {
require(msg.sender == ownerOf(_tokenId),"Sorry, you don't own this token");
tokenIdentityOf[_tokenId]._nickName = _nickName;
}
| 23,236 |
26 | // If the user is un-delegated we delegate to their indicated address | delegate = firstDelegation;
| delegate = firstDelegation;
| 48,582 |
22 | // Migrates the accounting variables from the current creditline to a brand new one _borrower The borrower address _limit The new limit _interestApr The new interest APR _paymentPeriodInDays The new payment period in days _termInDays The new term in days _lateFeeApr The new late fee APR / | function migrateCreditLine(
address _borrower,
uint256 _limit,
uint256 _interestApr,
uint256 _paymentPeriodInDays,
uint256 _termInDays,
uint256 _lateFeeApr
| function migrateCreditLine(
address _borrower,
uint256 _limit,
uint256 _interestApr,
uint256 _paymentPeriodInDays,
uint256 _termInDays,
uint256 _lateFeeApr
| 44,852 |
96 | // Allows the DAO to set the amount of Breadsticks that is/ claimed per Proof of Pasta/bsticksDisplayValue The amount of Breadsticks a user can claim. | function daoSetBSTICKSPerProofOfPasta(uint256 bsticksDisplayValue)
public
onlyOwner
| function daoSetBSTICKSPerProofOfPasta(uint256 bsticksDisplayValue)
public
onlyOwner
| 1,528 |
53 | // Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). / | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath#sub: UNDERFLOW");
uint256 c = a - b;
return c;
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath#sub: UNDERFLOW");
uint256 c = a - b;
return c;
}
| 11,669 |
37 | // Triggers locked state permanently. Requirements: - The contract must not be locked. / | function _permanentLock() internal virtual whenNotLocked {
_permanentlyLocked = true;
emit PermanentlyLocked(_msgSender());
}
| function _permanentLock() internal virtual whenNotLocked {
_permanentlyLocked = true;
emit PermanentlyLocked(_msgSender());
}
| 59,302 |
0 | // Used for authentication | address public monetaryPolicy;
| address public monetaryPolicy;
| 32,620 |
32 | // messageHash can be used only once | bytes32 messageHash = message(tx.origin, _amount, deadline);
require(!msgHash[messageHash], "claim: signature duplicate");
| bytes32 messageHash = message(tx.origin, _amount, deadline);
require(!msgHash[messageHash], "claim: signature duplicate");
| 15,651 |
56 | // Action: ExchangeRate Function / | {
return globalBorrowEXR;
}
| {
return globalBorrowEXR;
}
| 7,925 |
17 | // it calculates how much 'want' this contract holds. | function balanceOfWant() public view returns (uint256) {
return IERC20(want).balanceOf(address(this));
}
| function balanceOfWant() public view returns (uint256) {
return IERC20(want).balanceOf(address(this));
}
| 15,982 |
89 | // Transfer the governance to a new address./_governance Address of the new governance. | function transferGovernance(address _governance) external onlyGovernance {
emit GovernanceProposed(futureGovernance = _governance);
}
| function transferGovernance(address _governance) external onlyGovernance {
emit GovernanceProposed(futureGovernance = _governance);
}
| 27,331 |
221 | // if there is no pending deposit or withdrawals, return | if (totalPendingDeposit == 0 && pendingSharesToWithdraw == 0) {
return;
}
| if (totalPendingDeposit == 0 && pendingSharesToWithdraw == 0) {
return;
}
| 8,169 |
17 | // Returns the number of tokens in ``owner``'s account. / | function balanceOf(address owner) external view returns (uint256 balance);
| function balanceOf(address owner) external view returns (uint256 balance);
| 25,406 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.