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 |
|---|---|---|---|---|
74 | // If we have enough "free" tokens, allocate them | if (freeTokens >= allocated){
freeTokens = SafeMath.sub(freeTokens, allocated);
gameTokenAmount[game] = allocated;
}
| if (freeTokens >= allocated){
freeTokens = SafeMath.sub(freeTokens, allocated);
gameTokenAmount[game] = allocated;
}
| 28,003 |
6 | // Requires the expected and actual data arguments are equal | require(_data.length == _expectedSetupForAugurData.length && keccak256(_data) == keccak256(_expectedSetupForAugurData));
| require(_data.length == _expectedSetupForAugurData.length && keccak256(_data) == keccak256(_expectedSetupForAugurData));
| 4,379 |
238 | // Returns true if msg.sender is grantee eligible to trigger stake/ undelegation for this operator. Function checks both standard grantee/ and managed grantee case./operator The operator tokens are delegated to./tokenGrant KEEP token grant contract reference. | function canUndelegate(
Storage storage self,
address operator,
TokenGrant tokenGrant
| function canUndelegate(
Storage storage self,
address operator,
TokenGrant tokenGrant
| 6,914 |
6 | // Emergency Stop | function halt() public onlyAdmin {
icoState = State.halted;
}
| function halt() public onlyAdmin {
icoState = State.halted;
}
| 15,595 |
16 | // I mint TB token to msg.sender to be able to track collateral ownership. Minted amount equals debt increase. | _mint(msg.sender, debtAfter - debtBefore);
| _mint(msg.sender, debtAfter - debtBefore);
| 13,999 |
86 | // Internal Out Of Gas/Throw: revert this transaction too; Call Stack Depth Limit reached: n/a after HF 4; Recursive Call: safe, all changes already made. | ProxyEventsEmitter(proxies[_symbol]).emitTransfer(_address(_fromId), _address(_toId), _value);
| ProxyEventsEmitter(proxies[_symbol]).emitTransfer(_address(_fromId), _address(_toId), _value);
| 6,887 |
11 | // With the xDai AMB, it is best practice to also check the source chainId https:docs.tokenbridge.net/amb-bridge/how-to-develop-xchain-apps-by-ambreceive-a-method-call-from-the-amb-bridge | require(l1MessengerAddress.messageSourceChainId() == l2ChainId, "L2_XDAI_BRG: Invalid source Chain ID");
| require(l1MessengerAddress.messageSourceChainId() == l2ChainId, "L2_XDAI_BRG: Invalid source Chain ID");
| 50,024 |
16 | // allow owner to remove arbitrary tokens included just in case contract receives wrong token | function withdrawToken(address _token, uint256 _value) onlyOwner returns (bool ok)
| function withdrawToken(address _token, uint256 _value) onlyOwner returns (bool ok)
| 8,248 |
26 | // The OpenSea operator filter registry. | address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
| address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
| 19,576 |
81 | // generate the pancakeswap pair path of token -> weth | address[] memory path = new address[](2);
path[0] = pancakeswapV2Router.WAVAX();
path[1] = address(this);
| address[] memory path = new address[](2);
path[0] = pancakeswapV2Router.WAVAX();
path[1] = address(this);
| 9,724 |
41 | // Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) bypresenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't/ Sets `value` as the allowance of `spender` over `owner`'s tokens,given `owner`'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transactionordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address.- `deadline` must be a timestamp in the future.- `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`over the EIP712-formatted function arguments.- the signature must use ``owner``'s current | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
| function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
| 1,408 |
170 | // Join a pool self - ConfigurableRightsPool instance calling the library bPool - Core BPool the CRP is wrapping poolAmountOut - number of pool tokens to receive maxAmountsIn - Max amount of asset tokens to spendreturn actualAmountsIn - calculated values of the tokens to pull in / | function joinPool(
IConfigurableRightsPool self,
IBPool bPool,
uint poolAmountOut,
uint[] calldata maxAmountsIn
)
external
view
returns (uint[] memory actualAmountsIn)
| function joinPool(
IConfigurableRightsPool self,
IBPool bPool,
uint poolAmountOut,
uint[] calldata maxAmountsIn
)
external
view
returns (uint[] memory actualAmountsIn)
| 30,745 |
158 | // maximum number of worker accounts allowed per manager | uint256 maxWorkerCount;
| uint256 maxWorkerCount;
| 104 |
34 | // Give the multisig wallet all initial tokens (unissued tokens) | balances[multiSigWallet] = totalSupply;
emit TRANSFER664(address(0), multiSigWallet, totalSupply);
| balances[multiSigWallet] = totalSupply;
emit TRANSFER664(address(0), multiSigWallet, totalSupply);
| 13,782 |
117 | // WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist.- `to` cannot be the zero address. Emits a {Transfer} event. / | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| 113 |
113 | // InvestaX X-Token Lite (c) Copyright 2020 IC SG PTE LTD, all rights reserved. Contract: Investa AdminNo part of this source code may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, printing, photocopying,recording, or otherwise, without the prior written permission of IC SG PTE LTD.Binod NirvanTransfer State ContractEnables the admins to maintain the transfer state. Transfer state when disabled disallows everyone but the admins to transfer tokens./ | abstract contract TransferState is InvestaAdmin {
bool private _transfersEnabled = false;
/**
* @dev Emitted when transfer state is disabled.
* @param disabledBy The address of the administrator who performed this operation.
*/
event TransfersDisabled(address indexed disabledBy);
/**
* @dev Emitted when transfer state is enabled.
* @param enabledBy The address of the administrator who performed this operation.
*/
event TransfersEnabled(address indexed enabledBy);
///@notice Checks if the supplied address is able to perform transfers.
///@param _from The address to check against if the transfer is allowed.
modifier checkTransferState(address _from) {
if (_transfersEnabled == false) {
if (isAdmin(_from) == false) {
revert("Transfer state is restricted.");
}
}
_;
}
/**
* Enables owners and administrators to disable transfer state
* on global level. When transfer state is disabled, no one
* but the administrators can transfer tokens.
*/
function disableTransfers() external onlyAdmin {
require(_transfersEnabled, "Sorry, transfer is disabled.");
_transfersEnabled = false;
emit TransfersDisabled(msg.sender);
}
/**
* Resume the transfer state on global level. Meaning, everyone
* can transfer their tokens freely.
*/
function enableTransfers() external onlyAdmin {
require(_transfersEnabled == false, "Sorry, transfer isn't disabled.");
_transfersEnabled = true;
emit TransfersEnabled(msg.sender);
}
/**
* @dev Transfer state dictates if the tokens can be freely
* transferred by the token holders. When transfers are
* in disabled state, only the administrators have the
* ability to perform token transfers.
* @return If the return value is `true`, it means
* tokens are freely transferrable.
*/
function getTransferState() external view returns (bool) {
return _transfersEnabled;
}
}
| abstract contract TransferState is InvestaAdmin {
bool private _transfersEnabled = false;
/**
* @dev Emitted when transfer state is disabled.
* @param disabledBy The address of the administrator who performed this operation.
*/
event TransfersDisabled(address indexed disabledBy);
/**
* @dev Emitted when transfer state is enabled.
* @param enabledBy The address of the administrator who performed this operation.
*/
event TransfersEnabled(address indexed enabledBy);
///@notice Checks if the supplied address is able to perform transfers.
///@param _from The address to check against if the transfer is allowed.
modifier checkTransferState(address _from) {
if (_transfersEnabled == false) {
if (isAdmin(_from) == false) {
revert("Transfer state is restricted.");
}
}
_;
}
/**
* Enables owners and administrators to disable transfer state
* on global level. When transfer state is disabled, no one
* but the administrators can transfer tokens.
*/
function disableTransfers() external onlyAdmin {
require(_transfersEnabled, "Sorry, transfer is disabled.");
_transfersEnabled = false;
emit TransfersDisabled(msg.sender);
}
/**
* Resume the transfer state on global level. Meaning, everyone
* can transfer their tokens freely.
*/
function enableTransfers() external onlyAdmin {
require(_transfersEnabled == false, "Sorry, transfer isn't disabled.");
_transfersEnabled = true;
emit TransfersEnabled(msg.sender);
}
/**
* @dev Transfer state dictates if the tokens can be freely
* transferred by the token holders. When transfers are
* in disabled state, only the administrators have the
* ability to perform token transfers.
* @return If the return value is `true`, it means
* tokens are freely transferrable.
*/
function getTransferState() external view returns (bool) {
return _transfersEnabled;
}
}
| 14,561 |
2 | // Map of users address and their configuration data (userAddress => userConfiguration) | mapping(address => DataTypes.UserConfigurationMap) internal _usersConfig;
| mapping(address => DataTypes.UserConfigurationMap) internal _usersConfig;
| 10,872 |
0 | // Construct a new Fund Oracles contractmed_ The address of the Medianizerlink_ The LINK token addressweth_ The WETH token addressuniswapExchange_ The address of the LINK to ETH Uniswap Exchange/ | constructor(MedianizerInterface med_, ERC20 link_, WETH weth_, UniswapExchangeInterface uniswapExchange_) public {
med = med_;
link = link_;
weth = weth_;
uniswapExchange = uniswapExchange_;
}
| constructor(MedianizerInterface med_, ERC20 link_, WETH weth_, UniswapExchangeInterface uniswapExchange_) public {
med = med_;
link = link_;
weth = weth_;
uniswapExchange = uniswapExchange_;
}
| 43,786 |
53 | // REMOVE LIQUIDITY | function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
public
| function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
public
| 17,147 |
173 | // Creator: | address(this),
| address(this),
| 42,984 |
33 | // subclasses should add their custom withdraw logic in this function. Note that security fee has already been deducted, so it shouldn't be deducted again within this function. / | function _withdraw(uint256 _amount) internal virtual;
| function _withdraw(uint256 _amount) internal virtual;
| 33,002 |
227 | // issueId => nomatch | mapping (uint256 => uint256) public nomatch;
| mapping (uint256 => uint256) public nomatch;
| 22,871 |
43 | // Core creator implementation / | abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
using Strings for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using AddressUpgradeable for address;
/// @custom:oz-upgrades-unsafe-allow state-variable-assignment
uint256 _tokenCount = 0;
// Track registered extensions data
EnumerableSet.AddressSet internal _extensions;
EnumerableSet.AddressSet internal _blacklistedExtensions;
mapping(address => address) internal _extensionPermissions;
mapping(address => bool) internal _extensionApproveTransfers;
// For tracking which extension a token was minted by
mapping(uint256 => address) internal _tokensExtension;
// The baseURI for a given extension
mapping(address => string) private _extensionBaseURI;
mapping(address => bool) private _extensionBaseURIIdentical;
// The prefix for any tokens with a uri configured
mapping(address => string) private _extensionURIPrefix;
// Mapping for individual token URIs
mapping(uint256 => string) internal _tokenURIs;
// Royalty configurations
mapping(address => address payable[]) internal _extensionRoyaltyReceivers;
mapping(address => uint256[]) internal _extensionRoyaltyBPS;
mapping(uint256 => address payable[]) internal _tokenRoyaltyReceivers;
mapping(uint256 => uint256[]) internal _tokenRoyaltyBPS;
/**
* External interface identifiers for royalties
*/
/**
* @dev CreatorCore
*
* bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6
*
* => 0xbb3bafd6 = 0xbb3bafd6
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;
/**
* @dev Rarible: RoyaltiesV1
*
* bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
* bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
*
* => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;
/**
* @dev Foundation
*
* bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c
*
* => 0xd5a06d4c = 0xd5a06d4c
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;
/**
* @dev EIP-2981
*
* bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
*
* => 0x2a55205a = 0x2a55205a
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(ICreatorCore).interfaceId ||
super.supportsInterface(interfaceId) ||
interfaceId == _INTERFACE_ID_ROYALTIES_CREATORCORE ||
interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE ||
interfaceId == _INTERFACE_ID_ROYALTIES_FOUNDATION ||
interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981;
}
/**
* @dev Only allows registered extensions to call the specified function
*/
modifier extensionRequired() {
require(
_extensions.contains(msg.sender),
"Must be registered extension"
);
_;
}
/**
* @dev Only allows non-blacklisted extensions
*/
modifier nonBlacklistRequired(address extension) {
require(
!_blacklistedExtensions.contains(extension),
"Extension blacklisted"
);
_;
}
/**
* @dev See {ICreatorCore-getExtensions}.
*/
function getExtensions()
external
view
override
returns (address[] memory extensions)
{
extensions = new address[](_extensions.length());
for (uint256 i = 0; i < _extensions.length(); i++) {
extensions[i] = _extensions.at(i);
}
return extensions;
}
/**
* @dev Register an extension
*/
function _registerExtension(
address extension,
string calldata baseURI,
bool baseURIIdentical
) internal {
require(extension != address(this), "Creator: Invalid");
require(
extension.isContract(),
"Creator: Extension must be a contract"
);
if (!_extensions.contains(extension)) {
_extensionBaseURI[extension] = baseURI;
_extensionBaseURIIdentical[extension] = baseURIIdentical;
emit ExtensionRegistered(extension, msg.sender);
_extensions.add(extension);
}
}
/**
* @dev Unregister an extension
*/
function _unregisterExtension(address extension) internal {
if (_extensions.contains(extension)) {
emit ExtensionUnregistered(extension, msg.sender);
_extensions.remove(extension);
}
}
/**
* @dev Set base token uri for an extension
*/
function _setBaseTokenURIExtension(string calldata uri, bool identical)
internal
{
_extensionBaseURI[msg.sender] = uri;
_extensionBaseURIIdentical[msg.sender] = identical;
}
/**
* @dev Set token uri prefix for an extension
*/
function _setTokenURIPrefixExtension(string calldata prefix) internal {
_extensionURIPrefix[msg.sender] = prefix;
}
/**
* @dev Set token uri for a token of an extension
*/
function _setTokenURIExtension(uint256 tokenId, string calldata uri)
internal
{
require(_tokensExtension[tokenId] == msg.sender, "Invalid token");
_tokenURIs[tokenId] = uri;
}
/**
* @dev Set base token uri for tokens with no extension
*/
function _setBaseTokenURI(string memory uri) internal {
_extensionBaseURI[address(this)] = uri;
}
/**
* @dev Set token uri prefix for tokens with no extension
*/
function _setTokenURIPrefix(string calldata prefix) internal {
_extensionURIPrefix[address(this)] = prefix;
}
/**
* @dev Set token uri for a token with no extension
*/
function _setTokenURI(uint256 tokenId, string calldata uri) internal {
require(_tokensExtension[tokenId] == address(this), "Invalid token");
_tokenURIs[tokenId] = uri;
}
/**
* @dev Retrieve a token's URI
*/
function _tokenURI(uint256 tokenId) internal view returns (string memory) {
address extension = _tokensExtension[tokenId];
require(
!_blacklistedExtensions.contains(extension),
"Extension blacklisted"
);
if (bytes(_tokenURIs[tokenId]).length != 0) {
if (bytes(_extensionURIPrefix[extension]).length != 0) {
return
string(
abi.encodePacked(
_extensionURIPrefix[extension],
_tokenURIs[tokenId]
)
);
}
return _tokenURIs[tokenId];
}
if (
ERC165Checker.supportsInterface(
extension,
type(ICreatorExtensionTokenURI).interfaceId
)
) {
return
ICreatorExtensionTokenURI(extension).tokenURI(
address(this),
tokenId
);
}
if (bytes(_extensionBaseURI[extension]).length != 0) {
if (!_extensionBaseURIIdentical[extension]) {
return
string(
abi.encodePacked(
_extensionBaseURI[extension],
tokenId.toString()
)
);
} else {
return _extensionBaseURI[extension];
}
} else {
if (!_extensionBaseURIIdentical[address(this)])
{
return
string(
abi.encodePacked(
_extensionBaseURI[address(this)],
tokenId.toString()
)
);
}else{
return _extensionBaseURI[address(this)];
}
}
}
/**
* Get token extension
*/
function _tokenExtension(uint256 tokenId)
internal
view
returns (address extension)
{
extension = _tokensExtension[tokenId];
require(extension != address(this), "No extension for token");
require(
!_blacklistedExtensions.contains(extension),
"Extension blacklisted"
);
return extension;
}
/**
* Helper to get royalties for a token
*/
function _getRoyalties(uint256 tokenId)
internal
view
returns (address payable[] storage, uint256[] storage)
{
return (_getRoyaltyReceivers(tokenId), _getRoyaltyBPS(tokenId));
}
/**
* Helper to get royalty receivers for a token
*/
function _getRoyaltyReceivers(uint256 tokenId)
internal
view
returns (address payable[] storage)
{
if (_tokenRoyaltyReceivers[tokenId].length > 0) {
return _tokenRoyaltyReceivers[tokenId];
} else if (
_extensionRoyaltyReceivers[_tokensExtension[tokenId]].length > 0
) {
return _extensionRoyaltyReceivers[_tokensExtension[tokenId]];
}
return _extensionRoyaltyReceivers[address(this)];
}
/**
* Helper to get royalty basis points for a token
*/
function _getRoyaltyBPS(uint256 tokenId)
internal
view
returns (uint256[] storage)
{
if (_tokenRoyaltyBPS[tokenId].length > 0) {
return _tokenRoyaltyBPS[tokenId];
} else if (_extensionRoyaltyBPS[_tokensExtension[tokenId]].length > 0) {
return _extensionRoyaltyBPS[_tokensExtension[tokenId]];
}
return _extensionRoyaltyBPS[address(this)];
}
function _getRoyaltyInfo(uint256 tokenId, uint256 value)
internal
view
returns (address receiver, uint256 amount)
{
address payable[] storage receivers = _getRoyaltyReceivers(tokenId);
require(receivers.length <= 1, "More than 1 royalty receiver");
if (receivers.length == 0) {
return (address(this), 0);
}
return (receivers[0], (_getRoyaltyBPS(tokenId)[0] * value) / 10000);
}
/**
* Set royalties for a token
*/
function _setRoyalties(
uint256 tokenId,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) internal {
require(receivers.length == basisPoints.length, "Invalid input");
uint256 totalBasisPoints;
for (uint256 i = 0; i < basisPoints.length; i++) {
totalBasisPoints += basisPoints[i];
}
require(totalBasisPoints < 10000, "Invalid total royalties");
_tokenRoyaltyReceivers[tokenId] = receivers;
_tokenRoyaltyBPS[tokenId] = basisPoints;
emit RoyaltiesUpdated(tokenId, receivers, basisPoints);
}
/**
* Set royalties for all tokens of an extension
*/
function _setRoyaltiesExtension(
address extension,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) internal {
require(receivers.length == basisPoints.length, "Invalid input");
uint256 totalBasisPoints;
for (uint256 i = 0; i < basisPoints.length; i++) {
totalBasisPoints += basisPoints[i];
}
require(totalBasisPoints < 10000, "Invalid total royalties");
_extensionRoyaltyReceivers[extension] = receivers;
_extensionRoyaltyBPS[extension] = basisPoints;
if (extension == address(this)) {
emit DefaultRoyaltiesUpdated(receivers, basisPoints);
} else {
emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);
}
}
}
| abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
using Strings for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using AddressUpgradeable for address;
/// @custom:oz-upgrades-unsafe-allow state-variable-assignment
uint256 _tokenCount = 0;
// Track registered extensions data
EnumerableSet.AddressSet internal _extensions;
EnumerableSet.AddressSet internal _blacklistedExtensions;
mapping(address => address) internal _extensionPermissions;
mapping(address => bool) internal _extensionApproveTransfers;
// For tracking which extension a token was minted by
mapping(uint256 => address) internal _tokensExtension;
// The baseURI for a given extension
mapping(address => string) private _extensionBaseURI;
mapping(address => bool) private _extensionBaseURIIdentical;
// The prefix for any tokens with a uri configured
mapping(address => string) private _extensionURIPrefix;
// Mapping for individual token URIs
mapping(uint256 => string) internal _tokenURIs;
// Royalty configurations
mapping(address => address payable[]) internal _extensionRoyaltyReceivers;
mapping(address => uint256[]) internal _extensionRoyaltyBPS;
mapping(uint256 => address payable[]) internal _tokenRoyaltyReceivers;
mapping(uint256 => uint256[]) internal _tokenRoyaltyBPS;
/**
* External interface identifiers for royalties
*/
/**
* @dev CreatorCore
*
* bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6
*
* => 0xbb3bafd6 = 0xbb3bafd6
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;
/**
* @dev Rarible: RoyaltiesV1
*
* bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
* bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
*
* => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;
/**
* @dev Foundation
*
* bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c
*
* => 0xd5a06d4c = 0xd5a06d4c
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;
/**
* @dev EIP-2981
*
* bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
*
* => 0x2a55205a = 0x2a55205a
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(ICreatorCore).interfaceId ||
super.supportsInterface(interfaceId) ||
interfaceId == _INTERFACE_ID_ROYALTIES_CREATORCORE ||
interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE ||
interfaceId == _INTERFACE_ID_ROYALTIES_FOUNDATION ||
interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981;
}
/**
* @dev Only allows registered extensions to call the specified function
*/
modifier extensionRequired() {
require(
_extensions.contains(msg.sender),
"Must be registered extension"
);
_;
}
/**
* @dev Only allows non-blacklisted extensions
*/
modifier nonBlacklistRequired(address extension) {
require(
!_blacklistedExtensions.contains(extension),
"Extension blacklisted"
);
_;
}
/**
* @dev See {ICreatorCore-getExtensions}.
*/
function getExtensions()
external
view
override
returns (address[] memory extensions)
{
extensions = new address[](_extensions.length());
for (uint256 i = 0; i < _extensions.length(); i++) {
extensions[i] = _extensions.at(i);
}
return extensions;
}
/**
* @dev Register an extension
*/
function _registerExtension(
address extension,
string calldata baseURI,
bool baseURIIdentical
) internal {
require(extension != address(this), "Creator: Invalid");
require(
extension.isContract(),
"Creator: Extension must be a contract"
);
if (!_extensions.contains(extension)) {
_extensionBaseURI[extension] = baseURI;
_extensionBaseURIIdentical[extension] = baseURIIdentical;
emit ExtensionRegistered(extension, msg.sender);
_extensions.add(extension);
}
}
/**
* @dev Unregister an extension
*/
function _unregisterExtension(address extension) internal {
if (_extensions.contains(extension)) {
emit ExtensionUnregistered(extension, msg.sender);
_extensions.remove(extension);
}
}
/**
* @dev Set base token uri for an extension
*/
function _setBaseTokenURIExtension(string calldata uri, bool identical)
internal
{
_extensionBaseURI[msg.sender] = uri;
_extensionBaseURIIdentical[msg.sender] = identical;
}
/**
* @dev Set token uri prefix for an extension
*/
function _setTokenURIPrefixExtension(string calldata prefix) internal {
_extensionURIPrefix[msg.sender] = prefix;
}
/**
* @dev Set token uri for a token of an extension
*/
function _setTokenURIExtension(uint256 tokenId, string calldata uri)
internal
{
require(_tokensExtension[tokenId] == msg.sender, "Invalid token");
_tokenURIs[tokenId] = uri;
}
/**
* @dev Set base token uri for tokens with no extension
*/
function _setBaseTokenURI(string memory uri) internal {
_extensionBaseURI[address(this)] = uri;
}
/**
* @dev Set token uri prefix for tokens with no extension
*/
function _setTokenURIPrefix(string calldata prefix) internal {
_extensionURIPrefix[address(this)] = prefix;
}
/**
* @dev Set token uri for a token with no extension
*/
function _setTokenURI(uint256 tokenId, string calldata uri) internal {
require(_tokensExtension[tokenId] == address(this), "Invalid token");
_tokenURIs[tokenId] = uri;
}
/**
* @dev Retrieve a token's URI
*/
function _tokenURI(uint256 tokenId) internal view returns (string memory) {
address extension = _tokensExtension[tokenId];
require(
!_blacklistedExtensions.contains(extension),
"Extension blacklisted"
);
if (bytes(_tokenURIs[tokenId]).length != 0) {
if (bytes(_extensionURIPrefix[extension]).length != 0) {
return
string(
abi.encodePacked(
_extensionURIPrefix[extension],
_tokenURIs[tokenId]
)
);
}
return _tokenURIs[tokenId];
}
if (
ERC165Checker.supportsInterface(
extension,
type(ICreatorExtensionTokenURI).interfaceId
)
) {
return
ICreatorExtensionTokenURI(extension).tokenURI(
address(this),
tokenId
);
}
if (bytes(_extensionBaseURI[extension]).length != 0) {
if (!_extensionBaseURIIdentical[extension]) {
return
string(
abi.encodePacked(
_extensionBaseURI[extension],
tokenId.toString()
)
);
} else {
return _extensionBaseURI[extension];
}
} else {
if (!_extensionBaseURIIdentical[address(this)])
{
return
string(
abi.encodePacked(
_extensionBaseURI[address(this)],
tokenId.toString()
)
);
}else{
return _extensionBaseURI[address(this)];
}
}
}
/**
* Get token extension
*/
function _tokenExtension(uint256 tokenId)
internal
view
returns (address extension)
{
extension = _tokensExtension[tokenId];
require(extension != address(this), "No extension for token");
require(
!_blacklistedExtensions.contains(extension),
"Extension blacklisted"
);
return extension;
}
/**
* Helper to get royalties for a token
*/
function _getRoyalties(uint256 tokenId)
internal
view
returns (address payable[] storage, uint256[] storage)
{
return (_getRoyaltyReceivers(tokenId), _getRoyaltyBPS(tokenId));
}
/**
* Helper to get royalty receivers for a token
*/
function _getRoyaltyReceivers(uint256 tokenId)
internal
view
returns (address payable[] storage)
{
if (_tokenRoyaltyReceivers[tokenId].length > 0) {
return _tokenRoyaltyReceivers[tokenId];
} else if (
_extensionRoyaltyReceivers[_tokensExtension[tokenId]].length > 0
) {
return _extensionRoyaltyReceivers[_tokensExtension[tokenId]];
}
return _extensionRoyaltyReceivers[address(this)];
}
/**
* Helper to get royalty basis points for a token
*/
function _getRoyaltyBPS(uint256 tokenId)
internal
view
returns (uint256[] storage)
{
if (_tokenRoyaltyBPS[tokenId].length > 0) {
return _tokenRoyaltyBPS[tokenId];
} else if (_extensionRoyaltyBPS[_tokensExtension[tokenId]].length > 0) {
return _extensionRoyaltyBPS[_tokensExtension[tokenId]];
}
return _extensionRoyaltyBPS[address(this)];
}
function _getRoyaltyInfo(uint256 tokenId, uint256 value)
internal
view
returns (address receiver, uint256 amount)
{
address payable[] storage receivers = _getRoyaltyReceivers(tokenId);
require(receivers.length <= 1, "More than 1 royalty receiver");
if (receivers.length == 0) {
return (address(this), 0);
}
return (receivers[0], (_getRoyaltyBPS(tokenId)[0] * value) / 10000);
}
/**
* Set royalties for a token
*/
function _setRoyalties(
uint256 tokenId,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) internal {
require(receivers.length == basisPoints.length, "Invalid input");
uint256 totalBasisPoints;
for (uint256 i = 0; i < basisPoints.length; i++) {
totalBasisPoints += basisPoints[i];
}
require(totalBasisPoints < 10000, "Invalid total royalties");
_tokenRoyaltyReceivers[tokenId] = receivers;
_tokenRoyaltyBPS[tokenId] = basisPoints;
emit RoyaltiesUpdated(tokenId, receivers, basisPoints);
}
/**
* Set royalties for all tokens of an extension
*/
function _setRoyaltiesExtension(
address extension,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) internal {
require(receivers.length == basisPoints.length, "Invalid input");
uint256 totalBasisPoints;
for (uint256 i = 0; i < basisPoints.length; i++) {
totalBasisPoints += basisPoints[i];
}
require(totalBasisPoints < 10000, "Invalid total royalties");
_extensionRoyaltyReceivers[extension] = receivers;
_extensionRoyaltyBPS[extension] = basisPoints;
if (extension == address(this)) {
emit DefaultRoyaltiesUpdated(receivers, basisPoints);
} else {
emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);
}
}
}
| 6,470 |
11 | // get Dydx Solo Address / | function getDydxAddress() public pure returns (address addr) {
addr = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;
}
| function getDydxAddress() public pure returns (address addr) {
addr = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;
}
| 24,765 |
62 | // Query if an address is an authorized operator for another address/_owner The address that owns the WARs/_operator The address that acts on behalf of the owner/ return True if `_operator` is an approved operator for `_owner`, false otherwise | function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return operatorToApprovals[_owner][_operator];
}
| function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return operatorToApprovals[_owner][_operator];
}
| 31,325 |
273 | // adjustments[10]/mload(0x4000), Constraint expression for pedersen/hash0/ec_subset_sum/bit_extraction_end: column4_row0. | let val := /*column4_row0*/ mload(0x2360)
| let val := /*column4_row0*/ mload(0x2360)
| 60,122 |
497 | // Collective Canvas contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract CollectiveCanvas is ERC721, Ownable {
enum ValidationState {
LOOKING_FOR_OPEN_TAG_OPEN_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE,
LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET,
LOOKING_FOR_CLOSE_TAG_SLASH,
LOOKING_FOR_CLOSE_TAG_CLOSE_BRACKET,
LOOKING_FOR_CLOSE_QUOTE
}
struct ValidationStackFrame {
ValidationState state;
uint index;
}
struct TokenMetadata {
address creator;
uint256 timestamp;
uint256 funded;
uint256 withdrawn;
}
uint256 public basePrice;
bytes[] private _layers;
mapping(uint256 => TokenMetadata) private _tokenMetadata;
constructor(string memory name, string memory symbol) ERC721(name, symbol) {
basePrice = 24000000000000000; //0.024 ETH
}
function mint(bytes memory layer) public payable returns (uint256) {
require(currentPriceToMint() <= msg.value, "Eth value sent is not sufficient");
_validateLayer(layer);
uint mintIndex = _layers.length;
_layers.push(layer);
_safeMint(msg.sender, mintIndex);
_tokenMetadata[mintIndex] = TokenMetadata({creator: msg.sender,
timestamp: block.timestamp,
funded: msg.value,
withdrawn: 0});
return mintIndex;
}
function balanceOfToken(uint256 tokenId) public view returns (uint256) {
require(_exists(tokenId), "Query for nonexistent token");
uint256 balance = 0;
for (uint256 i=tokenId;i<_layers.length;i++) {
balance += (_tokenMetadata[i].funded / (i + 1));
}
return balance - _tokenMetadata[tokenId].withdrawn;
}
function totalFunded() public view returns (uint256) {
uint256 result = 0;
for (uint256 i=0;i<_layers.length;i++) {
result += _tokenMetadata[i].funded;
}
return result;
}
function withdraw(uint256 tokenId, uint256 amount) public {
uint256 balance = balanceOfToken(tokenId);
require(balance >= amount, "Attempt to withdraw more than balance");
require(ownerOf(tokenId) == msg.sender, "Unauthorized attempt to withdraw");
TokenMetadata storage metadata = _tokenMetadata[tokenId];
metadata.withdrawn += amount;
_tokenMetadata[tokenId] = metadata;
payable(msg.sender).transfer(amount);
}
function currentPriceToMint() public view returns (uint256) {
return basePrice * ((_layers.length / 10) + 1);
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory svgUri = _encodeSvgUriAtTokenId(_layers.length-1);
string memory json = Base64.encode(abi.encodePacked('{"name":"Autonomous Art #', Strings.toString(tokenId), '","image":"', svgUri, '"}'));
string memory jsonUri = string(abi.encodePacked("data:application/json;base64,", json));
return jsonUri;
}
function layerCount() public view returns (uint256) {
return _layers.length;
}
function historicalImageAt(uint256 tokenId) public view returns (string memory) {
require(_exists(tokenId), "Query for nonexistent token");
return _encodeSvgUriAtTokenId(tokenId);
}
function creatorAt(uint256 tokenId) public view returns (address) {
require(_exists(tokenId), "Query for nonexistent token");
return _tokenMetadata[tokenId].creator;
}
function timestampAt(uint256 tokenId) public view returns (uint256) {
require(_exists(tokenId), "Query for nonexistent token");
return _tokenMetadata[tokenId].timestamp;
}
function setBasePrice(uint256 updatedBasePrice) public onlyOwner {
basePrice = updatedBasePrice;
}
function _encodeSvgUriAtTokenId(uint256 tokenId) private view returns (string memory) {
return string(abi.encodePacked('data:image/svg+xml;base64,', Base64.encode(_encodeSvgAtTokenId(tokenId))));
}
function _encodeSvgAtTokenId(uint256 tokenId) private view returns (bytes memory) {
bytes memory svg = '<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">';
uint layerIndex = 0;
for (layerIndex = 0 ; layerIndex < tokenId+1; layerIndex++) {
svg = abi.encodePacked(svg, '<g>', _layers[layerIndex], '</g>');
}
svg = abi.encodePacked(svg, '</svg>');
return svg;
}
function _validateLayer(bytes memory layer) public pure {
ValidationStackFrame[] memory stack = new ValidationStackFrame[](10);
uint16 index = 0;
stack[0] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_OPEN_BRACKET, index: 0});
for (uint i=0;i<layer.length;i++) {
if (stack[index].state == ValidationState.LOOKING_FOR_OPEN_TAG_OPEN_BRACKET) {
require(layer[i] == 0x3c, "Expecting '<'");
require(index + 1 < stack.length, "Stack space exceeded");
stack[++index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET, index: i+1});
} else if (stack[index].state == ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET) {
if (layer[i] == 0x2f) { // '/'
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE, index: i});
} else if (layer[i] == 0x22) { // '"'
require(index + 1 < stack.length, "Stack space exceeded");
stack[++index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_QUOTE, index: i});
} else if (layer[i] == 0x3e) { // '>'
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET, index: stack[index].index});
} else {
require((layer[i] >= 0x30 && layer[i] <= 0x39) || (layer[i] >= 0x41 && layer[i] <= 0x7a) || (layer[i] == 0x3d) || (layer[i] == 0x20) || (layer[i] == 0x2d), string(abi.encodePacked("Expecting '0-9', 'a-zA-Z', '=', '-', or ' ' but got: ", layer[i])));
}
} else if (stack[index].state == ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE) {
require(layer[i] == 0x3e, "Expecting '>'");
index--;
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET) {
require(layer[i] == 0x3c, "Expecting '<'");
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_SLASH, index: stack[index].index});
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_TAG_SLASH) {
if (layer[i] == 0x2f) { // '/'
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_CLOSE_BRACKET, index: i + 1 - stack[index].index});
} else {
require((layer[i] >= 0x41 && layer[i] <= 0x7a), "Expecting a-zA-Z");
require(index + 1 < stack.length, "Stack space exceeded");
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET, index: stack[index].index});
stack[++index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET, index: i});
}
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_TAG_CLOSE_BRACKET) {
if (layer[i] == 0x3e) { // '>'
index--;
} else {
require(layer[i] == layer[i - stack[index].index], string(abi.encodePacked("Expecting a-zA-Z to match: ", layer[i - stack[index].index])));
}
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_QUOTE) {
if (layer[i] == 0x22) { // '"'
index--;
} else {
require((layer[i] >= 0x20 && layer[i] <= 0x7e), string(abi.encodePacked("Expecting ascii 0x20-0x7e, but got: ", layer[i])));
}
}
}
require(index == 0, "Invalid layer, ended with non-zero index");
}
}
| contract CollectiveCanvas is ERC721, Ownable {
enum ValidationState {
LOOKING_FOR_OPEN_TAG_OPEN_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET,
LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE,
LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET,
LOOKING_FOR_CLOSE_TAG_SLASH,
LOOKING_FOR_CLOSE_TAG_CLOSE_BRACKET,
LOOKING_FOR_CLOSE_QUOTE
}
struct ValidationStackFrame {
ValidationState state;
uint index;
}
struct TokenMetadata {
address creator;
uint256 timestamp;
uint256 funded;
uint256 withdrawn;
}
uint256 public basePrice;
bytes[] private _layers;
mapping(uint256 => TokenMetadata) private _tokenMetadata;
constructor(string memory name, string memory symbol) ERC721(name, symbol) {
basePrice = 24000000000000000; //0.024 ETH
}
function mint(bytes memory layer) public payable returns (uint256) {
require(currentPriceToMint() <= msg.value, "Eth value sent is not sufficient");
_validateLayer(layer);
uint mintIndex = _layers.length;
_layers.push(layer);
_safeMint(msg.sender, mintIndex);
_tokenMetadata[mintIndex] = TokenMetadata({creator: msg.sender,
timestamp: block.timestamp,
funded: msg.value,
withdrawn: 0});
return mintIndex;
}
function balanceOfToken(uint256 tokenId) public view returns (uint256) {
require(_exists(tokenId), "Query for nonexistent token");
uint256 balance = 0;
for (uint256 i=tokenId;i<_layers.length;i++) {
balance += (_tokenMetadata[i].funded / (i + 1));
}
return balance - _tokenMetadata[tokenId].withdrawn;
}
function totalFunded() public view returns (uint256) {
uint256 result = 0;
for (uint256 i=0;i<_layers.length;i++) {
result += _tokenMetadata[i].funded;
}
return result;
}
function withdraw(uint256 tokenId, uint256 amount) public {
uint256 balance = balanceOfToken(tokenId);
require(balance >= amount, "Attempt to withdraw more than balance");
require(ownerOf(tokenId) == msg.sender, "Unauthorized attempt to withdraw");
TokenMetadata storage metadata = _tokenMetadata[tokenId];
metadata.withdrawn += amount;
_tokenMetadata[tokenId] = metadata;
payable(msg.sender).transfer(amount);
}
function currentPriceToMint() public view returns (uint256) {
return basePrice * ((_layers.length / 10) + 1);
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory svgUri = _encodeSvgUriAtTokenId(_layers.length-1);
string memory json = Base64.encode(abi.encodePacked('{"name":"Autonomous Art #', Strings.toString(tokenId), '","image":"', svgUri, '"}'));
string memory jsonUri = string(abi.encodePacked("data:application/json;base64,", json));
return jsonUri;
}
function layerCount() public view returns (uint256) {
return _layers.length;
}
function historicalImageAt(uint256 tokenId) public view returns (string memory) {
require(_exists(tokenId), "Query for nonexistent token");
return _encodeSvgUriAtTokenId(tokenId);
}
function creatorAt(uint256 tokenId) public view returns (address) {
require(_exists(tokenId), "Query for nonexistent token");
return _tokenMetadata[tokenId].creator;
}
function timestampAt(uint256 tokenId) public view returns (uint256) {
require(_exists(tokenId), "Query for nonexistent token");
return _tokenMetadata[tokenId].timestamp;
}
function setBasePrice(uint256 updatedBasePrice) public onlyOwner {
basePrice = updatedBasePrice;
}
function _encodeSvgUriAtTokenId(uint256 tokenId) private view returns (string memory) {
return string(abi.encodePacked('data:image/svg+xml;base64,', Base64.encode(_encodeSvgAtTokenId(tokenId))));
}
function _encodeSvgAtTokenId(uint256 tokenId) private view returns (bytes memory) {
bytes memory svg = '<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">';
uint layerIndex = 0;
for (layerIndex = 0 ; layerIndex < tokenId+1; layerIndex++) {
svg = abi.encodePacked(svg, '<g>', _layers[layerIndex], '</g>');
}
svg = abi.encodePacked(svg, '</svg>');
return svg;
}
function _validateLayer(bytes memory layer) public pure {
ValidationStackFrame[] memory stack = new ValidationStackFrame[](10);
uint16 index = 0;
stack[0] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_OPEN_BRACKET, index: 0});
for (uint i=0;i<layer.length;i++) {
if (stack[index].state == ValidationState.LOOKING_FOR_OPEN_TAG_OPEN_BRACKET) {
require(layer[i] == 0x3c, "Expecting '<'");
require(index + 1 < stack.length, "Stack space exceeded");
stack[++index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET, index: i+1});
} else if (stack[index].state == ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET) {
if (layer[i] == 0x2f) { // '/'
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE, index: i});
} else if (layer[i] == 0x22) { // '"'
require(index + 1 < stack.length, "Stack space exceeded");
stack[++index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_QUOTE, index: i});
} else if (layer[i] == 0x3e) { // '>'
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET, index: stack[index].index});
} else {
require((layer[i] >= 0x30 && layer[i] <= 0x39) || (layer[i] >= 0x41 && layer[i] <= 0x7a) || (layer[i] == 0x3d) || (layer[i] == 0x20) || (layer[i] == 0x2d), string(abi.encodePacked("Expecting '0-9', 'a-zA-Z', '=', '-', or ' ' but got: ", layer[i])));
}
} else if (stack[index].state == ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET_EXCLUSIVE) {
require(layer[i] == 0x3e, "Expecting '>'");
index--;
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET) {
require(layer[i] == 0x3c, "Expecting '<'");
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_SLASH, index: stack[index].index});
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_TAG_SLASH) {
if (layer[i] == 0x2f) { // '/'
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_CLOSE_BRACKET, index: i + 1 - stack[index].index});
} else {
require((layer[i] >= 0x41 && layer[i] <= 0x7a), "Expecting a-zA-Z");
require(index + 1 < stack.length, "Stack space exceeded");
stack[index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_CLOSE_TAG_OPEN_BRACKET, index: stack[index].index});
stack[++index] = ValidationStackFrame({state: ValidationState.LOOKING_FOR_OPEN_TAG_CLOSE_BRACKET, index: i});
}
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_TAG_CLOSE_BRACKET) {
if (layer[i] == 0x3e) { // '>'
index--;
} else {
require(layer[i] == layer[i - stack[index].index], string(abi.encodePacked("Expecting a-zA-Z to match: ", layer[i - stack[index].index])));
}
} else if (stack[index].state == ValidationState.LOOKING_FOR_CLOSE_QUOTE) {
if (layer[i] == 0x22) { // '"'
index--;
} else {
require((layer[i] >= 0x20 && layer[i] <= 0x7e), string(abi.encodePacked("Expecting ascii 0x20-0x7e, but got: ", layer[i])));
}
}
}
require(index == 0, "Invalid layer, ended with non-zero index");
}
}
| 83,340 |
1 | // the liquidity index. Expressed in ray | uint128 liquidityIndex;
| uint128 liquidityIndex;
| 2,507 |
134 | // Constraint expression for cpu/operands/mem0_addr: column5_row4 + half_offset_size - (cpu__decode__opcode_rc__bit_1column7_row9 + (1 - cpu__decode__opcode_rc__bit_1)column7_row1 + column7_row8). | let val := addmod(
addmod(/*column5_row4*/ mload(0x1780), /*half_offset_size*/ mload(0xc0), PRIME),
sub(
PRIME,
addmod(
addmod(
mulmod(
| let val := addmod(
addmod(/*column5_row4*/ mload(0x1780), /*half_offset_size*/ mload(0xc0), PRIME),
sub(
PRIME,
addmod(
addmod(
mulmod(
| 20,239 |
21 | // Repay debt to protocol amount Assets to repay to the protocol / | function repayToProtocol(uint256 amount) internal virtual;
| function repayToProtocol(uint256 amount) internal virtual;
| 19,858 |
447 | // distribute wpc | if (distributeWpcPaused == false) {
piggyDistribution.distributeBorrowWpc(pToken, borrower, false);
}
| if (distributeWpcPaused == false) {
piggyDistribution.distributeBorrowWpc(pToken, borrower, false);
}
| 13,762 |
16 | // ========== MUTATIVE FUNCTIONS ========== / Mint and lock new tokens Minted and locked tokens incur a 50% penalty when withdrawn before lockDuration has passed. | function lock(address user, uint256 amount) external onlyRole(MINTER_ROLE) {
require(amount > 0, "Cannot lock 0");
balances[user] = balances[user] + amount;
uint256 unlockTime = block.timestamp + lockDuration;
LockedBalance[] storage locks = userLocks[user];
uint256 idx = locks.length;
if (idx == 0 || locks[idx-1].unlockTime < unlockTime) {
locks.push(LockedBalance({amount: amount, unlockTime: unlockTime}));
} else {
locks[idx-1].amount = locks[idx-1].amount + amount;
}
_STRFToken.mint(address(this), amount);
emit Locked(user, amount);
}
| function lock(address user, uint256 amount) external onlyRole(MINTER_ROLE) {
require(amount > 0, "Cannot lock 0");
balances[user] = balances[user] + amount;
uint256 unlockTime = block.timestamp + lockDuration;
LockedBalance[] storage locks = userLocks[user];
uint256 idx = locks.length;
if (idx == 0 || locks[idx-1].unlockTime < unlockTime) {
locks.push(LockedBalance({amount: amount, unlockTime: unlockTime}));
} else {
locks[idx-1].amount = locks[idx-1].amount + amount;
}
_STRFToken.mint(address(this), amount);
emit Locked(user, amount);
}
| 1,523 |
5 | // Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId. | function getBaseURI(uint256 _tokenId) internal view returns (string memory) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
return baseURI[indices[i]];
}
}
revert("Invalid tokenId");
}
| function getBaseURI(uint256 _tokenId) internal view returns (string memory) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
return baseURI[indices[i]];
}
}
revert("Invalid tokenId");
}
| 31,012 |
138 | // Delete any fixed credits per token | delete nonRebasingCreditsPerToken[msg.sender];
| delete nonRebasingCreditsPerToken[msg.sender];
| 19,738 |
20 | // durationYears = duration; | startTime = Now();
uint32 dur = math.min(durationYears, Sys.MaxTimingYearsPeriod);
bidEnds = startTime + Sys.BidPeriodPerYear * dur;
revEnds = bidEnds + Sys.RevealPeriodPerYear * dur;
uint256 exp = uint256(math.max(revEnds, expiryBase)) +
uint256(durationYears) * uint256(365 days);
if (exp > Sys.MaxU32) exp = Sys.MaxU32;
expiryTarget = uint32(exp);
if (expiryBase > 0) {
finalizeAfter = math.max(revEnds, expiryBase) + Sys.ProlongGrace;
| startTime = Now();
uint32 dur = math.min(durationYears, Sys.MaxTimingYearsPeriod);
bidEnds = startTime + Sys.BidPeriodPerYear * dur;
revEnds = bidEnds + Sys.RevealPeriodPerYear * dur;
uint256 exp = uint256(math.max(revEnds, expiryBase)) +
uint256(durationYears) * uint256(365 days);
if (exp > Sys.MaxU32) exp = Sys.MaxU32;
expiryTarget = uint32(exp);
if (expiryBase > 0) {
finalizeAfter = math.max(revEnds, expiryBase) + Sys.ProlongGrace;
| 36,754 |
192 | // Used to change `keeper`.`keeper` is the only address that may call `tend()` or `harvest()`, other than `governance()` or `strategist`. However, unlike `governance()` or `strategist`, `keeper` may only call `tend()` and `harvest()`, and no other authorized functions, following the principle of least privilege.This may only be called by governance or the strategist. _keeper The new address to assign as `keeper`. / | function setKeeper(address _keeper) external onlyAuthorized {
keeper = _keeper;
emit UpdatedKeeper(_keeper);
}
| function setKeeper(address _keeper) external onlyAuthorized {
keeper = _keeper;
emit UpdatedKeeper(_keeper);
}
| 7,374 |
87 | // get this address from whitlist. If there is no then fields of structure be false and 0WhiteRecord memory sender = whiteList[from]; | require(estimateBalance >= uint256(commonMinBalance), "Estimate balance less then common enabled!");
if (whiteListEnable == true) {
require(whiteList[from].transferEnabled, "Sender is not whitelist member!");
require(
estimateBalance >= uint256(commonMinBalance + whiteList[from].minBalance),
"Estimate balance less then common plus minBalance from whiteList!"
);
}
| require(estimateBalance >= uint256(commonMinBalance), "Estimate balance less then common enabled!");
if (whiteListEnable == true) {
require(whiteList[from].transferEnabled, "Sender is not whitelist member!");
require(
estimateBalance >= uint256(commonMinBalance + whiteList[from].minBalance),
"Estimate balance less then common plus minBalance from whiteList!"
);
}
| 60,716 |
1,104 | // 553 | entry "unsandwiched" : ENG_ADJECTIVE
| entry "unsandwiched" : ENG_ADJECTIVE
| 17,165 |
32 | // Calculate x + y.Special values behave in the following way: NaN + x = NaN for any x.Infinity + x = Infinity for any finite x.-Infinity + x = -Infinity for any finite x.Infinity + Infinity = Infinity.-Infinity + -Infinity = -Infinity.Infinity + -Infinity = -Infinity + Infinity = NaN.x quadruple precision number y quadruple precision numberreturn quadruple precision number / | function add(bytes16 x, bytes16 y) internal pure returns (bytes16) {
uint256 xExponent = (uint128(x) >> 112) & 0x7FFF;
uint256 yExponent = (uint128(y) >> 112) & 0x7FFF;
if (xExponent == 0x7FFF) {
if (yExponent == 0x7FFF) {
if (x == y) return x;
else return NaN;
} else return x;
} else if (yExponent == 0x7FFF) return y;
else {
bool xSign = uint128(x) >= 0x80000000000000000000000000000000;
uint256 xSignifier = uint128(x) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (xExponent == 0) xExponent = 1;
else xSignifier |= 0x10000000000000000000000000000;
bool ySign = uint128(y) >= 0x80000000000000000000000000000000;
uint256 ySignifier = uint128(y) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (yExponent == 0) yExponent = 1;
else ySignifier |= 0x10000000000000000000000000000;
if (xSignifier == 0) return y == NEGATIVE_ZERO ? POSITIVE_ZERO : y;
else if (ySignifier == 0)
return x == NEGATIVE_ZERO ? POSITIVE_ZERO : x;
else {
int256 delta = int256(xExponent) - int256(yExponent);
if (xSign == ySign) {
if (delta > 112) return x;
else if (delta > 0) ySignifier >>= uint256(delta);
else if (delta < -112) return y;
else if (delta < 0) {
xSignifier >>= uint256(-delta);
xExponent = yExponent;
}
xSignifier += ySignifier;
if (xSignifier >= 0x20000000000000000000000000000) {
xSignifier >>= 1;
xExponent += 1;
}
if (xExponent == 0x7FFF)
return xSign ? NEGATIVE_INFINITY : POSITIVE_INFINITY;
else {
if (xSignifier < 0x10000000000000000000000000000)
xExponent = 0;
else xSignifier &= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
return
bytes16(
uint128(
(
xSign
? 0x80000000000000000000000000000000
: 0
) |
(xExponent << 112) |
xSignifier
)
);
}
} else {
if (delta > 0) {
xSignifier <<= 1;
xExponent -= 1;
} else if (delta < 0) {
ySignifier <<= 1;
xExponent = yExponent - 1;
}
if (delta > 112) ySignifier = 1;
else if (delta > 1)
ySignifier =
((ySignifier - 1) >> uint256(delta - 1)) +
1;
else if (delta < -112) xSignifier = 1;
else if (delta < -1)
xSignifier =
((xSignifier - 1) >> uint256(-delta - 1)) +
1;
if (xSignifier >= ySignifier) xSignifier -= ySignifier;
else {
xSignifier = ySignifier - xSignifier;
xSign = ySign;
}
if (xSignifier == 0) return POSITIVE_ZERO;
uint256 msb = msbFunc(xSignifier);
if (msb == 113) {
xSignifier =
(xSignifier >> 1) &
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
xExponent += 1;
} else if (msb < 112) {
uint256 shift = 112 - msb;
if (xExponent > shift) {
xSignifier =
(xSignifier << shift) &
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
xExponent -= shift;
} else {
xSignifier <<= xExponent - 1;
xExponent = 0;
}
} else xSignifier &= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (xExponent == 0x7FFF)
return xSign ? NEGATIVE_INFINITY : POSITIVE_INFINITY;
else
return
bytes16(
uint128(
(
xSign
? 0x80000000000000000000000000000000
: 0
) |
(xExponent << 112) |
xSignifier
)
);
}
}
}
}
| function add(bytes16 x, bytes16 y) internal pure returns (bytes16) {
uint256 xExponent = (uint128(x) >> 112) & 0x7FFF;
uint256 yExponent = (uint128(y) >> 112) & 0x7FFF;
if (xExponent == 0x7FFF) {
if (yExponent == 0x7FFF) {
if (x == y) return x;
else return NaN;
} else return x;
} else if (yExponent == 0x7FFF) return y;
else {
bool xSign = uint128(x) >= 0x80000000000000000000000000000000;
uint256 xSignifier = uint128(x) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (xExponent == 0) xExponent = 1;
else xSignifier |= 0x10000000000000000000000000000;
bool ySign = uint128(y) >= 0x80000000000000000000000000000000;
uint256 ySignifier = uint128(y) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (yExponent == 0) yExponent = 1;
else ySignifier |= 0x10000000000000000000000000000;
if (xSignifier == 0) return y == NEGATIVE_ZERO ? POSITIVE_ZERO : y;
else if (ySignifier == 0)
return x == NEGATIVE_ZERO ? POSITIVE_ZERO : x;
else {
int256 delta = int256(xExponent) - int256(yExponent);
if (xSign == ySign) {
if (delta > 112) return x;
else if (delta > 0) ySignifier >>= uint256(delta);
else if (delta < -112) return y;
else if (delta < 0) {
xSignifier >>= uint256(-delta);
xExponent = yExponent;
}
xSignifier += ySignifier;
if (xSignifier >= 0x20000000000000000000000000000) {
xSignifier >>= 1;
xExponent += 1;
}
if (xExponent == 0x7FFF)
return xSign ? NEGATIVE_INFINITY : POSITIVE_INFINITY;
else {
if (xSignifier < 0x10000000000000000000000000000)
xExponent = 0;
else xSignifier &= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
return
bytes16(
uint128(
(
xSign
? 0x80000000000000000000000000000000
: 0
) |
(xExponent << 112) |
xSignifier
)
);
}
} else {
if (delta > 0) {
xSignifier <<= 1;
xExponent -= 1;
} else if (delta < 0) {
ySignifier <<= 1;
xExponent = yExponent - 1;
}
if (delta > 112) ySignifier = 1;
else if (delta > 1)
ySignifier =
((ySignifier - 1) >> uint256(delta - 1)) +
1;
else if (delta < -112) xSignifier = 1;
else if (delta < -1)
xSignifier =
((xSignifier - 1) >> uint256(-delta - 1)) +
1;
if (xSignifier >= ySignifier) xSignifier -= ySignifier;
else {
xSignifier = ySignifier - xSignifier;
xSign = ySign;
}
if (xSignifier == 0) return POSITIVE_ZERO;
uint256 msb = msbFunc(xSignifier);
if (msb == 113) {
xSignifier =
(xSignifier >> 1) &
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
xExponent += 1;
} else if (msb < 112) {
uint256 shift = 112 - msb;
if (xExponent > shift) {
xSignifier =
(xSignifier << shift) &
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
xExponent -= shift;
} else {
xSignifier <<= xExponent - 1;
xExponent = 0;
}
} else xSignifier &= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (xExponent == 0x7FFF)
return xSign ? NEGATIVE_INFINITY : POSITIVE_INFINITY;
else
return
bytes16(
uint128(
(
xSign
? 0x80000000000000000000000000000000
: 0
) |
(xExponent << 112) |
xSignifier
)
);
}
}
}
}
| 5,749 |
41 | // Transfer tokens to a secified address (For Only Owner) to The address to transfer to. value The amount to be transferred.return Transfer status in true or false / | function transferByOwner(address to, uint256 value, uint8 lockingTime) public AllTransfersLockStatus onlyOwner returns (bool) {
addLockingTime(to,lockingTime,value);
_transfer(msg.sender, to, value);
return true;
}
| function transferByOwner(address to, uint256 value, uint8 lockingTime) public AllTransfersLockStatus onlyOwner returns (bool) {
addLockingTime(to,lockingTime,value);
_transfer(msg.sender, to, value);
return true;
}
| 24,500 |
19 | // Get the address of the itoken based on the pool Id. pid Daa Pool Index id. / | function getcoin(uint256 pid) external view returns(address){
return deployeditokens[pid];
}
| function getcoin(uint256 pid) external view returns(address){
return deployeditokens[pid];
}
| 34,780 |
17 | // Gas correction offset | uint256 public initialGasOffsetCorrection;
uint256 public gasOffsetCorrection;
| uint256 public initialGasOffsetCorrection;
uint256 public gasOffsetCorrection;
| 48,855 |
3 | // Mint bBTC with Sett LP tokenInvoking pool.sett.safeTransferFrom() before core.mint(), will mess up core.totalSystemAssets() calculationpoolId System internal ID of the whitelisted curve poolinAmount Amount of Sett LP token to mint bBTC with return outAmount Amount of bBTC minted to user's account/ | function mint(uint poolId, uint inAmount, bytes32[] calldata merkleProof)
override
external
defend
blockLocked
returns(uint outAmount)
| function mint(uint poolId, uint inAmount, bytes32[] calldata merkleProof)
override
external
defend
blockLocked
returns(uint outAmount)
| 11,976 |
41 | // Internal function to mint a new tokenReverts if the given token ID already exists_to The address that will own the minted token_tokenId uint256 ID of the token to be minted by the msg.sender/ | function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
Transfer(address(0), _to, _tokenId);
}
| function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
Transfer(address(0), _to, _tokenId);
}
| 85,914 |
2 | // EIP-20 token decimals for this token | uint8 public constant decimals = 18;
| uint8 public constant decimals = 18;
| 28,813 |
144 | // Public Functions | function mint(uint256 _numTokens) external payable {
require(isSaleActive, "The sale is paused.");
require(_numTokens <= MAX_MINT_PER_TX, "You cannot mint that many in one transaction.");
require(mintedPerWallet[msg.sender] + _numTokens <= MAX_MINT_PER_TX, "You cannot mint that many total.");
uint256 curTotalSupply = totalSupply;
require(curTotalSupply + _numTokens <= MAX_TOKENS, "Exceeds total supply.");
require(_numTokens * price <= msg.value, "Insufficient funds.");
for(uint256 i = 1; i <= _numTokens; ++i) {
_safeMint(msg.sender, curTotalSupply + i);
}
mintedPerWallet[msg.sender] += _numTokens;
totalSupply += _numTokens;
}
| function mint(uint256 _numTokens) external payable {
require(isSaleActive, "The sale is paused.");
require(_numTokens <= MAX_MINT_PER_TX, "You cannot mint that many in one transaction.");
require(mintedPerWallet[msg.sender] + _numTokens <= MAX_MINT_PER_TX, "You cannot mint that many total.");
uint256 curTotalSupply = totalSupply;
require(curTotalSupply + _numTokens <= MAX_TOKENS, "Exceeds total supply.");
require(_numTokens * price <= msg.value, "Insufficient funds.");
for(uint256 i = 1; i <= _numTokens; ++i) {
_safeMint(msg.sender, curTotalSupply + i);
}
mintedPerWallet[msg.sender] += _numTokens;
totalSupply += _numTokens;
}
| 22,485 |
75 | // background N°7 => Artistic | function item_7() public pure returns (string memory) {
return base("FF00E3", "E8E18B", "00C4AD");
}
| function item_7() public pure returns (string memory) {
return base("FF00E3", "E8E18B", "00C4AD");
}
| 33,868 |
61 | // fallback function / | function() payable public {
buy(msg.sender);
}
| function() payable public {
buy(msg.sender);
}
| 5,274 |
200 | // our simple algo get the lowest apr strat cycle through and see who could take its funds plus want for the highest apr | _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
_lowest = i;
lowestNav = lenders[i].nav();
| _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
_lowest = i;
lowestNav = lenders[i].nav();
| 61,467 |
95 | // The Amount of allready collected tokens for rewards (for airdrops) / | function RewardTokensBalance() public view returns (uint256) {
return _collectedTokens;
}
| function RewardTokensBalance() public view returns (uint256) {
return _collectedTokens;
}
| 41,839 |
1 | // When a withdrawal is initiated, we burn the withdrawer's token to prevent subsequent usage. | function _handleInitiateWithdrawal(
address, // _to,
uint _tokenId
)
internal
override
{
_burn(_tokenId);
}
| function _handleInitiateWithdrawal(
address, // _to,
uint _tokenId
)
internal
override
{
_burn(_tokenId);
}
| 42,091 |
0 | // Emitted when tokens have been drawn down for a beneficiary | event TokensClaimed(address indexed beneficiary, uint256 indexed version, uint256 amount);
| event TokensClaimed(address indexed beneficiary, uint256 indexed version, uint256 amount);
| 19,435 |
30 | // Modify the NestNode raising time | function changeNNLimitTime(uint256 num) public onlyOwner {
require(num > 0, "Parameter needs to be greater than 0");
_NNLimitTime = num;
}
| function changeNNLimitTime(uint256 num) public onlyOwner {
require(num > 0, "Parameter needs to be greater than 0");
_NNLimitTime = num;
}
| 24,767 |
4 | // implementation of a LUKSO's Universal Profile based on LSP3 Fabian Vogelsteller <fabian@lukso.network> Implementation of the ERC725Account + LSP1 universalReceiver / | contract UniversalProfile is LSP0ERC725Account {
/**
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
* @param _newOwner the owner of the contract
*/
constructor(address _newOwner) LSP0ERC725Account(_newOwner) {
// set key SupportedStandards:LSP3UniversalProfile
_setData(_LSP3_SUPPORTED_STANDARDS_KEY, _LSP3_SUPPORTED_STANDARDS_VALUE);
}
}
| contract UniversalProfile is LSP0ERC725Account {
/**
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
* @param _newOwner the owner of the contract
*/
constructor(address _newOwner) LSP0ERC725Account(_newOwner) {
// set key SupportedStandards:LSP3UniversalProfile
_setData(_LSP3_SUPPORTED_STANDARDS_KEY, _LSP3_SUPPORTED_STANDARDS_VALUE);
}
}
| 34,195 |
13 | // Get likers of a project | function getLikers(uint _projectId) public view returns (address[] memory) {
Project storage project = projects[_projectId];
return project.likers;
}
| function getLikers(uint _projectId) public view returns (address[] memory) {
Project storage project = projects[_projectId];
return project.likers;
}
| 23,277 |
27 | // insert the trove in the factory contract in the right spot of the list of troves with the same token _newNextTrove is the trove that we think will be the next one in the list. This might be off in case there were some other list changing transactions / | function insertTrove(address _newNextTrove) private {
// insertTrove is only called after updateCollateral has been invoked and the _debt variable has been updated
require(_collateralization() >= mcr(), "41670 TCR must be > MCR");
// only call insertTrove if there are more than one troves in the list
address tokenAddress = address(token);
if (factory.troveCount(tokenAddress) > 1) {
factory.insertTrove(tokenAddress, _newNextTrove);
}
}
| function insertTrove(address _newNextTrove) private {
// insertTrove is only called after updateCollateral has been invoked and the _debt variable has been updated
require(_collateralization() >= mcr(), "41670 TCR must be > MCR");
// only call insertTrove if there are more than one troves in the list
address tokenAddress = address(token);
if (factory.troveCount(tokenAddress) > 1) {
factory.insertTrove(tokenAddress, _newNextTrove);
}
}
| 22,067 |
31 | // FUNCTIONS // PRIVATE FUNCTIONS / | function _addTokenTo(address _to, uint256 _tokenId) internal {
require(cardIdToOwner[_tokenId] == address(0));
ownerToCardCount[_to] = ownerToCardCount[_to] + 1;
cardIdToOwner[_tokenId] = _to;
}
| function _addTokenTo(address _to, uint256 _tokenId) internal {
require(cardIdToOwner[_tokenId] == address(0));
ownerToCardCount[_to] = ownerToCardCount[_to] + 1;
cardIdToOwner[_tokenId] = _to;
}
| 34,000 |
33 | // Internal function to reward the player with a random power-up or defense NFT player The player's address / | function _rewardRandomPowerUpOrDefense(address player) internal {
uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp, player))) % 2; // Generate a random number (0 or 1)
uint256 tokenId = randomNumber == 0 ? POWER_UP_ID : DEFENSE_ID;
_mint(player, tokenId, 1, "");
emit RewardClaimed(player, badgeCount[player] / BADGE_THRESHOLD);
}
| function _rewardRandomPowerUpOrDefense(address player) internal {
uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp, player))) % 2; // Generate a random number (0 or 1)
uint256 tokenId = randomNumber == 0 ? POWER_UP_ID : DEFENSE_ID;
_mint(player, tokenId, 1, "");
emit RewardClaimed(player, badgeCount[player] / BADGE_THRESHOLD);
}
| 31,544 |
26 | // flash withdraw from strategy, providing strategy tokens, buying wSqueeth, burning and receiving ETH this function will execute a flash swap where it receives wSqueeth, burns, withdraws ETH and then repays the flash swap with ETH _crabAmount strategy token amount to burn _maxEthToPay maximum ETH to pay to buy back the owed wSqueeth debt / | function flashWithdraw(uint256 _crabAmount, uint256 _maxEthToPay) external nonReentrant {
uint256 exactWSqueethNeeded = _getDebtFromStrategyAmount(_crabAmount);
_exactOutFlashSwap(
weth,
wPowerPerp,
IUniswapV3Pool(ethWSqueethPool).fee(),
exactWSqueethNeeded,
_maxEthToPay,
uint8(FLASH_SOURCE.FLASH_WITHDRAW),
abi.encodePacked(_crabAmount)
);
emit FlashWithdraw(msg.sender, _crabAmount, exactWSqueethNeeded);
}
| function flashWithdraw(uint256 _crabAmount, uint256 _maxEthToPay) external nonReentrant {
uint256 exactWSqueethNeeded = _getDebtFromStrategyAmount(_crabAmount);
_exactOutFlashSwap(
weth,
wPowerPerp,
IUniswapV3Pool(ethWSqueethPool).fee(),
exactWSqueethNeeded,
_maxEthToPay,
uint8(FLASH_SOURCE.FLASH_WITHDRAW),
abi.encodePacked(_crabAmount)
);
emit FlashWithdraw(msg.sender, _crabAmount, exactWSqueethNeeded);
}
| 23,986 |
67 | // ============ Structs ============ //The base definition of a SetToken Positioncomponent Address of token in the Position moduleIf not in default state, the address of associated module unitEach unit is theof components per 10^18 of a SetToken positionState Position ENUM. Default is 0; External is 1 dataArbitrary data / | struct Position {
address component;
address module;
int256 unit;
uint8 positionState;
bytes data;
}
| struct Position {
address component;
address module;
int256 unit;
uint8 positionState;
bytes data;
}
| 10,901 |
54 | // Transfer ownership of the contract from the current {`owner()`} to the {`pendingOwner()`}. Once this function is called:- the current {`owner()`} will loose access to the functions restricted to the {`owner()`} only.- the {`pendingOwner()`} will gain access to the functions restricted to the {`owner()`} only. @custom:requirements- MUST be called by the pendingOwner.- When notifying the previous owner via LSP1, the typeId used MUST be `keccak256('LSP0OwnershipTransferred_SenderNotification')`.- When notifying the new owner via LSP1, the typeId used MUST be `keccak256('LSP0OwnershipTransferred_RecipientNotification')`. / | function acceptOwnership() public virtual override {
address previousOwner = owner();
_acceptOwnership();
| function acceptOwnership() public virtual override {
address previousOwner = owner();
_acceptOwnership();
| 22,893 |
253 | // Retrieves the EVM Recipient from a Transfer _transferAction The messagereturn The EVM Recipient / | function evmRecipient(bytes29 _transferAction)
internal
pure
typeAssert(_transferAction, Types.Transfer)
returns (address)
| function evmRecipient(bytes29 _transferAction)
internal
pure
typeAssert(_transferAction, Types.Transfer)
returns (address)
| 22,383 |
84 | // implement the eip-2612 | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(owner != address(0), "zero address");
require(block.timestamp <= deadline || deadline == 0, "permit is expired");
bytes32 digest = keccak256(
abi.encodePacked(
uint16(0x1901),
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
require(owner == ecrecover(digest, v, r, s), "invalid signature");
_approve(owner, spender, value);
}
| function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(owner != address(0), "zero address");
require(block.timestamp <= deadline || deadline == 0, "permit is expired");
bytes32 digest = keccak256(
abi.encodePacked(
uint16(0x1901),
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
require(owner == ecrecover(digest, v, r, s), "invalid signature");
_approve(owner, spender, value);
}
| 14,566 |
9 | // Core ERC1155 creator implementation / | abstract contract ERC1155CreatorCore is CreatorCore, IERC1155CreatorCore {
uint256 constant public VERSION = 2;
using EnumerableSet for EnumerableSet.AddressSet;
string public name;
string public symbol;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) {
return interfaceId == type(IERC1155CreatorCore).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {CreatorCore-_setApproveTransferExtension}
*/
function _setApproveTransferExtension(address extension, bool enabled) internal override {
if (ERC165Checker.supportsInterface(extension, type(IERC1155CreatorExtensionApproveTransfer).interfaceId)) {
_extensionApproveTransfers[extension] = enabled;
emit ExtensionApproveTransferUpdated(extension, enabled);
}
}
/**
* @dev Set mint permissions for an extension
*/
function _setMintPermissions(address extension, address permissions) internal {
require(_extensions.contains(extension), "Invalid extension");
require(permissions == address(0) || ERC165Checker.supportsInterface(permissions, type(IERC1155CreatorMintPermissions).interfaceId), "Invalid address");
if (_extensionPermissions[extension] != permissions) {
_extensionPermissions[extension] = permissions;
emit MintPermissionsUpdated(extension, permissions, msg.sender);
}
}
/**
* Check if an extension can mint
*/
function _checkMintPermissions(address[] memory to, uint256[] memory tokenIds, uint256[] memory amounts) internal {
if (_extensionPermissions[msg.sender] != address(0)) {
IERC1155CreatorMintPermissions(_extensionPermissions[msg.sender]).approveMint(msg.sender, to, tokenIds, amounts);
}
}
/**
* Post burn actions
*/
function _postBurn(address owner, uint256[] memory tokenIds, uint256[] memory amounts) internal virtual {
require(tokenIds.length > 0, "Invalid input");
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[tokenIds[i]] == extension, "Mismatched token originators");
unchecked { ++i; }
}
// Callback to originating extension if needed
if (extension != address(0)) {
if (ERC165Checker.supportsInterface(extension, type(IERC1155CreatorExtensionBurnable).interfaceId)) {
IERC1155CreatorExtensionBurnable(extension).onBurn(owner, tokenIds, amounts);
}
}
}
/**
* Approve a transfer
*/
function _approveTransfer(address from, address to, uint256[] memory tokenIds, uint256[] memory amounts) internal {
require(tokenIds.length > 0, "Invalid input");
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[tokenIds[i]] == extension, "Mismatched token originators");
unchecked { ++i; }
}
if (_extensionApproveTransfers[extension]) {
require(IERC1155CreatorExtensionApproveTransfer(extension).approveTransfer(msg.sender, from, to, tokenIds, amounts), "Extension approval failure");
}
}
} | abstract contract ERC1155CreatorCore is CreatorCore, IERC1155CreatorCore {
uint256 constant public VERSION = 2;
using EnumerableSet for EnumerableSet.AddressSet;
string public name;
string public symbol;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) {
return interfaceId == type(IERC1155CreatorCore).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {CreatorCore-_setApproveTransferExtension}
*/
function _setApproveTransferExtension(address extension, bool enabled) internal override {
if (ERC165Checker.supportsInterface(extension, type(IERC1155CreatorExtensionApproveTransfer).interfaceId)) {
_extensionApproveTransfers[extension] = enabled;
emit ExtensionApproveTransferUpdated(extension, enabled);
}
}
/**
* @dev Set mint permissions for an extension
*/
function _setMintPermissions(address extension, address permissions) internal {
require(_extensions.contains(extension), "Invalid extension");
require(permissions == address(0) || ERC165Checker.supportsInterface(permissions, type(IERC1155CreatorMintPermissions).interfaceId), "Invalid address");
if (_extensionPermissions[extension] != permissions) {
_extensionPermissions[extension] = permissions;
emit MintPermissionsUpdated(extension, permissions, msg.sender);
}
}
/**
* Check if an extension can mint
*/
function _checkMintPermissions(address[] memory to, uint256[] memory tokenIds, uint256[] memory amounts) internal {
if (_extensionPermissions[msg.sender] != address(0)) {
IERC1155CreatorMintPermissions(_extensionPermissions[msg.sender]).approveMint(msg.sender, to, tokenIds, amounts);
}
}
/**
* Post burn actions
*/
function _postBurn(address owner, uint256[] memory tokenIds, uint256[] memory amounts) internal virtual {
require(tokenIds.length > 0, "Invalid input");
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[tokenIds[i]] == extension, "Mismatched token originators");
unchecked { ++i; }
}
// Callback to originating extension if needed
if (extension != address(0)) {
if (ERC165Checker.supportsInterface(extension, type(IERC1155CreatorExtensionBurnable).interfaceId)) {
IERC1155CreatorExtensionBurnable(extension).onBurn(owner, tokenIds, amounts);
}
}
}
/**
* Approve a transfer
*/
function _approveTransfer(address from, address to, uint256[] memory tokenIds, uint256[] memory amounts) internal {
require(tokenIds.length > 0, "Invalid input");
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[tokenIds[i]] == extension, "Mismatched token originators");
unchecked { ++i; }
}
if (_extensionApproveTransfers[extension]) {
require(IERC1155CreatorExtensionApproveTransfer(extension).approveTransfer(msg.sender, from, to, tokenIds, amounts), "Extension approval failure");
}
}
} | 14,031 |
112 | // sUSD is a special case and is never stale. | if (currencyKey == "sUSD") return false;
return lastRateUpdateTimes[currencyKey].add(rateStalePeriod) < now;
| if (currencyKey == "sUSD") return false;
return lastRateUpdateTimes[currencyKey].add(rateStalePeriod) < now;
| 52,517 |
171 | // The multiplication in the next line has the same exact purpose as the one above. | let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
| let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
| 35,421 |
17 | // 无效操作 | return CODE_ERR_INVALIDOPERATION;
| return CODE_ERR_INVALIDOPERATION;
| 11,110 |
22 | // Enumerate NFTs assigned to an owner/Throws if `_index` >= `balanceOf(_owner)` or if/`_owner` is the zero address, representing invalid NFTs./_owner An address where we are interested in NFTs owned by them/_index A counter less than `balanceOf(_owner)`/ return The token identifier for the `_index`th NFT assigned to `_owner`,/ (sort order not specified) | function tokenOfOwnerByIndex(address _owner , uint256 _index) external view returns (uint256) {
require (_index < max, "index out of range");
require (_owner != address(0), "address invalid");
require (ownership[_index] != address(0), "token not assigned");
return _index;
}
| function tokenOfOwnerByIndex(address _owner , uint256 _index) external view returns (uint256) {
require (_index < max, "index out of range");
require (_owner != address(0), "address invalid");
require (ownership[_index] != address(0), "token not assigned");
return _index;
}
| 56,213 |
666 | // Make sure input address is clean. (Solidity does not guarantee this) | input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
| input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
| 36,034 |
228 | // function to update base URI for NFT marketplaces __baseURI The new base URI/ | function updateBaseURI(string memory __baseURI) public onlyOwner {
_baseTokenURI = __baseURI;
}
| function updateBaseURI(string memory __baseURI) public onlyOwner {
_baseTokenURI = __baseURI;
}
| 75,145 |
24 | // path[0] = uniswapRouter.WETH(); | path[0] = add1;
path[1] = add2;
return path;
| path[0] = add1;
path[1] = add2;
return path;
| 448 |
154 | // Used to collect accumulated protocol fees. / | function collectProtocol(
uint256 amount0,
uint256 amount1,
address to
| function collectProtocol(
uint256 amount0,
uint256 amount1,
address to
| 54,970 |
1 | // Mutable Internal State // Immutable Private State // Mutable Private State // Constructor / | ) Ownable() {
// Prevent overflow, though 76 would create a safe but unusable contract
require(
stakingTokenDecimals < 77,
"StakedRewardsPool: staking token has far too many decimals"
);
_rewardsToken = rewardsToken;
_stakingToken = stakingToken;
_stakingTokenDecimals = stakingTokenDecimals;
_stakingTokenBase = 10**stakingTokenDecimals;
}
| ) Ownable() {
// Prevent overflow, though 76 would create a safe but unusable contract
require(
stakingTokenDecimals < 77,
"StakedRewardsPool: staking token has far too many decimals"
);
_rewardsToken = rewardsToken;
_stakingToken = stakingToken;
_stakingTokenDecimals = stakingTokenDecimals;
_stakingTokenBase = 10**stakingTokenDecimals;
}
| 31,245 |
16 | // Lock tokens | require (token.transferFrom(msg.sender, this, _price));
ordersOf[msg.sender].push(id);
OpenAskOrder(id);
| require (token.transferFrom(msg.sender, this, _price));
ordersOf[msg.sender].push(id);
OpenAskOrder(id);
| 4,752 |
3 | // We return the petId provided as a confirmation | return petId;
| return petId;
| 2,499 |
3 | // ============ External Setter Functions ============ |
function setToReturn(
address newAddress
)
external
|
function setToReturn(
address newAddress
)
external
| 40,629 |
304 | // amount needs to be subtracted from totalBalance because it has already been added to it from either IWETH.deposit and IERC20.safeTransferFrom | uint256 total = totalWithDepositedAmount.sub(amount);
uint256 shareSupply = totalSupply();
| uint256 total = totalWithDepositedAmount.sub(amount);
uint256 shareSupply = totalSupply();
| 9,390 |
23 | // Resume the issuance of new tokens.Once set to false, '_isIssuable' can never be set to 'true' again. / | function getMinWithdrawAmount() public returns (uint256 amount);
| function getMinWithdrawAmount() public returns (uint256 amount);
| 12,535 |
534 | // mapping from trait type (index) to its name | string[9] _traitTypes = [
"Body",
"Hat",
"Eye",
"Mouth",
"Clothes",
"Tail",
"Alpha"
];
| string[9] _traitTypes = [
"Body",
"Hat",
"Eye",
"Mouth",
"Clothes",
"Tail",
"Alpha"
];
| 12,806 |
4 | // If last selector slot is not full | if (selectorCount % 8 > 0) {
ds.selectorSlots[selectorCount / 8] = selectorSlot;
}
| if (selectorCount % 8 > 0) {
ds.selectorSlots[selectorCount / 8] = selectorSlot;
}
| 79,448 |
60 | // Calculates user dividends g Cache of stored globals stakeSharesParam Param from stake to calculate bonuses for beginDay First day to calculate bonuses for endDay Last day (non-inclusive) of range to calculate bonuses forreturn payout in Suns / | function _calcPayoutDividendsReward(
GlobalsCache memory g,
uint256 stakeSharesParam,
uint256 beginDay,
uint256 endDay
)
private
view
returns (uint256 payout)
| function _calcPayoutDividendsReward(
GlobalsCache memory g,
uint256 stakeSharesParam,
uint256 beginDay,
uint256 endDay
)
private
view
returns (uint256 payout)
| 5,983 |
79 | // Return a rate for which we can buy an amount of tokens/_srcAddr From token/_destAddr To token/_destAmount To amount/ return rate Rate | function getBuyRate(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) public override view returns (uint rate) {
uint256 srcRate = getSellRate(_destAddr, _srcAddr, _destAmount, _additionalData);
uint256 srcAmount = wmul(srcRate, _destAmount);
rate = getSellRate(_srcAddr, _destAddr, srcAmount, _additionalData);
// increase rate by 3% too account for inaccuracy between sell/buy conversion
rate = rate + (rate / 30);
}
| function getBuyRate(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) public override view returns (uint rate) {
uint256 srcRate = getSellRate(_destAddr, _srcAddr, _destAmount, _additionalData);
uint256 srcAmount = wmul(srcRate, _destAmount);
rate = getSellRate(_srcAddr, _destAddr, srcAmount, _additionalData);
// increase rate by 3% too account for inaccuracy between sell/buy conversion
rate = rate + (rate / 30);
}
| 39,755 |
11 | // Returns the address of the incentives controller contract / | function getIncentivesController() external view override returns (IAaveIncentivesController) {
return _getIncentivesController();
}
| function getIncentivesController() external view override returns (IAaveIncentivesController) {
return _getIncentivesController();
}
| 18,664 |
4 | // Allowance for future token management by user | mapping (address => mapping (address => uint)) public allowed;
| mapping (address => mapping (address => uint)) public allowed;
| 17,763 |
15 | // -- Collectors -- | mapping (address => uint) public collectors;
| mapping (address => uint) public collectors;
| 42,038 |
320 | // File @1inch/solidity-utils/contracts/libraries/ECDSA.sol@v2.1.1 |
pragma solidity ^0.8.0;
library ECDSA {
|
pragma solidity ^0.8.0;
library ECDSA {
| 12,082 |
33 | // solhint-disable no-unused-vars/ | * @dev See {IERC4626-withdraw}.
*/
function withdraw(
uint256 assets,
address receiver,
address owner,
uint256 minimumReceive
)
public
virtual
override
returns (uint256)
{
require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max");
uint256 shares = previewWithdraw(assets);
_withdraw(_msgSender(), receiver, owner, assets, shares);
return shares;
}
| * @dev See {IERC4626-withdraw}.
*/
function withdraw(
uint256 assets,
address receiver,
address owner,
uint256 minimumReceive
)
public
virtual
override
returns (uint256)
{
require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max");
uint256 shares = previewWithdraw(assets);
_withdraw(_msgSender(), receiver, owner, assets, shares);
return shares;
}
| 7,404 |
36 | // critical reserve ratio = 2 - time in second / 25 years | FixidityLib.Fraction memory timeSinceInitialization = FixidityLib.newFixed(now.sub(startTime));
FixidityLib.Fraction memory m = FixidityLib.newFixed(25 * 365 * 1 days);
FixidityLib.Fraction memory b = FixidityLib.newFixed(2);
FixidityLib.Fraction memory criticalRatio;
| FixidityLib.Fraction memory timeSinceInitialization = FixidityLib.newFixed(now.sub(startTime));
FixidityLib.Fraction memory m = FixidityLib.newFixed(25 * 365 * 1 days);
FixidityLib.Fraction memory b = FixidityLib.newFixed(2);
FixidityLib.Fraction memory criticalRatio;
| 37,281 |
6 | // only if the entered timestamp is within the allowed rangeThis helps to not list or bid for too short or too long period of time / | modifier onlyAllowedExpireTimestamp(uint256 expireTimestamp) {
require(
expireTimestamp.sub(block.timestamp) >= _actionTimeOutRangeMin,
"Please enter a longer period of time"
);
require(
expireTimestamp.sub(block.timestamp) <= _actionTimeOutRangeMax,
"Please enter a shorter period of time"
);
_;
}
| modifier onlyAllowedExpireTimestamp(uint256 expireTimestamp) {
require(
expireTimestamp.sub(block.timestamp) >= _actionTimeOutRangeMin,
"Please enter a longer period of time"
);
require(
expireTimestamp.sub(block.timestamp) <= _actionTimeOutRangeMax,
"Please enter a shorter period of time"
);
_;
}
| 22,349 |
15 | // Function to flip claim on or off | function toggleClaim() public onlyOwner {
claimIsActive = !claimIsActive;
}
| function toggleClaim() public onlyOwner {
claimIsActive = !claimIsActive;
}
| 32,070 |
95 | // Returns the total current supply of the contract.WARNING - Underlying variables do NOT get automatically updated on mintsso that we can save gas on transactions that mint multiple tokens./ | function totalSupply() public view virtual returns (uint256) {
return _totalMinted - _totalBurned;
}
| function totalSupply() public view virtual returns (uint256) {
return _totalMinted - _totalBurned;
}
| 34,471 |
44 | // Function to mint tokens to The address that will receive the minted tokens. value The amount of tokens to mint.return A boolean that indicates if the operation was successful. / | function mint( address to, uint256 value ) public onlyOwner returns (bool){
_mint(to, value);
return true;
}
| function mint( address to, uint256 value ) public onlyOwner returns (bool){
_mint(to, value);
return true;
}
| 6,956 |
16 | // Return true if disclosures latest agreement is fully signed. / | public view returns(bool) {
return isAgreementFullySigned(
latestMap[disclosureIndex].agreementHash
);
}
| public view returns(bool) {
return isAgreementFullySigned(
latestMap[disclosureIndex].agreementHash
);
}
| 33,234 |
169 | // Allows to stake an operator on the Polygon stakeManager./ This function calls Polygon transferFrom so the totalAmount(_amount + _heimdallFee)/ has to be approved first./_amount amount to stake./_heimdallFee heimdallFee to stake. | function stake(uint256 _amount, uint256 _heimdallFee) external;
| function stake(uint256 _amount, uint256 _heimdallFee) external;
| 28,212 |
259 | // Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) / | event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| 36,394 |
48 | // ICO start date seconds since epoch. | uint public startAt;
| uint public startAt;
| 40,520 |
9 | // Sets the contentURI of the current implementation _contentURI bytes representing the external URI for fetching new version's content / | function updateContentURI(bytes _contentURI) public onlyProxyOwner {
_setContentURI(_contentURI);
}
| function updateContentURI(bytes _contentURI) public onlyProxyOwner {
_setContentURI(_contentURI);
}
| 53,208 |
43 | // Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address. / | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
| function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
| 208 |
9 | // Returns a number between 0 and 1e18 to indicate how much collateral each long and short token is entitledto per collateralPerPair. expiryPrice The price from the optimistic oracle for the LSP price identifier.return expiryPercentLong to indicate how much collateral should be sent between long and short tokens. / | function percentageLongCollateralAtExpiry(int256 expiryPrice)
public
view
override
nonReentrantView
returns (uint256)
| function percentageLongCollateralAtExpiry(int256 expiryPrice)
public
view
override
nonReentrantView
returns (uint256)
| 9,747 |
69 | // Liquidity / tokenA address of first token in pair tokenB address of second token in pairreturn LP balance / | function getLiquidity(address tokenA, address tokenB)
external
view
returns (uint256)
| function getLiquidity(address tokenA, address tokenB)
external
view
returns (uint256)
| 14,134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.