user3953: If I want to create one top level contract for creating a bunch of other, similar contracts, lets say a top level Uniswap contract that creates liquidity pool contracts and keeps track of the total amount of LP tokens in each of the pool scripts below it. A pool can only be created by a "create" call to the top level contract, and everytime LP tokens are minted or burned, the top level contract updates its datum.
How exactly would I go about that?

user1130: Check out the Uniswap example in the plutus-use-cases!
The way it works is there is an NFT they call the "Uniswap coin." In order to create new liquidity pools, that NFT needs to included in the transaction and the new pool needs to be recorded in the Factory datum. That validation happens here.

A pool can only be created by a "create" call to the top level contract, and everytime LP tokens are minted or burned, the top level contract updates its datum.

Luckily you don't need to update the top level datum after each pool is created. The validateCreate path in the SC (what you refer to as the "create" call) also checks that a liquidity pool is created with a Poolstate token here. Since we can be sure that the Poolstate token was created using the Uniswap NFT, we only need to update the Pool datum on the Poolstate token in the future.
Hope that helps :)

3953: <p>If I want to create one top level contract for creating a bunch of other, similar contracts, lets say a top level Uniswap contract that creates liquidity pool contracts and keeps track of the total amount of LP tokens in each of the pool scripts below it. A pool can only be created by a &quot;create&quot; call to the top level contract, and everytime LP tokens are minted or burned, the top level contract updates its datum.</p>
<p>How exactly would I go about that?</p>
 1130: <p>Check out the <a href="https://github.com/input-output-hk/plutus-apps/tree/main/plutus-use-cases/src/Plutus/Contracts/Uniswap/" rel="nofollow noreferrer">Uniswap example</a> in the <code>plutus-use-cases</code>!</p>
<p>The way it works is there is an NFT they call the &quot;Uniswap coin.&quot; In order to create new liquidity pools, that NFT needs to included in the transaction and the new pool needs to be recorded in the <code>Factory</code> datum. That validation happens <a href="https://github.com/input-output-hk/plutus/blob/5c297af98d0049202458c3cd5e99bb3567a59f40/plutus-use-cases/src/Plutus/Contracts/Uniswap/OnChain.hs#L107" rel="nofollow noreferrer">here</a>.</p>
<blockquote>
<p>A pool can only be created by a &quot;create&quot; call to the top level contract, and everytime LP tokens are minted or burned, the top level contract updates its datum.</p>
</blockquote>
<p>Luckily you don't need to update the top level datum after each pool is created. The <code>validateCreate</code> path in the SC (what you refer to as the &quot;create&quot; call) also checks that a liquidity pool is created with a <code>Poolstate</code> token <a href="https://github.com/input-output-hk/plutus/blob/5c297af98d0049202458c3cd5e99bb3567a59f40/plutus-use-cases/src/Plutus/Contracts/Uniswap/OnChain.hs#L114" rel="nofollow noreferrer">here</a>. Since we can be sure that the <code>Poolstate</code> token was created using the <code>Uniswap</code> NFT, we only need to update the <code>Pool</code> datum on the <code>Poolstate</code> token in the future.</p>
<p>Hope that helps :)</p>
