Skip to content

Conversation

@DaemonWAGMI
Copy link
Contributor

New helper method I am using in the discord bot, figured it might make sense to add directly to the SDK.

).value.amount
);
return marketsAccount.markets.reduce((collateralVaultAmount, market) => {
return collateralVaultAmount.sub(market.amm.totalFee.div(new BN(2)));
Copy link
Member

Choose a reason for hiding this comment

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

Is this trying to calculate how much of the collateral is the users? If so i don't think you need to divide by two

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@0xbigz mentioned in Discord that the collateral wallet holds the user collateral plus the insurance fund, which is equal to the amount of half of the total fees collected (as in calculateInsuranceFundSize ). So this was my attempt to 'back out' the insurance portion from the collateral balance.

I may have misunderstood him though - @0xbigz thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ping :)

Copy link
Member

Choose a reason for hiding this comment

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

None of the fees are owned by the users, so I think it's safe to subtract the entire totalFee (the exchange can use them in various ways)

@DaemonWAGMI
Copy link
Contributor Author

HI guys, I've pushed an update that removes the division. No conflicts it looks like, but a security check failed.

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.

2 participants