Skip to content

Commit

Permalink
Merge pull request #13 from morpho-org/fix/allow-caps-setting-for-non…
Browse files Browse the repository at this point in the history
…-listed-vault-market

fix(public-allocator): allow set flow cap to 0 for a non-listed vault market
  • Loading branch information
julien-devatom authored Dec 19, 2024
2 parents 018fefa + ff8d19e commit 6dce056
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/public-allocator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
MarketFlowCapsSet,
MetaMorpho,
MetaMorphoAllocator,
MetaMorphoMarket,
MetaMorphoPublicAllocator,
MetaMorphoPublicAllocatorMarket,
PublicAllocatorReallocationToEvent,
Expand Down Expand Up @@ -240,6 +241,21 @@ export function handleSetFlowCaps(event: SetFlowCaps): void {
for (let i = 0; i < event.params.config.length; i++) {
const config = event.params.config[i];

const mmMarket = MetaMorphoMarket.load(
event.params.vault.concat(config.id)
);

if (
!mmMarket &&
config.caps.maxIn.isZero() &&
config.caps.maxOut.isZero()
) {
// because of the following line on the PA contract, you can set a flow cap to 0 for a non-listed market
// If the mmMarket doesn't exist at all, we just skip the cap configuration
// https://github.com/morpho-org/public-allocator/blob/main/src/PublicAllocator.sol#L85
continue;
}

const paMarket = loadPublicAllocatorMarket(event.params.vault, config.id);

const marketFlowCapsSet = new MarketFlowCapsSet(eventId.concat(config.id));
Expand Down
2 changes: 1 addition & 1 deletion subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ dataSources:
name: PublicAllocator
network: mainnet
source:
address: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D"
abi: PublicAllocator
address: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D"
startBlock: 19375099
mapping:
kind: ethereum/events
Expand Down

0 comments on commit 6dce056

Please sign in to comment.