Skip to content
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
3 changes: 2 additions & 1 deletion contracts/contracts/ccip/fee_quoter/contract.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ fun sendExcessesTo(sendExcessesTo: address?, sender: address) {
dest: receiver,
body: createEmptyCell(),
});
returnExcesses.send(SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE);
reserveToncoinsOnBalance(0, RESERVE_MODE_INCREASE_BY_ORIGINAL_BALANCE);
returnExcesses.send(SEND_MODE_CARRY_ALL_BALANCE);
}

get fun tokenPrice(token: address): TimestampedPrice {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/ccip/fee_quoter/messages.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ fun FeeQuoter_Costs.GetValidatedFee(): int {

fun FeeQuoter_Costs.updatePrices(): int {
// when we support token transfers the message value amount should depend on the quantity of supported tokens
return ton("0.01");
return ton("0.03");
}
46 changes: 45 additions & 1 deletion contracts/tests/ccip/feequoter/FeeQuoter.updatePrices.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@ton/test-utils'

import { toNano } from '@ton/core'
import { Address, toNano } from '@ton/core'

import { FeeQuoterSetup } from './FeeQuoterSetup'
import * as feeQuoter from '../../../wrappers/ccip/FeeQuoter'
Expand Down Expand Up @@ -319,6 +319,50 @@ describe('FeeQuoter UpdatePrices', () => {
})
})

it('should not end up with lower balance than initial balance after returning excess', async () => {
const contract = await blockchain.getContract(setup.bind.feeQuoter.address)
const initialBalance = contract.balance

const priceUpdates: feeQuoter.PriceUpdates = {
tokenPricesUpdates: [{ token: FeeQuoterSetup.NATIVE_TON.token, price: 4000000000000000000n }],
gasPricesUpdates: [],
}

const updateResult = await setup.bind.feeQuoter.sendUpdatePrices(setup.acc.owner.getSender(), {
value: toNano('0.03'),
msg: { updates: priceUpdates, sendExcessesTo: setup.acc.deployer.address },
})

expect(updateResult.transactions).toHaveTransaction({
to: setup.bind.feeQuoter.address,
success: true,
})

expect(updateResult.transactions).toHaveTransaction({
from: setup.bind.feeQuoter.address,
to: setup.acc.deployer.address,
success: true,
})

const tx = updateResult.transactions.find(
(tx) =>
tx.inMessage &&
tx.inMessage.info.src &&
tx.inMessage.info.src instanceof Address &&
tx.inMessage.info.src.equals(setup.acc.owner.address) &&
tx.inMessage.info.dest &&
tx.inMessage.info.dest instanceof Address &&
tx.inMessage.info.dest.equals(setup.bind.feeQuoter.address),
)
if (!tx || tx.description.type != 'generic') {
throw new Error('Expected an internal message')
}
const storageFees = tx.description.storagePhase?.storageFeesCollected || toNano('0')

const finalBalance = (await blockchain.getContract(setup.bind.feeQuoter.address)).balance
expect(finalBalance).toEqual(initialBalance - storageFees)
})

afterAll(async () => {
if (process.env['COVERAGE'] === 'true') {
const testSuitePrefix = 'feeQuoter_update_prices_suite'
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccip/ocr/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type Config struct {
}

var DefaultConfigSet = Config{
CommitPriceUpdateOnlyCostTON: 0.03,
CommitPriceAndRootCostTON: 0.05,
CommitPriceUpdateOnlyCostTON: 0.05,
CommitPriceAndRootCostTON: 0.07,
ExecuteCostTON: 0.085,
}

Expand Down
Loading