withdraw.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:contracts 作者: DAB-Foundation 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号