Skip to content

Commit d79217c

Browse files
committed
enhancement: using less buffer for the deploy command
1 parent 094158a commit d79217c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/commands/contract/deploy.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ export async function deployContract(
233233
const symbol = String(tokensNeeded).split(' ')[1]
234234
const currentBalance = ramInfo.tokenBalance.value || 0
235235
const shortfall = tokensNeeded.value - currentBalance
236-
const amountToSend = Asset.from(
237-
`${(shortfall * 1.1).toFixed(4)} ${symbol}` // Add 10% buffer
238-
)
236+
const amountToSend = Asset.from(`${(shortfall * 1.01).toFixed(4)} ${symbol}`)
239237

240238
console.log(
241239
`\n❌ Insufficient funds! Need approximately ${amountToSend} more ${symbol}`
@@ -251,7 +249,7 @@ export async function deployContract(
251249

252250
displayQRCode(uri, `💰 Send ${amountToSend} to ${accountName}`)
253251

254-
// Poll for balance
252+
// Poll for balance - only wait for the actual amount needed (not the buffered amount)
255253
const targetBalance = Asset.from(`${tokensNeeded.value.toFixed(4)} ${symbol}`)
256254
const received = await waitForBalance(
257255
analysisClient,
@@ -290,10 +288,9 @@ export async function deployContract(
290288
console.log(` Estimated cost: ${ramInfo.costInTokens}`)
291289

292290
if (!options.yes) {
291+
const ramAmount = formatBytes(ramInfo.ramToBuy)
293292
const proceed = await promptConfirmation(
294-
`\nPurchase ${formatBytes(ramInfo.ramToBuy)} of RAM for ~${
295-
ramInfo.costInTokens
296-
}?`
293+
`\nPurchase ${ramAmount} of RAM for ~${ramInfo.costInTokens}?`
297294
)
298295

299296
if (!proceed) {

0 commit comments

Comments
 (0)