| 852 | } |
| 853 | |
| 854 | Object RPC_PARAM::CdpToJson(const CUserCDP &cdp, uint32_t tipHeight) { |
| 855 | |
| 856 | uint64_t bcoinMedianPrice = GetPriceByCdp(*pCdMan->pPriceFeedCache, cdp); |
| 857 | uint64_t interest = ComputeCDPInterest(*pCdMan->pSysParamCache, cdp, tipHeight); |
| 858 | |
| 859 | int32_t blockInterval = tipHeight >= cdp.block_height ? tipHeight - cdp.block_height : 0; |
| 860 | int32_t interestDays = std::max<int32_t>(1, ceil((double)blockInterval / SysCfg().GetOneDayBlocks(tipHeight))); |
| 861 | |
| 862 | auto obj = cdp.ToJson(bcoinMedianPrice); |
| 863 | obj.push_back(Pair("interest_due", interest)); |
| 864 | obj.push_back(Pair("interest_days", interestDays)); |
| 865 | return obj; |
| 866 | } |
nothing calls this directly
no test coverage detected