From 8dec92fb53890b64af10864f2cbc1f1ab0cdcba8 Mon Sep 17 00:00:00 2001 From: vicente Date: Wed, 25 Mar 2026 16:39:11 -0300 Subject: [PATCH] fixes for mainnet firedrills --- .../firedrill/firedrill_entrypoint.tolk | 6 ++++++ contracts/scripts/deployFiredrillComplete.ts | 17 ++++++++++------- contracts/scripts/firedrillPriceRegistries.ts | 2 +- .../tests/firedrill/FiredrillEntrypoint.spec.ts | 6 ++++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/contracts/contracts/firedrill/firedrill_entrypoint.tolk b/contracts/contracts/firedrill/firedrill_entrypoint.tolk index faace60c7..dc5ef34cc 100644 --- a/contracts/contracts/firedrill/firedrill_entrypoint.tolk +++ b/contracts/contracts/firedrill/firedrill_entrypoint.tolk @@ -166,6 +166,12 @@ fun drillPriceRegistries(st: FiredrillEntrypoint_Storage) { dataAvailabilityGasPrice: 1, timestamp: timestamp }); + + emit(USD_PER_TOKEN_UPDATED_TOPIC, UsdPerTokenUpdated { + sourceToken: st.tokenAddress, + usdPerToken: 1, + timestamp: timestamp + }); } // ========== Router Getters ========== diff --git a/contracts/scripts/deployFiredrillComplete.ts b/contracts/scripts/deployFiredrillComplete.ts index ab1b6b67e..242552f57 100644 --- a/contracts/scripts/deployFiredrillComplete.ts +++ b/contracts/scripts/deployFiredrillComplete.ts @@ -5,9 +5,9 @@ import { FiredrillOnRamp } from '../wrappers/firedrill/FiredrillOnRamp' import { FiredrillOffRamp } from '../wrappers/firedrill/FiredrillOffRamp' import { generateRandomContractId, LINK_TOKEN } from '../src/utils' import { tonAddressToCrossChainAddress } from '../tests/firedrill/Firedrill.Setup' -import { randomAddress } from '@ton/test-utils' -const CHAINSEL_TON = 1399300952838017768n +const CHAINSEL_TON_TESTNET = 1399300952838017768n +const CHAINSEL_TON_MAINNET = 16448340667252469081n export async function run(provider: NetworkProvider) { // Compile contracts console.log('šŸ“¦ Compiling contracts...') @@ -38,6 +38,8 @@ export async function run(provider: NetworkProvider) { console.log(`Using default token address: ${tokenAddress.toString()}`) } + const selector = (provider.network() === 'mainnet') ? CHAINSEL_TON_MAINNET : CHAINSEL_TON_TESTNET + console.log('\nšŸš€ Starting deployment...\n') // Step 1: Deploy Entrypoint first with random ramp addresses @@ -48,7 +50,7 @@ export async function run(provider: NetworkProvider) { owner: senderAddress, pendingOwner: null, }, - chainSelector: CHAINSEL_TON, + chainSelector: selector, tokenAddress: tokenAddress, firedrillContracts: undefined, sSendLast: 0n, @@ -63,9 +65,9 @@ export async function run(provider: NetworkProvider) { // Verify entrypoint deployed correctly const initialChainSelector = await entrypoint.getChainSelector() - if (initialChainSelector !== CHAINSEL_TON) { + if (initialChainSelector !== selector) { throw new Error( - `Entrypoint chain selector mismatch: expected ${CHAINSEL_TON}, got ${initialChainSelector}`, + `Entrypoint chain selector mismatch: expected ${selector}, got ${initialChainSelector}`, ) } console.log(`āœ… Entrypoint deployed at: ${entrypoint.address.toString()}\n`) @@ -75,7 +77,7 @@ export async function run(provider: NetworkProvider) { const onRampConfig = { id: generateRandomContractId(), controlAddress: entrypoint.address, - chainSelector: CHAINSEL_TON, + chainSelector: selector, tokenAddress: tokenAddress, } @@ -97,7 +99,7 @@ export async function run(provider: NetworkProvider) { const offRampConfig = { id: generateRandomContractId(), controlAddress: entrypoint.address, - chainSelector: CHAINSEL_TON, + chainSelector: selector, onRampAddress: tonAddressToCrossChainAddress(onramp.address), } @@ -111,6 +113,7 @@ export async function run(provider: NetworkProvider) { // Step 4: Update ramp addresses in entrypoint console.log('4 Updating ramp addresses in Entrypoint...') await entrypoint.sendInitRamps(sender, toNano('0.05'), onramp.address, offramp.address) + await delay(15000) // Verify ramps were set correctly const setOnRampAddress = await entrypoint.getOnRampAddress() diff --git a/contracts/scripts/firedrillPriceRegistries.ts b/contracts/scripts/firedrillPriceRegistries.ts index 85440710c..4e48f9f65 100644 --- a/contracts/scripts/firedrillPriceRegistries.ts +++ b/contracts/scripts/firedrillPriceRegistries.ts @@ -38,7 +38,7 @@ export async function run(provider: NetworkProvider) { console.log('šŸš€ Sending drill price registries...\n') - await entrypoint.sendDrillPriceRegistries(sender, toNano('0.5')) + await entrypoint.sendDrillPriceRegistries(sender, toNano('0.2')) await new Promise((resolve) => setTimeout(resolve, 3000)) diff --git a/contracts/tests/firedrill/FiredrillEntrypoint.spec.ts b/contracts/tests/firedrill/FiredrillEntrypoint.spec.ts index 7dc482a2e..8b68862c3 100644 --- a/contracts/tests/firedrill/FiredrillEntrypoint.spec.ts +++ b/contracts/tests/firedrill/FiredrillEntrypoint.spec.ts @@ -281,6 +281,12 @@ describe('FiredrillEntrypoint - Unit Tests', () => { executionGasPrice: 1n, // uint112 dataAvailabilityGasPrice: 1n, // uint112 }) + + assertLog(result.transactions,entrypoint.address, LogTypes.UsdPerTokenUpdated, { + sourceToken: tokenAddress, + usdPerToken: 1n, + }) + }) it('should reject drill price registries from non-owner', async () => {