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

feat: add maker share of drop (mergeback) #282

Merged
merged 2 commits into from
Jul 21, 2021
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
10 changes: 5 additions & 5 deletions onboarding/api/src/repos/agreement.repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AgreementRepo {
where agreements.user_id = ${userId}
`

return (agreements as unknown) as Agreement[]
return agreements as unknown as Agreement[]
}

async getByUserIds(userIds: string[]): Promise<Agreement[]> {
Expand All @@ -59,7 +59,7 @@ export class AgreementRepo {
where agreements.user_id in (${userIds})
`

return (agreements as unknown) as Agreement[]
return agreements as unknown as Agreement[]
}

async getByUserPoolTranche(userId: string, poolId: string, tranche: Tranche): Promise<Agreement[]> {
Expand All @@ -71,7 +71,7 @@ export class AgreementRepo {
and agreements.tranche = ${tranche}
`

return (agreements as unknown) as Agreement[]
return agreements as unknown as Agreement[]
}

async getCompletedAgreementsByUserPool(userId: string, poolId: string): Promise<Agreement[]> {
Expand All @@ -84,7 +84,7 @@ export class AgreementRepo {
and counter_signed_at is not null
`

return (agreements as unknown) as Agreement[]
return agreements as unknown as Agreement[]
}

async findOrCreate(
Expand Down Expand Up @@ -186,7 +186,7 @@ export class AgreementRepo {

if (!agreements) return []

return (agreements as unknown) as Agreement[]
return agreements as unknown as Agreement[]
}

async getStatusForProfileAgreements(
Expand Down
32 changes: 28 additions & 4 deletions tinlake-ui/components/Overview/OverviewHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ const OverviewHeader: React.FC<Props> = (props: Props) => {
? poolData?.maker?.debt
.mul(new BN(10).pow(new BN(45)))
.div(poolData?.maker?.line)
.div(new BN(10).pow(new BN(14)))
.div(new BN(10).pow(new BN(16)))
: undefined

const makerDropShare =
isMakerIntegrated && poolData?.maker && poolData?.maker?.dropBalance && poolData.senior
? poolData?.maker?.dropBalance
.mul(new BN(10).pow(new BN(18)))
.div(poolData?.senior?.totalSupply)
.div(new BN(10).pow(new BN(16)))
: undefined

React.useEffect(() => {
Expand Down Expand Up @@ -193,7 +201,7 @@ const OverviewHeader: React.FC<Props> = (props: Props) => {
{open && (
<Box direction="row" margin={{ bottom: 'small' }}>
<Box basis="2/3" direction="row">
<div style={{ width: '75%', lineHeight: '1.8em' }}>
<div style={{ width: '60%', lineHeight: '1.8em' }}>
For this pool Maker provides a revolving line of credit against real-world assets as collateral. The
direct integration allows the Asset Originator to lock up DROP as collateral in a Maker vault, draw
DAI in return and use it to finance new originations. The credit line is capped at the debt ceiling
Expand Down Expand Up @@ -249,15 +257,31 @@ const OverviewHeader: React.FC<Props> = (props: Props) => {
</TableCell>
</TableRow>
<TableRow>
<TableCell scope="row" border={{ color: 'transparent' }} pad={{ vertical: '12px' }}>
<TableCell
scope="row"
border={{ side: 'bottom', color: 'rgba(255, 255, 255, 0.3)' }}
pad={{ vertical: '12px' }}
>
Debt Utilization
</TableCell>
<TableCell
style={{ textAlign: 'end' }}
border={{ side: 'bottom', color: 'rgba(255, 255, 255, 0.3)' }}
pad={{ vertical: '12px' }}
>
{parseFloat((makerDebtUtilization || new BN(0)).toString())} %
</TableCell>
</TableRow>
<TableRow>
<TableCell scope="row" border={{ color: 'transparent' }} pad={{ vertical: '12px' }}>
Maker DROP Share
</TableCell>
<TableCell
style={{ textAlign: 'end' }}
border={{ color: 'transparent' }}
pad={{ vertical: '12px' }}
>
{parseFloat((makerDebtUtilization || new BN(0)).toString()) / 100} %
{parseFloat((makerDropShare || new BN(0)).toString())} %
</TableCell>
</TableRow>
</TableBody>
Expand Down