Skip to content

Commit

Permalink
doc: add natspec to getFeeSide
Browse files Browse the repository at this point in the history
  • Loading branch information
adjisb committed Oct 3, 2023
1 parent 32453a7 commit 8bc3d5e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/marketplace/contracts/lib-asset/LibAsset.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ library LibAsset {
bytes32 internal constant ASSET_TYPEHASH =
keccak256("Asset(AssetType assetType,uint256 value)AssetType(uint256 assetClass,bytes data)");

/// @notice decides if the fees will be taken and from which side
/// @param leftClass left side asset class type
/// @param rightClass right side asset class type
/// @return side from which the fees will be taken or none
function getFeeSide(AssetClassType leftClass, AssetClassType rightClass) internal pure returns (FeeSide) {
if (leftClass == AssetClassType.ERC20_ASSET_CLASS && rightClass != AssetClassType.ERC20_ASSET_CLASS) {
return FeeSide.LEFT;
Expand All @@ -45,16 +49,16 @@ library LibAsset {
return FeeSide.NONE;
}

/// @notice calculate hash of asset type
/// @param assetType to be hashed
/// @return hash of assetType
/// @notice calculate hash of asset type
/// @param assetType to be hashed
/// @return hash of assetType
function hash(AssetType memory assetType) internal pure returns (bytes32) {
return keccak256(abi.encode(ASSET_TYPE_TYPEHASH, assetType.assetClass, keccak256(assetType.data)));
}

/// @notice calculate hash of asset
/// @param asset to be hashed
/// @return hash of asset
/// @notice calculate hash of asset
/// @param asset to be hashed
/// @return hash of asset
function hash(Asset memory asset) internal pure returns (bytes32) {
return keccak256(abi.encode(ASSET_TYPEHASH, hash(asset.assetType), asset.value));
}
Expand Down

1 comment on commit 8bc3d5e

@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

83.29%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/marketplace/contracts/exchange
   AssetMatcher.sol100%100%100%100%
   Exchange.sol80.82%71.88%88.24%87.50%101, 180, 66, 82, 92, 92, 92, 92–93, 93, 93–94
   ExchangeCore.sol86.17%65.63%100%96.08%114, 138–139, 139, 139, 142, 203, 205, 209, 230–231, 248, 74
   OrderValidator.sol71.70%58.33%100%79.17%38, 67–68, 68, 68, 72, 83–84, 89, 91, 91, 91, 91–92, 94
   WhiteList.sol97.73%93.75%100%100%57
packages/marketplace/contracts/exchange/libraries
   LibFill.sol60.87%33.33%75%69.23%32–33, 58, 68–69, 69, 69–70
   LibMath.sol27.50%18.75%50%30%100–103, 17–18, 33–34, 50, 50, 50–51, 72, 72, 72–73, 75, 88, 88, 88–89, 93, 93, 93, 93, 93, 97
packages/marketplace/contracts/interfaces
   IAssetMatcher.sol100%100%100%100%
   IOrderValidator.sol100%100%100%100%
   IRoyaltiesProvider.sol100%100%100%100%
   IWhiteList.sol100%100%100%100%
packages/marketplace/contracts/lib-asset
   LibAsset.sol100%100%100%100%
packages/marketplace/contracts/lib-bp
   BpLibrary.sol100%100%100%100%
packages/marketplace/contracts/lib-order
   LibOrder.sol73.33%50%100%100%64, 64, 66, 66
packages/marketplace/contracts/lib-part
   LibPart.sol0%100%0%0%21
packages/marketplace/contracts/royalties
   IERC2981.sol100%100%100%100%
   LibRoyalties2981.sol78.57%50%100%88.89%19–20, 23
packages/marketplace/contracts/royalties-registry
   IMultiRoyaltyRecipients.sol100%100%100%100%
   RoyaltiesRegistry.sol79.20%79.41%100%75%166–167, 170–171, 212, 216, 232–233, 236–244, 247, 247, 247–248, 250, 256, 259, 276, 60
packages/marketplace/contracts/transfer-manager
   TransferExecutor.sol90.48%75%100%100%24, 30
   TransferManager.sol81.65%68.97%100%87.50%137, 190, 199, 206–207, 207, 207–208, 212, 220, 227–228, 252, 269, 273–275, 275, 275–277, 282–283, 306, 310–311, 62, 82–83
packages/marketplace/contracts/transfer-manager/interfaces
   IRoyaltyUGC.sol100%100%100%100%
   ITransferExecutor.sol100%100%100%100%
   ITransferManager.sol100%100%100%100%

Please sign in to comment.