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 |
|---|---|---|---|---|
71 | // Internal migration id used to specify that a contract has already been initialized. / | string constant private INITIALIZED_ID = "initialized";
| string constant private INITIALIZED_ID = "initialized";
| 7,331 |
207 | // ERC721A Non-Fungible Token Standard, including the Metadata extension.Optimized for lower gas during batch mints. Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)starting from `_startTokenId()`. Assumptions: - An owner cannot have more than 264 - 1 (max value of uint64) of supply.- The maximum token I... | contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =========================... | contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =========================... | 3,709 |
169 | // The new owner accept an ownership transfer.The new owner should remove `operator` role from previous owner and add for himself. / | function acceptOwnership() external {
require(_msgSender() == newOwner, "IDO: CALLER_NO_NEW_OWNER");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
| function acceptOwnership() external {
require(_msgSender() == newOwner, "IDO: CALLER_NO_NEW_OWNER");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
| 64,316 |
62 | // Burn strategy tokens to withdraw pool tokens. It can be called only when invested./to Recipient for the pool tokens/ return poolTokensObtained Amount of pool tokens obtained/The strategy tokens that the user burns need to have been transferred previously, using a batchable router. | function burn(
address to
| function burn(
address to
| 23,567 |
11 | // Modifiers to allow any combination of roles | modifier hasAnyOfTwoRoles(bytes32 role1, bytes32 role2) {
require(_core.hasRole(role1, msg.sender) || _core.hasRole(role2, msg.sender), "UNAUTHORIZED");
_;
}
| modifier hasAnyOfTwoRoles(bytes32 role1, bytes32 role2) {
require(_core.hasRole(role1, msg.sender) || _core.hasRole(role2, msg.sender), "UNAUTHORIZED");
_;
}
| 23,011 |
190 | // we have more B than A, sell some B | amount = looseB.sub(debtB);
path = _getPath(tokenB, tokenA);
| amount = looseB.sub(debtB);
path = _getPath(tokenB, tokenA);
| 38,020 |
16 | // overriding the virtual function in LzReceiver | function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {
| function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {
| 32,751 |
620 | // IBabylonGate Babylon Finance Interface for interacting with the Guestlists / | interface IBabylonGate {
/* ============ Functions ============ */
function setGardenAccess(
address _user,
address _garden,
uint8 _permission
) external returns (uint256);
function setCreatorPermissions(address _user, bool _canCreate) external returns (uint256);
function ... | interface IBabylonGate {
/* ============ Functions ============ */
function setGardenAccess(
address _user,
address _garden,
uint8 _permission
) external returns (uint256);
function setCreatorPermissions(address _user, bool _canCreate) external returns (uint256);
function ... | 72,497 |
34 | // If over vesting duration, all tokens vested | if (elapsedDays >= tokenGrant.vestingDuration*(30)) {
uint256 remainingGrant = tokenGrant.amount-(tokenGrant.totalClaimed);
return (tokenGrant.vestingDuration, remainingGrant);
} else {
| if (elapsedDays >= tokenGrant.vestingDuration*(30)) {
uint256 remainingGrant = tokenGrant.amount-(tokenGrant.totalClaimed);
return (tokenGrant.vestingDuration, remainingGrant);
} else {
| 41,854 |
280 | // Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`/params tokenId The ID of the token for which liquidity is being increased,/ amount0Desired The desired amount of token0 to be spent,/ amount1Desired The desired amount of token1 to be spent,/ amount0Min The minimum amount of token0... | function increaseLiquidity(IncreaseLiquidityParams calldata params)
external
payable
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
| function increaseLiquidity(IncreaseLiquidityParams calldata params)
external
payable
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
| 27,333 |
160 | // Attempts to verify a DS record's hash value against some data. digesttype The digest ID from the DS record. data The data to digest. digest The digest data to check against.return True iff the digest matches. / | function verifyDSHash(uint8 digesttype, bytes data, bytes digest) internal view returns (bool) {
if (digests[digesttype] == address(0)) {
return false;
}
return digests[digesttype].verify(data, digest.substring(4, digest.length - 4));
}
| function verifyDSHash(uint8 digesttype, bytes data, bytes digest) internal view returns (bool) {
if (digests[digesttype] == address(0)) {
return false;
}
return digests[digesttype].verify(data, digest.substring(4, digest.length - 4));
}
| 8,381 |
3 | // 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-contracts/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 4 |
28 | // If the Presale is active do not accept incoming transactions | if (active) { revert(); }
| if (active) { revert(); }
| 44,369 |
137 | // Set the confirmation period after a vote has concluded. Only the contract owner may call this. The proposed duration must fallwithin sensible bounds (1 day to 2 weeks). / | function setConfirmationPeriod(uint duration)
external
onlyOwner
| function setConfirmationPeriod(uint duration)
external
onlyOwner
| 49,888 |
91 | // Description of the clock / solhint-disable-next-line func-name-mixedcase | function CLOCK_MODE() external view returns (string memory);
| function CLOCK_MODE() external view returns (string memory);
| 27,350 |
37 | // exposing the total reward amount for DApp | function reward_total() external constant returns (uint) {
return ((coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total));
}
| function reward_total() external constant returns (uint) {
return ((coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total));
}
| 8,484 |
37 | // View the state of a given proposal. proposalId The id of the specified proposalreturn The state of the proposal Requirements: - Proposal must exist / | function state(uint256 proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "Invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (bl... | function state(uint256 proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "Invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (bl... | 42,716 |
13 | // View functions / |
function MODULE_TYPE() external view returns(bytes32);
function oneTokenCount() external view returns(uint256);
function oneTokenAtIndex(uint256 index) external view returns(address);
function isOneToken(address oneToken) external view returns(bool);
|
function MODULE_TYPE() external view returns(bytes32);
function oneTokenCount() external view returns(uint256);
function oneTokenAtIndex(uint256 index) external view returns(address);
function isOneToken(address oneToken) external view returns(bool);
| 45,200 |
0 | // `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrarycontract-specific code that enables us to report opaque error codes from upgradeable contracts. / | event Failure(uint256 error, uint256 info, uint256 detail);
| event Failure(uint256 error, uint256 info, uint256 detail);
| 17,336 |
1,083 | // Set our length and extra data, save the context. | ctx.length = _index;
ctx.extraData = _extraData;
_self.setContext(ctx);
| ctx.length = _index;
ctx.extraData = _extraData;
_self.setContext(ctx);
| 65,853 |
9 | // Modifier to ensure voter has voted | modifier haveVoted(address _to) {
require(!voters[_to].voted, "Voter has already voted");
_;
}
| modifier haveVoted(address _to) {
require(!voters[_to].voted, "Voter has already voted");
_;
}
| 21,453 |
23 | // transfer escrowed amount to domain | uint256 escrowAmount = domains[msg.sender].escrowedAmount;
if(domain.drp.reactContract != address(0)){
| uint256 escrowAmount = domains[msg.sender].escrowedAmount;
if(domain.drp.reactContract != address(0)){
| 15,747 |
187 | // The player is the current winner | _auctionInfo.topBidder = msg.sender;
_auctionInfo.topBid = _maxBid;
| _auctionInfo.topBidder = msg.sender;
_auctionInfo.topBid = _maxBid;
| 1,393 |
142 | // use if staking warmup is 0 | IERC20(ASG).approve(stakingHelper, _amount);
IStakingHelper(stakingHelper).stake(_amount, _recipient);
| IERC20(ASG).approve(stakingHelper, _amount);
IStakingHelper(stakingHelper).stake(_amount, _recipient);
| 30,201 |
274 | // TODOeventAddress address of event controlling getNFT nftIndex unique index of getNFTorderTimeP timestamp passed on by ticket issuer of order time of database ticket twin (primary market getNFT)pricePaidP price of primary sale as passed on by ticket issuer/ | function addNftMetaPrimary(address eventAddress, uint256 nftIndex, uint256 orderTimeP, uint256 pricePaidP) public virtual returns(bool success){
EventStruct storage c = allEventStructs[eventAddress];
c.amountNFTs++;
c.ordersprimary[nftIndex] = OrdersPrimary({_nftIndex: nftIndex, _pricePaidP: pricePa... | function addNftMetaPrimary(address eventAddress, uint256 nftIndex, uint256 orderTimeP, uint256 pricePaidP) public virtual returns(bool success){
EventStruct storage c = allEventStructs[eventAddress];
c.amountNFTs++;
c.ordersprimary[nftIndex] = OrdersPrimary({_nftIndex: nftIndex, _pricePaidP: pricePa... | 20,803 |
60 | // Approve or reject loan. Manager approve or reject loan. _loanId Loan Id. _approve `true` value indicates the approval and `false` indicates rejection. / | function approveOrRejectLoan(uint _loanId, bool _approve) external onlyByManager {
address _userAddrs = loanIdToUser[_loanId];
for(uint256 i = 0; i < userInfo[_userAddrs].loanInfo.length ; i++) {
if(userInfo[_userAddrs].loanInfo[i].loanId == _loanId){
if(_approve... | function approveOrRejectLoan(uint _loanId, bool _approve) external onlyByManager {
address _userAddrs = loanIdToUser[_loanId];
for(uint256 i = 0; i < userInfo[_userAddrs].loanInfo.length ; i++) {
if(userInfo[_userAddrs].loanInfo[i].loanId == _loanId){
if(_approve... | 36,638 |
20 | // ------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack as ... | function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
| function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
| 1,128 |
37 | // Struct used to initialize WETH -> deposit swaps | struct Weth2Deposit {
address router;
address[] path;
}
| struct Weth2Deposit {
address router;
address[] path;
}
| 82,579 |
11 | // solhint-disable avoid-low-level-calls // solhint-disable no-inline-assembly // solhint-disable reason-string / | import { IERC721Receiver } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import { IERC1155Receiver } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "../utils/BaseRouter.sol";
// $$\ $$\ $$\ $$\ $$\
// $$ | $$ ... | import { IERC721Receiver } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import { IERC1155Receiver } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "../utils/BaseRouter.sol";
// $$\ $$\ $$\ $$\ $$\
// $$ | $$ ... | 27,980 |
92 | // Division precision. | uint256 private precision = 1e18;
| uint256 private precision = 1e18;
| 24,567 |
19 | // 0x31: Retrieval of at least one of the sources timed out. | RetrievalTimeout,
| RetrievalTimeout,
| 12,319 |
169 | // The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. Reverts upon any failure borrower The borrower of this cToken to be liquidated cTokenCollateral The market in which to seize collateral from the borrower / | function liquidateBorrow(address borrower, address cTokenCollateral)
| function liquidateBorrow(address borrower, address cTokenCollateral)
| 27,397 |
124 | // Delete from the mapping | delete frax_pools[pool_address];
| delete frax_pools[pool_address];
| 25,300 |
20 | // Ether Escrow legible as Bill of Sale with arbitration procedure. / | contract BillOfSale {
using SafeMath for uint256;
address public buyer;
address public seller;
address public arbiter;
string public descr;
uint256 public price;
uint256 private arbiterFee;
uint256 private buyerAward;
uint256 private sellerAward;
enum State { Created, Co... | contract BillOfSale {
using SafeMath for uint256;
address public buyer;
address public seller;
address public arbiter;
string public descr;
uint256 public price;
uint256 private arbiterFee;
uint256 private buyerAward;
uint256 private sellerAward;
enum State { Created, Co... | 573 |
11 | // Mint function uses OpenZeppelin's mint functions to ensure safety. Requires ensure that minting is 1-10. Does not allow to mint beyond the gift buffer. | function mint(uint256 mintAmount) public payable nonReentrant {
require(currentState == ContractState.PUBLIC, "Public sale not started");
require(mintAmount > 0, "Can't mint 0");
require(mintAmount + _tokenIdCounter.current() <= MAX_SUPPLY - giftsRemaining() - SNAPSHOT, "Minting more than ma... | function mint(uint256 mintAmount) public payable nonReentrant {
require(currentState == ContractState.PUBLIC, "Public sale not started");
require(mintAmount > 0, "Can't mint 0");
require(mintAmount + _tokenIdCounter.current() <= MAX_SUPPLY - giftsRemaining() - SNAPSHOT, "Minting more than ma... | 31,184 |
259 | // Modify minting limit | function change_MAX_Bones(uint new_MAX) public onlyOwner returns(uint)
| function change_MAX_Bones(uint new_MAX) public onlyOwner returns(uint)
| 37,000 |
63 | // Case 5: Unforeseen stuff | else {
revert("Fatal Error: Case5 unforeseen.");
}
| else {
revert("Fatal Error: Case5 unforeseen.");
}
| 28,715 |
95 | // Transfers all the LP tokens to the Dev address for Migration process | stakingToken.safeTransfer(
msg.sender,
stakingToken.balanceOf(address(this))
);
| stakingToken.safeTransfer(
msg.sender,
stakingToken.balanceOf(address(this))
);
| 11,806 |
40 | // Allocate 32% of all tokens to Foundation | foundationTokens = div(mul(totalSupply, 32), 100);
balances[foundationReserve] = foundationTokens;
| foundationTokens = div(mul(totalSupply, 32), 100);
balances[foundationReserve] = foundationTokens;
| 44,987 |
0 | // Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | 23,294 |
272 | // IVariety interface/Simon Fremaux (@dievardump) | interface IVariety is IERC721 {
/// @notice mint `seeds.length` token(s) to `to` using `seeds`
/// @param to token recipient
/// @param seeds each token seed
function plant(address to, bytes32[] memory seeds)
external
returns (uint256);
/// @notice this function returns the seed ass... | interface IVariety is IERC721 {
/// @notice mint `seeds.length` token(s) to `to` using `seeds`
/// @param to token recipient
/// @param seeds each token seed
function plant(address to, bytes32[] memory seeds)
external
returns (uint256);
/// @notice this function returns the seed ass... | 23,289 |
210 | // Interface for the NFT Royalty Standard. A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universalsupport for royalty payments across all NFT marketplaces and ecosystem participants./ | interface IERC2981 is IERC165 {
| interface IERC2981 is IERC165 {
| 44,403 |
42 | // If x > 1, then we compute the fraction part of log2(x), which is larger than 0. | if (x > FIXED_1) {
for (uint8 i = MAX_PRECISION; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += ONE << (i - 1);
}
| if (x > FIXED_1) {
for (uint8 i = MAX_PRECISION; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += ONE << (i - 1);
}
| 3,666 |
104 | // Variables used to parameterize behavior. | uint256 public minimumBond;
uint256 public minimumPodSize;
uint256 public minimumEpochInterval;
address public slasher;
| uint256 public minimumBond;
uint256 public minimumPodSize;
uint256 public minimumEpochInterval;
address public slasher;
| 22,959 |
23 | // ============== Minting ============== | function mintBatch(
address[] calldata _to,
uint256[][] calldata _ids,
uint256[][] calldata _amounts
| function mintBatch(
address[] calldata _to,
uint256[][] calldata _ids,
uint256[][] calldata _amounts
| 1,367 |
180 | // Allow a n token holder to mint a token with one of their n token's id tokenId Id to be minted / | function mintWithN(uint256 tokenId) public payable virtual nonReentrant {
require(n.ownerOf(tokenId) == msg.sender, "NPass:INVALID_OWNER");
_safeMint(msg.sender, tokenId);
}
| function mintWithN(uint256 tokenId) public payable virtual nonReentrant {
require(n.ownerOf(tokenId) == msg.sender, "NPass:INVALID_OWNER");
_safeMint(msg.sender, tokenId);
}
| 5,138 |
28 | // See {IERC721-approve}. / | function approve(address to, uint256 tokenId) public virtual override {
| function approve(address to, uint256 tokenId) public virtual override {
| 28,219 |
5 | // Lets trandfer LRC first. | require(
lrcAddress.safeTransferFrom(msg.sender, address(this), amount),
"TRANSFER_FAILURE"
);
Stake storage user = users[msg.sender];
| require(
lrcAddress.safeTransferFrom(msg.sender, address(this), amount),
"TRANSFER_FAILURE"
);
Stake storage user = users[msg.sender];
| 48,746 |
72 | // Batch mint tokens. Assign directly to _to[]. | function mint(uint256 _id, address[] calldata _to, uint256[] calldata _quantities) external creatorOnly(_id) {
for (uint256 i = 0; i < _to.length; ++i) {
address to = _to[i];
uint256 quantity = _quantities[i];
// Grant the items to the caller
balances[_id][... | function mint(uint256 _id, address[] calldata _to, uint256[] calldata _quantities) external creatorOnly(_id) {
for (uint256 i = 0; i < _to.length; ++i) {
address to = _to[i];
uint256 quantity = _quantities[i];
// Grant the items to the caller
balances[_id][... | 23,430 |
61 | // Returns the downcasted int24 from int256, reverting onoverflow (when the input is less than smallest int24 orgreater than largest int24). Counterpart to Solidity's `int24` operator. Requirements: - input must fit into 24 bits _Available since v4.7._ / | function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
| function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
| 30,776 |
177 | // The total number of rewards issued. | uint256 count = _rewardMultipliers.length;
| uint256 count = _rewardMultipliers.length;
| 1,100 |
103 | // Enumerable mapping from token ids to their owners | EnumerableMap.UintToAddressMap private _tokenOwners;
| EnumerableMap.UintToAddressMap private _tokenOwners;
| 22,507 |
49 | // Gets a dial's weighted votes for each distribution period. dialIdDial identifier starting from 0.return voteHistoryList of weighted votes with the first distribution at index 0. / | function getDialVoteHistory(uint256 dialId)
public
view
returns (HistoricVotes[] memory voteHistory)
| function getDialVoteHistory(uint256 dialId)
public
view
returns (HistoricVotes[] memory voteHistory)
| 64,135 |
0 | // ERC1155标准的接口合约,实现了EIP1155的功能 / | interface IERC1155 is IERC165 {
/**
* @dev 单类代币转账事件
* 当`value`个`id`种类的代币被`operator`从`from`转账到`to`时释放.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev 批量代币转账事件
* ids和values为转账的代币种类和数量数组
*/
ev... | interface IERC1155 is IERC165 {
/**
* @dev 单类代币转账事件
* 当`value`个`id`种类的代币被`operator`从`from`转账到`to`时释放.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev 批量代币转账事件
* ids和values为转账的代币种类和数量数组
*/
ev... | 24,505 |
285 | // Read oracle prices for borrowed and collateral assets / Use stored value here as it is view function | uint256 _exchangeRateMantissa =
IiToken(_iTokenCollateral).exchangeRateStored();
| uint256 _exchangeRateMantissa =
IiToken(_iTokenCollateral).exchangeRateStored();
| 40,588 |
13 | // Mint a token with set Id/Set Id determined by owner/_to Address to mint token to Mint a token with sequential id | function _mintTokenId(address _to, uint256 _tokenId) private {
_mint(_to, _tokenId, 1, "");
totalSupplyMinted += 1;
emit MintEvent(block.timestamp, _tokenId);
}
| function _mintTokenId(address _to, uint256 _tokenId) private {
_mint(_to, _tokenId, 1, "");
totalSupplyMinted += 1;
emit MintEvent(block.timestamp, _tokenId);
}
| 34,848 |
216 | // send tokens | if (maxTokensCreated()) {
revert("Max tokens created");
}
| if (maxTokensCreated()) {
revert("Max tokens created");
}
| 45,865 |
143 | // Internal function that transfer tokens from one address to another./ Update magnifiedDividendCorrections to keep dividends unchanged./from The address to transfer from./to The address to transfer to./value The amount to be transferred. | function _transfer(address from, address to, uint256 value) internal virtual override {
require(false);
int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256();
magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);
magnifiedDividendCorrections[to... | function _transfer(address from, address to, uint256 value) internal virtual override {
require(false);
int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256();
magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);
magnifiedDividendCorrections[to... | 8,631 |
126 | // sell | if (takeFee && recipient == address(uniswapV2Pair)) {
uint256 fees = (amount * totalSellFeeBPS) / 10000;
amount -= fees;
_executeTransfer(sender, address(this), fees);
}
| if (takeFee && recipient == address(uniswapV2Pair)) {
uint256 fees = (amount * totalSellFeeBPS) / 10000;
amount -= fees;
_executeTransfer(sender, address(this), fees);
}
| 37,272 |
3 | // Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot 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;
}
... | 22,285 |
13 | // currentBid.auctionId = auctionId;currentBid.number = bidNumber; |
bidsOfAuction[auctionId].push(currentBid); // Add current highestBid to the auction.
|
bidsOfAuction[auctionId].push(currentBid); // Add current highestBid to the auction.
| 11,391 |
7 | // Unlocks a token. / | function unlockId(uint256 _id) external;
| function unlockId(uint256 _id) external;
| 8,284 |
177 | // returns the protection level based on the timestamp and protection delays_addTimestamptime at which the liquidity was added _removeTimestamp time at which the liquidity is removedreturn protection level (as a ratio) / | function protectionLevel(uint256 _addTimestamp, uint256 _removeTimestamp) internal view returns (Fraction memory) {
uint256 timeElapsed = _removeTimestamp.sub(_addTimestamp);
if (timeElapsed < minProtectionDelay) {
return Fraction({ n: 0, d: 1 });
}
if (timeElapsed >= ma... | function protectionLevel(uint256 _addTimestamp, uint256 _removeTimestamp) internal view returns (Fraction memory) {
uint256 timeElapsed = _removeTimestamp.sub(_addTimestamp);
if (timeElapsed < minProtectionDelay) {
return Fraction({ n: 0, d: 1 });
}
if (timeElapsed >= ma... | 45,536 |
58 | // Guarantees that the msg.sender is allowed to transfer NFT. _tokenId ID of the NFT to transfer. / | modifier canTransfer(
uint256 _tokenId
| modifier canTransfer(
uint256 _tokenId
| 53,961 |
72 | // Emits {SwapAndLiquify}/ | function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
| function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
| 43,034 |
28 | // return the name | string memory equbName = pools[poolIndex].name;
return equbName;
| string memory equbName = pools[poolIndex].name;
return equbName;
| 15,539 |
60 | // 0x00: Unknown error. Something went really bad! | Unknown,
| Unknown,
| 59,749 |
130 | // indexed events are emitted | emit BondCreated(
_amount,
payout,
block.number.add(terms.vestingTerm),
priceInUSD
);
emit BondPriceChanged(bondPriceInUSD(), _bondPrice(), debtRatio());
adjust(); // control variable is adjusted
return payout;
| emit BondCreated(
_amount,
payout,
block.number.add(terms.vestingTerm),
priceInUSD
);
emit BondPriceChanged(bondPriceInUSD(), _bondPrice(), debtRatio());
adjust(); // control variable is adjusted
return payout;
| 7,593 |
57 | // if all shares are taken, just modify the owner address in place | holding.owner = _to;
| holding.owner = _to;
| 41,962 |
189 | // return {"success" : "Returns true if successfully called from another contract"} / | function execSwap(
Data storage self,
address requester,
string symbolA,
string symbolB,
uint valueA,
uint valueB,
uint8 sigV,
bytes32 sigR,
bytes32 sigS,
| function execSwap(
Data storage self,
address requester,
string symbolA,
string symbolB,
uint valueA,
uint valueB,
uint8 sigV,
bytes32 sigR,
bytes32 sigS,
| 26,828 |
47 | // isValid a redToken _tokenId the token id / | function isValidRedToken(uint256 _tokenId) public view returns (bool) {
return redTokens[_tokenId].isValid;
}
| function isValidRedToken(uint256 _tokenId) public view returns (bool) {
return redTokens[_tokenId].isValid;
}
| 36,701 |
183 | // Increase allowance with a signed authorization owner Token owner's address (Authorizer) spender Spender's address increment Amount of increase in allowance validAfterThe time after which this is valid (unix time) validBefore The time before which this is valid (unix time) nonce Unique nonce v v of the signature r r ... | function increaseAllowanceWithAuthorization(
address owner,
address spender,
uint256 increment,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
| function increaseAllowanceWithAuthorization(
address owner,
address spender,
uint256 increment,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
| 10,595 |
190 | // Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve | * voting weight using {IGovernor-getVotes} and call the {_countVote} internal function.
*
* Emits a {IGovernor-VoteCast} event.
*/
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual returns (uint256)... | * voting weight using {IGovernor-getVotes} and call the {_countVote} internal function.
*
* Emits a {IGovernor-VoteCast} event.
*/
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual returns (uint256)... | 7,869 |
262 | // 2 | uint16 dailyDataCount;
uint72 stakeSharesTotal;
uint40 latestStakeId;
uint128 claimStats;
| uint16 dailyDataCount;
uint72 stakeSharesTotal;
uint40 latestStakeId;
uint128 claimStats;
| 16,134 |
1 | // Add some extra buffer at the end | bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
| bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
| 21,146 |
23 | // can only burn from the deployer address. | function burn (uint256 amount) public {
require(msg.sender == owner);
require(_balanceOf[msg.sender] >= amount);
supply = supply.sub(amount);
_transfer(msg.sender, address(0), amount);
}
| function burn (uint256 amount) public {
require(msg.sender == owner);
require(_balanceOf[msg.sender] >= amount);
supply = supply.sub(amount);
_transfer(msg.sender, address(0), amount);
}
| 79,780 |
23 | // Returns the token collection symbol. / | function symbol() external view returns (string memory);
| function symbol() external view returns (string memory);
| 20,365 |
0 | // Curiosity / | contract CuriosityVoting is Curiosity {
// voting contract
}
| contract CuriosityVoting is Curiosity {
// voting contract
}
| 22,013 |
80 | // index of the vault that is to be modified (if any) | uint256 vaultId;
| uint256 vaultId;
| 9,436 |
19 | // if the caller is the winner, transfer the NFT image if not refund | if (msg.sender == highestBidder) {
recipient = highestBidder;
value = bids[highestBidder] - highestBindingBid;
| if (msg.sender == highestBidder) {
recipient = highestBidder;
value = bids[highestBidder] - highestBindingBid;
| 18,325 |
214 | // Set Free Updates Count / | function setFreeUpdatesCount(uint256 _freeUpdatesCount) public onlyOwner {
freeUpdatesCount = _freeUpdatesCount;
}
| function setFreeUpdatesCount(uint256 _freeUpdatesCount) public onlyOwner {
freeUpdatesCount = _freeUpdatesCount;
}
| 53,613 |
20 | // Presale end time (inclusive) | uint256 public endTimePre;
| uint256 public endTimePre;
| 36,949 |
15 | // 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));
}
| 61,968 |
93 | // Compute remainder using mulmod. | remainder := mulmod(x, y, denominator)
| remainder := mulmod(x, y, denominator)
| 1,323 |
10 | // Forming Proposition | StorageFormingProposition._initStorage(initData.formingPropositionHash);
| StorageFormingProposition._initStorage(initData.formingPropositionHash);
| 18,289 |
28 | // Returns the current status of transaction approvals/This function doesn't modify state and can be freely called./ return The current status of transaction approvals | function isTxnApprovalEnabled() external view returns (bool) {
return txnApprovalsEnabled;
}
| function isTxnApprovalEnabled() external view returns (bool) {
return txnApprovalsEnabled;
}
| 15,861 |
231 | // The typehash for the data type specified in the structured data https:github.com/ethereum/EIPs/blob/master/EIPS/eip-712.mdrationale-for-typehash | bytes32 private constant _BUYING_LIFC_TYPEHASH =
keccak256("BuyLIFC(address owner,uint256 nonce,uint256 amount,uint256 cost,uint256 deadline,address currencyAddress)");
| bytes32 private constant _BUYING_LIFC_TYPEHASH =
keccak256("BuyLIFC(address owner,uint256 nonce,uint256 amount,uint256 cost,uint256 deadline,address currencyAddress)");
| 24,467 |
108 | // susdv2 pool | address public constant curve = 0xA5407eAE9Ba41422680e2e00537571bcC53efBfD;
| address public constant curve = 0xA5407eAE9Ba41422680e2e00537571bcC53efBfD;
| 7,231 |
7 | // applying check on duplication data.......... | require(degrees[byte_id].expiration_date == 0, "Degree with given id already exists");
| require(degrees[byte_id].expiration_date == 0, "Degree with given id already exists");
| 2,186 |
46 | // burnable | event Burn(address indexed burner, uint256 value);
| event Burn(address indexed burner, uint256 value);
| 9,984 |
98 | // Multiplier on the marginRatio for this market | Decimal.D256 marginPremium;
| Decimal.D256 marginPremium;
| 8,392 |
12 | // latest BRR data (reward and rebate in bps) | BRRData internal latestBrrData;
| BRRData internal latestBrrData;
| 33,621 |
15 | // Public variables of the token // Variables of the token // Events / | function () payable {
require (crowdsaleIsOpen == true);
require(msg.value != 0);
mintTRCToken(msg.sender, (msg.value * TRCExchangeRate * 10**decimals) / etherChange);
}
| function () payable {
require (crowdsaleIsOpen == true);
require(msg.value != 0);
mintTRCToken(msg.sender, (msg.value * TRCExchangeRate * 10**decimals) / etherChange);
}
| 49,694 |
59 | // 32 is the length in bytes of hash, enforced by the type signature above | return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
| return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
| 50,896 |
18 | // Check: extension namespace must already exist. Check: provided extension implementation must be non-zero. | require(_canReplaceExtension(_extension), "ExtensionManager: cannot replace extension.");
| require(_canReplaceExtension(_extension), "ExtensionManager: cannot replace extension.");
| 27,380 |
10 | // Copy remaining bytes | uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
| uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
| 4,482 |
0 | // Error functions / | error AmountZeroOrLess();
error CallerIsNotUser();
error InsufficientBalance();
error MaxMintPerAddressExceeded();
error MaxSupplyExceeded();
error NotAllowedMint();
error NotApproved();
error NotTokenOwner(uint256 tokenId);
error OverMintAmountPerTransaction();
error ZeroAddress... | error AmountZeroOrLess();
error CallerIsNotUser();
error InsufficientBalance();
error MaxMintPerAddressExceeded();
error MaxSupplyExceeded();
error NotAllowedMint();
error NotApproved();
error NotTokenOwner(uint256 tokenId);
error OverMintAmountPerTransaction();
error ZeroAddress... | 26,606 |
0 | // string jrv; | address sender;
| address sender;
| 20,875 |
93 | // - return info about current user's reward_user - user's address/ | function getRewards(address _user) public view returns(uint256) {
return userInfo[_user].rewardDebt;
}
| function getRewards(address _user) public view returns(uint256) {
return userInfo[_user].rewardDebt;
}
| 31,094 |
11 | // The number of CVX should unlocked at the start of epoch `unlockEpoch`. | uint192 pendingUnlock;
| uint192 pendingUnlock;
| 84,338 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.