Bind a Sui admin capability to one pool instance
Requiring a capability type can protect a function while accidentally authorizing every pool created by the same module. Bind each issued capability to its intended target.
Store the pool ID when issuing the capability
During pool creation, construct AdminCap in the defining module with pool set to object::id of the new pool. The pause function borrows the cap and checks that stored ID before modifying a shared Pool.
public struct AdminCap has key { id: UID, pool: ID }
public fun pause(cap: &AdminCap, pool: &mut Pool) {
assert!(cap.pool == object::id(pool), 0);
pool.paused = true;
}
Test cross-instance access explicitly
Create pools A and B in a Move test. Pair A’s cap with B and expect the assertion to abort. Pair it with A and verify paused changes. Keep construction and any delegated issuance paths under review: a check at use time only works when the issuance process records the correct association.