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(#minor); ribbon-finance; fix financialSnapshots.tvl #2294

Merged
merged 3 commits into from
Jul 24, 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 deployment/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -3224,7 +3224,7 @@
"status": "prod",
"versions": {
"schema": "1.3.1",
"subgraph": "1.0.1",
"subgraph": "1.0.2",
"methodology": "1.0.0"
},
"files": {
Expand All @@ -3250,7 +3250,7 @@
"status": "prod",
"versions": {
"schema": "1.3.1",
"subgraph": "1.0.1",
"subgraph": "1.0.2",
"methodology": "1.0.0"
},
"files": {
Expand Down
2 changes: 2 additions & 0 deletions subgraphs/ribbon-finance/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export const SECONDS_PER_DAY = 60 * 60 * 24;
export const MAX_BPS = BigInt.fromI32(10000);
export const DEFAULT_DECIMALS = BigInt.fromI32(18);

export const INT_SIX = 6 as i32;

export const BIGINT_ZERO = BigInt.fromI32(0);
export const BIGINT_ONE = BigInt.fromI32(1);
export const BIGINT_TEN = BigInt.fromI32(10);
Expand Down
10 changes: 5 additions & 5 deletions subgraphs/ribbon-finance/src/mappings/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export function handleDeposit(event: DepositEvent): void {
getOrCreateVault(vaultAddress, event.block);
updateVaultTVL(vaultAddress, block);
updateUsageMetrics(event.block, event.params.account);
updateFinancials(block);
updateVaultSnapshots(vaultAddress, event.block);

Transaction(
Expand All @@ -99,6 +98,7 @@ export function handleDeposit(event: DepositEvent): void {
event.block,
constants.TransactionType.DEPOSIT
);
updateFinancials(block);
}

export function handleWithdraw(event: WithdrawEvent): void {
Expand All @@ -109,7 +109,6 @@ export function handleWithdraw(event: WithdrawEvent): void {
getOrCreateVault(vaultAddress, event.block);
updateVaultTVL(vaultAddress, block);
updateUsageMetrics(event.block, event.params.account);
updateFinancials(block);
updateVaultSnapshots(vaultAddress, event.block);

Transaction(
Expand All @@ -119,6 +118,7 @@ export function handleWithdraw(event: WithdrawEvent): void {
event.block,
constants.TransactionType.WITHDRAW
);
updateFinancials(block);
}

export function handleInstantWithdraw(event: InstantWithdraw): void {
Expand All @@ -128,7 +128,6 @@ export function handleInstantWithdraw(event: InstantWithdraw): void {

updateVaultTVL(vaultAddress, block);
updateUsageMetrics(event.block, event.params.account);
updateFinancials(block);
updateVaultSnapshots(vaultAddress, event.block);

Transaction(
Expand All @@ -138,6 +137,7 @@ export function handleInstantWithdraw(event: InstantWithdraw): void {
event.block,
constants.TransactionType.WITHDRAW
);
updateFinancials(block);
}

export function handleCollectVaultFees(event: CollectVaultFees): void {
Expand Down Expand Up @@ -302,7 +302,6 @@ export function handleWithdrawWithFee(event: WithdrawWithFee): void {
getOrCreateVault(vaultAddress, event.block);
updateVaultTVL(vaultAddress, block);
updateUsageMetrics(event.block, event.params.account);
updateFinancials(block);
updateVaultSnapshots(vaultAddress, block);

Transaction(
Expand All @@ -313,6 +312,7 @@ export function handleWithdrawWithFee(event: WithdrawWithFee): void {
constants.TransactionType.WITHDRAW,
feeAmount
);
updateFinancials(block);
}

export function handleCollectManagementFee(event: CollectManagementFee): void {
Expand Down Expand Up @@ -357,7 +357,7 @@ export function handleCollectPerformanceFee(
false
);
const performanceFeeUSD = utils
.bigIntToBigDecimal(performanceFee, 6)
.bigIntToBigDecimal(performanceFee, constants.INT_SIX)
.times(usdcToken.lastPriceUSD!);

updateRevenueSnapshots(
Expand Down
Loading