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

Creating and Minting vault account #1259

Open
wants to merge 101 commits into
base: managed-vaults
Choose a base branch
from
Open

Conversation

Patricie29
Copy link
Collaborator

In this PR we have logic for

  • creating new vault and Instantiating Contract message with all the details

  • minting vault address

  • redirecting to vault details page after mint

  • querying contract for vault details and checking the admin of the vault address with currently logged in wallet to see if user is owner

  • displaying vault description and fees from the contract

  • executing contract message to update/withdraw vault fee (buttons are disabled, because you can only update/withdraw the fee if there are accumulated fees)

Screen.Recording.2024-12-11.at.1.40.19.PM.mov

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
mars-v2-frontend ✅ Ready (Inspect) Visit Preview Jan 14, 2025 10:53pm

@Patricie29 Patricie29 changed the base branch from main to managed-vaults January 10, 2025 03:02
public/reset.css Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we should ever edit this file.
Just make sure you add the width definition to tailwind.config.js especially since .w-140 is already in this file, 10 lines below this add.

@@ -80,6 +103,7 @@ export default function AssetsSelect(props: Props) {
return selectionState
}

console.log(selectedDenoms, 'selectedDenoms selectedDenoms')
Copy link
Collaborator

Choose a reason for hiding this comment

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

console.log

Comment on lines 39 to 46
if (!hideColumns || hideColumns.length === 0) {
return columns
}
return columns.filter((column) => {
if (!column.id) {
return true
}
return !hideColumns.includes(column.id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (!hideColumns || hideColumns.length === 0) {
return columns
}
return columns.filter((column) => {
if (!column.id) {
return true
}
return !hideColumns.includes(column.id)
if (!hideColumns || hideColumns.length === 0) return columns
return columns.filter((column) => {
if (!column.id) return true
return !hideColumns.includes(column.id)

@@ -46,6 +48,7 @@ export default function AccountMenuContent(props: Props) {
const [isAutoLendEnabled] = useEnableAutoLendGlobal()
const chainConfig = useChainConfig()

const hasVaults = false // TODO: Replace with actual vault availability check
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should already be able to do this via the useAccounts hook
Just check for vault accounts.

Comment on lines 22 to 23
{/* TODO: fetch values */}
<Skeleton health={23} healthFactor={2} positionBalance={BN(190000)} risk={12} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should also be very straight forward. There should be no difference between vault accounts and default accounts, especially regarding the fetching of values and positions.

Comment on lines 35 to 36
{/* TODO: fetch values */}
Risk score: {risk}/100
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a reminder. The only difference between accounts of type vault to accounts of type default should be the metadata and that there is a different logic for withdrawing. I don't think you need to introduce that much custom/duplicate code.


return (
<div className='flex flex-wrap w-full p-4'>
{/* temporary mapping through accIds - TODO: map through vaults */}
Copy link
Collaborator

Choose a reason for hiding this comment

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

No, map through accountIds, not vaults. You'll have it in your accounts array.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please rebase this file.

The chainConfig.managedVaults && logic doesn't work in a multi-chain environment.
The Routes component is initialized on load and doesn't re-initialize after changing chains.
So the rerouting has to take place on the page level. This has been done on develop so pleas rebase on it.

@@ -179,6 +179,7 @@ export default function PerpsSummary(props: Props) {
reduceOnly: isReduceOnly,
}

console.log('perpOrderParams', perpOrderParams)
Copy link
Collaborator

Choose a reason for hiding this comment

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

console.log

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.

3 participants