¡El código fuente de este contrato está verificado!
Metadatos del Contrato
Compilador
0.8.19+commit.7dd6d404
Idioma
Solidity
¡El código fuente de este contrato está verificado!
Metadatos del Contrato
Compilador
0.8.18+commit.87f61d96
Idioma
Solidity
Código Fuente del Contrato
Archivo 1 de 16: AddressUtils.sol
// SPDX-License-Identifier: MITpragmasolidity ^0.8.8;import { UintUtils } from'./UintUtils.sol';
libraryAddressUtils{
usingUintUtilsforuint256;
errorAddressUtils__InsufficientBalance();
errorAddressUtils__NotContract();
errorAddressUtils__SendValueFailed();
functiontoString(address account) internalpurereturns (stringmemory) {
returnuint256(uint160(account)).toHexString(20);
}
functionisContract(address account) internalviewreturns (bool) {
uint256 size;
assembly {
size :=extcodesize(account)
}
return size >0;
}
functionsendValue(addresspayable account, uint256 amount) internal{
(bool success, ) = account.call{ value: amount }('');
if (!success) revert AddressUtils__SendValueFailed();
}
functionfunctionCall(address target,
bytesmemory data
) internalreturns (bytesmemory) {
return
functionCall(target, data, 'AddressUtils: failed low-level call');
}
functionfunctionCall(address target,
bytesmemory data,
stringmemoryerror) internalreturns (bytesmemory) {
return _functionCallWithValue(target, data, 0, error);
}
functionfunctionCallWithValue(address target,
bytesmemory data,
uint256 value
) internalreturns (bytesmemory) {
return
functionCallWithValue(
target,
data,
value,
'AddressUtils: failed low-level call with value'
);
}
functionfunctionCallWithValue(address target,
bytesmemory data,
uint256 value,
stringmemoryerror) internalreturns (bytesmemory) {
if (value >address(this).balance)
revert AddressUtils__InsufficientBalance();
return _functionCallWithValue(target, data, value, error);
}
/**
* @notice execute arbitrary external call with limited gas usage and amount of copied return data
* @dev derived from https://github.com/nomad-xyz/ExcessivelySafeCall (MIT License)
* @param target recipient of call
* @param gasAmount gas allowance for call
* @param value native token value to include in call
* @param maxCopy maximum number of bytes to copy from return data
* @param data encoded call data
* @return success whether call is successful
* @return returnData copied return data
*/functionexcessivelySafeCall(address target,
uint256 gasAmount,
uint256 value,
uint16 maxCopy,
bytesmemory data
) internalreturns (bool success, bytesmemory returnData) {
returnData =newbytes(maxCopy);
assembly {
// execute external call via assembly to avoid automatic copying of return data
success :=call(
gasAmount,
target,
value,
add(data, 0x20),
mload(data),
0,
0
)
// determine whether to limit amount of data to copylet toCopy :=returndatasize()
ifgt(toCopy, maxCopy) {
toCopy := maxCopy
}
// store the length of the copied bytesmstore(returnData, toCopy)
// copy the bytes from returndata[0:toCopy]returndatacopy(add(returnData, 0x20), 0, toCopy)
}
}
function_functionCallWithValue(address target,
bytesmemory data,
uint256 value,
stringmemoryerror) privatereturns (bytesmemory) {
if (!isContract(target)) revert AddressUtils__NotContract();
(bool success, bytesmemory returnData) = target.call{ value: value }(
data
);
if (success) {
return returnData;
} elseif (returnData.length>0) {
assembly {
let returnData_size :=mload(returnData)
revert(add(32, returnData), returnData_size)
}
} else {
revert(error);
}
}
}
Código Fuente del Contrato
Archivo 2 de 16: ERC1155MetadataExtensionInternal.sol
// SPDX-License-Identifier: UNLICENSEDpragmasolidity ^0.8.18;import { ERC1155MetadataExtensionStorage } from'./ERC1155MetadataExtensionStorage.sol';
abstractcontractERC1155MetadataExtensionInternal{
/**
* @notice sets a new name for ECR1155 collection
* @param name name to set
*/function_setName(stringmemory name) internal{
ERC1155MetadataExtensionStorage.layout().name= name;
}
/**
* @notice sets a new symbol for ECR1155 collection
* @param symbol symbol to set
*/function_setSymbol(stringmemory symbol) internal{
ERC1155MetadataExtensionStorage.layout().symbol = symbol;
}
/**
* @notice reads ERC1155 collcetion name
* @return name ERC1155 collection name
*/function_name() internalviewreturns (stringmemory name) {
name = ERC1155MetadataExtensionStorage.layout().name;
}
/**
* @notice reads ERC1155 collcetion symbol
* @return symbol ERC1155 collection symbol
*/function_symbol() internalviewreturns (stringmemory symbol) {
symbol = ERC1155MetadataExtensionStorage.layout().symbol;
}
}
Código Fuente del Contrato
Archivo 3 de 16: ERC1155MetadataExtensionStorage.sol
// SPDX-License-Identifier: MITpragmasolidity ^0.8.8;/**
* @title Diamond proxy introspection interface
* @dev see https://eips.ethereum.org/EIPS/eip-2535
*/interfaceIDiamondReadable{
structFacet {
address target;
bytes4[] selectors;
}
/**
* @notice get all facets and their selectors
* @return diamondFacets array of structured facet data
*/functionfacets() externalviewreturns (Facet[] memory diamondFacets);
/**
* @notice get all selectors for given facet address
* @param facet address of facet to query
* @return selectors array of function selectors
*/functionfacetFunctionSelectors(address facet
) externalviewreturns (bytes4[] memory selectors);
/**
* @notice get addresses of all facets used by diamond
* @return addresses array of facet addresses
*/functionfacetAddresses()
externalviewreturns (address[] memory addresses);
/**
* @notice get the address of the facet associated with given selector
* @param selector function selector to query
* @return facet facet address (zero address if not found)
*/functionfacetAddress(bytes4 selector
) externalviewreturns (address facet);
}
Código Fuente del Contrato
Archivo 6 de 16: IERC173.sol
// SPDX-License-Identifier: MITpragmasolidity ^0.8.8;import { IERC173Internal } from'./IERC173Internal.sol';
/**
* @title Contract ownership standard interface
* @dev see https://eips.ethereum.org/EIPS/eip-173
*/interfaceIERC173isIERC173Internal{
/**
* @notice get the ERC173 contract owner
* @return conrtact owner
*/functionowner() externalviewreturns (address);
/**
* @notice transfer contract ownership to new account
* @param account address of new owner
*/functiontransferOwnership(address account) external;
}
// SPDX-License-Identifier: UNLICENSEDpragmasolidity ^0.8.18;import { IOwnableInternal } from'@solidstate/contracts/access/ownable/IOwnableInternal.sol';
interfaceISimpleVaultInternalisIOwnableInternal{
/**
* @notice indicates which lending adaptor is to be interacted with
*/enumLendingAdaptor {
DEFAULT, //allows for passing an 'empty' adaptor argument in functions
JPEGD
}
/**
* @notice indicates which staking adaptor is to be interacted with
*/enumStakingAdaptor {
DEFAULT, //allows for passing an 'empty' adaptor argument in functions
JPEGD
}
/**
* @notice encapsulates an amount of fees of a particular token
*/structTokenFee {
address token;
uint256 fees;
}
/**
* @notice encapsulates an amount of yield of a particular token
*/structTokenYield {
address token;
uint256 yield;
}
/**
* @notice encapsulates the cumulative amount of yield accrued of a paritcular token per shard
*/structTokensPerShard {
address token;
uint256 cumulativeAmount;
}
/**
* @notice thrown when function called by non-protocol owner
*/errorSimpleVault__NotProtocolOwner();
/**
* @notice thrown when function called by account which is non-authorized and non-protocol owner
*/errorSimpleVault__NotAuthorized();
/**
* @notice thrown when the deposit amount is not a multiple of shardSize
*/errorSimpleVault__InvalidDepositAmount();
/**
* @notice thrown when the maximum capital has been reached or vault has invested
*/errorSimpleVault__DepositForbidden();
/**
* @notice thrown when attempting to call a disabled function
*/errorSimpleVault__NotEnabled();
/**
* @notice thrown when user is attempting to deposit after owning (minting) max shards
*/errorSimpleVault__MaxMintBalance();
/**
* @notice thrown when attempting to act without being whitelisted
*/errorSimpleVault__NotWhitelisted();
/**
* @notice thrown when the maximum capital has been reached or vault has invested
*/errorSimpleVault__WithdrawalForbidden();
/**
* @notice thrown when setting a basis point fee value larger than 10000
*/errorSimpleVault__BasisExceeded();
/**
* @notice thrown when attempting to claim yield before yield claiming is initialized
*/errorSimpleVault__YieldClaimingForbidden();
/**
* @notice thrown when attempting to set a reserved supply larger than max supply
*/errorSimpleVault__ExceededMaxSupply();
/**
* @notice thrown when setting a max supply which is smaller than total supply
*/errorSimpleVault__MaxSupplyTooSmall();
/**
* @notice thrown when the vault does not have enough ETH to account for an ETH transfer + respective fee
*/errorSimpleVault__InsufficientETH();
/**
* @notice thrown when attempting to interact on a collection which is not part of the vault collections
*/errorSimpleVault__NotCollectionOfVault();
/**
* @notice thrown when marking a token for sale which is not in ownedTokenIds
*/errorSimpleVault__NotOwnedToken();
/**
* @notice thrown when attempting to sell a token not marked for sale
*/errorSimpleVault__TokenNotForSale();
/**
* @notice thrown when an incorrect ETH amount is received during token sale
*/errorSimpleVault__IncorrectETHReceived();
/**
* @notice thrown when attempted to mark a token for sale whilst it is collateralized
*/errorSimpleVault__TokenCollateralized();
/**
* @notice thrown when attempting to discount yield fee with a DAWN_OF_INSRT token not
* belonging to account yield fee is being discounted for
*/errorSimpleVault__NotDawnOfInsrtTokenOwner();
/**
* @notice thrown when attempting to add a token to collectionOwnedTokens without vault being the token owner
*/errorSimpleVault__NotTokenOwner();
/**
* @notice thrown when attempting to remove a token from collectionOwnedTokens with vault being the token owner
*/errorSimpleVault__TokenStillOwned();
/**
* @notice emitted when an ERC721 is transferred from the treasury to the vault in exchange for ETH
* @param tokenId id of ERC721 asset
*/eventERC721AssetTransfered(uint256 tokenId);
/**
* @notice emitted when protocol fees are withdrawn
* @param tokenFees array of TokenFee structs indicating address of fee token and amount
*/eventFeesWithdrawn(TokenFee[3] tokenFees);
/**
* @notice emitted when an token is marked for sale
* @param collection address of collection of token
* @param tokenId id of token
* @param price price in ETH of token
*/eventTokenMarkedForSale(address collection,
uint256 tokenId,
uint256 price
);
/**
* @notice emitted when a token is sold
* @param collection address of token collection
* @param tokenId id of token
*/eventTokenSold(address collection, uint256 tokenId);
/**
* @notice emitted when whitelistEndsAt is set
* @param whitelistEndsAt the new whitelistEndsAt timestamp
*/eventWhitelistEndsAtSet(uint48 whitelistEndsAt);
/**
* @notice emitted when reservedSupply is set
* @param reservedSupply the new reservedSupply
*/eventReservedSupplySet(uint64 reservedSupply);
/**
* @notice emitted when isEnabled is set
* @param isEnabled the new isEnabled value
*/eventIsEnabledSet(bool isEnabled);
/**
* @notice emitted when maxMintBalance is set
* @param maxMintBalance the new maxMintBalance
*/eventMaxMintBalanceSet(uint64 maxMintBalance);
/**
* @notice emitted when maxSupply is set
* @param maxSupply the new maxSupply
*/eventMaxSupplySet(uint64 maxSupply);
/**
* @notice emitted when sale fee is set
* @param feeBP the new sale fee basis points
*/eventSaleFeeSet(uint16 feeBP);
/**
* @notice emitted when acquisition fee is set
* @param feeBP the new acquisition fee basis points
*/eventAcquisitionFeeSet(uint16 feeBP);
/**
* @notice emitted when yield fee is set
* @param feeBP the new yield fee basis points
*/eventYieldFeeSet(uint16 feeBP);
/**
* @notice emitted when ltvBufferBP is set
* @param bufferBP new ltvBufferBP value
*/eventLTVBufferSet(uint16 bufferBP);
/**
* @notice emitted when ltvDeviationBP is set
* @param deviationBP new ltvDeviationBP value
*/eventLTVDeviationSet(uint16 deviationBP);
/**
* @notice emitted when a collection is removed from vault collections
* @param collection address of removed collection
*/eventCollectionRemoved(address collection);
/**
* @notice emitted when a collection is added to vault collections
* @param collection address of added collection
*/eventCollectionAdded(address collection);
/**
* @notice emitted when an owned token is added to a collection manually
* @param collection collection address
* @param tokenId tokenId
*/eventOwnedTokenAddedToCollection(address collection, uint256 tokenId);
/**
* @notice emitted when an owned token is removed from a collection manually
* @param collection collection address
* @param tokenId tokenId
*/eventOwnedTokenRemovedFromCollection(address collection, uint256 tokenId);
/**
* @notice emmitted when the 'authorized' state is granted to or revoked from an account
* @param account address of account to grant/revoke 'authorized'
* @param isAuthorized value of 'authorized' state
*/eventAuthorizedSet(address account, bool isAuthorized);
/**
* @notice emitted when an ERC721 asset is collateralized in a lending vendor
* @param adaptor enum indicating which lending vendor adaptor was used
* @param collection address of ERC721 collection
* @param tokenId id of token
*/eventERC721AssetCollateralized(
LendingAdaptor adaptor,
address collection,
uint256 tokenId
);
/**
* @notice emitted when lending vendor tokens received for collateralizing and asset
* are staked in a lending vendor
* @param adaptor enum indicating which lending vendor adaptor was used
* @param shares lending vendor shares received after staking, if any
*/eventStaked(StakingAdaptor adaptor, uint256 shares);
/**
* @notice emitted when a position in a lending vendor is unstaked and converted back
* to the tokens which were initially staked
* @param adaptor enum indicating which lending vendor adaptor was used
* @param tokenAmount amount of tokens received for unstaking
*/eventUnstaked(StakingAdaptor adaptor, uint256 tokenAmount);
/**
* @notice emitted when a certain amount of the staked position in a lending vendor is
* unstaked and converted to tokens to be provided as yield
* @param adaptor enum indicating which lending vendor adaptor was used
* @param tokenYields array of token addresses and corresponding yields provided
*/eventYieldProvided(StakingAdaptor adaptor, TokenYield[] tokenYields);
/**
* @notice emitted when a loan repayment is made for a collateralized position
* @param adaptor enum indicating which lending vendor adaptor was used
* @param paidDebt amount of debt repaid
*/eventLoanPaymentMade(LendingAdaptor adaptor, uint256 paidDebt);
/**
* @notice emitted when a loan is repaid in full and the position is closed
* @param adaptor enum indicating which lending vendor adaptor was used
* @param receivedETH amount of ETH received after closing position
*/eventPositionClosed(LendingAdaptor adaptor, uint256 receivedETH);
}