Skip to content

Commit

Permalink
add read method for feeinfo object (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
doerfli committed Aug 15, 2024
1 parent 64dd397 commit 4b37dd4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions contracts/instance/InstanceReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,17 @@ contract InstanceReader {
}
}

function getFeeInfo(NftId productNftId)
public
view
returns (IComponents.FeeInfo memory feeInfo)
{
bytes memory data = _store.getData(toFeeKey(productNftId));
if (data.length > 0) {
return abi.decode(data, (IComponents.FeeInfo));
}
}

function getPoolInfo(NftId poolNftId)
public
view
Expand Down Expand Up @@ -554,6 +565,10 @@ contract InstanceReader {
return productNftId.toKey32(PRODUCT());
}

function toFeeKey(NftId productNftId) public pure returns (Key32) {
return productNftId.toKey32(FEE());
}

// low level function
function getInstance() external view returns (IInstance instance) {
return _instance;
Expand Down

0 comments on commit 4b37dd4

Please sign in to comment.