fix(scripts): attach pair creation fee uluna on deploy-dex-local create_pair (#276) #320
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#320
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Current codebase
Factory
CreatePaircharges a governance-set pair creation fee in nativeuluna(default 100_000_000 = 100 LUNC). The fee is forwarded to treasury; underpayment is rejected (GitLab #276).DEFAULT_PAIR_CREATION_FEE_ULUNAinsmartcontracts/packages/dex-common/src/factory.rsexecute_create_pairinsmartcontracts/contracts/factory/src/contract.rs— requiresinfo.funds≥ fee; error:Pair creation requires {required} uluna attachedcreate_pair_charges_fee_to_treasury_and_gov_can_set_itinsmartcontracts/tests/src/lib.rsLocal deploy script (
scripts/deploy-dex-local.sh) callsterrad_tx wasm execute "$FACTORY_ADDRESS" "$CREATE_MSG"for everycreate_pairwithout attaching native coins:terrad_tx()only sets--fees 500000000uluna(gas); it does not pass--amountfor the creation fee.Related script:
scripts/e2e-seed-wrap-pairs.sh(~line 144) has the same gap for wrap E2E pair seeding.Observed failure (Cloud Agent / fresh LocalTerra, 2026-06-05): Phase 4 fails on the first pair with:
Deploy aborts before writing
frontend-dapp/.env.local/indexer/.env, blockingmake deploy-local, strict E2E, and manual QA.Why this is needed
make deploy-localto succeed on a fundedtest1wallet aftermake start.sedpatches to finish deploy.Constraints and guardrails
DEFAULT_PAIR_CREATION_FEE_ULUNA/ factory query, or a single named shell constant (e.g.PAIR_CREATION_FEE_ULUNA=100000000) documented next to deploy — do not hardcode unrelated values in three places.PAIR_CREATION_BLOCK): deploy alreadysleeps between creates; keep sequential pair creation.100000000ulunais sufficient.info.fundsare rejected — only attachuluna, not mixed with gas (gas remains--fees).test1on LocalTerra must retain enoughulunafor: (N pairs × creation fee) + gas for full deploy (~23+ pairs today).Relevant files
scripts/deploy-dex-local.shcreate_pairfactory executesscripts/e2e-seed-wrap-pairs.shscripts/lib/terrad-tx-events.shsmartcontracts/packages/dex-common/src/factory.rssmartcontracts/contracts/factory/src/contract.rssmartcontracts/contracts/factory/src/error.rssmartcontracts/tests/src/lib.rsMakefiledeploy-localtargetAGENTS.mddocs/testing.mdRecommended solution direction
deploy-dex-local.sh, e.g.PAIR_CREATION_FEE_ULUNA="${PAIR_CREATION_FEE_ULUNA:-100000000}", matchingDEFAULT_PAIR_CREATION_FEE_ULUNA.terrad_tx_create_pair(), that runs:terrad_tx wasm execute "$FACTORY_ADDRESS" "$CREATE_MSG" --amount "${PAIR_CREATION_FEE_ULUNA}uluna"and replace the three
create_paircall sites.--amountine2e-seed-wrap-pairs.sh(or source shared snippet).terrad query wasm contract-state smart $FACTORY configand use returnedpair_creation_fee_ulunainstead of a fixed default (helps if local governance changes fee).AGENTS.md/ deploy script header that deploy needs ~(num_pairs × fee) + gasuluna ontest1.Acceptance criteria
make start && make wait-healthy && make deploy-localcompletes on a freshmake resetvolume without manual patches.frontend-dapp/.env.localandindexer/.envare written;.qa-deploy-stamplists expected pair count.create_pairtxs indeploy-dex-local.shinclude100000000uluna(or queried fee) attachment.scripts/e2e-seed-wrap-pairs.shcreate_pairsucceeds when wrap pairs are missing (or fails with clear message if wallet underfunded).cargo test create_pair_charges_fee_to_treasury_and_gov_can_set_itstill passes.Test plan (functional paths)
make reset && make start && make wait-healthy && make deploy-localdeploy-localon same chaintest1with < 100M uluna before first pairInsufficientPairCreationFee/ attach message; script exits non-zero with readable loge2e-seed-wrap-pairs.shafter deployset_pair_creation_feeto different value; deploy uses updated amountTest plan (attack / abuse / misuse)
--amountto honest deploy paths; do not change factory codeUnexpectedPairCreationFundsuluna; no CW20 increate_pairfunds--amount 0create_pairin scriptVerification criteria
make deploy-localfrom clean state documented in MR description.create_pairexecutes inscripts/deploy-dex-local.shandscripts/e2e-seed-wrap-pairs.shinclude--amountwithuluna.curl http://127.0.0.1:1317/...factory pair count matches script summary line.main.Related
marked as related to #276
marked as related to #302
Implementation agent — verification (#320)
Status: Already fixed on `main` (no new MR). The deploy failure described in this issue was addressed in #318 via merge `qa/318-315-deploy-fee-gas` (commit `
f5747ed` — `fix(deploy): attach pair-creation fee + gas-prices on local deploy`).What is on `main`
Acceptance checklist
Commands (Cloud Agent VM, 2026-06-05)
```bash
./scripts/qa/verify-issue-276.sh
make start && make wait-healthy && make build-optimized
./scripts/deploy-dex-local.sh # exit 0
./scripts/e2e-seed-wrap-pairs.sh
```
Closing as duplicate of the delivered #318 work; no additional code changes required for #320.