Closed parva-jain closed 9 months ago
Hi @parva-jain, thanks for the heads up. Unfortunately, we can't change the zondax package because we don't maintain it, but I've opened a draft PR to address this and include it in the new package that Filecoin will publish. For now, for uint64 endEpoch
value, you can use something like this:
function getEndEpochValue(uint64 dealId) internal returns (uint64 endEpoch) {
MarketTypes.GetDealTermReturn memory dealTerm = MarketAPI.getDealTerm(
dealId
);
endEpoch = uint64(
CommonTypes.ChainEpoch.unwrap(dealTerm.start) +
CommonTypes.ChainEpoch.unwrap(dealTerm.end)
);
}
Alright!!
The MarketAPI.getDealTerm() function returns the start epoch and duration(in epoch) of a deal, but the its return type i.e. MarketTypes.GetDealTermReturn is having start epoch and end epoch as variable. The duration can be misinterpreted as end epoch for deal.
Example - Here, in getExpiringDeals function's if statement, return value from MarketAPI.getDealTerm is considered as end epoch and hence the statement is wrong and giving wrong output everytime.