Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
14 | // Calculate accrued rewards for user if idx differs from previous | if (newIdx != asset.userIndex[_user]) {
if (_userStake != 0) {
accruedRewards = _calculateRewards(
_userStake,
newIdx,
asset.userIndex[_user]
);
}
| if (newIdx != asset.userIndex[_user]) {
if (_userStake != 0) {
accruedRewards = _calculateRewards(
_userStake,
newIdx,
asset.userIndex[_user]
);
}
| 15,289 |
5 | // If not processed yet: | processedTxNonce[msg.sender][_nonce] = true;
_;
| processedTxNonce[msg.sender][_nonce] = true;
_;
| 32,061 |
0 | // Set SwaceToken. _swa SwaceToken The address of swace token / | function setSwaceToken(SwaceToken _swa)
public
onlyOwner
| function setSwaceToken(SwaceToken _swa)
public
onlyOwner
| 13,333 |
104 | // event of exchange WRC-20 token with original chain token request/event invoked by storeman group/smgIDID of storemanGroup/tokenPairIDtoken pair ID of cross chain token/tokenAccount Rapidity shadow token account/valueRapidity value/userAccountaccount of shadow chain, used to receive token | event UserBurnLogger(bytes32 indexed smgID, uint indexed tokenPairID, address indexed tokenAccount, uint value, uint contractFee, uint fee, bytes userAccount);
| event UserBurnLogger(bytes32 indexed smgID, uint indexed tokenPairID, address indexed tokenAccount, uint value, uint contractFee, uint fee, bytes userAccount);
| 1,615 |
112 | // Can be overridden to add finalization logic. The overriding functionshould call super._finalization() to ensure the chain of finalization isexecuted entirely. / | function _finalization() internal {
// solhint-disable-previous-line no-empty-blocks
}
| function _finalization() internal {
// solhint-disable-previous-line no-empty-blocks
}
| 34,654 |
0 | // Create new participant in the network and log the starting datetime | function makePayment(int date) payable public {
require(msg.value != 0);
lastPayment[msg.sender] = date;
}
| function makePayment(int date) payable public {
require(msg.value != 0);
lastPayment[msg.sender] = date;
}
| 53,734 |
2 | // Sushiswap Interface | interface iPair {
function sync() external;
}
| interface iPair {
function sync() external;
}
| 43,387 |
112 | // If user is last to withdraw, don't take withdraw fee. And there may still have some pending rewards, we just simple ignore it now. If we want the reward later, we can upgrade the contract. | _withdrawable = _totalUnderlying;
| _withdrawable = _totalUnderlying;
| 29,118 |
0 | // For interacting with masterchef | interface IMasterchef {
// Transfer want tokens vault -> masterchef
function deposit(uint256 pid, uint256 _amount) external;
// Transfer want tokens masterchef -> vault
function withdraw(uint256 pid, uint256 _amount) external;
//get the amount staked and reward debt for user
function userInfo(uint256 _pid, address _address) external view returns (uint256, uint256);
//Emergency withdraw from the pools leaving out any pending harvest
function emergencyWithdraw(uint256 _pid) external;
} | interface IMasterchef {
// Transfer want tokens vault -> masterchef
function deposit(uint256 pid, uint256 _amount) external;
// Transfer want tokens masterchef -> vault
function withdraw(uint256 pid, uint256 _amount) external;
//get the amount staked and reward debt for user
function userInfo(uint256 _pid, address _address) external view returns (uint256, uint256);
//Emergency withdraw from the pools leaving out any pending harvest
function emergencyWithdraw(uint256 _pid) external;
} | 12,448 |
326 | // res += valcoefficients[59]. | res := addmod(res,
mulmod(val, /*coefficients[59]*/ mload(0xca0), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[59]*/ mload(0xca0), PRIME),
PRIME)
| 21,620 |
17 | // Adds a new probability distribution for a given trait. / | function _pushProbabilities(uint256 traitId, uint64[] memory pdf) internal {
if (traitId >= _numPerTrait.length) {
revert InvalidTraitId(traitId);
}
if (pdf.length != _numPerTrait[traitId]) {
revert IncorrectPDFLength(pdf.length, traitId, _numPerTrait[traitId]);
}
uint64[] memory cdf = pdf.computeCDF();
if (cdf[cdf.length - 1] == 0) {
revert ConstantZeroPDF();
}
_cdfs[traitId].push(cdf);
}
| function _pushProbabilities(uint256 traitId, uint64[] memory pdf) internal {
if (traitId >= _numPerTrait.length) {
revert InvalidTraitId(traitId);
}
if (pdf.length != _numPerTrait[traitId]) {
revert IncorrectPDFLength(pdf.length, traitId, _numPerTrait[traitId]);
}
uint64[] memory cdf = pdf.computeCDF();
if (cdf[cdf.length - 1] == 0) {
revert ConstantZeroPDF();
}
_cdfs[traitId].push(cdf);
}
| 7,681 |
8 | // Performs a single exact input swap | function exactInputInternal(
uint256 amountIn,
address recipient,
uint160 sqrtPriceLimitX96,
SwapCallbackData memory data
| function exactInputInternal(
uint256 amountIn,
address recipient,
uint160 sqrtPriceLimitX96,
SwapCallbackData memory data
| 10,190 |
3 | // Modulo is the number of equiprobable outcomes in a game:2 for coin flip6 for dice roll66 = 36 for double dice37 for roulette100 for polyroll | uint constant MAX_MODULO = 100;
| uint constant MAX_MODULO = 100;
| 26,998 |
13 | // perform transfers | for (uint256 i = 0; i < ids.length; ++i) {
| for (uint256 i = 0; i < ids.length; ++i) {
| 48,917 |
54 | // Storing in local variables to avoid stack too deep | uint256[] memory _balances = balances;
uint256 _protocolSwapFeePercentage = protocolSwapFeePercentage;
amountsIn = new uint256[](2);
amountsIn[tokenIndex] = amountIn;
_upscaleArray(amountsIn);
uint256 amountInForVirtualSwap;
| uint256[] memory _balances = balances;
uint256 _protocolSwapFeePercentage = protocolSwapFeePercentage;
amountsIn = new uint256[](2);
amountsIn[tokenIndex] = amountIn;
_upscaleArray(amountsIn);
uint256 amountInForVirtualSwap;
| 20,415 |
12 | // ERC721Metadata methods | function name() external view returns (string _name) {
return "SNFT";
}
| function name() external view returns (string _name) {
return "SNFT";
}
| 9,602 |
26 | // Define 1% | uint256 private constant onePercent = 100000 * 10**_decimals;
| uint256 private constant onePercent = 100000 * 10**_decimals;
| 1,733 |
7 | // Make sure signature is valid and get the address of the signer | address signer = _verifyWithdrawToken(_data);
| address signer = _verifyWithdrawToken(_data);
| 4,212 |
28 | // Swap to ITS | swapTokenfortoken(WETH,token);
| swapTokenfortoken(WETH,token);
| 39,457 |
129 | // Divides value a by value b (result is rounded down). / | function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISE_UNIT).div(b);
}
| function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISE_UNIT).div(b);
}
| 25,832 |
204 | // return the previous eth to the bidder | if(currentBidder != address(0))
withdrawETH(currentBidder, prevBidPrice);
| if(currentBidder != address(0))
withdrawETH(currentBidder, prevBidPrice);
| 35,710 |
164 | // If order.makerAssetAmount is zero, we also reject the order. While the Exchange contract handles them correctly, they create edge cases in the supporting infrastructure because they have an 'infinite' price when computed by a simple division. | if (order.makerAssetAmount == 0) {
orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT);
return orderInfo;
}
| if (order.makerAssetAmount == 0) {
orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT);
return orderInfo;
}
| 8,741 |
38 | // Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator. _to address to be approved for the given token ID _tokenId uint256 ID of the token to be approved / | function approve(address _to, uint256 _tokenId) public {
address owner = ownerOf(_tokenId);
require(_to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
if (getApproved(_tokenId) != address(0) || _to != address(0)) {
tokenApprovals[_tokenId] = _to;
emit Approval(owner, _to, _tokenId);
}
}
| function approve(address _to, uint256 _tokenId) public {
address owner = ownerOf(_tokenId);
require(_to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
if (getApproved(_tokenId) != address(0) || _to != address(0)) {
tokenApprovals[_tokenId] = _to;
emit Approval(owner, _to, _tokenId);
}
}
| 18,627 |
512 | // get APR from chainlink data by measuring (current month - previous month) / previous month/ return percentageChange percentage change in basis points over past month | function getMonthlyAPR() public view returns (int256 percentageChange) {
int256 delta = int128(currentMonth) - int128(previousMonth);
percentageChange = (delta * Constants.BP_INT) / int128(previousMonth);
}
| function getMonthlyAPR() public view returns (int256 percentageChange) {
int256 delta = int128(currentMonth) - int128(previousMonth);
percentageChange = (delta * Constants.BP_INT) / int128(previousMonth);
}
| 12,837 |
109 | // Check Token Total Supply | require(token.totalSupply() == TOTAL_SUPPLY, "Total supply check error.");
| require(token.totalSupply() == TOTAL_SUPPLY, "Total supply check error.");
| 36,436 |
10 | // index of decimal place (0 if no decimal) | uint8 decimalIndex;
| uint8 decimalIndex;
| 7,611 |
11 | // Modifier that requires the voter to be an active airline / | modifier requireVoterToBeActive(address airline) {
require(this.isActiveAndFunded(airline), "Airline cannot vote");
_;
}
| modifier requireVoterToBeActive(address airline) {
require(this.isActiveAndFunded(airline), "Airline cannot vote");
_;
}
| 28,632 |
111 | // Repays protocol fee | if (_reserve == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
protocolFeePayoutAddress1.call.value(protocolFee.div(2))("");
protocolFeePayoutAddress2.call.value(protocolFee.div(2))("");
} else {
| if (_reserve == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
protocolFeePayoutAddress1.call.value(protocolFee.div(2))("");
protocolFeePayoutAddress2.call.value(protocolFee.div(2))("");
} else {
| 49,708 |
0 | // Migration contract address | AssetContractShared public migrationTarget;
mapping(address => bool) public sharedProxyAddresses;
| AssetContractShared public migrationTarget;
mapping(address => bool) public sharedProxyAddresses;
| 16,171 |
254 | // check if there is any CRV we need to earmark | uint256 crvExpiry = rewardsContract.periodFinish();
if (crvExpiry < block.timestamp) {
return true;
}
| uint256 crvExpiry = rewardsContract.periodFinish();
if (crvExpiry < block.timestamp) {
return true;
}
| 43,579 |
9 | // ============ Constructor ============ / | {
require(
_operatorFeeSplit <= PreciseUnitMath.preciseUnit(),
"Operator Fee Split must be less than 1e18"
);
setToken = _setToken;
indexModule = _indexModule;
feeModule = _feeModule;
operator = _operator;
methodologist = _methodologist;
operatorFeeSplit = _operatorFeeSplit;
}
| {
require(
_operatorFeeSplit <= PreciseUnitMath.preciseUnit(),
"Operator Fee Split must be less than 1e18"
);
setToken = _setToken;
indexModule = _indexModule;
feeModule = _feeModule;
operator = _operator;
methodologist = _methodologist;
operatorFeeSplit = _operatorFeeSplit;
}
| 14,636 |
214 | // ERC721 Non-Fungible Token Standard basic implementationModified to remove the mint function and to replace itwith the _addTokenTo function.This function is very similar to the _mint function, but itdoes not emit a Transfer event / | contract NoMintERC721 is Context, ERC165, IERC721 {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
// which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
// Mapping from token ID to owner
mapping (uint256 => address) private _tokenOwner;
// Mapping from token ID to approved address
mapping (uint256 => address) private _tokenApprovals;
// Mapping from owner to number of owned token
mapping (address => Counters.Counter) private _ownedTokensCount;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) private _operatorApprovals;
/*
* bytes4(keccak256('balanceOf(address)')) == 0x70a08231
* bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
* bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
* bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
* bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
* bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
* bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
*
* => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
* 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
*/
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
constructor () public {
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721);
}
/**
* @dev Gets the balance of the specified address.
* @param owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _ownedTokensCount[owner].current();
}
/**
* @dev Gets the owner of the specified token ID.
* @param tokenId uint256 ID of the token to query the owner of
* @return address currently marked as the owner of the given token ID
*/
function ownerOf(uint256 tokenId) public view returns (address) {
address owner = _tokenOwner[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev Approves another address to transfer the given token ID
* The zero address indicates there is no approved address.
* There can only be one approved address per token at a given time.
* Can only be called by the token owner or an approved operator.
* @param to address to be approved for the given token ID
* @param tokenId uint256 ID of the token to be approved
*/
function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Gets the approved address for a token ID, or zero if no address set
* Reverts if the token ID does not exist.
* @param tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 tokenId) public view returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev Sets or unsets the approval of a given operator
* An operator is allowed to transfer all tokens of the sender on their behalf.
* @param to operator address to set the approval
* @param approved representing the status of the approval to be set
*/
function setApprovalForAll(address to, bool approved) public {
require(to != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][to] = approved;
emit ApprovalForAll(_msgSender(), to, approved);
}
/**
* @dev Tells whether an operator is approved by a given owner.
* @param owner owner address which you want to query the approval of
* @param operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner
*/
function isApprovedForAll(address owner, address operator) public view returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Transfers the ownership of a given token ID to another address.
* Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
* Requires the msg.sender to be the owner, approved, or operator.
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function transferFrom(address from, address to, uint256 tokenId) public {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transferFrom(from, to, tokenId);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the _msgSender() to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransferFrom(from, to, tokenId, _data);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function _safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) internal {
_transferFrom(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether the specified token exists.
* @param tokenId uint256 ID of the token to query the existence of
* @return bool whether the token exists
*/
function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
/**
* @dev Returns whether the given spender can transfer a given token ID.
* @param spender address of the spender to query
* @param tokenId uint256 ID of the token to be transferred
* @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Internal function to mint a new token.
* Reverts if the given token ID already exists.
* @param to The address that will own the minted token
* @param tokenId uint256 ID of the token to be minted
*/
function _addTokenTo(address to, uint256 tokenId) internal {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_tokenOwner[tokenId] = to;
_ownedTokensCount[to].increment();
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* Deprecated, use {_burn} instead.
* @param owner owner of the token to burn
* @param tokenId uint256 ID of the token being burned
*/
function _burn(address owner, uint256 tokenId) internal {
require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own");
_clearApproval(tokenId);
_ownedTokensCount[owner].decrement();
_tokenOwner[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* @param tokenId uint256 ID of the token being burned
*/
function _burn(uint256 tokenId) internal {
_burn(ownerOf(tokenId), tokenId);
}
/**
* @dev Internal function to transfer ownership of a given token ID to another address.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function _transferFrom(address from, address to, uint256 tokenId) internal {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_clearApproval(tokenId);
_ownedTokensCount[from].decrement();
_ownedTokensCount[to].increment();
_tokenOwner[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* This function is deprecated.
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool)
{
if (!to.isContract()) {
return true;
}
bytes4 retval = IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data);
return (retval == _ERC721_RECEIVED);
}
/**
* @dev Private function to clear current approval of a given token ID.
* @param tokenId uint256 ID of the token to be transferred
*/
function _clearApproval(uint256 tokenId) private {
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
}
}
| contract NoMintERC721 is Context, ERC165, IERC721 {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
// which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
// Mapping from token ID to owner
mapping (uint256 => address) private _tokenOwner;
// Mapping from token ID to approved address
mapping (uint256 => address) private _tokenApprovals;
// Mapping from owner to number of owned token
mapping (address => Counters.Counter) private _ownedTokensCount;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) private _operatorApprovals;
/*
* bytes4(keccak256('balanceOf(address)')) == 0x70a08231
* bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
* bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
* bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
* bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
* bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
* bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
*
* => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
* 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
*/
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
constructor () public {
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721);
}
/**
* @dev Gets the balance of the specified address.
* @param owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _ownedTokensCount[owner].current();
}
/**
* @dev Gets the owner of the specified token ID.
* @param tokenId uint256 ID of the token to query the owner of
* @return address currently marked as the owner of the given token ID
*/
function ownerOf(uint256 tokenId) public view returns (address) {
address owner = _tokenOwner[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev Approves another address to transfer the given token ID
* The zero address indicates there is no approved address.
* There can only be one approved address per token at a given time.
* Can only be called by the token owner or an approved operator.
* @param to address to be approved for the given token ID
* @param tokenId uint256 ID of the token to be approved
*/
function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Gets the approved address for a token ID, or zero if no address set
* Reverts if the token ID does not exist.
* @param tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 tokenId) public view returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev Sets or unsets the approval of a given operator
* An operator is allowed to transfer all tokens of the sender on their behalf.
* @param to operator address to set the approval
* @param approved representing the status of the approval to be set
*/
function setApprovalForAll(address to, bool approved) public {
require(to != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][to] = approved;
emit ApprovalForAll(_msgSender(), to, approved);
}
/**
* @dev Tells whether an operator is approved by a given owner.
* @param owner owner address which you want to query the approval of
* @param operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner
*/
function isApprovedForAll(address owner, address operator) public view returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Transfers the ownership of a given token ID to another address.
* Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
* Requires the msg.sender to be the owner, approved, or operator.
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function transferFrom(address from, address to, uint256 tokenId) public {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transferFrom(from, to, tokenId);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the _msgSender() to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransferFrom(from, to, tokenId, _data);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function _safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) internal {
_transferFrom(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether the specified token exists.
* @param tokenId uint256 ID of the token to query the existence of
* @return bool whether the token exists
*/
function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
/**
* @dev Returns whether the given spender can transfer a given token ID.
* @param spender address of the spender to query
* @param tokenId uint256 ID of the token to be transferred
* @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Internal function to mint a new token.
* Reverts if the given token ID already exists.
* @param to The address that will own the minted token
* @param tokenId uint256 ID of the token to be minted
*/
function _addTokenTo(address to, uint256 tokenId) internal {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_tokenOwner[tokenId] = to;
_ownedTokensCount[to].increment();
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* Deprecated, use {_burn} instead.
* @param owner owner of the token to burn
* @param tokenId uint256 ID of the token being burned
*/
function _burn(address owner, uint256 tokenId) internal {
require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own");
_clearApproval(tokenId);
_ownedTokensCount[owner].decrement();
_tokenOwner[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* @param tokenId uint256 ID of the token being burned
*/
function _burn(uint256 tokenId) internal {
_burn(ownerOf(tokenId), tokenId);
}
/**
* @dev Internal function to transfer ownership of a given token ID to another address.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function _transferFrom(address from, address to, uint256 tokenId) internal {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_clearApproval(tokenId);
_ownedTokensCount[from].decrement();
_ownedTokensCount[to].increment();
_tokenOwner[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* This function is deprecated.
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool)
{
if (!to.isContract()) {
return true;
}
bytes4 retval = IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data);
return (retval == _ERC721_RECEIVED);
}
/**
* @dev Private function to clear current approval of a given token ID.
* @param tokenId uint256 ID of the token to be transferred
*/
function _clearApproval(uint256 tokenId) private {
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
}
}
| 35,165 |
44 | // Check if address is a valid destination to transfer tokens to- must not be zero address- must not be the token address- must not be the owner&39;s address- must not be the admin&39;s address- must not be the token offering contract address / | modifier validDestination(address to) {
require(to != address(0x0));
require(to != address(this));
require(to != owner);
require(to != address(adminAddr));
require(to != address(tokenOfferingAddr));
_;
}
| modifier validDestination(address to) {
require(to != address(0x0));
require(to != address(this));
require(to != owner);
require(to != address(adminAddr));
require(to != address(tokenOfferingAddr));
_;
}
| 40,144 |
61 | // Events to allow tracking add/remove. | event AddressAddedToWhitelist(address indexed addedAddress, uint8 indexed whitelist, address indexed addedBy);
event AddressRemovedFromWhitelist(address indexed removedAddress, uint8 indexed whitelist, address indexed removedBy);
event OutboundWhitelistUpdated(
address indexed updatedBy, uint8 indexed sourceWhitelist, uint8 indexed destinationWhitelist, bool from, bool to);
event WhitelistEnabledUpdated(address indexed updatedBy, bool indexed enabled);
| event AddressAddedToWhitelist(address indexed addedAddress, uint8 indexed whitelist, address indexed addedBy);
event AddressRemovedFromWhitelist(address indexed removedAddress, uint8 indexed whitelist, address indexed removedBy);
event OutboundWhitelistUpdated(
address indexed updatedBy, uint8 indexed sourceWhitelist, uint8 indexed destinationWhitelist, bool from, bool to);
event WhitelistEnabledUpdated(address indexed updatedBy, bool indexed enabled);
| 33,098 |
2 | // Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens. IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will bestuck._Available since v3.1._ / | contract ERC1155Holder is ERC1155Receiver {
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}
| contract ERC1155Holder is ERC1155Receiver {
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}
| 4,965 |
10 | // Internal Functions // / | function _areAddressesEqual(address leftAddress, address rightAddress)
internal
view
returns (bool)
| function _areAddressesEqual(address leftAddress, address rightAddress)
internal
view
returns (bool)
| 8,183 |
24 | // Event emitted when the funds recipient is changed/newAddress new address for the funds recipient/changedBy address that the recipient is changed by | event FundsRecipientChanged(
address indexed newAddress,
address indexed changedBy
);
| event FundsRecipientChanged(
address indexed newAddress,
address indexed changedBy
);
| 10,251 |
81 | // uint issuedTokenSupply = token.totalSupply();uint restrictedTokens = issuedTokenSupply.mul(49).div(51);token.mint(multisigVault, restrictedTokens); | token.finishMinting();
token.transferOwnership(owner);
| token.finishMinting();
token.transferOwnership(owner);
| 30,277 |
32 | // copy last item in list to location of item to be removed, reduce length by 1 | CToken[] storage storedList = accountAssets[msg.sender];
storedList[assetIndex] = storedList[storedList.length - 1];
storedList.pop();
emit MarketExited(cToken, msg.sender);
return uint(Error.NO_ERROR);
| CToken[] storage storedList = accountAssets[msg.sender];
storedList[assetIndex] = storedList[storedList.length - 1];
storedList.pop();
emit MarketExited(cToken, msg.sender);
return uint(Error.NO_ERROR);
| 11,852 |
2 | // A call has failed. returnData Data returned from the call. / | event CallFailed(bytes returnData);
| event CallFailed(bytes returnData);
| 17,693 |
88 | // Emitted when schain type added. / | event SchainTypeAdded(uint indexed schainType, uint partOfNode, uint numberOfNodes);
| event SchainTypeAdded(uint indexed schainType, uint partOfNode, uint numberOfNodes);
| 41,387 |
24 | // Sets the values for {token}, {trustedAccountAddress} and{walletAddress}. All three of these values are immutable: they can only be set once duringconstruction. / | constructor(
address _tokenAddress,
address _trustedAccountAddress,
address _walletAddress
) {
token = IERC20(_tokenAddress);
trustedAccountAddress = _trustedAccountAddress;
walletAddress = _walletAddress;
}
| constructor(
address _tokenAddress,
address _trustedAccountAddress,
address _walletAddress
) {
token = IERC20(_tokenAddress);
trustedAccountAddress = _trustedAccountAddress;
walletAddress = _walletAddress;
}
| 18,687 |
5 | // Computes a unique key for the particular salt and msg.sender/salt A salt used to generate the nonce key/ return A unique nonce key derived from the salt and msg.sender | function computeKey(bytes32 salt)
view
internal
returns (bytes32)
| function computeKey(bytes32 salt)
view
internal
returns (bytes32)
| 27,334 |
80 | // Update the lockToBlock | function lockToUpdate(uint256 _newLockTo) public onlyAuthorized {
lockToBlock = _newLockTo;
}
| function lockToUpdate(uint256 _newLockTo) public onlyAuthorized {
lockToBlock = _newLockTo;
}
| 34,794 |
50 | // Withdraw all Ether (fee) from auction contract to token contract. Only auction contract owner. / | function withdrawBalance() external {
address tokenAddress = address(tokenContract);
// Check sender as owner or token contract
require(msg.sender == owner || msg.sender == tokenAddress);
// Send Ether on this contract to token contract
// Boolean method make sure that even if one fails it will still work
bool res = tokenAddress.send(address(this).balance);
}
| function withdrawBalance() external {
address tokenAddress = address(tokenContract);
// Check sender as owner or token contract
require(msg.sender == owner || msg.sender == tokenAddress);
// Send Ether on this contract to token contract
// Boolean method make sure that even if one fails it will still work
bool res = tokenAddress.send(address(this).balance);
}
| 32,734 |
70 | // / | function _addToWhitelist(address addressToAdd, uint8 whitelist) internal {
// Verify a valid address was passed in
require(addressToAdd != address(0), "Cannot add address 0x0 to a whitelist.");
// Verify the whitelist is valid
require(whitelist != NO_WHITELIST, "Invalid whitelist ID supplied");
// Save off the previous white list
uint8 previousWhitelist = addressWhitelists[addressToAdd];
// Set the address's white list ID
addressWhitelists[addressToAdd] = whitelist;
// If the previous whitelist existed then we want to indicate it has been removed
if(previousWhitelist != NO_WHITELIST) {
// Emit the event for tracking
emit AddressRemovedFromWhitelist(addressToAdd, previousWhitelist, msg.sender);
}
// Emit the event for new whitelist
emit AddressAddedToWhitelist(addressToAdd, whitelist, msg.sender);
}
| function _addToWhitelist(address addressToAdd, uint8 whitelist) internal {
// Verify a valid address was passed in
require(addressToAdd != address(0), "Cannot add address 0x0 to a whitelist.");
// Verify the whitelist is valid
require(whitelist != NO_WHITELIST, "Invalid whitelist ID supplied");
// Save off the previous white list
uint8 previousWhitelist = addressWhitelists[addressToAdd];
// Set the address's white list ID
addressWhitelists[addressToAdd] = whitelist;
// If the previous whitelist existed then we want to indicate it has been removed
if(previousWhitelist != NO_WHITELIST) {
// Emit the event for tracking
emit AddressRemovedFromWhitelist(addressToAdd, previousWhitelist, msg.sender);
}
// Emit the event for new whitelist
emit AddressAddedToWhitelist(addressToAdd, whitelist, msg.sender);
}
| 1,436 |
0 | // ERC20 interface that includes the decimals read only method. / | interface IERC20Standard is IERC20 {
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05`
* (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value
* {ERC20} uses, unless {_setupDecimals} is called.
*
* NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic
* of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() external view returns (uint8);
}
| interface IERC20Standard is IERC20 {
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05`
* (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value
* {ERC20} uses, unless {_setupDecimals} is called.
*
* NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic
* of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() external view returns (uint8);
}
| 33,453 |
23 | // Check that the account wasn't already set as an admin for this epoch. | if (_isAdmin(adminEpoch, account)) revert DuplicateAdmin(account);
if (account == address(0)) revert InvalidAdmins();
| if (_isAdmin(adminEpoch, account)) revert DuplicateAdmin(account);
if (account == address(0)) revert InvalidAdmins();
| 9,906 |
210 | // Minting | function mint(uint256 _mintAmount) public payable {
// Checks
require(!paused, "DanaNFT: minting has not started yet");
require(_mintAmount > 0, "DanaNFT: you have to mint at least one");
require(_mintAmount <= maxMintAmount, "DanaNFT: you can only mint 10 at a time");
require(lastSupply >= _mintAmount, "DanaNFT: the collection is sold out");
if (msg.sender != owner()) {
require(msg.value >= cost * _mintAmount, "DanaNFT: total cost isn't match");
}
// Minting
for (uint256 i = 1; i <= _mintAmount; i++) {
// Mint for caller
_randomMint(msg.sender);
// Split cost
handleMintReward(msg.value/_mintAmount);
}
}
| function mint(uint256 _mintAmount) public payable {
// Checks
require(!paused, "DanaNFT: minting has not started yet");
require(_mintAmount > 0, "DanaNFT: you have to mint at least one");
require(_mintAmount <= maxMintAmount, "DanaNFT: you can only mint 10 at a time");
require(lastSupply >= _mintAmount, "DanaNFT: the collection is sold out");
if (msg.sender != owner()) {
require(msg.value >= cost * _mintAmount, "DanaNFT: total cost isn't match");
}
// Minting
for (uint256 i = 1; i <= _mintAmount; i++) {
// Mint for caller
_randomMint(msg.sender);
// Split cost
handleMintReward(msg.value/_mintAmount);
}
}
| 20,522 |
15 | // 1. deploy sushi LP | DAO storage fork = _dao[id];
address lp =
IUniswapV2Factory(_commons.pool2Factory).getPair(
fork.vision,
_commons.weth
);
if (lp == address(0)) {
IUniswapV2Factory(_commons.pool2Factory).createPair(
fork.vision,
_commons.weth
| DAO storage fork = _dao[id];
address lp =
IUniswapV2Factory(_commons.pool2Factory).getPair(
fork.vision,
_commons.weth
);
if (lp == address(0)) {
IUniswapV2Factory(_commons.pool2Factory).createPair(
fork.vision,
_commons.weth
| 42,890 |
3 | // extcodesize checks the size of the code stored in an address, and address returns the current address. Since the code is still not deployed when running a constructor, any checks on its code size will yield zero, making it an effective way to detect if a contract is under construction or not. | address self = address(this);
uint256 cs;
| address self = address(this);
uint256 cs;
| 1,082 |
22 | // Ballot receipt record for a voter | struct Receipt {
// Whether or not a vote has been cast
bool hasVoted;
bool support;
uint96 votes;
}
| struct Receipt {
// Whether or not a vote has been cast
bool hasVoted;
bool support;
uint96 votes;
}
| 24,453 |
95 | // See {IERC721-transferFrom}. / | function transferFrom(address from, address to, uint256 tokenId) public virtual override {
| function transferFrom(address from, address to, uint256 tokenId) public virtual override {
| 429 |
84 | // Accepts buy offer for the canvas. Caller has to be the owner of the canvas. You can specify minimal price, which is the protection against accidental calls./ | function acceptBuyOffer(uint32 _canvasId, uint _minPrice) external stateOwned(_canvasId) forceOwned(_canvasId) {
Canvas storage canvas = _getCanvas(_canvasId);
require(canvas.owner == msg.sender);
BuyOffer memory offer = buyOffers[_canvasId];
require(offer.hasOffer);
require(offer.amount > 0);
require(offer.buyer != 0x0);
require(offer.amount >= _minPrice);
uint fee = _calculateCommission(offer.amount);
uint toTransfer = offer.amount - fee;
addressToCount[canvas.owner]--;
addressToCount[offer.buyer]++;
canvas.owner = offer.buyer;
addPendingWithdrawal(msg.sender, toTransfer);
addPendingWithdrawal(owner, fee);
buyOffers[_canvasId] = BuyOffer(false, 0x0, 0);
canvasForSale[_canvasId] = SellOffer(false, 0x0, 0, 0x0);
emit CanvasSold(_canvasId, offer.amount, msg.sender, offer.buyer);
emit CommissionAddedToWithdrawals(_canvasId, fee, ACTION_BUY_OFFER_ACCEPTED);
}
| function acceptBuyOffer(uint32 _canvasId, uint _minPrice) external stateOwned(_canvasId) forceOwned(_canvasId) {
Canvas storage canvas = _getCanvas(_canvasId);
require(canvas.owner == msg.sender);
BuyOffer memory offer = buyOffers[_canvasId];
require(offer.hasOffer);
require(offer.amount > 0);
require(offer.buyer != 0x0);
require(offer.amount >= _minPrice);
uint fee = _calculateCommission(offer.amount);
uint toTransfer = offer.amount - fee;
addressToCount[canvas.owner]--;
addressToCount[offer.buyer]++;
canvas.owner = offer.buyer;
addPendingWithdrawal(msg.sender, toTransfer);
addPendingWithdrawal(owner, fee);
buyOffers[_canvasId] = BuyOffer(false, 0x0, 0);
canvasForSale[_canvasId] = SellOffer(false, 0x0, 0, 0x0);
emit CanvasSold(_canvasId, offer.amount, msg.sender, offer.buyer);
emit CommissionAddedToWithdrawals(_canvasId, fee, ACTION_BUY_OFFER_ACCEPTED);
}
| 40,755 |
59 | // Emits {Approval} event to reflect reduced allowance `value` for this contract to spend from receiver account (`receiver`),/ unless allowance is set to `type(uint256).max`/ Emits two {Transfer} events for minting and burning of the flash-minted amount./ Returns boolean value indicating whether operation succeeded./ Requirements:/ - `value` must be less or equal to type(uint112).max./ - The total of all flash loans in a tx must be less or equal to type(uint112).max. | function flashLoan(
IERC3156FlashBorrower receiver,
address token,
uint256 value,
bytes calldata data
) external override returns (bool) {
require(token == address(this), "WETH: flash mint only WETH10");
require(value <= type(uint112).max, "WETH: individual loan limit exceeded");
flashMinted = flashMinted + value;
require(flashMinted <= type(uint112).max, "WETH: total loan limit exceeded");
| function flashLoan(
IERC3156FlashBorrower receiver,
address token,
uint256 value,
bytes calldata data
) external override returns (bool) {
require(token == address(this), "WETH: flash mint only WETH10");
require(value <= type(uint112).max, "WETH: individual loan limit exceeded");
flashMinted = flashMinted + value;
require(flashMinted <= type(uint112).max, "WETH: total loan limit exceeded");
| 50,342 |
47 | // This functions returns a delimited list of founder wallets that have voted in the last 24 hours./A majority vote will allow a wallet to be removed and not receive their founder tokens./ return list of delimited wallet address who HAVE voted for a bad actor. | function getListOfWalletsWhoVotedInLast24Hrs() external view returns (string memory){
string memory walletsRecentlyVoted;
//Make sure the wallet that is trying to see voting information is in the walletAddresses list (ie, they are one of the founder wallets).
//Note: if a founder wallet gets voted out, they will no longer be in this list and won't be able to see voting information as soon as they are voted out.
bool ownerOrFounderWalletFound = false;
if(msg.sender == owner)
{
//caller is the contract owner
ownerOrFounderWalletFound = true;
}
else
{
for (uint256 i = 0; i < numTotalWallets; i++) {
address wallet = walletAddresses[i];
if(wallet == msg.sender)
{
//success in finding the caller in the list of founder wallets
ownerOrFounderWalletFound = true;
break;
}
}
}
//Validation to prevent any wallet on the internet from voting
require(ownerOrFounderWalletFound, "Must be contract owner or Founder.");
//loop through each valid founder wallet (that has not be voted out), and see if they have voted in last 24 hours. if so, add them to the comma delimited string
//to be returned.
for (uint256 i = 0; i < numTotalWallets; i++) {
//get this founder wallet
address oneFounderWallet = walletAddresses[i];
//make sure this is a valid wallet address (don't interrogate any invalid or 0x0000000... addresses for wallets that may have been voted out).
if(isValidWalletAddress(oneFounderWallet))
{
//Validate that the wallet casting a vote has not already voted within the last 24 hours.
uint256 lastVotedTime = walletLastVotedTimestamp[oneFounderWallet];
//see if this wallet has voted in last 24 hours
bool walletVotedRecently = isWithin24Hours(lastVotedTime);
string memory myDelimiter = "~";
//add them to the list of strings to be returned if they've voted in last 24 hours.
if(walletVotedRecently)
{
//add delimiter on the end as long as we're not on the last address.
walletsRecentlyVoted = string.concat(walletsRecentlyVoted, myDelimiter);
//convert the wallet to a string
string memory oneFounderWalletString = Strings.toHexString(uint256(uint160(oneFounderWallet)), 20);
walletsRecentlyVoted = string.concat(walletsRecentlyVoted, oneFounderWalletString); //walletsRecentlyVoted + ", " + string(abi.encodePacked(walletVotedRecently));
}
}
}
return walletsRecentlyVoted;
}
| function getListOfWalletsWhoVotedInLast24Hrs() external view returns (string memory){
string memory walletsRecentlyVoted;
//Make sure the wallet that is trying to see voting information is in the walletAddresses list (ie, they are one of the founder wallets).
//Note: if a founder wallet gets voted out, they will no longer be in this list and won't be able to see voting information as soon as they are voted out.
bool ownerOrFounderWalletFound = false;
if(msg.sender == owner)
{
//caller is the contract owner
ownerOrFounderWalletFound = true;
}
else
{
for (uint256 i = 0; i < numTotalWallets; i++) {
address wallet = walletAddresses[i];
if(wallet == msg.sender)
{
//success in finding the caller in the list of founder wallets
ownerOrFounderWalletFound = true;
break;
}
}
}
//Validation to prevent any wallet on the internet from voting
require(ownerOrFounderWalletFound, "Must be contract owner or Founder.");
//loop through each valid founder wallet (that has not be voted out), and see if they have voted in last 24 hours. if so, add them to the comma delimited string
//to be returned.
for (uint256 i = 0; i < numTotalWallets; i++) {
//get this founder wallet
address oneFounderWallet = walletAddresses[i];
//make sure this is a valid wallet address (don't interrogate any invalid or 0x0000000... addresses for wallets that may have been voted out).
if(isValidWalletAddress(oneFounderWallet))
{
//Validate that the wallet casting a vote has not already voted within the last 24 hours.
uint256 lastVotedTime = walletLastVotedTimestamp[oneFounderWallet];
//see if this wallet has voted in last 24 hours
bool walletVotedRecently = isWithin24Hours(lastVotedTime);
string memory myDelimiter = "~";
//add them to the list of strings to be returned if they've voted in last 24 hours.
if(walletVotedRecently)
{
//add delimiter on the end as long as we're not on the last address.
walletsRecentlyVoted = string.concat(walletsRecentlyVoted, myDelimiter);
//convert the wallet to a string
string memory oneFounderWalletString = Strings.toHexString(uint256(uint160(oneFounderWallet)), 20);
walletsRecentlyVoted = string.concat(walletsRecentlyVoted, oneFounderWalletString); //walletsRecentlyVoted + ", " + string(abi.encodePacked(walletVotedRecently));
}
}
}
return walletsRecentlyVoted;
}
| 24,189 |
32 | // Eq. ERC20 -> ERC1155 | _swapERC20EquivalentForNFTViaNft20(
nftToErc20[toNft],
toIds,
toAmounts,
msg.sender
);
| _swapERC20EquivalentForNFTViaNft20(
nftToErc20[toNft],
toIds,
toAmounts,
msg.sender
);
| 32,797 |
7 | // 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, string memory errorMessage) 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-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
| function mul(uint256 a, uint256 b, string memory errorMessage) 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-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
| 13,254 |
246 | // pay 2% out to community rewards | uint256 _com = _eth / 50;
uint256 _p3d;
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
token_community_addr.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
| uint256 _com = _eth / 50;
uint256 _p3d;
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
token_community_addr.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
| 18,686 |
28 | // Index of next genesis branch | uint256 public nextGenesisBranchId = 1;
| uint256 public nextGenesisBranchId = 1;
| 52,489 |
221 | // sum of stages hard caps | if (hardCap_ != totalValue) {
revert ValueMismatch(hardCap_, totalValue);
}
| if (hardCap_ != totalValue) {
revert ValueMismatch(hardCap_, totalValue);
}
| 13,741 |
90 | // Convenience method to compute the code hash of an arbitrary contract | function codeHashOf(address a) external view returns (bytes32) {
return a.codehash;
}
| function codeHashOf(address a) external view returns (bytes32) {
return a.codehash;
}
| 10,242 |
2 | // In the case where tickAfter is initialized, we only want to count it if we are swapping downwards. If the initializable tick after the swap is initialized, our original tickAfter is a multiple of tick spacing, and we are swapping downwards we know that tickAfter is initialized and we shouldn't count it. | tickAfterInitialized =
((self.tickBitmap(wordPosAfter) & (1 << bitPosAfter)) > 0) &&
((tickAfter % self.tickSpacing()) == 0) &&
(tickBefore > tickAfter);
| tickAfterInitialized =
((self.tickBitmap(wordPosAfter) & (1 << bitPosAfter)) > 0) &&
((tickAfter % self.tickSpacing()) == 0) &&
(tickBefore > tickAfter);
| 26,819 |
10 | // check the positive case | function testGreeting() public {
greeter.greet("yo");
require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("yo")), "not equal");
}
| function testGreeting() public {
greeter.greet("yo");
require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("yo")), "not equal");
}
| 16,452 |
5 | // If the function that is called has no delay the function is called immediately, otherwise the function call is stored on-chain and can be executed later using `executeTransaction` when the necessary time has passed. | function transact(
address to,
bytes calldata data
)
external
override
nonReentrant
payable
onlyAuthorized
| function transact(
address to,
bytes calldata data
)
external
override
nonReentrant
payable
onlyAuthorized
| 27,765 |
95 | // exclude from max tx | _isExcludedFromMaxTx[owner()] = true;
_isExcludedFromMaxTx[address(this)] = true;
_isExcludedFromMaxTx[address(0x000000000000000000000000000000000000dEaD)] = true;
_isExcludedFromMaxTx[address(0)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| _isExcludedFromMaxTx[owner()] = true;
_isExcludedFromMaxTx[address(this)] = true;
_isExcludedFromMaxTx[address(0x000000000000000000000000000000000000dEaD)] = true;
_isExcludedFromMaxTx[address(0)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| 11,011 |
8 | // update status to completed (2) | tasks[msg.sender][index].status = 2;
| tasks[msg.sender][index].status = 2;
| 32,062 |
53 | // 🔥🔥🔥 100 billion max supply | uint256 public constant LITSUPPLY = 100_000_000_000 * 10**18;
| uint256 public constant LITSUPPLY = 100_000_000_000 * 10**18;
| 61,379 |
30 | // ============ Internal ============ //Instructs the SetToken to set approvals of the ERC20 token to a spender._setTokenSetToken instance to invoke _token ERC20 token to approve _spender The account allowed to spend the SetToken's balance _quantityThe quantity of allowance to allow / | function invokeApprove(
ISetToken _setToken,
address _token,
address _spender,
uint256 _quantity
)
internal
{
| function invokeApprove(
ISetToken _setToken,
address _token,
address _spender,
uint256 _quantity
)
internal
{
| 19,718 |
237 | // Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. / | function revokeRole(bytes32 role, address account) external;
| function revokeRole(bytes32 role, address account) external;
| 2,364 |
133 | // Deletes price record from index._id The price ID./ | function unregisterRecord(bytes32 _id) internal {
// Since the order of price records is not guaranteed, we can make deletion more efficient
// by replacing record we want to delete with the last record, hence avoid reindex.
// Calculate deletion record ID slot.
bytes32 deletionIndexSlot = keccak256(abi.encodePacked("prices.indices.", _id));
// uint256 deletionIndex = pricesIndices[_id].sub(1);
uint256 deletionIndex = uintStorage[deletionIndexSlot].sub(1);
bytes32 deletionIdSlot = keccak256(abi.encodePacked("prices.ids.", deletionIndex));
// Calculate last record ID slot.
uint256 lastIndex = getCount().sub(1);
bytes32 lastIdSlot = keccak256(abi.encodePacked("prices.ids.", lastIndex));
// Calculate last record index slot.
bytes32 lastIndexSlot = keccak256(abi.encodePacked("prices.indices.", bytes32Storage[lastIdSlot]));
// Copy last record ID into the empty slot.
// pricesIds[deletionIdSlot] = pricesIds[lastIdSlot];
bytes32Storage[deletionIdSlot] = bytes32Storage[lastIdSlot];
// Make moved ID index point to the the correct record.
// pricesIndices[lastIndexSlot] = pricesIndices[deletionIndexSlot];
uintStorage[lastIndexSlot] = uintStorage[deletionIndexSlot];
// Delete last record ID.
// delete pricesIds[lastIndex];
delete bytes32Storage[lastIdSlot];
// Delete reversed index.
// delete pricesIndices[_id];
delete uintStorage[deletionIndexSlot];
decrementCount();
}
| function unregisterRecord(bytes32 _id) internal {
// Since the order of price records is not guaranteed, we can make deletion more efficient
// by replacing record we want to delete with the last record, hence avoid reindex.
// Calculate deletion record ID slot.
bytes32 deletionIndexSlot = keccak256(abi.encodePacked("prices.indices.", _id));
// uint256 deletionIndex = pricesIndices[_id].sub(1);
uint256 deletionIndex = uintStorage[deletionIndexSlot].sub(1);
bytes32 deletionIdSlot = keccak256(abi.encodePacked("prices.ids.", deletionIndex));
// Calculate last record ID slot.
uint256 lastIndex = getCount().sub(1);
bytes32 lastIdSlot = keccak256(abi.encodePacked("prices.ids.", lastIndex));
// Calculate last record index slot.
bytes32 lastIndexSlot = keccak256(abi.encodePacked("prices.indices.", bytes32Storage[lastIdSlot]));
// Copy last record ID into the empty slot.
// pricesIds[deletionIdSlot] = pricesIds[lastIdSlot];
bytes32Storage[deletionIdSlot] = bytes32Storage[lastIdSlot];
// Make moved ID index point to the the correct record.
// pricesIndices[lastIndexSlot] = pricesIndices[deletionIndexSlot];
uintStorage[lastIndexSlot] = uintStorage[deletionIndexSlot];
// Delete last record ID.
// delete pricesIds[lastIndex];
delete bytes32Storage[lastIdSlot];
// Delete reversed index.
// delete pricesIndices[_id];
delete uintStorage[deletionIndexSlot];
decrementCount();
}
| 61,213 |
229 | // Locks a specified amount of tokens against an address,for a specified reason and time_of address whose tokens are to be locked_reason The reason to lock tokens_amount Number of tokens to be locked_time Lock time in seconds/ | function _lock(address _of, bytes32 _reason, uint256 _amount, uint256 _time) internal {
require(_tokensLocked(_of, _reason) == 0);
require(_amount != 0);
if (locked[_of][_reason].amount == 0) {
lockReason[_of].push(_reason);
}
require(token.operatorTransfer(_of, _amount));
uint256 validUntil = now.add(_time); // solhint-disable-line
locked[_of][_reason] = LockToken(_amount, validUntil, false);
emit Locked(_of, _reason, _amount, validUntil);
}
| function _lock(address _of, bytes32 _reason, uint256 _amount, uint256 _time) internal {
require(_tokensLocked(_of, _reason) == 0);
require(_amount != 0);
if (locked[_of][_reason].amount == 0) {
lockReason[_of].push(_reason);
}
require(token.operatorTransfer(_of, _amount));
uint256 validUntil = now.add(_time); // solhint-disable-line
locked[_of][_reason] = LockToken(_amount, validUntil, false);
emit Locked(_of, _reason, _amount, validUntil);
}
| 34,659 |
17 | // To recieve ether in contract | receive() external payable { }
fallback() external payable { }
}
| receive() external payable { }
fallback() external payable { }
}
| 30,020 |
143 | // Internal function to set the token URI for a given token. Reverts if the token ID does not exist. TIP: if all token IDs share a prefix (e.g. if your URIs look like | * `http://api.myproject.com/token/<id>`), use {_setBaseURI} to store
* it and save gas.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| * `http://api.myproject.com/token/<id>`), use {_setBaseURI} to store
* it and save gas.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| 28,998 |
99 | // Sender approves the account to borrow a given market based on given collateral/account Address that is allowed to borrow the given market/market Address of the given market/collateral Address of the given collateral/amount The amount is allowed to withdrawn | function approveBorrow (address account, address market, address collateral, uint256 amount)
external
accountIsValid(account)
marketIsActive(market)
| function approveBorrow (address account, address market, address collateral, uint256 amount)
external
accountIsValid(account)
marketIsActive(market)
| 27,838 |
93 | // Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp/To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing/ the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,/ you must call it with secondsAgos = [3600, 0]./The time weighted average tick represents the geometric time weighted average price of the pool, in/ log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a | function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
| function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
| 10,273 |
7 | // membershipId -> communityId. | mapping(string => string) public _memberOf;
| mapping(string => string) public _memberOf;
| 13,535 |
51 | // Mapping(Account => Stake) | mapping(address => uint) public accountStaked;
| mapping(address => uint) public accountStaked;
| 1,681 |
61 | // Integer division of two unsigned integers truncating the quotient, reverts on division by zero. / | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath#div: DIVISION_BY_ZERO");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath#div: DIVISION_BY_ZERO");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 8,256 |
16 | // Contract functions //Deposits reward. Returns success. | function depositReward()
public
payable
returns (bool)
| function depositReward()
public
payable
returns (bool)
| 48,831 |
90 | // Allows the current owner to change administrator account of the contract to a newAdmin. newAdmin The address to transfer ownership to. / | function changeAdmin(address newAdmin) public onlyOwner {
require(newAdmin != address(0));
emit AdminChanged(admin, newAdmin);
admin = newAdmin;
}
| function changeAdmin(address newAdmin) public onlyOwner {
require(newAdmin != address(0));
emit AdminChanged(admin, newAdmin);
admin = newAdmin;
}
| 32,579 |
33 | // called by the owner to unpause, returns to normal state / | function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
| function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
| 17,030 |
59 | // (current price – base target price in usd)total supply / (base target price in usdlag factor) | int256 goldPrice = curGoldPrice.toInt256Safe();
int256 marketPrice = marketPrice.toInt256Safe();
int256 delta = marketPrice.sub(goldPrice);
int256 lagSpawn = goldPrice.mul(rebaseLag.toInt256Safe());
return tt.totalSupply().toInt256Safe()
.mul(delta).div(lagSpawn);
| int256 goldPrice = curGoldPrice.toInt256Safe();
int256 marketPrice = marketPrice.toInt256Safe();
int256 delta = marketPrice.sub(goldPrice);
int256 lagSpawn = goldPrice.mul(rebaseLag.toInt256Safe());
return tt.totalSupply().toInt256Safe()
.mul(delta).div(lagSpawn);
| 36,830 |
33 | // check if free mints available | if(AddressToFreebiesMap[msg.sender] == 0) revert NoFreeMintsHomie();
| if(AddressToFreebiesMap[msg.sender] == 0) revert NoFreeMintsHomie();
| 2,117 |
20 | // BUYTOKEN tokenomics2.0 buy tax value applied to itself | uint buyTokenA2 = (value * buyTokenInfo.addedToks.tokenA2TaxOnBuy) / 10000;
if (buyTokenA2 > 0) {
(bool success, bytes memory data) = buyToken.call(abi.encodeWithSelector(_TRANSFER, buyTokenInfo.feeReceiver, buyTokenA2));
require(success && (data.length == 0 || abi.decode(data, (bool))), "DarwinSwap: TAX_FAILED_BUY_A2");
}
| uint buyTokenA2 = (value * buyTokenInfo.addedToks.tokenA2TaxOnBuy) / 10000;
if (buyTokenA2 > 0) {
(bool success, bytes memory data) = buyToken.call(abi.encodeWithSelector(_TRANSFER, buyTokenInfo.feeReceiver, buyTokenA2));
require(success && (data.length == 0 || abi.decode(data, (bool))), "DarwinSwap: TAX_FAILED_BUY_A2");
}
| 16,220 |
39 | // TAX SELLERS 20% WHO SELL WITHIN 24 HOURS | if (_buyMap[from] != 0 &&
(_buyMap[from] + (24 hours) >= block.timestamp)) {
_feeAddr1 = 2;
_feeAddr2 = 20;
} else {
| if (_buyMap[from] != 0 &&
(_buyMap[from] + (24 hours) >= block.timestamp)) {
_feeAddr1 = 2;
_feeAddr2 = 20;
} else {
| 46,785 |
166 | // FRAX portion is FraxCR | uint256 frax_portion_with_cr = (allocations[2] * FRAX.global_collateral_ratio()) / PRICE_PRECISION;
| uint256 frax_portion_with_cr = (allocations[2] * FRAX.global_collateral_ratio()) / PRICE_PRECISION;
| 34,925 |
23 | // Used in place of the constructor to allow the contract to be upgradable via proxy. registryAddress The address of the registry core smart contract. minElectableValidators The minimum number of validators that can be elected. _maxNumGroupsVotedFor The maximum number of groups that an account can vote for at once. _electabilityThreshold The minimum ratio of votes a group needs before its members canbe elected. Should be called only once. / | function initialize(
address registryAddress,
uint256 minElectableValidators,
uint256 maxElectableValidators,
uint256 _maxNumGroupsVotedFor,
uint256 _electabilityThreshold
| function initialize(
address registryAddress,
uint256 minElectableValidators,
uint256 maxElectableValidators,
uint256 _maxNumGroupsVotedFor,
uint256 _electabilityThreshold
| 36,793 |
230 | // withdraw reward too | require(
rewardToken.transfer(msg.sender, balances[msg.sender]),
"claim: transfer failed"
);
tokenReceived[msg.sender] = tokenReceived[msg.sender].add(balances[msg.sender]);
| require(
rewardToken.transfer(msg.sender, balances[msg.sender]),
"claim: transfer failed"
);
tokenReceived[msg.sender] = tokenReceived[msg.sender].add(balances[msg.sender]);
| 72,544 |
184 | // Get a reference to the amount still tappable in the current funding cycle. | uint256 _limit = _currentFundingCycle.target -
_currentFundingCycle.tapped;
| uint256 _limit = _currentFundingCycle.target -
_currentFundingCycle.tapped;
| 28,596 |
50 | // Indicates that the contract is in the process of being initialized. / | bool private initializing;
| bool private initializing;
| 1,011 |
32 | // Shared Manifold extension which supports letting users add arbitrary minting permissionsand per token royalties set at the time of minting. Version: 1.2 / | contract GlobalVerisartManifoldExtension is ICreatorExtensionRoyalties {
bytes32 private constant _DOMAIN_TYPEHASH =
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)"
);
bytes32 private _eip712DomainSeparator =
keccak256(
abi.encode(
_DOMAIN_TYPEHASH,
keccak256("Verisart"),
keccak256("1"),
block.chainid,
address(this),
0xf1ca08ca57710ea92070eeb3815fb1f0511ccba827234f5f42e2908ebedebc03 // Verisart's EIP712 salt
)
);
bytes32 private constant _MINT_SIGNED_TYPEHASH =
keccak256(
"MintNFT(address sender,address to,address creatorContract,string uri,"
"bytes32 tokenNonce,address[] royaltyReceivers,uint256[] royaltyBasisPoints)"
);
bytes32 private constant _MINT_EDITIONS_SIGNED_TYPEHASH =
keccak256(
"MintNFTEditions(address sender,address to,address creatorContract,string[] uris,"
"bytes32 tokenNonce,address[][] royaltyReceivers,uint256[][] royaltyBasisPoints)"
);
mapping(address => bool) private _disableSignedMinting;
struct RoyaltyConfig {
address payable receiver;
uint16 bps;
}
event Granted(address indexed creatorContract, address indexed account);
event Revoked(address indexed creatorContract, address indexed account);
event RoyaltiesUpdated(
address indexed creatorContract,
uint256 indexed tokenId,
address payable[] receivers,
uint256[] basisPoints
);
event DefaultRoyaltiesUpdated(
address indexed creatorContract,
address payable[] receivers,
uint256[] basisPoints
);
mapping(address => mapping(address => bool)) private _permissions;
mapping(address => mapping(uint256 => RoyaltyConfig[]))
private _tokenRoyalties;
mapping(address => RoyaltyConfig[]) private _defaultRoyalties;
mapping(bytes32 => bool) private _signedMints;
function supportsInterface(
bytes4 interfaceId
) external view virtual override(IERC165) returns (bool) {
return
interfaceId == type(ICreatorExtensionRoyalties).interfaceId ||
interfaceId == type(IERC165).interfaceId;
}
function hasMintingPermission(
address creatorContract,
address creator
) public view returns (bool) {
return _permissions[creatorContract][creator];
}
function grantMinting(address creatorContract, address creator) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_permissions[creatorContract][creator] = true;
emit Granted(creatorContract, creator);
}
function enableSignedMinting(address creatorContract) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_disableSignedMinting[creatorContract] = false;
}
function disableSignedMinting(address creatorContract) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_disableSignedMinting[creatorContract] = true;
}
function revokeMinting(address creatorContract, address creator) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_permissions[creatorContract][creator] = false;
emit Revoked(creatorContract, creator);
}
function _mintNoPermission(
ERC721Creator creatorCon,
address to,
string calldata uri,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) private {
_checkRoyalties(receivers, basisPoints);
uint256 tokenId = creatorCon.mintExtension(to, uri);
_setTokenRoyalties(
address(creatorCon),
tokenId,
receivers,
basisPoints
);
}
function mint(
address creatorContract,
address to,
string calldata uri,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external {
ERC721Creator creatorCon = _checkIsGranted(creatorContract);
_mintNoPermission(creatorCon, to, uri, receivers, basisPoints);
}
function mintSigned(
address to,
address creatorContract,
string calldata uri,
bytes32 tokenNonce,
address payable[] calldata royaltyReceivers,
uint256[] calldata royaltyBasisPoints,
bytes calldata signature
) external {
require(
!_disableSignedMinting[creatorContract],
"Signed minting disabled"
);
bytes memory args = abi.encode(
_MINT_SIGNED_TYPEHASH,
msg.sender,
to,
creatorContract,
keccak256(abi.encodePacked(uri)),
tokenNonce,
keccak256(abi.encodePacked(royaltyReceivers)),
keccak256(abi.encodePacked(royaltyBasisPoints))
);
ERC721Creator creatorCon = _checkSigned(
creatorContract,
args,
tokenNonce,
signature
);
_mintNoPermission(
creatorCon,
to,
uri,
royaltyReceivers,
royaltyBasisPoints
);
}
function _mintBatchNoPermission(
ERC721Creator creatorCon,
address to,
string[] calldata uris,
address payable[][] calldata receiversPerToken,
uint256[][] calldata basisPointsPerToken
) private {
require(
receiversPerToken.length == basisPointsPerToken.length,
"Mismatch in array lengths"
);
require(
receiversPerToken.length == 0 ||
receiversPerToken.length == uris.length,
"Incorrect royalty array length"
);
for (uint256 i = 0; i < receiversPerToken.length; i++) {
_checkRoyalties(receiversPerToken[i], basisPointsPerToken[i]);
}
uint256[] memory tokenIds = creatorCon.mintExtensionBatch(to, uris);
if (receiversPerToken.length != 0) {
for (uint256 i = 0; i < tokenIds.length; i++) {
_setTokenRoyalties(
address(creatorCon),
tokenIds[i],
receiversPerToken[i],
basisPointsPerToken[i]
);
}
}
}
function mintBatch(
address creatorContract,
address to,
string[] calldata uris,
address payable[][] calldata receiversPerToken,
uint256[][] calldata basisPointsPerToken
) external {
ERC721Creator creatorCon = _checkIsGranted(creatorContract);
_mintBatchNoPermission(
creatorCon,
to,
uris,
receiversPerToken,
basisPointsPerToken
);
}
function mintBatchSigned(
address to,
address creatorContract,
string[] calldata uris,
bytes32 tokenNonce,
address payable[][] calldata royaltyReceivers,
uint256[][] calldata royaltyBasisPoints,
bytes calldata signature
) external {
require(
!_disableSignedMinting[creatorContract],
"Signed minting disabled"
);
bytes memory args = abi.encode(
_MINT_EDITIONS_SIGNED_TYPEHASH,
msg.sender,
to,
creatorContract,
keccak256(abi.encodePacked(_hashStringArray(uris))),
tokenNonce,
keccak256(
abi.encodePacked(
_hashTwoDimensionalAddressArray(royaltyReceivers)
)
),
keccak256(
abi.encodePacked(
_hashTwoDimensionalUintArray(royaltyBasisPoints)
)
)
);
ERC721Creator creatorCon = _checkSigned(
creatorContract,
args,
tokenNonce,
signature
);
_mintBatchNoPermission(
creatorCon,
to,
uris,
royaltyReceivers,
royaltyBasisPoints
);
}
function setTokenRoyalties(
address creatorContract,
uint256 tokenId,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external {
_checkIsGranted(creatorContract);
_checkRoyalties(receivers, basisPoints);
_setTokenRoyalties(creatorContract, tokenId, receivers, basisPoints);
emit RoyaltiesUpdated(creatorContract, tokenId, receivers, basisPoints);
}
function setDefaultRoyalties(
address creatorContract,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external {
_checkIsGranted(creatorContract);
_checkRoyalties(receivers, basisPoints);
delete _defaultRoyalties[creatorContract];
_setRoyalties(
receivers,
basisPoints,
_defaultRoyalties[creatorContract]
);
emit DefaultRoyaltiesUpdated(creatorContract, receivers, basisPoints);
}
function getRoyalties(
address creator,
uint256 tokenId
)
external
view
virtual
override
returns (address payable[] memory, uint256[] memory)
{
RoyaltyConfig[] memory royalties = _tokenRoyalties[creator][tokenId];
if (royalties.length == 0) {
royalties = _defaultRoyalties[creator];
}
address payable[] memory receivers = new address payable[](
royalties.length
);
uint256[] memory bps = new uint256[](royalties.length);
for (uint256 i; i < royalties.length; ) {
receivers[i] = royalties[i].receiver;
bps[i] = royalties[i].bps;
unchecked {
++i;
}
}
return (receivers, bps);
}
function _setTokenRoyalties(
address creatorContract,
uint256 tokenId,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) private {
delete _tokenRoyalties[creatorContract][tokenId];
_setRoyalties(
receivers,
basisPoints,
_tokenRoyalties[creatorContract][tokenId]
);
}
function _setRoyalties(
address payable[] calldata receivers,
uint256[] calldata basisPoints,
RoyaltyConfig[] storage royalties
) private {
for (uint256 i; i < basisPoints.length; ) {
royalties.push(
RoyaltyConfig({
receiver: receivers[i],
bps: uint16(basisPoints[i])
})
);
unchecked {
++i;
}
}
}
function _checkIsAddressGranted(
address sender,
address creatorContract
) private view returns (ERC721Creator) {
ERC721Creator creatorCon = ERC721Creator(creatorContract);
require(
hasMintingPermission(creatorContract, sender) ||
creatorCon.isAdmin(sender),
"Permission denied"
);
return creatorCon;
}
function _checkIsGranted(
address creatorContract
) private view returns (ERC721Creator) {
return _checkIsAddressGranted(msg.sender, creatorContract);
}
function _checkRoyalties(
address payable[] calldata receivers,
uint256[] calldata basisPoints
) private pure {
require(
receivers.length == basisPoints.length,
"Mismatch in array lengths"
);
uint256 totalBasisPoints;
for (uint256 i; i < basisPoints.length; ) {
totalBasisPoints += basisPoints[i];
unchecked {
++i;
}
}
require(totalBasisPoints < 10000, "Invalid total royalties");
}
function _checkSigned(
address creatorContract,
bytes memory args,
bytes32 tokenNonce,
bytes calldata signature
) private returns (ERC721Creator) {
// TODO: Should have global flag here too?
// Recover signature
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
_eip712DomainSeparator,
keccak256(args)
)
);
// Recover signer
address authorizer = ECDSA.recover(digest, signature);
// Check signer can mint on this contract
ERC721Creator creatorCon = _checkIsAddressGranted(
authorizer,
creatorContract
);
// Check nonce hasn't been redeemed already
bytes32 tokenNonceHash = keccak256(
abi.encode(creatorContract, tokenNonce)
);
require(
_signedMints[tokenNonceHash] == false,
"Signed mint already redeemed"
);
// Mark the nonce as redeemed
_signedMints[tokenNonceHash] = true;
return creatorCon;
}
// In EIP-712 arrays of dynamically-sized types need each element hashed first
function _hashStringArray(
string[] calldata data
) private pure returns (bytes32[] memory) {
bytes32[] memory keccakData = new bytes32[](data.length);
for (uint256 i = 0; i < data.length; i++) {
keccakData[i] = keccak256(bytes(data[i]));
}
return keccakData;
}
function _hashTwoDimensionalAddressArray(
address payable[][] calldata data
) private pure returns (bytes32[] memory) {
bytes32[] memory keccakData = new bytes32[](data.length);
for (uint256 i = 0; i < data.length; i++) {
keccakData[i] = keccak256(abi.encodePacked(data[i]));
}
return keccakData;
}
function _hashTwoDimensionalUintArray(
uint256[][] calldata data
) private pure returns (bytes32[] memory) {
bytes32[] memory keccakData = new bytes32[](data.length);
for (uint256 i = 0; i < data.length; i++) {
keccakData[i] = keccak256(abi.encodePacked(data[i]));
}
return keccakData;
}
}
| contract GlobalVerisartManifoldExtension is ICreatorExtensionRoyalties {
bytes32 private constant _DOMAIN_TYPEHASH =
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)"
);
bytes32 private _eip712DomainSeparator =
keccak256(
abi.encode(
_DOMAIN_TYPEHASH,
keccak256("Verisart"),
keccak256("1"),
block.chainid,
address(this),
0xf1ca08ca57710ea92070eeb3815fb1f0511ccba827234f5f42e2908ebedebc03 // Verisart's EIP712 salt
)
);
bytes32 private constant _MINT_SIGNED_TYPEHASH =
keccak256(
"MintNFT(address sender,address to,address creatorContract,string uri,"
"bytes32 tokenNonce,address[] royaltyReceivers,uint256[] royaltyBasisPoints)"
);
bytes32 private constant _MINT_EDITIONS_SIGNED_TYPEHASH =
keccak256(
"MintNFTEditions(address sender,address to,address creatorContract,string[] uris,"
"bytes32 tokenNonce,address[][] royaltyReceivers,uint256[][] royaltyBasisPoints)"
);
mapping(address => bool) private _disableSignedMinting;
struct RoyaltyConfig {
address payable receiver;
uint16 bps;
}
event Granted(address indexed creatorContract, address indexed account);
event Revoked(address indexed creatorContract, address indexed account);
event RoyaltiesUpdated(
address indexed creatorContract,
uint256 indexed tokenId,
address payable[] receivers,
uint256[] basisPoints
);
event DefaultRoyaltiesUpdated(
address indexed creatorContract,
address payable[] receivers,
uint256[] basisPoints
);
mapping(address => mapping(address => bool)) private _permissions;
mapping(address => mapping(uint256 => RoyaltyConfig[]))
private _tokenRoyalties;
mapping(address => RoyaltyConfig[]) private _defaultRoyalties;
mapping(bytes32 => bool) private _signedMints;
function supportsInterface(
bytes4 interfaceId
) external view virtual override(IERC165) returns (bool) {
return
interfaceId == type(ICreatorExtensionRoyalties).interfaceId ||
interfaceId == type(IERC165).interfaceId;
}
function hasMintingPermission(
address creatorContract,
address creator
) public view returns (bool) {
return _permissions[creatorContract][creator];
}
function grantMinting(address creatorContract, address creator) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_permissions[creatorContract][creator] = true;
emit Granted(creatorContract, creator);
}
function enableSignedMinting(address creatorContract) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_disableSignedMinting[creatorContract] = false;
}
function disableSignedMinting(address creatorContract) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_disableSignedMinting[creatorContract] = true;
}
function revokeMinting(address creatorContract, address creator) external {
require(
ERC721Creator(creatorContract).isAdmin(msg.sender),
"Must be admin"
);
_permissions[creatorContract][creator] = false;
emit Revoked(creatorContract, creator);
}
function _mintNoPermission(
ERC721Creator creatorCon,
address to,
string calldata uri,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) private {
_checkRoyalties(receivers, basisPoints);
uint256 tokenId = creatorCon.mintExtension(to, uri);
_setTokenRoyalties(
address(creatorCon),
tokenId,
receivers,
basisPoints
);
}
function mint(
address creatorContract,
address to,
string calldata uri,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external {
ERC721Creator creatorCon = _checkIsGranted(creatorContract);
_mintNoPermission(creatorCon, to, uri, receivers, basisPoints);
}
function mintSigned(
address to,
address creatorContract,
string calldata uri,
bytes32 tokenNonce,
address payable[] calldata royaltyReceivers,
uint256[] calldata royaltyBasisPoints,
bytes calldata signature
) external {
require(
!_disableSignedMinting[creatorContract],
"Signed minting disabled"
);
bytes memory args = abi.encode(
_MINT_SIGNED_TYPEHASH,
msg.sender,
to,
creatorContract,
keccak256(abi.encodePacked(uri)),
tokenNonce,
keccak256(abi.encodePacked(royaltyReceivers)),
keccak256(abi.encodePacked(royaltyBasisPoints))
);
ERC721Creator creatorCon = _checkSigned(
creatorContract,
args,
tokenNonce,
signature
);
_mintNoPermission(
creatorCon,
to,
uri,
royaltyReceivers,
royaltyBasisPoints
);
}
function _mintBatchNoPermission(
ERC721Creator creatorCon,
address to,
string[] calldata uris,
address payable[][] calldata receiversPerToken,
uint256[][] calldata basisPointsPerToken
) private {
require(
receiversPerToken.length == basisPointsPerToken.length,
"Mismatch in array lengths"
);
require(
receiversPerToken.length == 0 ||
receiversPerToken.length == uris.length,
"Incorrect royalty array length"
);
for (uint256 i = 0; i < receiversPerToken.length; i++) {
_checkRoyalties(receiversPerToken[i], basisPointsPerToken[i]);
}
uint256[] memory tokenIds = creatorCon.mintExtensionBatch(to, uris);
if (receiversPerToken.length != 0) {
for (uint256 i = 0; i < tokenIds.length; i++) {
_setTokenRoyalties(
address(creatorCon),
tokenIds[i],
receiversPerToken[i],
basisPointsPerToken[i]
);
}
}
}
function mintBatch(
address creatorContract,
address to,
string[] calldata uris,
address payable[][] calldata receiversPerToken,
uint256[][] calldata basisPointsPerToken
) external {
ERC721Creator creatorCon = _checkIsGranted(creatorContract);
_mintBatchNoPermission(
creatorCon,
to,
uris,
receiversPerToken,
basisPointsPerToken
);
}
function mintBatchSigned(
address to,
address creatorContract,
string[] calldata uris,
bytes32 tokenNonce,
address payable[][] calldata royaltyReceivers,
uint256[][] calldata royaltyBasisPoints,
bytes calldata signature
) external {
require(
!_disableSignedMinting[creatorContract],
"Signed minting disabled"
);
bytes memory args = abi.encode(
_MINT_EDITIONS_SIGNED_TYPEHASH,
msg.sender,
to,
creatorContract,
keccak256(abi.encodePacked(_hashStringArray(uris))),
tokenNonce,
keccak256(
abi.encodePacked(
_hashTwoDimensionalAddressArray(royaltyReceivers)
)
),
keccak256(
abi.encodePacked(
_hashTwoDimensionalUintArray(royaltyBasisPoints)
)
)
);
ERC721Creator creatorCon = _checkSigned(
creatorContract,
args,
tokenNonce,
signature
);
_mintBatchNoPermission(
creatorCon,
to,
uris,
royaltyReceivers,
royaltyBasisPoints
);
}
function setTokenRoyalties(
address creatorContract,
uint256 tokenId,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external {
_checkIsGranted(creatorContract);
_checkRoyalties(receivers, basisPoints);
_setTokenRoyalties(creatorContract, tokenId, receivers, basisPoints);
emit RoyaltiesUpdated(creatorContract, tokenId, receivers, basisPoints);
}
function setDefaultRoyalties(
address creatorContract,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external {
_checkIsGranted(creatorContract);
_checkRoyalties(receivers, basisPoints);
delete _defaultRoyalties[creatorContract];
_setRoyalties(
receivers,
basisPoints,
_defaultRoyalties[creatorContract]
);
emit DefaultRoyaltiesUpdated(creatorContract, receivers, basisPoints);
}
function getRoyalties(
address creator,
uint256 tokenId
)
external
view
virtual
override
returns (address payable[] memory, uint256[] memory)
{
RoyaltyConfig[] memory royalties = _tokenRoyalties[creator][tokenId];
if (royalties.length == 0) {
royalties = _defaultRoyalties[creator];
}
address payable[] memory receivers = new address payable[](
royalties.length
);
uint256[] memory bps = new uint256[](royalties.length);
for (uint256 i; i < royalties.length; ) {
receivers[i] = royalties[i].receiver;
bps[i] = royalties[i].bps;
unchecked {
++i;
}
}
return (receivers, bps);
}
function _setTokenRoyalties(
address creatorContract,
uint256 tokenId,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) private {
delete _tokenRoyalties[creatorContract][tokenId];
_setRoyalties(
receivers,
basisPoints,
_tokenRoyalties[creatorContract][tokenId]
);
}
function _setRoyalties(
address payable[] calldata receivers,
uint256[] calldata basisPoints,
RoyaltyConfig[] storage royalties
) private {
for (uint256 i; i < basisPoints.length; ) {
royalties.push(
RoyaltyConfig({
receiver: receivers[i],
bps: uint16(basisPoints[i])
})
);
unchecked {
++i;
}
}
}
function _checkIsAddressGranted(
address sender,
address creatorContract
) private view returns (ERC721Creator) {
ERC721Creator creatorCon = ERC721Creator(creatorContract);
require(
hasMintingPermission(creatorContract, sender) ||
creatorCon.isAdmin(sender),
"Permission denied"
);
return creatorCon;
}
function _checkIsGranted(
address creatorContract
) private view returns (ERC721Creator) {
return _checkIsAddressGranted(msg.sender, creatorContract);
}
function _checkRoyalties(
address payable[] calldata receivers,
uint256[] calldata basisPoints
) private pure {
require(
receivers.length == basisPoints.length,
"Mismatch in array lengths"
);
uint256 totalBasisPoints;
for (uint256 i; i < basisPoints.length; ) {
totalBasisPoints += basisPoints[i];
unchecked {
++i;
}
}
require(totalBasisPoints < 10000, "Invalid total royalties");
}
function _checkSigned(
address creatorContract,
bytes memory args,
bytes32 tokenNonce,
bytes calldata signature
) private returns (ERC721Creator) {
// TODO: Should have global flag here too?
// Recover signature
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
_eip712DomainSeparator,
keccak256(args)
)
);
// Recover signer
address authorizer = ECDSA.recover(digest, signature);
// Check signer can mint on this contract
ERC721Creator creatorCon = _checkIsAddressGranted(
authorizer,
creatorContract
);
// Check nonce hasn't been redeemed already
bytes32 tokenNonceHash = keccak256(
abi.encode(creatorContract, tokenNonce)
);
require(
_signedMints[tokenNonceHash] == false,
"Signed mint already redeemed"
);
// Mark the nonce as redeemed
_signedMints[tokenNonceHash] = true;
return creatorCon;
}
// In EIP-712 arrays of dynamically-sized types need each element hashed first
function _hashStringArray(
string[] calldata data
) private pure returns (bytes32[] memory) {
bytes32[] memory keccakData = new bytes32[](data.length);
for (uint256 i = 0; i < data.length; i++) {
keccakData[i] = keccak256(bytes(data[i]));
}
return keccakData;
}
function _hashTwoDimensionalAddressArray(
address payable[][] calldata data
) private pure returns (bytes32[] memory) {
bytes32[] memory keccakData = new bytes32[](data.length);
for (uint256 i = 0; i < data.length; i++) {
keccakData[i] = keccak256(abi.encodePacked(data[i]));
}
return keccakData;
}
function _hashTwoDimensionalUintArray(
uint256[][] calldata data
) private pure returns (bytes32[] memory) {
bytes32[] memory keccakData = new bytes32[](data.length);
for (uint256 i = 0; i < data.length; i++) {
keccakData[i] = keccak256(abi.encodePacked(data[i]));
}
return keccakData;
}
}
| 38,603 |
159 | // Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function callencoded in `data`. | * Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallSecure(newImplementation, data, true);
}
| * Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallSecure(newImplementation, data, true);
}
| 50,683 |
2 | // View Functions | function upkeepEligibility() external view returns (uint256 numberOfDepositsEligible, uint256 amountOfYieldToSwap);
function getOutstandingYield(uint256 id_) external view returns (uint256);
function getPrincipalInGDUS(uint256 id_) external view returns (uint256);
function getTotalHarvestableYieldGDUS(address recipient_) external view returns (uint256 totalGOHM);
function getRecipientIds(address recipient_) external view returns (uint256[] memory);
| function upkeepEligibility() external view returns (uint256 numberOfDepositsEligible, uint256 amountOfYieldToSwap);
function getOutstandingYield(uint256 id_) external view returns (uint256);
function getPrincipalInGDUS(uint256 id_) external view returns (uint256);
function getTotalHarvestableYieldGDUS(address recipient_) external view returns (uint256 totalGOHM);
function getRecipientIds(address recipient_) external view returns (uint256[] memory);
| 5,797 |
60 | // Return a Bee with its image and data. | return outputBee;
| return outputBee;
| 58,611 |
449 | // Shh - we don't ever want this hook to be marked pure | if (false) {
maxAssets = maxAssets;
}
| if (false) {
maxAssets = maxAssets;
}
| 12,569 |
104 | // transfer HEAL tokens to crowdsale account from the account of controller | require(ethealToken.transferFrom(SALE, _sale, _amount));
| require(ethealToken.transferFrom(SALE, _sale, _amount));
| 32,293 |
13 | // For initial setup | bool private initialised;
| bool private initialised;
| 38,048 |
99 | // function to get Token lockstatus by id | function getTokenLockStatus(uint256 id)public view returns(bool){
return _TokenTransactionstatus[id];
}
| function getTokenLockStatus(uint256 id)public view returns(bool){
return _TokenTransactionstatus[id];
}
| 22,926 |
62 | // _pooId the id of the pool/_booster the address of the booster contract | constructor(uint256 _pooId, address _booster) {
require(_booster != address(0), "invalid booster address");
poolId = _pooId;
convexBooster = _booster;
(lpToken, , , cvxRewards, , ) = IConvexDeposit(convexBooster).poolInfo(poolId);
_approveConvexExtra();
}
| constructor(uint256 _pooId, address _booster) {
require(_booster != address(0), "invalid booster address");
poolId = _pooId;
convexBooster = _booster;
(lpToken, , , cvxRewards, , ) = IConvexDeposit(convexBooster).poolInfo(poolId);
_approveConvexExtra();
}
| 50,602 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.