Skip to content

Commit

Permalink
feat: add depositBonus for lite
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorovdg committed Dec 11, 2024
1 parent 2180ae0 commit ec0d278
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/pools/PoolTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,31 @@ export class PoolTemplate extends CorePool {
public async depositBonus(amounts: (number | string)[]): Promise<string> {
const amountsBN = amounts.map(BN);
let pricesBN: BigNumber[] = [];

const multicallContract = curve.contracts[this.address].multicallContract;
if(this.isCrypto || this.id === 'wsteth') {
pricesBN = (await this._underlyingPrices()).map(BN);
if(curve.isLiteChain) {
const prices = this.id.includes('twocrypto')
? [
1,
Number(await curve.contracts[this.address].contract.price_oracle()) / (10 ** 18),
]
: [
1,
...(await curve.multicallProvider.all([
multicallContract.price_oracle(0),
multicallContract.price_oracle(1),
])).map((value) => Number(value) / (10 ** 18)),
]
pricesBN = prices.map(BN);
} else {
pricesBN = (await this._underlyingPrices()).map(BN);
}
} else {
pricesBN = await this._storedRatesBN(true);
}

const balancesBN = (await this.stats.underlyingBalances()).map(BN);
const balancedAmounts = this._balancedAmountsWithSameValue(amountsBN, pricesBN, balancesBN);

const expectedBN = BN(await this.depositExpected(amounts));
const balancedExpectedBN = BN(await this.depositExpected(balancedAmounts));

Expand Down

0 comments on commit ec0d278

Please sign in to comment.