示例#1
0
    def handle(self):
        commit = Commit()

        commit.opcode = "join_loanDAO"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction

        data = {
            "poolId": self._args.get("_poolId"),
            "lender": self._args.get("_lender"),
            "tokens": str(self._args.get("_tokens"))
        }

        commit.data = data

        return [commit]
示例#2
0
    def handle(self):
        commit = Commit()

        commit.opcode = "withdraw_collateral"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": str(self._args.get("_entryId")),
            "to": self._args.get("_to"),
            "amount": str(self._args.get("_amount")),
        }

        commit.data = data

        return [commit]
示例#3
0
    def handle(self):
        commit = Commit()

        commit.opcode = "provide_oracleFactory"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "oracle": self._args.get("_oracle"),
            "signer": self._args.get("_signer"),
            "rate": str(self._args.get("_rate"))
        }

        commit.data = data

        return [commit]
示例#4
0
    def handle(self):
        commit = Commit()

        commit.opcode = "ownership_transferred_debt_engine"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "previous_owner": self._args.get("_previousOwner"),
            "new_owner": self._args.get("_newOwner"),
        }

        commit.data = data

        # return [commit]
        return []
示例#5
0
    def handle(self):
        commit = Commit()

        commit.opcode = "transfer_collateral"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "from": self._args.get("_from"),
            "to": self._args.get("_to"),
            "tokenId": str(self._args.get("_tokenId"))
        }

        commit.data = data

        return [commit]
示例#6
0
    def handle(self):
        commit = Commit()

        commit.opcode = "error_debt_engine"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": self._args.get("_id"),
            "error": True
        }

        commit.id_loan = self._args.get("_id")
        commit.data = data

        return [commit]
示例#7
0
    def handle(self):
        commit = Commit()

        commit.opcode = "set_paid_base_installments"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": self._args.get("_id"),
            "paid_base": str(self._args.get("_paidBase"))
        }

        commit.id_loan = self._args.get("_id")
        commit.data = data

        return [commit]
示例#8
0
    def handle(self):
        commit = Commit()

        commit.opcode = "cosigned_loan_manager"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": self._args.get("_id"),
            "cosigner": self._args.get("_cosigner")
        }

        commit.id_loan = self._args.get("_id")
        commit.data = data

        return [commit]
示例#9
0
    def handle(self):
        commit = Commit()

        commit.opcode = "paid_ERC20D"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._address

        data = {
            "from": self._args.get("_from"),
            "value": self._args.get("_value"),
            "contractAddress": self._address
        }

        commit.data = data

        return [commit]
示例#10
0
    def handle(self):
        commit = Commit()

        commit.opcode = "borrow_collateral"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": str(self._args.get("_entryId")),
            "handler": self._args.get("_handler"),
            "newAmount": str(self._args.get("_newAmount")),
            "status": str(CollateralState.TO_WITHDRAW.value)
        }

        commit.data = data

        return [commit]
示例#11
0
    def handle(self):
        commit = Commit()

        commit.opcode = "withdrawn_debt_engine"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": self._args.get("_id"),
            "sender": self._args.get("_sender"),
            "to": self._args.get("_to"),
            "amount": str(self._args.get("_amount"))
        }

        commit.id_loan = self._args.get("_id")
        commit.data = data

        return [commit]
示例#12
0
    def handle(self):
        commit = Commit()

        commit.opcode = "claimed_expired_collateral"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": str(self._args.get("_entryId")),
            "auctionId": str(self._args.get("_auctionId")),
            "obligation": str(self._args.get("_obligation")),
            "obligationToken": str(self._args.get("_obligationToken")),
            "status": str(CollateralState.IN_AUCTION.value)
        }

        commit.data = data

        return [commit]
示例#13
0
    def handle(self):
        commit = Commit()

        commit.opcode = "lent_loan_manager"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": self._args.get("_id"),
            "lender": self._args.get("_lender"),
            "tokens": str(self._args.get("_tokens")),
            "open": False,
            "status": "1",
        }

        commit.id_loan = self._args.get("_id")
        commit.data = data

        return [commit]
