Skip to content
Open
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
10 changes: 7 additions & 3 deletions contracts/contracts/ccip/fee_quoter/contract.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import "../../lib/math";
import "../router/messages"
import "../ccipsend_executor/messages"

const CONTRACT_VERSION = "1.6.0";
const CONTRACT_VERSION = "1.6.1";
const RESERVE = ton("1"); // TODO: set correct value

fun onInternalMessage(in: InMessage) {
Expand Down Expand Up @@ -536,7 +536,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 Expand Up @@ -662,7 +663,10 @@ get fun reserve(): coins {
}

@method_id(1000)
fun migrate(storage: cell, version: slice): cell { throw Upgradeable_Error.VersionMismatch; }
fun migrate(storage: cell, version: slice): cell {
assert(version.bitsEqual(CONTRACT_VERSION), Upgradeable_Error.VersionMismatch);
return storage;
}

@method_id(1001)
fun version(): slice { return CONTRACT_VERSION; }
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.02");
}
5 changes: 4 additions & 1 deletion contracts/contracts/ccip/offramp/contract.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ fun onUpgrade(msg: Upgradeable_Upgrade) {
}

@method_id(1000)
fun migrate(storage: cell, version: slice): cell { throw Upgradeable_Error.VersionMismatch; }
fun migrate(storage: cell, version: slice): cell {
assert(version.bitsEqual(CONTRACT_VERSION), Upgradeable_Error.VersionMismatch);
return storage;
}

@method_id(1001)
fun version(): slice { return CONTRACT_VERSION; }
Expand Down
29 changes: 29 additions & 0 deletions contracts/tests/ccip/feequoter/FeeQuoter.updatePrices.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,35 @@ 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.01'),
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 finalBalance = (await blockchain.getContract(setup.bind.feeQuoter.address)).balance
expect(finalBalance).toEqual(initialBalance)
})

afterAll(async () => {
if (process.env['COVERAGE'] === 'true') {
const testSuitePrefix = 'feeQuoter_update_prices_suite'
Expand Down
2 changes: 1 addition & 1 deletion contracts/wrappers/ccip/FeeQuoter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import * as upgradeable from '../libraries/versioning/Upgradeable'
import * as typeAndVersion from '../libraries/versioning/TypeAndVersion'
import * as rt from './Router'

export const FEE_QUOTER_CONTRACT_VERSION = '1.6.0'
export const FEE_QUOTER_CONTRACT_VERSION = '1.6.1'

export const FACILITY_NAME = 'link.chain.ton.ccip.FeeQuoter'
export const FACILITY_ID = facilityId(crc32(FACILITY_NAME))
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.04,
CommitPriceAndRootCostTON: 0.06,
ExecuteCostTON: 0.085,
}

Expand Down
Loading