Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug calculating threshold price upon repayment #13

Merged
merged 3 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clean.sh → clean-container.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
docker-compose down -v
rm -rf build
sudo rm -rf data
rm -rf generated
source .env
docker-compose up --force-recreate
6 changes: 5 additions & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,9 @@ export function collateralizationAtLup(debt: BigDecimal, collateral: BigDecimal,
}

export function thresholdPrice(debt: BigDecimal, collateral: BigDecimal): BigDecimal {
return debt.div(collateral)
if (collateral > ZERO_BD) {
return debt.div(collateral)
} else {
return ZERO_BD;
}
}
1 change: 1 addition & 0 deletions subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ dataSources:
source:
address: "0xaeB91e664A49829FaBf06BE35d4447938d83A271"
abi: GrantFund
startBlock: 8613513
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand Down