def to_credit(self, dct):
"""
used only after the activation of CDT contract
convert DCT to CDT, those who pay the loan gets the CDT.
market for DCT
:param dct:
:return: cdt
"""
# used only after the activation of CDT contract
if not self.is_cdt_active:
return
# repay rate is the same as loan rate
ether = dct * self.CDTL
# update the CDT balance
self.CDTB += ether
# convert DCT to CDT
cdt = dct
# calculate the cash price of CDT
self.CDTP = self.CDTB / (self.CDTS * self.CDT_CRR)
# log CDT contract according to switch
if self.log == self.log_cdt or self.log == self.log_dpt_cdt:
print('to credit: ', dct, 'DCT', '+', ether, 'ETH', '=>', cdt, 'CDT')
return cdt
评论列表
文章目录