feat(factory): governance-set pair-creation fee to treasury (#276) #754

Merged
Brouie merged 1 commit from qa/276-pair-creation-fee into main 2026-06-05 03:18:11 +00:00
Brouie commented 2026-06-05 02:44:56 +00:00 (Migrated from gitlab.com)

Follow-up on #276, your "100 LUNC creation fee to treasury, governance-settable" direction.

Permissionless CreatePair was free — the one-per-block gate was the only cost to spam pairs.

Fix (factory):

  • pair_creation_fee_uluna on Config + InstantiateMsg + ConfigResponse, #[serde(default)] = 100 LUNC (DEFAULT_PAIR_CREATION_FEE_ULUNA) so 1.3.x stored configs migrate cleanly; CONTRACT_VERSION 1.3.0 -> 1.4.0.
  • execute_create_pair charges the fee: rejects stray denoms (UnexpectedPairCreationFunds), requires >= fee uluna attached (InsufficientPairCreationFee), BankMsg::Sends the fee to config.treasury, refunds any overpay to the sender. Atomic with the pair instantiate — if instantiate fails the tx reverts and no fee is charged.
  • New SetPairCreationFee { fee_uluna } governance setter, so the cost can be raised if spam is observed (per your note).

Tests: create_pair_charges_fee_to_treasury_and_gov_can_set_it — empty attachment rejected, exact fee credits the treasury, governance raises the fee (shows in Config), non-governance blocked. Existing factory tests instantiate with fee 0 (behavior unchanged). Contract suite 416/0.

Heads up (flagged in the plan): no in-repo precedent for a contract BankMsg::Send to treasury — worth a careful look at the fund handling. And the frontend ripple is a laptop follow-up: createPair must attach the uluna fee and the CreatePair page should surface it; off-chain scripts calling CreatePair with no funds will start failing InsufficientPairCreationFee (intended). No closing keyword.

Follow-up on #276, your "100 LUNC creation fee to treasury, governance-settable" direction. Permissionless `CreatePair` was free — the one-per-block gate was the only cost to spam pairs. Fix (factory): - `pair_creation_fee_uluna` on `Config` + `InstantiateMsg` + `ConfigResponse`, `#[serde(default)]` = 100 LUNC (`DEFAULT_PAIR_CREATION_FEE_ULUNA`) so 1.3.x stored configs migrate cleanly; `CONTRACT_VERSION` 1.3.0 -> 1.4.0. - `execute_create_pair` charges the fee: rejects stray denoms (`UnexpectedPairCreationFunds`), requires `>= fee` uluna attached (`InsufficientPairCreationFee`), `BankMsg::Send`s the fee to `config.treasury`, refunds any overpay to the sender. Atomic with the pair instantiate — if instantiate fails the tx reverts and no fee is charged. - New `SetPairCreationFee { fee_uluna }` governance setter, so the cost can be raised if spam is observed (per your note). Tests: `create_pair_charges_fee_to_treasury_and_gov_can_set_it` — empty attachment rejected, exact fee credits the treasury, governance raises the fee (shows in Config), non-governance blocked. Existing factory tests instantiate with fee 0 (behavior unchanged). Contract suite 416/0. Heads up (flagged in the plan): no in-repo precedent for a contract `BankMsg::Send` to treasury — worth a careful look at the fund handling. And the **frontend ripple is a laptop follow-up**: `createPair` must attach the uluna fee and the CreatePair page should surface it; off-chain scripts calling CreatePair with no funds will start failing `InsufficientPairCreationFee` (intended). No closing keyword.
Brouie commented 2026-06-05 02:45:07 +00:00 (Migrated from gitlab.com)

mentioned in issue #276

mentioned in issue #276
PlasticDigits commented 2026-06-05 03:18:12 +00:00 (Migrated from gitlab.com)

mentioned in commit 244e8a2e62

mentioned in commit 244e8a2e627532b90684006c878742eca95abdc9
PlasticDigits (Migrated from gitlab.com) merged commit 244e8a2e62 into main 2026-06-05 03:18:12 +00:00
PlasticDigits commented 2026-06-05 03:52:43 +00:00 (Migrated from gitlab.com)

mentioned in merge request !762

mentioned in merge request !762
Brouie commented 2026-06-05 04:02:33 +00:00 (Migrated from gitlab.com)

mentioned in merge request !763

mentioned in merge request !763
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!754
No description provided.