示例#14
0
    def handle(self):
        commit = Commit()

        commit.opcode = "claimed_liquidation_collateral"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": str(self._args.get("_entryId")),
            "auctionId": str(self._args.get("_auctionId")),
            "debt": str(self._args.get("_debt")),
            "required": str(self._args.get("_required")),
            "marketValue": str(self._args.get("_marketValue")),
            "status": str(CollateralState.IN_AUCTION.value)
        }

        commit.data = data

        return [commit]
示例#15
0
    def handle(self):
        commit = Commit()

        commit.opcode = "deposited_collateral"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        id = str(self._args.get("_entryId"))
        amount = str(self._args.get("_amount"))
        collateral = Collateral.objects.get(id=id)
        if collateral.status == CollateralState.FINISH.value and amount != '0':
            status = str(CollateralState.TO_WITHDRAW.value)
        else:
            status = str(collateral.status)

        data = {"id": id, "amount": amount, "status": status}

        commit.data = data

        return [commit]
示例#16
0
    def handle(self):
        commit = Commit()

        commit.opcode = "added_paid_installments"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        state = State.objects.get(id=self._args.get("_id"))

        data = {
            "id": self._args.get("_id"),
            "real": str(self._args.get("_paid")),
            "paid": str(int(state.paid) + self._args.get("_paid")),
            "state_last_payment": state.clock,
        }

        commit.id_loan = self._args.get("_id")
        commit.data = data

        return [commit]
示例#17
0
    def handle(self):
        commit = Commit()

        commit.opcode = "paid_debt_engine"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.address = self._tx.get("from")

        data = {
            "id": self._args.get("_id"),
            "sender": self._args.get("_sender"),
            "origin": self._args.get("_origin"),
            "requested": str(self._args.get("_requested")),
            "requested_tokens": str(self._args.get("_requestedTokens")),
            "paid": str(self._args.get("_paid")),
            "tokens": str(self._args.get("_tokens"))
        }

        commit.id_loan = self._args.get("_id")
        commit.data = data

        return [commit]
示例#18
0
    def handle(self):
        if self._args.get("_from") != "0x0000000000000000000000000000000000000000":

            commit = Commit()

            commit.opcode = "transfer_debt_engine"
            commit.timestamp = self._block_timestamp()
            commit.proof = self._transaction
            commit.address = self._tx.get("from")

            data = {
                "id": self._args.get("_tokenId"),
                "from": self._args.get("_from"),
                "to": self._args.get("_to")
            }

            commit.id_loan = self._args.get("_tokenId")
            commit.data = data

            return [commit]
        else:
            return []
示例#19
0
    def handle(self):
        commit = Commit()

        commit.opcode = "created_collateral"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction
        commit.id_loan = self._args.get("_debtId")
        commit.address = self._tx.get("from")

        data = {
            "id": str(self._args.get("_entryId")),
            "debt_id": self._args.get("_debtId"),
            "oracle": self._args.get("_oracle"),
            "token": self._args.get("_token"),
            "liquidation_ratio": str(self._args.get("_liquidationRatio")),
            "balance_ratio": str(self._args.get("_balanceRatio")),
            "amount": str(self._args.get("_amount")),
            "status": str(CollateralState.CREATED.value)
        }

        commit.data = data

        return [commit]
示例#20
0
    def handle(self):
        commit = Commit()

        commit.opcode = "pool_created_loanDAO"
        commit.timestamp = self._block_timestamp()
        commit.proof = self._transaction

        data = {
            "poolId": self._args.get("_poolId"),
            "manager": self._args.get("_manager"),
            "loanId": self._args.get("_loanId"),
            "cosigner": self._args.get("_cosigner"),
            "cosignerLimit": self._args.get("_cosignerLimit"),
            "cosignerData": self._args.get("_cosignerData"),
            "started": False,
            "token": self._args.get("_token"),
            "tracker": self._args.get("_tracker"),
            "raised": "0",
            "collected": "0"
        }

        commit.data = data

        return [commit]