From 8bc3d5e5ff6d5a4f56a27763ccb5fa45fddc413d Mon Sep 17 00:00:00 2001 From: Andres Adjimann Date: Tue, 3 Oct 2023 16:50:14 -0300 Subject: [PATCH] doc: add natspec to getFeeSide --- .../marketplace/contracts/lib-asset/LibAsset.sol | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/marketplace/contracts/lib-asset/LibAsset.sol b/packages/marketplace/contracts/lib-asset/LibAsset.sol index a99eeda431..7866b2fc81 100644 --- a/packages/marketplace/contracts/lib-asset/LibAsset.sol +++ b/packages/marketplace/contracts/lib-asset/LibAsset.sol @@ -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; @@ -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)); }