Skip to content

Commit

Permalink
remove bpts scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
mendesfabio committed Jan 24, 2024
1 parent c71a6d4 commit 2ef1484
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions subgraphs/vault/src/mappings/bpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Pool } from "../types/schema"
import { Transfer as TransferEvent } from "../types/templates/BPT/BPT"
import { ZERO_ADDRESS } from "../helpers/constants"
import { getPoolShare } from "../helpers/entities"
import { tokenToDecimal } from "../helpers/misc"

/************************************
********** BPTS TRANSFERS **********
Expand All @@ -18,22 +17,20 @@ export function handleTransfer(event: TransferEvent): void {
let poolShareTo = getPoolShare(poolAddress, event.params.to);

let pool = Pool.load(event.address) as Pool;

let BPT_DECIMALS = 18;


if (isMint) {
poolShareTo.balance = poolShareTo.balance.plus(tokenToDecimal(event.params.value, BPT_DECIMALS));
poolShareTo.balance = poolShareTo.balance.plus(event.params.value);
poolShareTo.save();
pool.totalShares = pool.totalShares.plus(tokenToDecimal(event.params.value, BPT_DECIMALS));
pool.totalShares = pool.totalShares.plus(event.params.value);
} else if (isBurn) {
poolShareFrom.balance = poolShareFrom.balance.minus(tokenToDecimal(event.params.value, BPT_DECIMALS));
poolShareFrom.balance = poolShareFrom.balance.minus(event.params.value);
poolShareFrom.save();
pool.totalShares = pool.totalShares.minus(tokenToDecimal(event.params.value, BPT_DECIMALS));
pool.totalShares = pool.totalShares.minus(event.params.value);
} else {
poolShareTo.balance = poolShareTo.balance.plus(tokenToDecimal(event.params.value, BPT_DECIMALS));
poolShareTo.balance = poolShareTo.balance.plus(event.params.value);
poolShareTo.save();

poolShareFrom.balance = poolShareFrom.balance.minus(tokenToDecimal(event.params.value, BPT_DECIMALS));
poolShareFrom.balance = poolShareFrom.balance.minus(event.params.value);
poolShareFrom.save();
}

Expand Down

0 comments on commit 2ef1484

Please sign in to comment.