You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should create CoW Pool and Factory, as described below:
CoW AMM Pool
CoW AMM Pool inherits WeightedPool and BaseHooks. It accepts swaps and donations only from the Cow AMM Router contract, which is defined by the BalancerContractRegistry contract (type COW_ROUTER).
Contract Variables (all variables are internal)
address trustedRouter : A cache of the CoWRouter, informed by BalancerContractRegistry. When pool is created, it should store the Registry value of the router in the trustedRouter variable. It's updated by refreshTrustedRouter function.
address balancerContractRegistry : Refer's to the Balancer's Registry of trusted contracts. Must be immutable and set in the constructor.
Functions
refreshTrustedRouter
Updates trustedRouter with value from BalancerContractRegistry
Permissionless
getHookFlags
Enables onBeforeSwap and onBeforeAddLiquidity flags
Blocks Add Liquidity with kind “Donation” if the router is not the trustedRouter. Other types of add liquidity are allowed. Notice that unbalanced liquidity are disabled for this type of pool, so unbalanced add liquidity will revert in the Vault.
Overrides BaseHooks
Return kind ≠ AddLiquidityKind.DONATION or router == trustedRouter
CoW AMM Factory
CoW AMM Factory creates and registers CoW AMM pools . It inherits BasePoolFactory and Version .
Contract Variables
address balancerContractRegistry: address of Balancer's registry of trusted contracts. Must be immutable, and set in the constructor.
string poolVersion: Version of pools that will be deployed by this factory. Must be immutable, and set in the constructor.
Constructor
Copies the constructor of WeightedPoolFactory , and also sets the balancerContractRegistry address.
Functions
create
Creates and registers a CoW AMM Pool
arguments:
string name
string symbol
TokenConfig[] tokens
uint256[] memory normalizedWeights
PoolRoleAccounts roleAccounts
uint256 swapFeePercentage
bytes32 salt
Logic
if roleAccounts.poolCreator ≠ address(0)
revert with error StandardPoolWithCreator
Creates new LiquidityManagement liquidityManagement
Creates pool, using the arguments and the balancerContractRegistry address.
Register pool in the vault, setting the poolHooksContract as the pool address.
Side Note: The event PoolRegistered is emitted by the Vault and has all the information that CoW team needs, so we don't need to emit other events in the factory.
indexed pool and factory (CoW AMM Factory)
The text was updated successfully, but these errors were encountered:
Should create CoW Pool and Factory, as described below:
CoW AMM Pool
CoW AMM Pool
inheritsWeightedPool
andBaseHooks
. It accepts swaps and donations only from theCow AMM Router
contract, which is defined by theBalancerContractRegistry
contract (typeCOW_ROUTER
).Contract Variables (all variables are internal)
address trustedRouter
: A cache of the CoWRouter, informed by BalancerContractRegistry. When pool is created, it should store the Registry value of the router in thetrustedRouter
variable. It's updated byrefreshTrustedRouter
function.address balancerContractRegistry
: Refer's to the Balancer's Registry of trusted contracts. Must be immutable and set in the constructor.Functions
refreshTrustedRouter
Updates
trustedRouter
with value fromBalancerContractRegistry
getHookFlags
Enables onBeforeSwap and onBeforeAddLiquidity flags
BaseHooks
HookFlags hookFlags
hookFlags.shouldCallBeforeSwap
= truehookFlags.shouldCallBeforeAddLiquidity
= truehookFlags
with filled flagsonBeforeSwap
Blocks swaps where
router
≠trustedRouter
BaseHooks
onBeforeAddLiquidity
Blocks Add Liquidity with kind “Donation” if the router is not the
trustedRouter
. Other types of add liquidity are allowed. Notice that unbalanced liquidity are disabled for this type of pool, so unbalanced add liquidity will revert in the Vault.BaseHooks
kind
≠AddLiquidityKind.DONATION
orrouter
==trustedRouter
CoW AMM Factory
CoW AMM Factory
creates and registersCoW AMM pools
. It inheritsBasePoolFactory
andVersion
.Contract Variables
address balancerContractRegistry
: address of Balancer's registry of trusted contracts. Must be immutable, and set in the constructor.string poolVersion
: Version of pools that will be deployed by this factory. Must be immutable, and set in the constructor.Constructor
Copies the constructor of
WeightedPoolFactory
, and also sets thebalancerContractRegistry
address.Functions
create
Creates and registers a
CoW AMM Pool
StandardPoolWithCreator
balancerContractRegistry
address.PoolRegistered
is emitted by the Vault and has all the information that CoW team needs, so we don't need to emit other events in the factory.The text was updated successfully, but these errors were encountered: