Skip to content
Draft
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
6 changes: 6 additions & 0 deletions contracts/contracts/firedrill/firedrill_entrypoint.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -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 ==========
Expand Down
17 changes: 10 additions & 7 deletions contracts/scripts/deployFiredrillComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...')
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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`)
Expand All @@ -75,7 +77,7 @@ export async function run(provider: NetworkProvider) {
const onRampConfig = {
id: generateRandomContractId(),
controlAddress: entrypoint.address,
chainSelector: CHAINSEL_TON,
chainSelector: selector,
tokenAddress: tokenAddress,
}

Expand All @@ -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),
}

Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/firedrillPriceRegistries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
6 changes: 6 additions & 0 deletions contracts/tests/firedrill/FiredrillEntrypoint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Loading