Skip to content

feat: build transaction to update pool Fee#1

Merged
codybutz merged 3 commits intomainfrom
richard/update-pool-fee
Dec 9, 2025
Merged

feat: build transaction to update pool Fee#1
codybutz merged 3 commits intomainfrom
richard/update-pool-fee

Conversation

@h2physics
Copy link
Copy Markdown
Collaborator

No description provided.

@h2physics h2physics requested a review from codybutz November 28, 2025 03:06
Comment on lines +12 to +20
function assetToDottedString(asset: { policyId: string; tokenName: string }): string {
if (asset.policyId === "" && asset.tokenName === "") {
return "lovelace"
}
if (asset.tokenName === "") {
return asset.policyId;
}
return `${asset.policyId}.${asset.tokenName}`;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should utilise the toUnit from the @lucid-evolution package

Comment on lines +9 to +10
const seed =
'mouse carpet zebra giant just pizza very song simple state rebel lunar above naive bundle accuse buffalo hurry mango scorpion country silly layer average';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this out of source control into a gitignored .env

Comment on lines +11 to +12
const walletAddr =
'addr_test1qz280luwccrquk3lk4ykjjsexl840ppsy2u6vtq4wflwa2c279l7xk8kwpt4zc27c4dsngvpyuqn700m3s8e0k6fw9nsdudnqx';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be derived from the seed. I.e. after lucid initialisation from the seed, get the address from the lucid instance.

Comment on lines +14 to +18
const poolLPAsset = {
policyId: 'd6aae2059baee188f74917493cf7637e679cd219bdfbbf4dcbeb1d0b',
tokenName:
'0c9dfded2857d530ce2cc536d4517a6e4c54e280f5e89b4f315fe0d81cabbcf5',
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's pass only the token name to the tx building, and let the tx building pick the right LP policy from the constant there.

Comment on lines +32 to +35
poolLPAsset: {
policyId: string,
tokenName: string
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, this should be only a token name.

};

export type RequestPoolFeeOptions = {
request: Omit<PoolFeeRequest, "version">;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious what the reason is for omitting the version field?

@@ -0,0 +1,110 @@
import { getAddressDetails, LucidEvolution, TxBuilder } from "@lucid-evolution/lucid";
import JSONBig from "json-bigint"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaa, this is nice, didn't know about this package, thanks.

Comment on lines +30 to +31
newFeeA: 0.9,
newFeeB: 0.3,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's maybe rename these parameters to newFeeAPercent and newFeeBPercent so it's semantically clear. AFAIK these parameters set the fee for A and B to 0.9% and 0.3% respectively.

Comment on lines +60 to +65
`Liquidity Pool Fee A must be in 0.05% - 20%, actual: ${newFeeA}%`
);
}
if (newFeeBBps < MIN_TRADING_FEE || newFeeBBps > MAX_TRADING_FEE) {
throw new Error(
`Liquidity Pool Fee B must be in 0.05% - 20%, actual: ${newFeeB}%`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, use the MIN_TRADING_FEE and MAX_TRADING_FEE constants in both of those error logs.

Comment on lines +103 to +109
return lucid
.newTx()
.addSigner(managerAddress)
.attachMetadata(674, {
["msg"]: ["Minswap: Request of Pool Fee Manager"],
["extraData"]: feeRequestJSON,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tx building still missing here.

@codybutz codybutz merged commit d092f4f into main Dec 9, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants