Skip to content

Deploy pool-specific hooks#769

Open
onnovisser wants to merge 5 commits intomainfrom
deploy-pool-hooks
Open

Deploy pool-specific hooks#769
onnovisser wants to merge 5 commits intomainfrom
deploy-pool-hooks

Conversation

@onnovisser
Copy link
Contributor

@onnovisser onnovisser commented Feb 5, 2026

Product requirements

  • Deploy pool-specific hooks for mainnet pools that have their PoolEscrow set, to prevent falling into the try/catch

Mostly for review. Don't think we want to merge this

Design notes

TODOs

  • [ ]

@onnovisser onnovisser changed the title Deploy pool-specific hook Deploy pool-specific hooks Feb 5, 2026
Copy link
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

LGTM except for the potential incorrect VERSION. Script also worked for me locally, great job!

contract PoolHooks is JsonRegistry, GraphQLQuery, CreateXScript {
using stdJson for string;

bytes32 constant VERSION = "1";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be "v3.1" as configured in env/*.json

} else if (currentHook == fullRestrictionsHook) {
_deployFullRestrictions(token.poolId, token.scId, poolEscrowAddr);
} else {
console.log("Hook is not freelyTransferable or fullRestrictions, skipping");
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose none of the pools use FreezeOnly or RedemptionRestrictions hooks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly

string memory saltName = string.concat("fullRestrictions-", vm.toString(PoolId.unwrap(poolId)));
bytes32 salt = makeSalt(saltName, VERSION, deployer);

hook = FullRestrictions(
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should make the script idempotent by adding a check whether it has been deployed already.

Copy link
Contributor Author

@onnovisser onnovisser Feb 5, 2026

Choose a reason for hiding this comment

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

Yes maybe a good idea. We may need to run the script again before we have the factory in place.

Copy link
Contributor

Choose a reason for hiding this comment

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

That would be very useful yes!

Copy link
Contributor

@lemunozm lemunozm left a comment

Choose a reason for hiding this comment

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

Except my two comments, the whole process looks really nice!


sleep 3.0 # Wait ensuring Anvil is up

SENDER="0xc1A929CBc122Ddb8794287D05Bf890E41f23c8cb"
Copy link
Contributor

Choose a reason for hiding this comment

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

As a note. This sender is the admin from testnet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes I just picked a random address for testing

bytes32 salt = makeSalt(saltName, VERSION, deployer);

hook = FreelyTransferable(
create3(
Copy link
Contributor

Choose a reason for hiding this comment

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

I really think we don't need create3 if we deploy with a custom deployer. We're not gaining anything, and can be confused when in other chains they have different addresses for the same pools.

I would go only with create3 if we can ensure that we always have the same addresses in all chains.

The only way to have all hooks with the same addresses for the same pools is using a factory IIUC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now, if you use the same account to deploy on all networks, the hooks for the same pool will all have the same address. If we need to deploy more for the same pool again in the future, we could use the same account again to get the same addresses AFAIK.

Copy link
Contributor

@lemunozm lemunozm Feb 5, 2026

Choose a reason for hiding this comment

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

The problem is that future hooks will be deployed by pool managers, not us. This is only a first time initialization by us

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, though I'm not sure it's that important that between now and then, the addresses are the same. Just that now they are the same for the same pool seems convenient.
Maybe @hieronx has thoughts on this?

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.

4 participants