simulated.py 文件源码

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

项目:contracts 作者: DAB-Foundation 项目源码 文件源码
def repay(self, sct):
        """
        used only after the activation of CDT contract
        repay the loan, which converts SCT to DCt
        :param sct: amount of SCT need to be repaid
        :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 = sct * self.CDTL
        # update the CDT balance
        self.CDTB += ether
        # convert SCT to CDT
        cdt = sct
        # 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('repay: ', sct, 'SCT', '+', ether, 'ETH', '=>', cdt, 'CDT')
        return cdt
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号