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

Mark off-boarded collaterals on the dashboard #595

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

aomafarag
Copy link
Contributor

Closes #594.

Screenshot from 2023-03-07 09-25-31

Checklist:

  • issue number linked above after pound (#)
    • replace "Closes " with "Contributes to" or other if this PR does not close the issue
  • issue checkboxes are all addressed
  • manually checked my feature / not applicable
  • wrote tests / not applicable
  • attached screenshots / not applicable

@@ -11,7 +11,7 @@
<CurrencyIcon :currency-symbol="record.symbol" />
</div>
<div slot="ilk" slot-scope="ilk" class="Element">
{{ ilk }}
{{ ilk }} <span v-if="isCollateralOffboarded(ilk)" class="opacity-50">&nbsp;(off-boarded)</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we might just use a separate column for that with off-boarded/active label

Comment on lines +167 to +182
async isCollateralOffboarded(
{ rootGetters }: ActionContext<State, State>,
collateralType: string
): Promise<boolean> {
const network = rootGetters['network/getMakerNetwork'];
if (!network) {
return false;
}
const typeHex = ethers.utils.formatBytes32String(collateralType);
const maxCollateralDebt = await getContractValue(network, 'MCD_VAT', 'ilks', {
parameters: [typeHex],
variableName: 'line',
decimalUnits: 'RAD',
});
return maxCollateralDebt.isZero();
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please move this function to the appropriate place in the core
  • Then, please just call isCollateralOffboarded inside existing fetchCollateralStatus action to add the values to the type
  • Then, you no longer need to pass any other new props to the dashboard, and can just use existing status.isOffboarded to display the appropriate label

Do you see any problems with this suggestion or why did you have to introduce all those new props and extra types like offBoardedCollaterals array?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark off-boarded collaterals on the dashboard
2 participants