Skip to content

Commit

Permalink
Merge pull request #1139 from thesandboxgame/asset-audit-n-01
Browse files Browse the repository at this point in the history
N-01 Asset Audit
  • Loading branch information
wojciech-turek authored Sep 15, 2023
2 parents 2355570 + d65768a commit 7e55db1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/asset/contracts/AssetCreate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ contract AssetCreate is
}

/// @notice Initialize the contract
/// @param _name The name of the contract (for EIP712)
/// @param _version The version of the contract (for EIP712)
/// @param _assetContract The address of the asset contract
/// @param _catalystContract The address of the catalyst contract
/// @param _authValidator The address of the AuthSuperValidator contract
/// @param _forwarder The address of the forwarder contract
/// @param _defaultAdmin The address of the default admin
function initialize(
string memory _name,
string memory _version,
Expand All @@ -80,7 +84,9 @@ contract AssetCreate is
/// @param signature A signature generated by TSB
/// @param tier The tier of the asset to mint
/// @param amount The amount of the asset to mint
/// @param revealed Whether the asset is revealed or not
/// @param metadataHash The metadata hash of the asset to mint
/// @param creator The address of the creator
function createAsset(
bytes memory signature,
uint8 tier,
Expand Down Expand Up @@ -110,7 +116,9 @@ contract AssetCreate is
/// @param signature A signature generated by TSB
/// @param tiers The tiers of the assets to mint
/// @param amounts The amounts of the assets to mint
/// @param revealed Whether the assets are revealed or not
/// @param metadataHashes The metadata hashes of the assets to mint
/// @param creator The address of the creator
function createMultipleAssets(
bytes memory signature,
uint8[] calldata tiers,
Expand Down Expand Up @@ -206,8 +214,10 @@ contract AssetCreate is

/// @notice Creates a hash of the mint data
/// @param creator The address of the creator
/// @param nonce The nonce of the creator
/// @param tier The tier of the asset
/// @param amount The amount of copies to mint
/// @param revealed Whether the asset is revealed or not
/// @param metadataHash The metadata hash of the asset
/// @return digest The hash of the mint data
function _hashMint(
Expand Down Expand Up @@ -235,8 +245,10 @@ contract AssetCreate is

/// @notice Creates a hash of the mint batch data
/// @param creator The address of the creator
/// @param nonce The nonce of the creator
/// @param tiers The tiers of the assets
/// @param amounts The amounts of copies to mint
/// @param revealed Whether the assets are revealed or not
/// @param metadataHashes The metadata hashes of the assets
/// @return digest The hash of the mint batch data
function _hashBatchMint(
Expand Down
1 change: 1 addition & 0 deletions packages/asset/contracts/libraries/TokenIdUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ library TokenIdUtils {
/// @notice Extracts the asset data from a given token id
/// @dev Created to limit the number of functions that need to be called when revealing an asset
/// @param tokenId The token id to extract the asset data from
/// @return data The asset data struct
function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {
data.creator = getCreatorAddress(tokenId);
data.tier = getTier(tokenId);
Expand Down

1 comment on commit 7e55db1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

96.15%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/asset/contracts
   Asset.sol94.53%89.58%96.43%98.08%116, 207, 312, 312–313, 76
   AssetCreate.sol94.51%83.33%100%100%138, 140, 173, 293, 72
   AssetReveal.sol94.35%86.21%96.55%98.89%143, 147, 181, 376, 416, 424, 441, 75, 98
   AuthSuperValidator.sol90%83.33%100%88.89%51–52
   Catalyst.sol95%91.94%95.45%98.21%125, 127, 140, 152, 224, 80
packages/asset/contracts/interfaces
   IAsset.sol100%100%100%100%
   IAssetCreate.sol100%100%100%100%
   IAssetReveal.sol100%100%100%100%
   ICatalyst.sol100%100%100%100%
   ITokenUtils.sol100%100%100%100%
packages/asset/contracts/libraries
   TokenIdUtils.sol100%100%100%100%
packages/dependency-metatx/contracts
   ERC2771Handler.sol100%100%100%100%
   ERC2771HandlerAbstract.sol100%100%100%100%
   ERC2771HandlerUpgradeable.sol95.45%83.33%100%100%43
packages/dependency-metatx/contracts/test
   ERC2771HandlerTest.sol100%100%100%100%
   ERC2771HandlerUpgradeableTest.sol100%100%100%100%
   MockTrustedForwarder.sol0%0%0%0%15, 18–19, 19, 19–20
packages/dependency-operator-filter/contracts
   OperatorFiltererUpgradeable.sol82.35%85%71.43%83.33%17, 51–52, 61–62, 71, 87
   OperatorFilterSubscription.sol60%50%100%50%19–20
packages/dependency-operator-filter/contracts/interfaces
   IOperatorFilterRegistry.sol100%100%100%100%
packages/dependency-royalty-management/contracts
   MultiRoyaltyDistributor.sol84.06%65%90%92.31%104, 144, 25, 41, 41, 41, 41, 60–61, 97
   RoyaltyDistributor.sol78.95%50%80%90%20, 50, 56
   RoyaltyManager.sol96.39%87.50%100%100%104, 47, 98
   RoyaltySplitter.sol92.08%75%92.31%97.06%117, 157, 185, 218, 65, 72, 83
packages/dependency-royalty-management/contracts/interfaces
   IERC20Approve.sol100%100%100%100%
   IMultiRoyaltyDistributor.sol100%100%100%100%
   IMultiRoyaltyRecipients.sol100%100%100%100%
   IRoyaltyManager.sol100%100%100%100%
   IRoyaltyUGC.sol100%100%100%100%

Please sign in to comment.